Update of /cvsroot/freevo/freevo/src
In directory sc8-pr-cvs1:/tmp/cvs-serv19743
Modified Files:
directory.py fxditem.py
Log Message:
small speed enhancements
Index: directory.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/directory.py,v
retrieving revision 1.79
retrieving revision 1.80
diff -C2 -d -r1.79 -r1.80
*** directory.py 30 Dec 2003 15:33:01 -0000 1.79
--- directory.py 31 Dec 2003 16:40:24 -0000 1.80
***************
*** 10,13 ****
--- 10,16 ----
# -----------------------------------------------------------------------
# $Log$
+ # Revision 1.80 2003/12/31 16:40:24 dischi
+ # small speed enhancements
+ #
# Revision 1.79 2003/12/30 15:33:01 dischi
# remove unneeded copy function, make id a function
***************
*** 69,72 ****
--- 72,76 ----
import config
import util
+
import menu
import skin
***************
*** 336,343 ****
for f in os.listdir(self.dir):
! if os.path.isfile(f):
has_files = True
! if os.path.isdir(f) and not (f.endswith('CVS') or f.endswith('.xvpics')
or \
! f.endswith('.thumbnails') or
f.endswith('.pics')):
has_dirs = True
if has_dirs and has_files:
--- 340,347 ----
for f in os.listdir(self.dir):
! if not has_files and os.path.isfile(f):
has_files = True
! if not has_dirs and os.path.isdir(f) and \
! not f in ('CVS', '.xvpics', '.thumbnails', '.pics'):
has_dirs = True
if has_dirs and has_files:
***************
*** 351,361 ****
if has_files:
! items.append(Playlist(_('Random play all items'), [ (self.dir, 0) ],
! self, display_type=display_type, random=True))
if has_dirs:
! items += [ Playlist(_('Recursive random play all items'), [ (self.dir,
1) ],
! self, display_type=display_type, random=True),
! Playlist(_('Recursive play all items'), [ (self.dir, 1) ],
! self, display_type=display_type, random=False) ]
items.append((self.configure, _('Configure directory'), 'configure'))
--- 355,362 ----
if has_files:
! items.append((self.play_random, _('Random play all items')))
if has_dirs:
! items += [ (self.play_random_recursive, _('Recursive random play all
items')),
! (self.play_recursive, _('Recursive play all items')) ]
items.append((self.configure, _('Configure directory'), 'configure'))
***************
*** 371,375 ****
-
def play(self, arg=None, menuw=None):
"""
--- 372,375 ----
***************
*** 382,385 ****
--- 382,406 ----
+ def play_random(self, arg=None, menuw=None):
+ """
+ play in random order
+ """
+ self.check_password_and_build(arg='playlist:random', menuw=menuw)
+
+
+ def play_recursive(self, arg=None, menuw=None):
+ """
+ play recursive
+ """
+ self.check_password_and_build(arg='playlist:recursive', menuw=menuw)
+
+
+ def play_random_recursive(self, arg=None, menuw=None):
+ """
+ play recursive in random order
+ """
+ self.check_password_and_build(arg='playlist:random_recursive', menuw=menuw)
+
+
def check_password_and_build(self, arg=None, menuw=None):
"""
***************
*** 489,492 ****
--- 510,525 ----
self.pl_items = []
+ if arg and arg.startswith('playlist:'):
+ if arg.endswith(':random'):
+ Playlist(playlist = [ (self.dir, 0) ], parent = self,
+ display_type=display_type, random=True).play()
+ elif arg.endswith(':recursive'):
+ Playlist(playlist = [ (self.dir, 1) ], parent = self,
+ display_type=display_type, random=False).play()
+ elif arg.endswith(':random_recursive'):
+ Playlist(playlist = [ (self.dir, 1) ], parent = self,
+ display_type=display_type, random=True).play()
+ return
+
display_type = self.display_type
if self.display_type == 'tv':
***************
*** 545,556 ****
# build play_items, pl_items and dir_items
for p in plugin.mimetype(display_type):
! for i in p.get(self, files):
! if i.type == 'playlist':
! self.pl_items.append(i)
! elif i.type == 'dir':
! self.dir_items.append(i)
! else:
! self.play_items.append(i)
!
# normal DirItems
for filename in files:
--- 578,593 ----
# build play_items, pl_items and dir_items
for p in plugin.mimetype(display_type):
! if p.files_only:
! self.play_items += p.get(self, files)
! else:
! for i in p.get(self, files):
! if i.type == 'playlist':
! self.pl_items.append(i)
! elif i.type == 'dir':
! self.dir_items.append(i)
! else:
! self.play_items.append(i)
!
!
# normal DirItems
for filename in files:
Index: fxditem.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/fxditem.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** fxditem.py 29 Dec 2003 22:07:14 -0000 1.7
--- fxditem.py 31 Dec 2003 16:40:25 -0000 1.8
***************
*** 27,30 ****
--- 27,33 ----
# -----------------------------------------------------------------------
# $Log$
+ # Revision 1.8 2003/12/31 16:40:25 dischi
+ # small speed enhancements
+ #
# Revision 1.7 2003/12/29 22:07:14 dischi
# renamed xml_file to fxd_file
***************
*** 80,83 ****
--- 83,88 ----
import item
import plugin
+ import os
+ import stat
***************
*** 88,92 ****
def __init__(self):
plugin.MimetypePlugin.__init__(self)
!
def get(self, parent, files):
--- 93,97 ----
def __init__(self):
plugin.MimetypePlugin.__init__(self)
! self.files_only = False
def get(self, parent, files):
***************
*** 100,116 ****
# get the list of fxd files
fxd_files = util.find_matches(files, ['fxd'])
- for d in copy.copy(files):
- if vfs.isdir(d) and vfs.isfile(vfs.join(d, vfs.basename(d) + '.fxd')):
- fxd_files.append(vfs.join(d, vfs.basename(d) + '.fxd'))
- files.remove(d)
# removed covered files from the list
for f in fxd_files:
! if f in files:
files.remove(f)
# return items
! return self.parse(parent, fxd_files, files)
!
--- 105,129 ----
# get the list of fxd files
fxd_files = util.find_matches(files, ['fxd'])
# removed covered files from the list
for f in fxd_files:
! try:
files.remove(f)
+ except:
+ pass
+
+ # check of directories with a fxd covering it
+ for d in copy.copy(files):
+ if os.path.isdir(d):
+ f = os.path.join(d, os.path.basename(d) + '.fxd')
+ if vfs.isfile(f):
+ fxd_files.append(f)
+ files.remove(d)
# return items
! if fxd_files:
! return self.parse(parent, fxd_files, files)
! else:
! return []
-------------------------------------------------------
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