Update of /cvsroot/freevo/freevo/lib/pyepg
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8405/lib/pyepg

Modified Files:
        channel.py 
Log Message:
Fix dummy_progs to fill large chunks instead of many small ones. Needs futther 
tweaking.


Index: channel.py
===================================================================
RCS file: /cvsroot/freevo/freevo/lib/pyepg/channel.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** channel.py  22 Dec 2004 10:32:59 -0000      1.7
--- channel.py  28 Dec 2004 00:31:24 -0000      1.8
***************
*** 47,50 ****
--- 47,51 ----
  # 
-----------------------------------------------------------------------------
  
+ import time
  
  # Try to import the notifier or set the variable notifier to None. If
***************
*** 87,115 ****
  
  
!     def __get_dummy_programs(self, start, stop):
          """
          Return some default Program with intervals no longer than a
          set default.
          """
!         default_prog_interval = 30 * 60
!         dummies = []
!         d_start = start
!         d_stop  = 0
! 
!         sec_after_last = start % default_prog_interval
!         sec_until_next = default_prog_interval - sec_after_last
! 
!         while(d_stop < stop):
!             d_stop = d_start + sec_until_next
!             if d_stop > stop:
!                 d_stop = stop
! 
!             dummies.append(Program(-1, u'NO DATA', d_start, d_stop,
!                                    '', '', '', self))
! 
!             sec_until_next = default_prog_interval
!             d_start = d_stop
! 
!         return dummies
  
  
--- 88,97 ----
  
  
!     def __get_dummy_program(self, start, stop):
          """
          Return some default Program with intervals no longer than a
          set default.
          """
!         return Program(-1, u'NO DATA', start, stop, '', '', '', self)
  
  
***************
*** 120,125 ****
          we will add dummy programs to fill it (TODO).
          """
-         # FIXME: adding dummy programs will add them from start to stop and
-         # not in 30 minutes chunks. That's bad!
          new_progs = []
          dummy_progs = []
--- 102,105 ----
***************
*** 141,145 ****
          l = len(new_progs)
          if not l:
!             dummy_progs = self.__get_dummy_programs(start, stop)
          else:
              p0 = new_progs[0]
--- 121,125 ----
          l = len(new_progs)
          if not l:
!             dummy_progs.append(self.__get_dummy_program(start, stop))
          else:
              p0 = new_progs[0]
***************
*** 154,169 ****
                      # fill gaps before
                      if p.start > start:
!                         n = self.__get_dummy_programs(start, p.start)
!                         dummy_progs += n
                  elif p == p1:
                      # fill gaps at the end
                      if p.stop < stop:
!                         n = self.__get_dummy_programs(p.stop, stop)
!                         dummy_progs += n
                  else:
                      # fill gaps between programs
                      if last.stop < p.start:
!                         n = self.__get_dummy_programs(last.stop, p.start)
!                         dummy_progs += n
                  last = p
                  # Add program. Because of some bad jitter from 60 seconds in
--- 134,147 ----
                      # fill gaps before
                      if p.start > start:
!                         dummy_progs.append(self.__get_dummy_program(start, 
p.start))
                  elif p == p1:
                      # fill gaps at the end
                      if p.stop < stop:
!                         dummy_progs.append(self.__get_dummy_program(p.stop, 
!                                             (int(time.time())/86400*86400)))
                  else:
                      # fill gaps between programs
                      if last.stop < p.start:
!                         
dummy_progs.append(self.__get_dummy_program(last.stop, p.start))
                  last = p
                  # Add program. Because of some bad jitter from 60 seconds in



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to