Update of /cvsroot/freevo/freevo/lib/pyepg
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23754/lib/pyepg
Modified Files:
channel.py
Log Message:
better dummy program handling
Index: channel.py
===================================================================
RCS file: /cvsroot/freevo/freevo/lib/pyepg/channel.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** channel.py 28 Dec 2004 00:31:24 -0000 1.8
--- channel.py 28 Dec 2004 19:50:01 -0000 1.9
***************
*** 48,51 ****
--- 48,52 ----
import time
+ import logging
# Try to import the notifier or set the variable notifier to None. If
***************
*** 60,63 ****
--- 61,70 ----
from program import Program
+ # get logging object
+ log = logging.getLogger('pyepg')
+
+ START_TIME = 0
+ STOP_TIME = 2147483647
+
class Channel:
***************
*** 93,96 ****
--- 100,104 ----
set default.
"""
+ log.info('create dummy for id=%s, %s-%s' % (self.id, start, stop))
return Program(-1, u'NO DATA', start, stop, '', '', '', self)
***************
*** 102,105 ****
--- 110,114 ----
we will add dummy programs to fill it (TODO).
"""
+ log.debug('import for id=%s, %s-%s' % (self.id, start, stop))
new_progs = []
dummy_progs = []
***************
*** 121,125 ****
l = len(new_progs)
if not l:
! dummy_progs.append(self.__get_dummy_program(start, stop))
else:
p0 = new_progs[0]
--- 130,146 ----
l = len(new_progs)
if not l:
! # No programs found? That's bad. Try to find the last before start
! # and the first after end and create a dummy.
! before = self.__epg.sql_get_programs(self.id, 0, start)
! if before:
! d_start = before[-1].stop
! else:
! d_start = START_TIME
! after = self.__epg.sql_get_programs(self.id, stop, -1)
! if after:
! d_stop = after[0].start
! else:
! d_stop = STOP_TIME
! dummy_progs.append(self.__get_dummy_program(d_start, d_stop))
else:
p0 = new_progs[0]
***************
*** 131,147 ****
if not notifier_counter and notifier and notifier.step:
notifier.step(False, False)
! if p == p0:
! # 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
--- 152,177 ----
if not notifier_counter and notifier and notifier.step:
notifier.step(False, False)
! if p == p0 and p.start > start:
! # gap at the beginning, find first program before this
! # item and fill the space with a dummy
! more = self.__epg.sql_get_programs(self.id, 10, start)
! if more:
! d = self.__get_dummy_program(more[-1].stop, p.start)
! else:
! d = self.__get_dummy_program(START_TIME, p.start)
! dummy_progs.append(d)
! elif p == p1 and p.stop < stop:
! # gap at the end, try to find next program and fill
! # the gap or create an 'endless' entry
! more = self.__epg.sql_get_programs(self.id, stop, -1)
! if more:
! d = self.__get_dummy_program(p.stop, more[0].start)
! else:
! d = self.__get_dummy_program(p.stop, STOP_TIME)
! dummy_progs.append(d)
! elif p != p0 and p != p1 and last.stop < p.start:
# fill gaps between programs
! d = self.__get_dummy_program(last.stop, p.start)
! dummy_progs.append(d)
last = p
# Add program. Because of some bad jitter from 60 seconds in
***************
*** 152,156 ****
continue
self.programs.append(p)
!
for p in dummy_progs:
# Add program. Because of some bad jitter from 60 seconds in
--- 182,186 ----
continue
self.programs.append(p)
!
for p in dummy_progs:
# Add program. Because of some bad jitter from 60 seconds in
***************
*** 180,183 ****
--- 210,218 ----
stop = 0
+ if start < START_TIME + 120:
+ start = START_TIME + 120
+ if stop > 0 and stop > STOP_TIME - 120:
+ stop = STOP_TIME - 120
+
# get programs
if self.programs:
-------------------------------------------------------
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