Update of /cvsroot/freevo/freevo/src/tv
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22732/src/tv
Modified Files:
channels.py
Log Message:
Add a simple but effective memory cache.
Index: channels.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/tv/channels.py,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** channels.py 13 Aug 2004 02:08:25 -0000 1.23
--- channels.py 14 Aug 2004 01:19:04 -0000 1.24
***************
*** 10,13 ****
--- 10,16 ----
# -----------------------------------------------------------------------
# $Log$
+ # Revision 1.24 2004/08/14 01:19:04 rshortt
+ # Add a simple but effective memory cache.
+ #
# Revision 1.23 2004/08/13 02:08:25 rshortt
# Add reference to config.TV_DEFAULT_SETTINGS and settings() to Channel class.
***************
*** 78,81 ****
--- 81,107 ----
import pyepg
+
+ _channels_cache = None
+
+ def get_channels():
+ global _channels_cache
+ pickle = os.path.join(config.FREEVO_CACHEDIR, 'epg')
+
+ if not _channels_cache:
+ _debug_('no epg in memory, caching')
+ _channels_cache = ChannelList()
+
+ elif not os.path.isfile(pickle):
+ _debug_('no epg "%s", will try to rebuild' % pickle)
+ _channels_cache = ChannelList()
+
+ elif os.stat(pickle)[stat.ST_MTIME] > _channels_cache.load_time:
+ _debug_('epg newer than memory cache, reloading')
+ _channels_cache = ChannelList()
+
+ return _channels_cache
+
+
+
class Channel:
"""
***************
*** 137,143 ****
return settings
-
-
-
--- 163,166 ----
***************
*** 153,156 ****
--- 176,180 ----
epg = pyepg.load(source, pickle)
+ self.load_time = time.time()
for c in config.TV_CHANNELS:
-------------------------------------------------------
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