Update of /cvsroot/freevo/freevo/src/util
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22989/src/util
Modified Files:
tv_util.py
Log Message:
Remove get_guide, fix get_chan_displayname, and use the chanlist/epg from the cache.
Index: tv_util.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/util/tv_util.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** tv_util.py 8 Aug 2004 19:48:31 -0000 1.9
--- tv_util.py 14 Aug 2004 01:21:47 -0000 1.10
***************
*** 7,10 ****
--- 7,13 ----
# -----------------------------------------------------------------------
# $Log$
+ # Revision 1.10 2004/08/14 01:21:47 rshortt
+ # Remove get_guide, fix get_chan_displayname, and use the chanlist/epg from the
cache.
+ #
# Revision 1.9 2004/08/08 19:48:31 rshortt
# Make this work again (for now).
***************
*** 54,60 ****
import sys, string, re
! import time, os, string
import util, config
DEBUG = 0
--- 57,64 ----
import sys, string, re
! import time, os, string, traceback
import util, config
+ from tv.channels import get_channels
DEBUG = 0
***************
*** 145,152 ****
return tv_display_name
! # guide = tv.epg_xmltv.get_guide()
! # c = guide.chan_dict.get(channel_id)
! # if c:
! # return c.displayname
# this shouldn't happen, but just in case
return 'Unknown'
--- 149,156 ----
return tv_display_name
! for chan in get_channels().get_all():
! if chan.id == channel_id:
! return chan.name
!
# this shouldn't happen, but just in case
return 'Unknown'
***************
*** 155,164 ****
def when_listings_expire():
- guide = get_guide()
last = 0
left = 0
! for ch in guide.chan_list:
! for prog in ch.programs:
if prog.start > last: last = prog.start
--- 159,167 ----
def when_listings_expire():
last = 0
left = 0
! for ch in get_channels().get_all():
! for prog in ch.epg.programs:
if prog.start > last: last = prog.start
***************
*** 173,237 ****
- # XXX: Adding get_guide() and caching here temporarily until we have a working
- # replacement since various parts of Freevo need it and I need it to fix
- # them else I'll lose my sanity. :) -Rob
-
- _cached_guide = None
-
- def get_guide():
- global _cached_guide
-
- source = config.XMLTV_FILE
- pickle = os.path.join(config.FREEVO_CACHEDIR, 'epg')
-
- if(_cached_guide == None or
- (os.path.isfile(source) and
- _cached_guide.timestamp != os.path.getmtime(source))):
-
- got_cached_guide = False
- if (os.path.isfile(source) and
- os.path.isfile(pickle) and (os.path.getmtime(pickle) >
- os.path.getmtime(source))):
-
-
- _cached_guide = util.read_pickle(pickle)
-
- epg_ver = None
- try:
- epg_ver = _cached_guide.EPG_VERSION
- except AttributeError:
- _debug_('EPG does not have a version number, must be reloaded')
- print dir(cached_guide)
-
- if _cached_guide.timestamp != os.path.getmtime(source):
- # Hmmm, weird, there is a pickled file newer than the TV.xml
- # file, but the timestamp in it does not match the TV.xml
- # timestamp. We need to reload!
- _debug_('EPG: Pickled file timestamp mismatch, reloading!')
-
- else:
- _debug_('XMLTV, got cached guide (version %s).' % epg_ver)
- got_cached_guide = True
-
-
- if not got_cached_guide:
- _debug_('XMLTV, trying to read raw file (%s)' % source)
-
- try:
- _cached_guide = pyepg.load(source)
- if not _cached_guide:
- _debug_('TV Guide is corrupt!')
- return False
- except:
- # Don't violently crash on a incomplete or empty TV.xml please.
- _cached_guide = None
- print
- print String(_("Couldn't load the TV Guide, got an exception!"))
- print
- traceback.print_exc()
- else:
- # Dump a pickled version for later reads
- util.save_pickle(_cached_guide, pickle)
-
- return _cached_guide
-
--- 176,177 ----
-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog