Update of /cvsroot/freevo/freevo/src/helpers
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22418/src/helpers

Modified Files:
        cache.py 
Log Message:
check mmpython cache version

Index: cache.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/helpers/cache.py,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** cache.py    1 Feb 2004 17:50:43 -0000       1.17
--- cache.py    5 Feb 2004 20:39:11 -0000       1.18
***************
*** 12,15 ****
--- 12,18 ----
  # -----------------------------------------------------------------------
  # $Log$
+ # Revision 1.18  2004/02/05 20:39:11  dischi
+ # check mmpython cache version
+ #
  # Revision 1.17  2004/02/01 17:50:43  dischi
  # fix, it deleted all infos on caching :-)
***************
*** 79,83 ****
      del_list = []
  
!     for name in ('image-viewer-thumb.jpg', 'thumbnails', 'audio'):
          if os.path.exists(os.path.join(config.FREEVO_CACHEDIR, name)):
              del_list.append(os.path.join(config.FREEVO_CACHEDIR, name))
--- 82,86 ----
      del_list = []
  
!     for name in ('image-viewer-thumb.jpg', 'thumbnails', 'audio', 'mmpython'):
          if os.path.exists(os.path.join(config.FREEVO_CACHEDIR, name)):
              del_list.append(os.path.join(config.FREEVO_CACHEDIR, name))
***************
*** 139,147 ****
      
  
! def cache_directories(rebuild=True):
      """
      cache all directories with mmpython
      """
      import util.mediainfo
  
      if rebuild:
--- 142,177 ----
      
  
! def cache_directories(rebuild):
      """
      cache all directories with mmpython
+     rebuild:
+     0   no rebuild
+     1   rebuild all files on disc
+     2   like 1, but also delete discinfo data
      """
      import util.mediainfo
+     try:
+         import mmpython.version
+ 
+         info = None
+         cachefile = os.path.join(config.FREEVO_CACHEDIR, 'mediainfo')
+         if os.path.isfile(cachefile):
+             info = util.read_pickle(cachefile)
+         if not info:
+             print
+             print 'Unable to detect last complete rebuild, forcing rebuild'
+             rebuild         = 2
+             complete_update = int(time.time())
+         else:
+             mmchanged, part_update, complete_update = info
+     except ImportError:
+         print
+         print 'Error: unable to read mmpython version information'
+         print 'Please update mmpython to the latest release or if you use'
+         print 'Freevo CVS versions, please also use mmpython CVS.'
+         print
+         print 'Some functions in Freevo may not work or even crash!'
+         print
+         print
  
      if rebuild:
***************
*** 150,153 ****
--- 180,187 ----
          for f in util.recursefolders(config.OVERLAY_DIR,1,'mmpython.cache',1):
              os.unlink(f)
+         if rebuild == 2:
+             for f in util.match_files(config.OVERLAY_DIR + '/disc/metadata', 
['mmpython']):
+                 os.unlink(f)
+                 print f
          print 'done'
  
***************
*** 161,164 ****
--- 195,206 ----
      print
  
+     try:
+         import mmpython.version
+         util.save_pickle((mmpython.version.CHANGED, int(time.time()), 
complete_update),
+                          cachefile)
+         print 
+     except ImportError:
+         pass
+     
  
  def cache_thumbnails():
***************
*** 319,327 ****
      cache_thumbnails()
  
- import time
- f = open(os.path.join(config.OVERLAY_DIR, 'cachetime'), 'w')
- f.write(str(long(time.time())))
- f.close()
- 
  # close db
  util.mediainfo.sync()
--- 361,365 ----
      cache_thumbnails()
  
  # close db
  util.mediainfo.sync()
+ 



-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to