Update of /cvsroot/freevo/freevo/src/util
In directory sc8-pr-cvs1:/tmp/cvs-serv17392/src/util

Modified Files:
        misc.py 
Log Message:
First try at the "Coming Up" page. It only shows up when a directory in the
TV menu is selected, but I'm working on a way to have it show up for the
rest of the TV menu.

TODO:
o Cache the coming up list for an hour at a time (misc.py)
o Cleanup the 'comingup()' function, it's currently just executable pseudo-code 
(misc.py)
o Show the Coming Up list for all items (skin)

If you don't use 'blurr2.fxd' this will have no effect on you whatsoever.



Index: misc.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/util/misc.py,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** misc.py     1 Jan 2004 16:18:11 -0000       1.12
--- misc.py     11 Jan 2004 03:22:30 -0000      1.13
***************
*** 11,14 ****
--- 11,26 ----
  # -----------------------------------------------------------------------
  # $Log$
+ # Revision 1.13  2004/01/11 03:22:30  outlyer
+ # First try at the "Coming Up" page. It only shows up when a directory in the
+ # TV menu is selected, but I'm working on a way to have it show up for the
+ # rest of the TV menu.
+ #
+ # TODO:
+ # o Cache the coming up list for an hour at a time (misc.py)
+ # o Cleanup the 'comingup()' function, it's currently just executable pseudo-code 
(misc.py)
+ # o Show the Coming Up list for all items (skin)
+ #
+ # If you don't use 'blurr2.fxd' this will have no effect on you whatsoever.
+ #
  # Revision 1.12  2004/01/01 16:18:11  dischi
  # fix crash
***************
*** 368,371 ****
--- 380,444 ----
      return string
  
+ 
+ # 
+ # Coming Up for TV schedule
+ #
+ 
+ def comingup(items):
+     # XXX We should cache this information and update it hourly/daily
+     # 
+     import tv.record_client as ri
+     import time
+ 
+     (status, recordings) = ri.getScheduledRecordings()
+     progs = recordings.getProgramList()
+ 
+     f = lambda a, b: cmp(a.start, b.start)
+     progl = progs.values()
+     progl.sort(f)
+ 
+     today = []
+     tomorrow = []
+     later = []
+ 
+     for what in progl:
+         if what.start <= time.time() + 86400:
+             today.append(what)
+         if what.start <= time.time() + 172800 and what.start >= time.time() + 86400:
+             tomorrow.append(what)
+         if what.start >= time.time() + 172800:
+             later.append(what)
+ 
+     result = ''
+ 
+ 
+ 
+     if len(today) > 0:
+         result = result + 'Today:\n'
+         for m in today:
+             sub_title = ''
+             if m.sub_title:
+                 sub_title = ' "' + m.sub_title + '" '
+             result = result + " " + str(m.title) + str(sub_title) + " at " + \
+                 str(time.strftime('%I:%M%p',time.localtime(m.start))) + '\n'
+ 
+     if len(tomorrow) > 0:
+         result = result + 'Tomorrow:\n'
+         for m in tomorrow:
+             sub_title = ''
+             if m.sub_title:
+                 sub_title = ' "' + m.sub_title + '" '
+             result = result + " " + str(m.title) + str(sub_title) + " at " + \
+                 str(time.strftime('%I:%M%p',time.localtime(m.start))) + '\n'
+            
+     if len(later) > 0:
+         for m in later:
+             sub_title = ''
+             if m.sub_title:
+                 sub_title = ' "' + m.sub_title + '" '
+             result = result + " " + str(m.title) + str(sub_title) + " at " + \
+                 str(time.strftime('%I:%M%p',time.localtime(m.start))) + '\n'
+ 
+     return result
  
  




-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software.
Perforce is the Fast Software Configuration Management System offering
advanced branching capabilities and atomic changes on 50+ platforms.
Free Eval! http://www.perforce.com/perforce/loadprog.html
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to