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

Modified Files:
        mediainfo.py 
Log Message:
reload cache if cache helper runs while running freevo

Index: mediainfo.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/util/mediainfo.py,v
retrieving revision 1.49
retrieving revision 1.50
diff -C2 -d -r1.49 -r1.50
*** mediainfo.py        9 Jun 2004 20:09:10 -0000       1.49
--- mediainfo.py        29 Jun 2004 18:07:03 -0000      1.50
***************
*** 11,14 ****
--- 11,17 ----
  # -----------------------------------------------------------------------
  # $Log$
+ # Revision 1.50  2004/06/29 18:07:03  dischi
+ # reload cache if cache helper runs while running freevo
+ #
  # Revision 1.49  2004/06/09 20:09:10  dischi
  # cleanup
***************
*** 708,711 ****
--- 711,765 ----
      util.save_pickle((mmpython.version.CHANGED, 0, 0, 0), cachefile)
  
+ 
+ __last_status_check__ = 0
+ 
+ def check_cache_status():
+     """
+     check if cache got updated with helper while freevo is running
+     """
+     global __last_status_check__
+     if not rc.app:
+         return
+     try:
+         cachefile = os.path.join(config.FREEVO_CACHEDIR, 'mediainfo')
+         if os.stat(cachefile)[stat.ST_MTIME] <= __last_status_check__:
+             return
+         if not __last_status_check__:
+             __last_status_check__ = os.stat(cachefile)[stat.ST_MTIME]
+             return
+     except:
+         __last_status_check__ = 1
+         return
+         
+     __last_status_check__ = os.stat(cachefile)[stat.ST_MTIME]
+     open_cache_files = []
+ 
+     for cache in mmpython_cache, meta_cache:
+         # save current cache
+         cache.save_cache()
+         # delete all info about loaded objects
+         cache.current_objects    = {}
+         cache.current_cachefile  = None
+         cache.current_cachedir   = None
+         cache.cache_modified     = False
+         
+         # file database
+         for d in cache.all_directories:
+             if d and not os.path.dirname(vfs.normalize(d)) in open_cache_files:
+                 open_cache_files.append(os.path.dirname(vfs.normalize(d)))
+         cache.all_directories  = {}
+ 
+     # create ProgressBox for reloading
+     from gui import ProgressBox
+     box = ProgressBox(text=_('Reloading cache files, be patient...'), 
full=len(open_cache_files))
+     box.show()
+ 
+     # reload already open cache files
+     for d in open_cache_files:
+         load_cache(d)
+         box.tick()
+     box.destroy()
+ 
+     
  #
  # setup mmpython
***************
*** 777,778 ****
--- 831,835 ----
          print
          print
+ 
+     import rc
+     rc.register(check_cache_status, True, 100)



-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to