Update of /cvsroot/freevo/freevo/src/util
In directory sc8-pr-cvs1:/tmp/cvs-serv7051
Modified Files:
misc.py vfs.py
Log Message:
major speedup in vfs using
Index: misc.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/util/misc.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** misc.py 29 Dec 2003 22:31:56 -0000 1.9
--- misc.py 30 Dec 2003 22:30:50 -0000 1.10
***************
*** 11,14 ****
--- 11,17 ----
# -----------------------------------------------------------------------
# $Log$
+ # Revision 1.10 2003/12/30 22:30:50 dischi
+ # major speedup in vfs using
+ #
# Revision 1.9 2003/12/29 22:31:56 dischi
# no need to check image
***************
*** 61,64 ****
--- 64,68 ----
# Configuration file. Determines where to look for AVI/MP3 files, etc
import config
+ from vfs import abspath as vfs_abspath
# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52560
***************
*** 167,172 ****
"""
for suffix in ('png', 'jpg', 'gif'):
! if vfs.abspath(base+'.'+suffix):
! return vfs.abspath(base+'.'+suffix)
return default
--- 171,176 ----
"""
for suffix in ('png', 'jpg', 'gif'):
! if vfs_abspath(base+'.'+suffix):
! return vfs_abspath(base+'.'+suffix)
return default
***************
*** 176,188 ****
make a nicer display name from file
"""
! if not vfs.exists(file):
return file
- name = vfs.splitext(vfs.basename(file))[0]
-
- if not name:
- # Bugfix for empty stem
- return vfs.basename(file)
! name = name[0].upper() + name[1:]
while FILENAME_REGEXP.match(name):
m = FILENAME_REGEXP.match(name)
--- 180,189 ----
make a nicer display name from file
"""
! if not os.path.exists(file):
return file
! name = os.path.basename(file)
! name = name[:name.rfind('.'):].capitalize()
!
while FILENAME_REGEXP.match(name):
m = FILENAME_REGEXP.match(name)
***************
*** 273,276 ****
--- 274,278 ----
return devices
+
def smartsort(x,y): # A compare function for use in list.sort()
"""
***************
*** 278,283 ****
Also obviously ignores the full path when looking for 'The' and 'A'
"""
! m = vfs.basename(x)
! n = vfs.basename(y)
for word in ('The', 'A'):
--- 280,285 ----
Also obviously ignores the full path when looking for 'The' and 'A'
"""
! m = os.path.basename(x)
! n = os.path.basename(y)
for word in ('The', 'A'):
Index: vfs.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/util/vfs.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** vfs.py 30 Dec 2003 15:28:48 -0000 1.5
--- vfs.py 30 Dec 2003 22:30:50 -0000 1.6
***************
*** 17,20 ****
--- 17,23 ----
# -----------------------------------------------------------------------
# $Log$
+ # Revision 1.6 2003/12/30 22:30:50 dischi
+ # major speedup in vfs using
+ #
# Revision 1.5 2003/12/30 15:28:48 dischi
# remove old code
***************
*** 62,70 ****
import config
! def getoverlay(item):
if not config.OVERLAY_DIR:
return ''
!
! directory = os.path.abspath(item)
if directory.startswith(config.OVERLAY_DIR):
return directory
--- 65,73 ----
import config
! def getoverlay(directory):
if not config.OVERLAY_DIR:
return ''
! if not directory.startswith('/'):
! directory = os.path.abspath(directory)
if directory.startswith(config.OVERLAY_DIR):
return directory
***************
*** 72,77 ****
if directory.startswith(media.mountdir):
directory = directory[len(media.mountdir):]
! return os.path.join(config.OVERLAY_DIR, 'disc', media.id + directory)
! return os.path.join(config.OVERLAY_DIR, directory[1:])
--- 75,80 ----
if directory.startswith(media.mountdir):
directory = directory[len(media.mountdir):]
! return '%s/disc/%s%s' % (config.OVERLAY_DIR, media.id, directory)
! return config.OVERLAY_DIR + directory
***************
*** 92,96 ****
return if the given name is a file
"""
! return os.path.isfile(abspath(name))
--- 95,102 ----
return if the given name is a file
"""
! if os.path.isfile(name):
! return True
! overlay = getoverlay(name)
! return overlay and os.path.isfile(overlay)
-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills. Sign up for IBM's
Free Linux Tutorials. Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog