Update of /cvsroot/freevo/freevo/WIP/Aubin
In directory sc8-pr-cvs1:/tmp/cvs-serv2726

Modified Files:
        mp3dir.py 
Log Message:
write result to fxd -- again proof of concept, still ugly (the global stuff)


Index: mp3dir.py
===================================================================
RCS file: /cvsroot/freevo/freevo/WIP/Aubin/mp3dir.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** mp3dir.py   14 Jan 2004 17:39:36 -0000      1.2
--- mp3dir.py   14 Jan 2004 18:31:26 -0000      1.3
***************
*** 4,18 ****
  import mmpython
  import config
  if mmpython.object_cache and hasattr(mmpython.object_cache, 'md5_cachedir'):
      mmpython.object_cache.md5_cachedir = False
      mmpython.object_cache.cachedir     = config.OVERLAY_DIR
- mmcache = '%s/mmpython' % ('/var/cache/freevo')
- mmpython.use_cache(mmcache)
  from util import recursefolders
  
  if sys.argv[1]:
      songs = recursefolders(sys.argv[1], pattern='*.mp3',recurse=1)
      dirtime = 0
      artist = ''
      album = ''
      for song in songs:
--- 4,46 ----
  import mmpython
  import config
+ import util.fxdparser
+ 
+ mmcache = '%s/mmpython' % ('/var/cache/freevo')
+ mmpython.use_cache(mmcache)
+ 
  if mmpython.object_cache and hasattr(mmpython.object_cache, 'md5_cachedir'):
      mmpython.object_cache.md5_cachedir = False
      mmpython.object_cache.cachedir     = config.OVERLAY_DIR
  from util import recursefolders
  
+ 
+ def folder_callback(fxd, node):
+     info = fxd.get_children(node, 'info')
+     if not info:
+         info = fxd.XMLnode('info')
+         fxd.add(info, node)
+     else:
+         info = info[0]
+     global dirtime
+     global artist
+     global album
+     length = str(dirtime)
+ 
+     for var in ('artist', 'album', 'length'):
+         x = fxd.get_children(info, var)
+         if not x:
+             x = fxd.XMLnode(var)
+             fxd.add(x, info)
+         else:
+             x = x[0]
+         x.first_cdata = eval(var)
+     
  if sys.argv[1]:
      songs = recursefolders(sys.argv[1], pattern='*.mp3',recurse=1)
+     global dirtime
      dirtime = 0
+     global artist
      artist = ''
+     global album
      album = ''
      for song in songs:
***************
*** 36,37 ****
--- 64,70 ----
      else:
          print '%i:%0.2i' % (int(dirtime/60), int(dirtime%60))
+ 
+ 
+     fxd = util.fxdparser.FXD(os.path.join(sys.argv[1], 'folder.fxd'))
+     fxd.set_handler('folder', folder_callback, mode='w', force=True)
+     fxd.save()




-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software.
Perforce is the Fast Software Configuration Management System offering
advanced branching capabilities and atomic changes on 50+ platforms.
Free Eval! http://www.perforce.com/perforce/loadprog.html
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to