
*Nc           @   s  d  d k  l Z d  d k Z d  d k l Z d  d k l Z d  d k l Z d  d k	 l
 Z
 d  d k l Z d  d k l Z d  d	 k l Z d  d
 k l Z d  d k l Z d  d k l Z l Z l Z l Z l Z l Z l Z d  d k l Z d  d k l  Z  d  d k! l" Z" d  d k# l$ Z$ d  d k% l% Z% d  d k& l' Z' l( Z( d  d k) l* Z* l) Z) d  d k+ l, Z, e- Z. e/ Z0 d d Z1 d e$ f d     YZ2 d e e
 f d     YZ3 d   Z4 d   Z5 e/ d  Z6 d   Z7 e- d  Z8 e- d   Z9 d S(!   i(   t   _N(   t	   ActionMap(   t   Button(   t   config(   t   GUIComponent(   t   HTMLComponent(   t   Label(   t   MultiContentEntryText(   t   ServiceEvent(   t   Event(   t   eServiceReferencet   eServiceCentert
   getDesktopt	   eEPGCachet   eListboxt   eListboxPythonMultiContentt   RT_HALIGN_RIGHT(   t	   ChoiceBox(   t   InfoBar(   t
   MessageBox(   t   Screen(   t   ServiceReference(   t
   parseColort	   parseFont(   t	   localtimet   time(   t   resolveFilenames      Cool TV Guide st   .
   (c) 2012 by Coolman

   New Version Is Now Available ,
   Please upgrade it at: 

   http://www.CoolTVGuide.comt   CoolSingleGuidec           B   s  e  Z d  Z d Z d Z d Z d5 d5 d5 d5 d  Z d   Z d   Z	 d   Z
 d   Z d   Z d	   Z d
   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d5 d5 d  Z d   Z  e! d  Z" d   Z# d   Z$ d    Z% d!   Z& d"   Z' d#   Z( d$   Z) d%   Z* d&   Z+ d'   Z, d(   Z- d)   Z. d*   Z/ d+   Z0 d,   Z1 d-   Z2 d.   Z3 d/   Z4 d0   Z5 d1   Z6 d2   Z7 d3   Z8 d4   Z9 RS(6   i    i   i   c         C   s[  t  i |  |  t t  } t d  i   i   }	 d |  _ |	 d j o
 d }
 n |	 d j o
 d }
 n d }
 t |
  } | i	   |  _
 | i   | |  _ | |  _ | |  _ t d  t d	  t d
  t d  t d  t d  t d  f |  _ d |  _ t |  _ d  |  _ t   |  d <t   |  d <t d  |  d <t d  |  d <t d  |  d <t d  |  d <|  i |  _ |  i |  _ |  i |  _ |  i |  _ t   |  d <t |  |  _  d |  _! | |  _" | |  _# t$ d |  i% d | i& i'  |  d <t( d g h |  i) d 6|  i* d 6|  i+ d 6|  i, d 6|  i- d  6|  i. d! 6|  i/ d" 6|  i0 d# 6|  i1 d$ 6|  i2 d% 6|  i3 d& 6|  i4 d' 6|  i5 d( 6|  i6 d) 6|  i7 d* 6 |  d+ <t( d, d- d. g h |  i8 d/ 6|  i9 d0 6|  i: d1 6|  i; d2 6|  i< d3 6|  i= d4 6d  |  d5 <|  |  d5 _> t( d6 g h |  i? d7 6|  i@ d8 6|  i? d9 6|  iA d: 6d  |  d; <tB iC iD iE |  _F tB iC iG iE |  _H tB iC iI iE |  _J tB iC iK iE |  _L |  iF d< j p0 |  iF d= j p  |  iF d> j p |  iF d? j o d@ |  _F n |  iH d< j p0 |  iH d= j p  |  iH d> j p |  iH d? j o dA |  _H n |  iJ d< j p0 |  iJ d= j p  |  iJ d> j p |  iJ d? j o dB |  _J |  iM   n |  d iN t |  iJ   |  iL d< j p0 |  iL d= j p  |  iL d> j p |  iL d? j o dC |  _L n |  d iN t |  iF   |  d iN t |  iH   |  d iN t |  iL   |  iO iP |  iQ  |  iR   d  S(D   Ni    R   i  sW   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSkin/CoolSingleGuide_720.xmli   sX   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSkin/CoolSingleGuide_1024.xmlsX   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSkin/CoolSingleGuide_1280.xmlt   Mont   Tuet   Wedt   Thut   Frit   Satt   Sunit   ServiceR	   t    t   key_redt	   key_greent
   key_yellowt   key_bluet   datet   selChangedCBt   timert   listt   CoolTVGuideActionst   CoolMenut   CoolRedt   CoolRedLongt	   CoolGreent   CoolGreenLongt
   CoolYellowt   CoolYellowLongt   CoolBluet   CoolBlueLongt   CoolOKt
   CoolOKLongt   CoolInfot
   CoolRecordt   CoolTimet	   CoolKeyTVt   Coolmant   EPGSelectActionst   OkCancelActionst   PowerKeyActionst	   powerdownt   cancelt   nextBouquett   prevBouquett   nextServicet   prevServicet   actionst   InputActionst   0t   7t   8t   9t   input_actionst	   PrimeTimes	   Bouquet +s	   Bouquet -t   Bouquetlistt   Zapt   Timers   Sort A-Zt
   CoolSearch(S   R   t   __init__t   strR   R   t   sizet   widtht   skinNamet   opent   readt   skint   closet   servicelistt   bouquetChangeCBt   serviceChangeCBR    t   dayst   ask_timet   Falset   closeRecursivet   Nonet   saved_titleR   R	   R   t   EMPTYt   key_red_choicet   key_green_choicet   key_yellow_choicet   key_blue_choiceR   R   t   currentServicet	   sort_typet   servicest   zapFunct   SingleEPGListt   onSelectionChangedt   navt   RecordTimerR   t	   showSetupR/   R0   R1   R2   R3   R4   R5   R6   R7   R8   R9   R:   t
   CoolSortAZt   openTimerEditListt	   CoolPowert   TimerAlarmExitt   nextChannelt   prevChannelRE   RF   t   cselt   openCoolSinglet   openCoolTVGt   openCoolEasyR   t   CTVGt   Cool_Redt   valuet   CRt
   Cool_Greent   CGt   Cool_Yellowt   CYt	   Cool_Bluet   CBt   setSortDescriptiont   setTextt   onLayoutFinisht   appendt   onCreatet
   checkImage(   t   selft   sessiont   servicet   ServicelistRm   t   eventidR]   R^   t   skinpatht   CoolWideRZ   t   Cool(    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyRS   3   s    	


			H						"	



















	



@@@	@c         C   s4   t    } | i | i f d j o |  i   n d  S(   Ni  i	   (   i  i	   (   R   t   tm_yeart   tm_mont   closeScreen(   R   t   now(    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyR      s    	c         C   s;   d d k  l } |  i   | |  i |  i  |  i   d  S(   Ni(   t   Man(   t   pluginR   t   hideR   R\   R   (   R   R   (    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyR{      s    
c         C   s;   |  i  i t  |  i   t |  i |  i   |  i   d  S(   N(   R\   t   setCurrentSelectiont   CoolCurServiceR   t   CSGManR   R   (   R   (    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyRz      s    
c         C   s;   d d k  l } |  i   | |  i |  i  |  i   d  S(   Ni(   t   CEGMan(   t   CoolEasyGuideR   R   R   R\   R   (   R   R   (    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyR|      s    
c         C   s%  |  i  } | d j o |  i   n | d j o |  i   n | d j o |  i   n | d j o |  i   n | d j o |  i   n | d j o |  i   nw | d j o |  i   n\ | d j o |  i   nA | d	 j o |  i	   n& | d
 j o |  i
   n |  i   d  S(   NRP   s
   Zap + ExitRR   s   IMDb Searcht   GuideSwitchs   Cool Info GuideRQ   t   QuickRect	   AutoTimers
   EPG Select(   R   t   zapTot   zapt   CSt
   IMDbSearchR{   t   infoKeyPressedt   timerAddR:   t   CoolAutoTimert   closeScreenZap(   R   t   x(    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyR/      s,    	c         C   s+  t  i i i } | d j o |  i   n | d j o |  i   n | d j o |  i   n | d j o |  i   n | d j o |  i   n | d j o |  i	   nw | d j o |  i
   n\ | d j o |  i   nA | d	 j o |  i   n& | d
 j o |  i   n |  i   d  S(   NRP   s
   Zap + ExitRR   s   IMDb SearchR   s   Cool Info GuideRQ   R   R   s
   EPG Select(   R   R}   t   Cool_RedLongR   R   R   R   R   R{   R   R   R:   R   R   (   R   R   (    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyR0      s,    c         C   s%  |  i  } | d j o |  i   n | d j o |  i   n | d j o |  i   n | d j o |  i   n | d j o |  i   n | d j o |  i   nw | d j o |  i   n\ | d j o |  i   nA | d	 j o |  i	   n& | d
 j o |  i
   n |  i   d  S(   NRP   s
   Zap + ExitRR   s   IMDb SearchR   s   Cool Info GuideRQ   R   R   s
   EPG Select(   R   R   R   R   R   R{   R   R   R:   R   R   (   R   R   (    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyR1      s,    	c         C   s+  t  i i i } | d j o |  i   n | d j o |  i   n | d j o |  i   n | d j o |  i   n | d j o |  i   n | d j o |  i	   nw | d j o |  i
   n\ | d j o |  i   nA | d	 j o |  i   n& | d
 j o |  i   n |  i   d  S(   NRP   s
   Zap + ExitRR   s   IMDb SearchR   s   Cool Info GuideRQ   R   R   s
   EPG Select(   R   R}   t   Cool_GreenLongR   R   R   R   R   R{   R   R   R:   R   R   (   R   R   (    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyR2      s,    c         C   s%  |  i  } | d j o |  i   n | d j o |  i   n | d j o |  i   n | d j o |  i   n | d j o |  i   n | d j o |  i   nw | d j o |  i   n\ | d j o |  i   nA | d	 j o |  i	   n& | d
 j o |  i
   n |  i   d  S(   NRP   s
   Zap + ExitRR   s   IMDb SearchR   s   Cool Info GuideRQ   R   R   s
   EPG Select(   R   R   R   R   R   R{   R   R   R:   R   R   Rs   (   R   R   (    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyR3     s,    	c         C   s+  t  i i i } | d j o |  i   n | d j o |  i   n | d j o |  i   n | d j o |  i   n | d j o |  i   n | d j o |  i	   nw | d j o |  i
   n\ | d j o |  i   nA | d	 j o |  i   n& | d
 j o |  i   n |  i   d  S(   NRP   s
   Zap + ExitRR   s   IMDb SearchR   s   Cool Info GuideRQ   R   R   s
   EPG Select(   R   R}   t   Cool_YellowLongR   R   R   R   R   R{   R   R   R:   R   R   (   R   R   (    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyR4   0  s,    c         C   s%  |  i  } | d j o |  i   n | d j o |  i   n | d j o |  i   n | d j o |  i   n | d j o |  i   n | d j o |  i   nw | d j o |  i   n\ | d j o |  i   nA | d	 j o |  i	   n& | d
 j o |  i
   n |  i   d  S(   NRP   s
   Zap + ExitRR   s   IMDb SearchR   s   Cool Info GuideRQ   R   R   s
   EPG Select(   R   R   R   R   R   R{   R   R   R:   R   R   (   R   R   (    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyR5   I  s,    	c         C   s+  t  i i i } | d j o |  i   n | d j o |  i   n | d j o |  i   n | d j o |  i   n | d j o |  i   n | d j o |  i	   nw | d j o |  i
   n\ | d j o |  i   nA | d	 j o |  i   n& | d
 j o |  i   n |  i   d  S(   NRP   s
   Zap + ExitRR   s   IMDb SearchR   s   Cool Info GuideRQ   R   R   s
   EPG Select(   R   R}   t   Cool_BlueLongR   R   R   R   R   R{   R   R   R:   R   R   (   R   R   (    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyR6   b  s,    c         C   s+  t  i i i } | d j o |  i   n | d j o |  i   n | d j o |  i   n | d j o |  i   n | d j o |  i   n | d j o |  i	   nw | d j o |  i
   n\ | d j o |  i   nA | d	 j o |  i   n& | d
 j o |  i   n |  i	   d  S(   NRP   s
   Zap + ExitRR   s   IMDb SearchR   s   Cool Info GuideRQ   R   R   s
   EPG Select(   R   R}   t   Cool_OKR   R   R   R   R   R{   R   R   R:   R   (   R   R   (    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyR7   {  s,    c         C   s%  t  i i i } | d j o |  i   n | d j o |  i   n | d j o |  i   n | d j o |  i   n | d j o |  i   n | d j o |  i	   nq | d j o |  i
   nV | d j o |  i   n; | d	 j o |  i   n  | d
 j o |  i   n d  Sd  S(   NRP   s
   Zap + ExitRR   s   IMDb SearchR   s   Cool Info GuideRQ   R   R   s
   EPG Select(   R   R}   t   Cool_OKLongR   R   R   R   R   R{   R   R   R:   R   (   R   R   (    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyR8     s,    c         C   sS   t  i i i } | d j o |  i   n& | d j o |  i   n |  i   d  S(   Ns
   EPG Selects   Cool Info Guide(   R   R}   t	   Cool_InfoR   R   R   (   R   R   (    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyR9     s    c         C   s   |  i    |  i   d  S(   N(   RE   R   (   R   (    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyRw     s    
c         C   s   |  i    |  i   d  S(   N(   RF   R   (   R   (    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyRx     s    
c         C   s/   |  i  o! |  i  d |   |  i i   n d  S(   Ni   (   R^   R\   t   moveDown(   R   (    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyRE     s    
c         C   s/   |  i  o! |  i  d |   |  i i   n d  S(   Ni(   R^   R\   t   moveUp(   R   (    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyRF     s    
c         C   s$   d d k  l } |  i i |  d  S(   Ni(   t   SleepTimerEdit(   t   Screens.SleepTimerEditR   R   RX   (   R   R   (    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyRu     s    c         C   s  d d k  l } t i   |  _ |  i   t   } t    } t } t i	 i
 i ox |  i i i i D] } | i } | i } | | | d } y" |  i i | i i | i  }	 Wn" |  i i | i i |  }	 n X|	 oo |	 i   }
 |
 |	 i   } |
 | j  p | | j o5 |	 i   d j o | | j o | i |  qGqKqd qd Wn t i	 i i oB x? |  i i i i D]' } | | i j  o | i |  qvqvWn t d  } x | D] } t | i  } t | d t | i    } t | i i     } | i! o t d  n
 t d  } | | d	 | d
 | d | d 7} qW| t d  7} | o |  i i" t# | t# i$  n |  i%   d  S(   Ni(   t   strftimei   i,  s$   
          !! Cool Timer Alarm !! 

s   %d.%m.%Y - %H:%Ms   is disableds	   has moveds    - s   
t    s   

s   -- please check your Timer --(&   R   R   R   t   getInstancet   epgcacheR   t   setRa   R   R}   t
   TimerAlarmR   R   Rp   Rq   t
   timer_listt   begint   endt   lookupEventIdt   service_reft   reft   eitt   lookupEventTimet   getBeginTimet   getDurationt   addt   TimerAlarmDisablet   processed_timersR    RT   t   nameR   t   getServiceNamet   disabledRX   R   t
   TYPE_ERRORR   (   R   R   R   R   t   tnameR   t   begR   t   mittet   eventt   evtbegint   evtendt   msgt   ttimet   tchannelt   ttype(    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyRv     sN    
		 		" !  #*c         C   s#   t  t i i _ |  i |  i  d  S(   N(   Ra   R   R}   t	   ScreenZapR   R[   Rb   (   R   (    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyR     s    c         C   s2   t  i i i o |  i |  i  n |  i   d  S(   N(   R   R}   R   R   R[   Rb   R|   (   R   (    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyR     s    c         C   sS   |  i  oE | d j o |  i  i   n |  i  i   | i |  i  i    n d  S(   Ni    (   t
   serviceSelRE   RF   t
   setServiceRj   (   R   t	   directiont   epg(    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyt   changeServiceCB  s
    
c   
      C   s   t  t i i _ d d k l } d d k l } |  i } |  d i	   } | d } | d } | p d  St
 t |   } | ov | i   } t |  }	 | |	  |  _ |  i i |  o8 |  i i |  i | | | d  | | |  i d |  i q n d  S(   Ni(   t   CoolInfoGuide(   t   SimpleServicelistR,   i   i    R^   (   Ra   R   R}   t   SinfoR   R   t   Screens.InfoBarGenericsR   R\   t
   getCurrentR
   RT   t   getRoott   getBouquetServicesR   t   selectServiceR   t   openWithCallbackt
   InfoClosedRc   t   eventViewCallbackR   (
   R   R   R   R   t   curR   R   R   t   current_pathRl   (    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyR     s     	

 c         C   s   |  i  i   } t i i i o@ | a |  i   t |  i	 |  i   |  i
   t t i i _ n |  d } |  i } | i |  | i |  d d  k } | i | i  d  S(   NR,   i(   R\   t   getCurrentSelectionR   R}   R   R   R   R   t   CSGmainR   R   Ra   Rj   t   fillSingleGuidet   moveToServiceR   t   moveToEventIdt   coolEID(   R   t   retR   t   lR   R   (    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyR     s    


	c         C   s   | |  _  |  i   d  S(   N(   Rl   R   (   R   Rl   (    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyt   setServices)  s    	c         C   s   | |  _  |  i   d  S(   N(   Rj   R   (   R   R   (    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyR   -  s    	c         C   sq   |  d } |  i  } |  i d  j o |  i i   |  _ n |  i d | i   } |  i i |  | i |  d  S(   NR,   s    - (   Rj   Rd   Rc   t   instancet   getTitleR   t   setTitleR   (   R   R   R   t   title(    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyR   1  s    
	c         C   sy   |  d } | i    } | d j o |  i   n | d 
j o |  i   n | i    } | | d  | | d  d  S(   NR,   ii   i    (   R   R   R   (   R   t   setEventR   t   valR   t   oldR   (    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyR   :  s    
c         C   s   ys t  t i i _ |  i i   } |  d i   } | d } | o | i } |  i i	 |  n | a
 |  i i   Wn d  SXd  S(   NR,   i   (   t   TrueR   R}   R   R   R\   R   R   R   R   R   R   (   R   R   R   t
   servicereft   refstr(    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyR   E  s    
	c         C   s   y} t  t i i _ |  i i   } |  d i   } | d } | o | i } |  i i	 |  n | a
 |  i i   |  i   Wn d  SXd  S(   NR,   i   (   R   R   R}   R   R   R\   R   R   R   R   R   R   R   (   R   R   R   R   R   (    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyR   T  s    
	c         C   sH   |  i  d j o d |  _  n
 d |  _  |  d i |  i   |  i   d  S(   Ni    i   R,   (   Rk   t   sortSingleGuideR   (   R   (    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyRs   d  s
    	c         C   sZ   |  i  d j oF |  i d j o |  d i t d   qV |  d i t d   n d  S(   Ns   Sort A-Zi   R'   s	   Sort Time(   R   Rk   R   R    (   R   (    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyR   l  s    c         C   s   |  d i    d  S(   NR,   (   R   (   R   (    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyR   s  s    c         C   s   |  d i    d  S(   NR,   (   R   (   R   (    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyR   v  s    c         C   sw   d d k  l  } y= |  d i   } | d } | p d  S| i   p d } Wn d } n X|  i i | | t  d  S(   Ni(   RR   R,   i    R$   (   RR   R   t   getEventNameR   RX   Ra   (   R   RR   R   R   R   (    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyR   y  s    
 
c         C   s   y d d k  l } l } Wn t j
 o d  } n Xy6 |  d i   } | d } | p d  S| i   } Wn t j
 o d  } n X| d  j	 o |  i i | | t	  n d  S(   Ni(   t   IMDBt   IMDBEPGSelectionR,   i    (
   t   Plugins.Extensions.IMDb.pluginR  R  t   ImportErrorRc   R   R   R   RX   Ra   (   R   R  R  R   R   R   (    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyR     s    
 c         C   s   |  d i    } | d } | p d  S| d } yv d d k l } |  i i |  i t d t d  d t d  d f t d	  d	 f g | |  i d
 | d | f Wn& |  i i t	 t d  t	 i
  n Xd  S(   NR,   i    i   i(   t   addAutotimerFromEventR   s      check Autotimer ?t   Yest   Not   evtR   sM   No AutoTimer seems to be installed. Please install it for this functionality.(   R   t,   Plugins.Extensions.AutoTimer.AutoTimerEditorR  R   R   t   CoolAutoTimerSafeR   R    RX   R   R   (   R   R   R   R   R  (    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyR     s    
 
F c         C   s   |  d i    } | d } | p d  S| d } | o | d } | d j oN y! d d k l } | |  i  Wq |  i i t t d  t i  q Xn d  S(   NR,   i    i   R  i(   t   mainsM   No AutoTimer seems to be installed. Please install it for this functionality.(   R   t#   Plugins.Extensions.AutoTimer.pluginR  R   RX   R   R    R   (   R   t   answerR   R   R   t   AutoTimerSafe(    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyR
    s    
 
c         C   s  |  d i    } | d } | d } | p d  S| i   } | i i   } xp|  i i i i D][ } | i | j oE | i	 i i   | j o, |  i i i i
 |  |  d i i   Pq^ q^ Wd d k l } l } d d k l }	 | | d t | |  }
 d d  k } | i i i |
  } | d  j	 o x8 | D]0 } | i |
  o |  i i i i |  q3q3W|  i i i i |
  } | d  j	 o |  i i |  i |	 |  qn |  d i i   |  i   d  S(   NR,   i   i    i(   t   RecordTimerEntryt
   parseEvent(   t   TimerSanityConflictt   checkOldTimers(   R   t
   getEventIdR   t   toStringR   Rp   Rq   R   R   R   t   removeEntryR   t
   invalidateR  R  t   Screens.TimerEditR  R   t   NavigationInstanceR   t   recordRc   t   setAutoincreaseEndt   timeChangedR   t   finishSanityCorrectionRo   (   R   R   R   R   R   R   R+   R  R  R  t   newEntryR  t	   conflictsR   (    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyR:     s8    

  )	 !c      
   C   sH  |  d i    } | d } | d } | p d  S| i   } | i i   } x |  i i i i D] } | i | j or | i	 i i   | j oY |  i i
 |  i t d t d d  | i   d t d  d f t d	  d
 f g Pq^ q^ Wd d k l } l } d d k l }	 | | d t | |  }
 |  i i
 |  i |	 |
  d  S(   NR,   i   i    R   s   Cool Timer Edit :s   

%ss   edit this Timer ?t   edits   delete this Timer ?t   deletei(   R  R  (   t
   TimerEntryR  (   R   R  R   R  R   Rp   Rq   R   R   R   R   t   CoolTimerEditR   R    R   R  R  t   Screens.TimerEntryR!  R   t   finishedAdd(   R   R   R   R   R   R   R+   R  R  R!  R  (    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyR     s     

  )T	c         C   s$   d d k  l } |  i i |  d  S(   Ni(   t   TimerEditList(   R  R%  R   RX   (   R   R%  (    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyRt     s    c   	      C   s>  d d k  l } |  d i   } | d } | d } | p d  S| i   } | i i   } | o | d } x |  i i i i	 D] } | d j oR | i
 | j o> | i i i   | j o% |  i i i i |  |  i   Pq n | d j oE | i
 | j o1 | i i i   | j o |  i i | |  Pq6q q Wd  S(   Ni(   R!  R,   i   i    R   R  (   R#  R!  R   R  R   R  R   Rp   Rq   R   R   R   R  Ro   RX   (	   R   R  R!  R   R   R   R   R   R+   (    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyR"    s(    

  )
	)c         C   s  | d o| d } |  i  i i i |  } | d  j	 o x8 | D]0 } | i |  o |  i  i i i |  qA qA W|  i  i i i |  } | d  j	 o- d d k l } |  i  i	 |  i
 | |  q n |  i d j o' |  d i t d   |  i |  _ q|  i d j o' |  d i t d   |  i |  _ q|  i d j o' |  d	 i t d   |  i |  _ q|  i d j o' |  d
 i t d   |  i |  _ qn |  i d j o' |  d i t d   |  i |  _ n |  i d j o' |  d i t d   |  i |  _ no |  i d j o' |  d	 i t d   |  i |  _ n8 |  i d j o' |  d
 i t d   |  i |  _ n d  S(   Ni    i   i(   R  RQ   R&   t	   TimerEditR%   R'   R(   (   R   Rp   Rq   R  Rc   R  R  R  R  R   R  R   R   R    t   REMOVE_TIMERRg   R   Rf   R   Rh   R   Ri   t	   ADD_TIMER(   R   R  t   entryt   simulTimerListR   R  (    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyR$    sH    
 !c         C   s   |  i  |  d  S(   N(   R$  (   R   R  (    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyR    s    c         C   s<  |  d i    } | d } |  d i |  d } | d  j	 o t   } | i   } t |  } t |  } | d | d j o* d |  i | d | d | d f } q d t d	  | d | d f } n |  d
 i |  | d d  j o |  d i	 d   n |  d i	 | d i
  | p |  i d j o! |  d i d  |  i |  _ n |  i d j o! |  d i d  |  i |  _ nc |  i d j o! |  d i d  |  i |  _ n2 |  i d j o! |  d i d  |  i |  _ n d  S| d } | i   }	 | i
 i   }
 t } xN |  i i i i D]: } | i |	 j o$ | i i
 i   |
 j o t } Pq,q,W| o |  i d j o' |  d i t d   |  i |  _ q8|  i d j o' |  d i t d   |  i |  _ q8|  i d j o' |  d i t d   |  i |  _ q8|  i d j o' |  d i t d   |  i |  _ q8n | p |  i d j o' |  d i t d   |  i |  _ q8|  i d j o' |  d i t d   |  i |  _ q8|  i d j o' |  d i t d   |  i |  _ q8|  i d j o' |  d i t d   |  i |  _ q8n d  S(   NR,   i    R	   R$   i   s	   %s %d.%d.i   i   t   TodayR)   R#   RQ   R&   R%   R'   R(   R&  (    R   t   newEventRc   R   R   R   R_   R    R   t
   newServiceR   R   Re   Rg   R   Rf   R   Rh   R   Ri   R  R  Ra   R   Rp   Rq   R   R   R   R   R'  R(  (   R   R   R   t   datestrR   R   t   nowTimet   begTimeR   R   R   t   isRecordEventR+   (    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyRo     s    
	*%
 )	c         C   s8   d d k  l } y |  i i |  i |  Wn n Xd  S(   Ni(   t   CoolTVGuideSetup(   R   R2  R   R   t   onSetupClose(   R   R2  (    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyRr   b  s
    c         C   sT   d d k  l } |  i   t |  i |  i  |  i i t | t i  |  i	   d  S(   Ni(   t   CoolTVGuideAbout(
   R   R4  R   R   R   R\   RX   R   t	   TYPE_INFOR   (   R   R4  (    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyR3  i  s
    
N(:   t   __name__t
   __module__Re   R(  R'  t   ZAPRc   RS   R   R{   Rz   R|   R/   R0   R1   R2   R3   R4   R5   R6   R7   R8   R9   Rw   Rx   RE   RF   Ru   Rv   R   R   R   R   Ra   R   R   R   R   R   R   R   Rs   R   R   R   R   R   R   R
  R:   R   Rt   R"  R$  R  Ro   Rr   R3  (    (    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyR   ,   sl   i																						)																							&		H	Rn   c           B   s   e  Z d d d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 e
 Z d   Z d   Z d	   Z d
   Z d   Z d d  Z d   Z d   Z d   Z d   Z d   Z RS(   c         C   s  t  d  t  d  t  d  t  d  t  d  t  d  t  d  f |  _ | |  _ g  |  _ | d  j	 o |  i i |  n t i |   t i	   |  _
 t   |  _ t d d d f  |  _ t d d d f  |  _ |  i i d
 |  i  |  i i d |  i  |  i i |  i  d
 |  _ d |  _ d |  _ d |  _ d |  _ d |  _ d |  _ d |  _ d  |  _ d  |  _ d |  _ d |  _ d |  _ t  i	   |  _! d  S(   NR   R   R   R   R    R!   R"   s
   Regular;22i   i    i   iF   i   i2   i f iɘ; i i``` i i (   i   i   (   i   i   (   i   i   (   i   i   ("   R    R_   R+   t   onSelChangedRc   R   R   RS   R   R   t   serviceHandlerR   R   R   t   CoolFontt   CoolEventFontt   setFontt   setBuildFunct   buildSingleGuideEntryt
   CoolDayPost   CoolTimePost   CoolEventPost   CoolDaySizet   CoolTimeSizet   CoolDayColort   CoolTimeColort   CoolEventColort   CoolBackColort   CoolBackColorSelt   CoolTunerColt   CoolRecPreColort   CoolRecColorR   R   (   R   R*   R+   (    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyRS   r  s6    H															c         C   s  g  } |  i  d  j	 ox||  i  D]m\ } } | d j o2 t | d d f  |  _ |  i i d |  i  q  | d j o2 t | d d f  |  _ |  i i d |  i  q  | d j o t |  |  _ q  | d j o t |  |  _	 q  | d j o t |  |  _
 q  | d	 j o t |  |  _ q  | d
 j o t |  |  _ q  | d j o t |  i   |  _ q  | d j o t |  i   |  _ q  | d j o t |  i   |  _ q  | d j o t |  i   |  _ q  | d j o t |  i   |  _ q  | d j o t |  i   |  _ q  | d j o t |  i   |  _ q  | d j o t |  i   |  _ q  | i | | f  q  Wn | |  _  t i |  | |  S(   NR;  i   i    R<  i   R@  RA  RB  RC  RD  RE  RF  RG  RH  RI  RJ  RK  RL  (   i   i   (   i   i   (   i   i   (   i   i   (   t   skinAttributesRc   R   R;  R   R=  R<  t   intR@  RA  RB  RC  RD  R   t   argbRE  RF  RG  RH  RI  RJ  RK  RL  R   R   t	   applySkin(   R   t   desktopt   parentt   attribst   attribR   (    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyRP    sN    
 	c         C   sC   d  } |  i d  j	 o) | d  j	 o |  i i | i |  } n | S(   N(   Rc   R   R   R   (   R   R   R   R   (    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyt   getEventFromId  s    c         C   sa   d } |  i  i   } | d  j o d S| | d } t | |  } |  i | |  } | | f S(   Ni    i   (   NN(   R   R   Rc   R   RU  (   R   t   idxt   tmpR   R   R   (    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyR     s    c         C   s   |  i  i |  i  i  d  S(   N(   R   t   moveSelectionR   (   R   (    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyR     s    c         C   s   |  i  i |  i  i  d  S(   N(   R   RX  R   (   R   (    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyR     s    c         C   s0   x) |  i  D] } | d  j	 o |   q
 q
 Wd  S(   N(   R9  Rc   (   R   R   (    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyt   selectionChanged  s    
 c         C   s:   | i  t  | i i   i |  i  | i |  i  d  S(   N(   t   setWrapAroundR   RY  t   getR   t
   setContentR   (   R   R   (    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyt   postWidgetCreate  s    c         C   s*   | i  i   i |  i   | i d   d  S(   N(   RY  R[  t   removeR\  Rc   (   R   R   (    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyt   preWidgetRemove  s    c   
      C   s5  x |  i  i D] } | i i i   | j o | | } | i } | i } | | | d }	 | i | j o' | | j  p | | j o d Sd Sq | |	 j o
 | j n o' | | j  p | | j o d Sd Sq q q WxP |  i  i D]B } | i	 o2 | i i i   | j o | i | j o d Sq q Wd  S(   Ni   t   recordxR  (
   R+   R   R   R   R  R   R   R   R   R   (
   R   R   t	   beginTimet   durationt   eventIdR   t   endTimeR   R   R   (    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyt
   CoolRecRed  s(     
		 #c         C   s0   |  i  i |  } | o | i | |  p t S(   N(   R:  t   infot
   isPlayableRa   (   R   t	   refToPlayt
   refPlayingRf  (    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyt   isServiceAvailable  s    c         C   s  t  i i   i   } |  i t |  t |   } |  i | | | |  } t |  }	 | d j o |  i }
 } } nZ | d j o |  i	 }
 } } n8 | p |  i
 }
 } } n |  i }
 |  i } |  i } d  t i |  i d |  i d d t |  i |	 d |
 |
 |  i |  i f g } | i t d |  i d f d d d	 d
 d | d | d | d |  i   | i t d |  i d f d |  i d f d	 d d d |	 d |	 d f d | d | d |  i d |  i d d d |  i  
 | S(   NR  R`  i    i   i   t   posRU   i  t   fonti   t   textt   colort	   color_selt   backcolor_sels	   %02d:%02di   i   t	   backcolort   border_widtht   border_color(   i  i   (   R  R   t#   getCurrentlyPlayingServiceReferenceR  Rj  R
   Re  R   RL  RK  RJ  RE  RG  RF  Rc   R   t	   TYPE_TEXTR@  RC  R   R_   RH  RI  R   R   RB  RA  RD  (   R   R   Rc  Ra  Rb  t	   EventNamet   curservicerefstrt	   FreeTunert   cooltypt   tt   FTDCt   FTECt   FTTCt   res(    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyR?    s"    			JFyc         C   sI   |  i  d  j	 o5 | d  j	 o |  i  i | |  S|  i  i |  Sn g  S(   N(   R   Rc   t   lookupEvent(   R   R,   t	   buildFunc(    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyt   queryEPG  s
    c         C   sT   d | i  i   d d d f g } |  i |  |  _ |  i i |  i  |  i   d  S(   Nt   RIBDTi    i(   R   R  R  R,   R   t   setListRY  (   R   R   t   test(    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyR   '  s    !c         C   su   |  i  } | oa |  i   } | d j o | i d d    n | i d d    |  i i   |  i |  n d  S(   Ni   t   keyc         S   s#   |  d  o |  d  i    |  d f S(   i   i   (   t   lower(   R   (    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyt   <lambda>2  s    c         S   s   |  d  S(   i   (    (   R   (    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyR  5  s    (   R,   t   getSelectedEventIdt   sortR   R  R   (   R   t   typeR,   t   event_id(    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyR   -  s    	c         C   s   |  i  i   } | o | d S(   Ni   (   R   R   (   R   R   (    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyR  9  s    c         C   sf   | p d  Sd } | i    } xA |  i D]6 } | d | j o |  i i |  Pn | d 7} q( Wd  S(   Ni    i   (   R  R,   R   t   moveSelectionTo(   R   R   t   indexR   R   (    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyR   =  s    
 c         C   sZ   | p d  Sd } xA |  i  D]6 } | d | j o |  i i |  Pn | d 7} q Wd  S(   Ni    i   (   R,   R   R  (   R   Rc  R  R   (    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyR   H  s    
 N(   R6  R7  Rc   RS   RP  RU  R   R   R   RY  R   t
   GUI_WIDGETR]  R_  Re  Rj  R?  R  R   R   R  R   R   (    (    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyRn   q  s&   &	-		
												c         C   sS   |  i  oE | d j o |  i  i   n |  i  i   | i |  i  i    n d  S(   Ni    (   R   RE   RF   R   Rj   (   R   R   R   (    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyR   R  s
    
c      	   C   s   d d k  l } |  i i i   } | ov t i   } |  i |  } | |  |  _ | a	 t
 } |  i i |  o) |  i i t t | d |  i d t q n d  S(   Ni(   R   R^   R   (   R   R   R   Rp   Rt  R   R   R   R   R   R   R   R   t   CoolSingleGuideClosedR   R   (   R   R   R   R   Rl   t	   SingleZap(    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyt   openCoolSingleGuideZ  s    c         C   s   t  o t i t  n d  S(   N(   R  R   R   R   (   R   R   (    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyR  g  s    c         C   s   g  } t  i   i |   } | d  j	 oc x` t oT | i   } | i   p Pn | i t i	 t i
 B@o q+ n | i t |   q+ Wn | S(   N(   R   R   R,   Rc   R   t   getNextt   validt   flagsR
   t   isDirectoryt   isMarkerR   R   (   t   bouquetRl   R\   R   (    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyR   k  s     c         C   s   | d  j oU d d k l } | o | i o | i i } qb |  i t t d  t i  d  Sn | a	 d d k l } | o | i o t
 | i  n d  S(   Ni(   R   s    No function with your Image(   Rc   t   Screens.InfoBarR   R   R\   RX   R   R    R   R   R  (   R   R\   R   (    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyR   x  s    c         K   s   t    i t    i f d j o |  i t t t i  n | d  j oU d d k l	 } | o | i
 o | i
 i } q |  i t t d  t i  d  Sn | a d d k l	 } | o | i
 o t | i
  n d  S(   Ni  i   i(   R   s    No function with your Image(   i  i   (   R   R   R   RX   R   t   CoolTVGuideProR5  Rc   R  R   R   R\   R    R   R   R  (   R   R\   t   kwargsR   (    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyR     s    (:   RS   R    R  t   Components.ActionMapR   t   Components.ButtonR   t   Components.configR   t   Components.GUIComponentR   t   Components.HTMLComponentR   t   Components.LabelR   t   Components.MultiContentR   t   Components.Sources.ServiceEventR   t   Components.Sources.EventR	   t   enigmaR
   R   R   R   R   R   R   t   Screens.ChoiceBoxR   R  R   t   Screens.MessageBoxR   t   Screens.ScreenR   R   RZ   R   R   R   R   t   Tools.DirectoriesR   Rc   R  Ra   t   mepg_config_initializedR  R   Rn   R   R  R  R   R   R   (    (    (    sI   /usr/lib/enigma2/python/Plugins/Extensions/CoolTVGuide/CoolSingleGuide.pyt   <module>   sB   4
   H			