Update of /cvsroot/freevo/freevo/src In directory sc8-pr-cvs1:/tmp/cvs-serv28138
Modified Files: directory.py item.py main.py Log Message: mmpython support Index: directory.py =================================================================== RCS file: /cvsroot/freevo/freevo/src/directory.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** directory.py 14 Jun 2003 00:09:40 -0000 1.15 --- directory.py 29 Jun 2003 20:45:14 -0000 1.16 *************** *** 10,13 **** --- 10,16 ---- # ----------------------------------------------------------------------- # $Log$ + # Revision 1.16 2003/06/29 20:45:14 dischi + # mmpython support + # # Revision 1.15 2003/06/14 00:09:40 outlyer # The "Smartsort" code. You can enable it in local_conf, it's disabled *************** *** 106,109 **** --- 109,113 ---- import image import games + import mmpython import event as em *************** *** 113,116 **** --- 117,121 ---- import gui.PasswordInputBox as PasswordInputBox import gui.AlertBox as AlertBox + from gui.PopupBox import PopupBox # XML support *************** *** 290,303 **** - def getattr(self, attr): - """ - return the specific attribute as string or an empty string - """ - a = Item.getattr(self, attr) - if not a and self.info and self.info.has_key(attr): - a = str(self.info[attr]) - return a - - def cwd(self, arg=None, menuw=None): """ --- 295,298 ---- *************** *** 363,366 **** --- 358,384 ---- # can also remove directories + mmpython_dir = self.dir + if self.media: + if self.dir != self.media.mountdir: + mmpython_dir = None + num_changes = 0 + else: + mmpython_dir = 'cd://%s:%s:' % (self.media.devicename, self.media.mountdir) + + if mmpython_dir: + num_changes = mmpython.check_cache(mmpython_dir) + + pop = None + + if num_changes > 10: + if self.media: + pop = PopupBox(text='Scanning disc, be patient...') + else: + pop = PopupBox(text='Scanning directory, be patient...') + pop.show() + + if num_changes > 0: + mmpython.cache_dir(mmpython_dir) + play_items = [] for t in ( 'video', 'audio', 'image', 'games' ): *************** *** 441,444 **** --- 459,469 ---- title = self.name + if pop: + pop.destroy() + # closing the poup will rebuild the menu which may umount + # the drive + if self.media: + self.media.mount() + # autoplay if len(items) == 1 and items[0].actions() and \ *************** *** 462,470 **** dirwatcher_thread.start() ! dirwatcher_thread.cwd(self, item_menu, self.dir, self.all_files) self.menu = item_menu return items def reload(self): """ --- 487,500 ---- dirwatcher_thread.start() ! if self.media: ! # don't watch rom drives ! dirwatcher_thread.cwd(self, item_menu, None, self.all_files) ! else: ! dirwatcher_thread.cwd(self, item_menu, self.dir, self.all_files) self.menu = item_menu return items + def reload(self): """ *************** *** 606,609 **** --- 636,640 ---- # reload the menu, use an event to avoid problems because this function # was called by a thread + del self.menu.skin_force_text_view rc.post_event('MENU_REBUILD') *************** *** 638,641 **** --- 669,675 ---- def scan(self): + if not self.dir: + return + self.lock.acquire() Index: item.py =================================================================== RCS file: /cvsroot/freevo/freevo/src/item.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** item.py 22 Jun 2003 20:48:45 -0000 1.18 --- item.py 29 Jun 2003 20:45:14 -0000 1.19 *************** *** 10,13 **** --- 10,16 ---- # ----------------------------------------------------------------------- # $Log$ + # Revision 1.19 2003/06/29 20:45:14 dischi + # mmpython support + # # Revision 1.18 2003/06/22 20:48:45 dischi # special len() support for new info_area *************** *** 82,87 **** # class Item: ! def __init__(self, parent = None): ! self.name = None # name in menu self.image = None # imagefile --- 85,89 ---- # class Item: ! def __init__(self, parent = None, info = None): self.image = None # imagefile *************** *** 92,95 **** --- 94,110 ---- self.menuw = None self.eventhandler_plugins = [] + + if not info: + self.info = {} + else: + self.info = info + + # name in menu + try: + self.name = info['title'] + + except (TypeError, AttributeError, KeyError): + self.name = None + # possible variables for an item. # some or only needed for video or image or audio *************** *** 102,113 **** self.mplayer_options = '' - self.url = '' - self.genre = '' - self.tagline = '' - self.plot = '' - self.runtime = '' - self.year = '' - self.rating = '' - self.rom_id = [] self.rom_label = [] --- 117,120 ---- *************** *** 133,144 **** self.mplayer_options = obj.mplayer_options - self.url = obj.url - self.genre = obj.genre - self.tagline = obj.tagline - self.plot = obj.plot - self.runtime = obj.runtime - self.year = obj.year - self.rating = obj.rating - self.rom_id = obj.rom_id self.rom_label = obj.rom_label --- 140,143 ---- *************** *** 146,149 **** --- 145,149 ---- self.elapsed = obj.elapsed + self.info = obj.info *************** *** 185,200 **** return the specific attribute as string or an empty string """ ! if hasattr(self, attr) and str(getattr(self,attr)): ! return str(getattr(self,attr)) ! if attr[:4] == 'len(' and attr[-1] == ')' and hasattr(self, attr[4:-1]): ! return str(len(getattr(self, attr[4:-1]))) ! if hasattr(self, 'info') and self.info: ! if self.info.has_key(attr): ! return str(self.info[attr]) ! # XXX old info area, delete next two lines ! if attr[:4] == 'len_' and self.info.has_key(attr[4:]): ! return str(len(self.info[attr[4:]])) ! # new info area ! if attr[:4] == 'len(' and attr[-1] == ')' and self.info.has_key(attr[4:-1]): ! return str(len(self.info[attr[4:-1]])) return '' --- 185,226 ---- return the specific attribute as string or an empty string """ ! if attr == 'length': ! try: ! length = int(self.info['length']) ! except ValueError: ! return self.info['length'] ! except: ! try: ! length = int(self.length) ! except: ! return '' ! if length / 3600: ! return '%d:%02d:%02d' % ( length / 3600, (length % 3600) / 60, length % 60) ! else: ! return '%d:%02d' % (length / 60, length % 60) ! ! if attr[:4] == 'len(' and attr[-1] == ')': ! try: ! r = self.info[attr[4:-1]] ! except: ! try: ! r = getattr(self,attr[4:-1]) ! except: ! return '' ! ! if r != None: ! return str(len(r)) ! ! else: ! try: ! r = self.info[attr] ! except: ! try: ! r = getattr(self,attr) ! except: ! return '' ! ! if r != None and str(r): ! return str(r) ! return '' Index: main.py =================================================================== RCS file: /cvsroot/freevo/freevo/src/main.py,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** main.py 20 Jun 2003 17:38:11 -0000 1.48 --- main.py 29 Jun 2003 20:45:14 -0000 1.49 *************** *** 10,13 **** --- 10,16 ---- # ----------------------------------------------------------------------- # $Log$ + # Revision 1.49 2003/06/29 20:45:14 dischi + # mmpython support + # # Revision 1.48 2003/06/20 17:38:11 dischi # setup mmpython if it is installed *************** *** 381,392 **** shutdown(allow_sys_shutdown=0) ! try: ! import mmpython ! mmcache = '%s/mmpython' % config.FREEVO_CACHEDIR ! if not os.path.isdir(mmcache): ! os.mkdir(mmcache) ! mmpython.use_cache(mmcache) ! except: ! pass try: --- 384,393 ---- shutdown(allow_sys_shutdown=0) ! import mmpython ! mmcache = '%s/mmpython' % config.FREEVO_CACHEDIR ! if not os.path.isdir(mmcache): ! os.mkdir(mmcache) ! mmpython.use_cache(mmcache) ! mmpython.mediainfo.DEBUG = 0 try: ------------------------------------------------------- This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET. http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01 _______________________________________________ Freevo-cvslog mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/freevo-cvslog