Update of /cvsroot/freevo/freevo/WIP/Ruelle
In directory sc8-pr-cvs1:/tmp/cvs-serv27850

Modified Files:
        tvtime.py 
Log Message:
just need a few more things

Index: tvtime.py
===================================================================
RCS file: /cvsroot/freevo/freevo/WIP/Ruelle/tvtime.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** tvtime.py   10 Sep 2003 14:19:08 -0000      1.1
--- tvtime.py   10 Sep 2003 18:24:58 -0000      1.2
***************
*** 10,15 ****
  # -----------------------------------------------------------------------
  # $Log$
! # Revision 1.1  2003/09/10 14:19:08  mikeruelle
! # first stage of new tvtime plugin
  #
  # Revision 1.17  2003/09/03 17:54:38  dischi
--- 10,15 ----
  # -----------------------------------------------------------------------
  # $Log$
! # Revision 1.2  2003/09/10 18:24:58  mikeruelle
! # just need a few more things
  #
  # Revision 1.17  2003/09/03 17:54:38  dischi
***************
*** 82,85 ****
--- 82,93 ----
          plugin.Plugin.__init__(self)
  
+         # get config locations and mod times so we can check if we need
+         # to regen the stationlist.xml file (because they changed)
+         self.mylocalconf = self.findLocalConf()
+         self.myfconfig = os.environ['FREEVO_CONFIG']
+         self.tvtimecache = os.path.join(config.FREEVO_CACHEDIR, 'tvtimecache')
+         self.mylocalconf_t = os.path.mtime(self.mylocalconf)
+         self.myfconfig_t = os.path.mtime(self.myfconfig)
+ 
          #check and create the stationlist.xml if it doesn't exist
        self.createStationListXML()
***************
*** 88,111 ****
          plugin.register(TVTime(), plugin.TV)
  
      def createStationListXML(self):
          tvtimedir = os.path.join(os.environ['HOME'], '.tvtime')
          if (os.path.isfile(os.path.join(tvtimedir, 'stationlist.xml'))):
            print "found stationlist.xml"
!             # if exists check cache of mtime.
!             #     if doesn't exist or is old
!             #         write new stationlist
!             self.writeStationListXML()
!             # write new cache of mtimes.
        else:
            print "not found stationlist.xml"
              self.writeStationListXML()
!             # write new cache of mtimes.
  
!     # find out how to use the autogen list of channels
      # for custom freq ' band="Custom" channel="55.25MHz" '
      def writeStationListXML(self):
          norm='freevo'
          tvnorm = config.CONF.tv
!         tvnorm.upper()
          tvtimefile = os.path.join(os.environ['HOME'], '.tvtime', 'stationlist.xml')
          fp = open(tvtimefile,'w')
--- 96,148 ----
          plugin.register(TVTime(), plugin.TV)
  
+     def findLocalConf(self):
+         cfgfilepath = [ '.', os.path.expanduser('~/.freevo'), '/etc/freevo' ]
+         mylocalconf = ''
+         for dir in cfgfilepath:
+             mylocalconf = os.path.join(dir,'local_conf.py')
+             if os.path.isfile(mylocalconf):
+                 break
+         return mylocalconf
+ 
      def createStationListXML(self):
          tvtimedir = os.path.join(os.environ['HOME'], '.tvtime')
          if (os.path.isfile(os.path.join(tvtimedir, 'stationlist.xml'))):
            print "found stationlist.xml"
!             if self.needNewStationList():
!                 self.writeStationListXML()
!                 self.writeMtimeCache()
        else:
            print "not found stationlist.xml"
+             if not os.path.isdir(tvtimedir):
+                 os.mkdir(tvtimedir)
              self.writeStationListXML()
!             self.writeMtimeCache()
  
!     def needNewStationList(self):
!         # if we have no cache return 1
!         # read the cache file
!         # if we don't match local_conf location return 1
!         # if local_conf.py mtime > cached mtime return 1
!         # if freevo_config.py mtime > cached mtime return 1
!         # otherwise we are good
! 
!     def writeMtimeCache(self):
!         # get their mtimes
!         # write to file in freevo_cache
!       fp = open(self.tvtimecache, 'wb')
!         fp.write(self.mylocalconf)
!       fp.write()
!         fp.write(self.mylocalconf_t)
!       fp.write()
!         fp.write(self.myfconfig_t)
!       fp.write()
!       fp.close()
! 
!     # fix the default band from the static US Cable
      # for custom freq ' band="Custom" channel="55.25MHz" '
      def writeStationListXML(self):
          norm='freevo'
          tvnorm = config.CONF.tv
!         tvnorm = tvnorm.upper()
          tvtimefile = os.path.join(os.environ['HOME'], '.tvtime', 'stationlist.xml')
          fp = open(tvtimefile,'w')




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to