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

Modified Files:
        mp3dir.py 
Log Message:
Use more of the built-in Freevo facilities. This is still a proof-of-concept,
but seems to accurately pull out the information for a directory. 


Index: mp3dir.py
===================================================================
RCS file: /cvsroot/freevo/freevo/WIP/Aubin/mp3dir.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** mp3dir.py   9 Jan 2004 22:44:58 -0000       1.1
--- mp3dir.py   14 Jan 2004 17:39:36 -0000      1.2
***************
*** 3,40 ****
  import sys, os, string, fnmatch
  import mmpython
! 
! def recursefolders(root, recurse=0, pattern='*', return_folders=0):
! 
!     # initialize
!     result = []
! 
!     # must have at least root folder
!     try:
!         names = os.listdir(root)
!     except os.error:
!         return result
!     
!     # expand pattern
!     pattern = pattern or '*'
!     pat_list = string.splitfields( pattern , ';' )
!     
!     # check each file
!     for name in names:
!         fullname = os.path.normpath(os.path.join(root, name))
!         
!         # grab if it matches our pattern and entry type
!         for pat in pat_list:
!             if fnmatch.fnmatch(name, pat): 
!                 if os.path.isfile(fullname) or \
!                    (return_folders and vfs.isdir(fullname)):
!                     result.append(fullname)
!                 continue
!         
!         # recursively scan other folders, appending results
!         if recurse:
!             result = result + recursefolders( fullname, recurse,
!                                                   pattern, return_folders )
!     
!     return result
  
  if sys.argv[1]:
--- 3,13 ----
  import sys, os, string, fnmatch
  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]:
***************
*** 59,61 ****
      print artist
      print album
!     print dirtime
--- 32,37 ----
      print artist
      print album
!     if dirtime > 3600:
!         print '%i:%0.2i:%0.2i' % (int(dirtime/3600), int((dirtime-3600)/60),  
int(dirtime%60))
!     else:
!         print '%i:%0.2i' % (int(dirtime/60), int(dirtime%60))




-------------------------------------------------------
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