Update of /cvsroot/freevo/freevo/src/record
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13903/src/record

Modified Files:
        client.py 
Log Message:
add comingup to record client (needs more work)

Index: client.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/record/client.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** client.py   28 Dec 2004 00:33:06 -0000      1.5
--- client.py   6 Jan 2005 19:02:05 -0000       1.6
***************
*** 33,36 ****
--- 33,37 ----
  import sys
  import time
+ import copy
  import logging
  
***************
*** 56,59 ****
--- 57,79 ----
          self.status = status
          self.description = {}
+ 
+ 
+     def __unicode__(self):
+         if self.description.has_key('title') and self.description['title']:
+             s = self.description['title']
+         else:
+             s = 'No Title'
+         if self.description.has_key('episode') and 
self.description['episode']:
+             s += u' %s' % self.description['episode']
+         if self.description.has_key('subtitle') and \
+            self.description['subtitle']:
+             s += u' - %s' % self.description['subtitle']
+         start = time.strftime('%I:%M%p', time.localtime(self.start))
+         return s + u' at %s' % Unicode(start)
+ 
+ 
+     def __str__(self):
+         return String(self.__unicode__())
+ 
          
  class Recordings:
***************
*** 64,67 ****
--- 84,88 ----
          mcomm.register_entity_notification(self.__entity_update)
          mcomm.register_event('record.list.update', self.__list_update)
+         self.comingup = _('The recordserver is down')
          
  
***************
*** 69,72 ****
--- 90,94 ----
          if not entity.present and entity == self.server:
              log.info('recordserver lost')
+             self.comingup = _('The recordserver is down')
              self.server = None
              return
***************
*** 121,128 ****
              return
          self.last_update = time.time()
!         description = dict(rec[9])
!         description['title'] = rec[1]
          description['start_padding'] = rec[7]
          description['stop_padding'] = rec[8]
          key = '%s-%s-%s' % (rec[2], rec[4], rec[5])
          self.__recordings[key].description = description
--- 143,152 ----
              return
          self.last_update = time.time()
!         description = {} 
!         description['title'] = Unicode(rec[1], 'UTF-8')
          description['start_padding'] = rec[7]
          description['stop_padding'] = rec[8]
+         for key, value in dict(rec[9]).items():
+             description[key] = Unicode(value, 'UTF-8')
          key = '%s-%s-%s' % (rec[2], rec[4], rec[5])
          self.__recordings[key].description = description
***************
*** 140,144 ****
                  return
          log.info('got all recording descriptions')
!         return
          
          
--- 164,202 ----
                  return
          log.info('got all recording descriptions')
! 
! 
!         # create coming up text list
!         reclist = copy.copy(self.__recordings.values())
!         reclist.sort(lambda x,y: cmp(x.start, y.start))
!         today = []
!         tomorrow = []
!         later = []
! 
!         date0 = time.localtime()[:3]
!         date1 = time.localtime(time.time() + 60 * 60 * 24)[:3]
! 
!         for what in reclist:
!             if time.localtime(what.start)[:3] == date0:
!                 today.append(what)
!             elif time.localtime(what.start)[:3] == date1:
!                 tomorrow.append(what)
!             elif what.start > time.time():
!                 later.append(what)
! 
!         self.comingup = ''
!         if len(today) > 0:
!             self.comingup += _('Today') + u':\n'
!             for r in today:
!                 self.comingup += u'%s\n' % Unicode(r)
!         if len(tomorrow) > 0:
!             self.comingup += _('Tomorrow') + u':\n'
!             for r in tomorrow:
!                 self.comingup += u'  %s\n' % Unicode(r)
!         if len(later) > 0:
!             self.comingup += _('This Week') + u':\n'
!             for r in later:
!                 self.comingup += u'  %s\n' % Unicode(r)
!         if not self.comingup:
!             self.comingup = _('No recordings are scheduled')
          
          
***************
*** 267,268 ****
--- 325,329 ----
  recordings = Recordings()
  favorites  = Favorites()
+ 
+ def comingup():
+     return recordings.comingup



-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to