Update of /cvsroot/freevo/freevo/src/video In directory sc8-pr-cvs1:/tmp/cvs-serv27041
Modified Files: fxdimdb.py videoitem.py xml_parser.py Log Message: use new vfs Index: fxdimdb.py =================================================================== RCS file: /cvsroot/freevo/freevo/src/video/fxdimdb.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** fxdimdb.py 9 Nov 2003 12:51:21 -0000 1.20 --- fxdimdb.py 22 Nov 2003 20:35:50 -0000 1.21 *************** *** 12,15 **** --- 12,18 ---- # ----------------------------------------------------------------------- # $Log$ + # Revision 1.21 2003/11/22 20:35:50 dischi + # use new vfs + # # Revision 1.20 2003/11/09 12:51:21 dischi # fix poster download *************** *** 18,39 **** # moved the encoding type (latin-1) to the config file config.LOCALE # - # Revision 1.18 2003/09/23 21:13:00 dischi - # adjust to mmpython change - # - # Revision 1.17 2003/09/23 20:05:29 dischi - # imdb patch from Eirik Meland - # - # Revision 1.16 2003/09/20 15:46:01 dischi - # adjust to new imdb webpage - # - # Revision 1.15 2003/09/20 15:08:26 dischi - # some adjustments to the missing testfiles - # - # Revision 1.14 2003/09/20 09:50:07 dischi - # cleanup - # - # Revision 1.13 2003/09/14 20:09:37 dischi - # removed some TRUE=1 and FALSE=0 add changed some debugs to _debug_ - # # ----------------------------------------------------------------------- # Freevo - A Home Theater PC framework --- 21,24 ---- *************** *** 268,293 **** """ - datadir = config.MOVIE_DATA_DIR - if not datadir: - datadir = '/tmp/' - if fxdfilename: ! if os.path.splitext(fxdfilename)[1] == '.fxd': ! self.fxdfile = os.path.splitext(fxdfilename)[0] else: self.fxdfile = fxdfilename else: if self.isdiscset == True: ! self.fxdfile = os.path.join(datadir, 'disc-set', self.getmedia_id(self.device)) else: ! #unwrap first video tuple ! type, none, device, none, file = self.video[0] ! if type == 'file' and device == None: self.fxdfile = os.path.splitext(file)[0] ! else: self.fxdfile = os.path.join(datadir, self.getmedia_id(device)) if overwrite == False: try: ! open(self.fxdfile + '.fxd') self.append = True except: --- 253,271 ---- """ if fxdfilename: ! if vfs.splitext(fxdfilename)[1] == '.fxd': ! self.fxdfile = vfs.splitext(fxdfilename)[0] else: self.fxdfile = fxdfilename else: if self.isdiscset == True: ! self.fxdfile = vfs.join(config.OVERLAY_DIR, 'disc-set', self.getmedia_id(self.device)) else: ! self.fxdfile = vfs.splitext(file)[0] if overwrite == False: try: ! vfs.open(self.fxdfile + '.fxd') self.append = True except: *************** *** 299,305 **** raise FxdImdb_XML_Error("FXD file to be updated is invalid, please correct it.") ! if not os.path.isdir(os.path.dirname(self.fxdfile)): ! if os.path.dirname(self.fxdfile): ! os.makedirs(os.path.dirname(self.fxdfile)) --- 277,283 ---- raise FxdImdb_XML_Error("FXD file to be updated is invalid, please correct it.") ! if not vfs.isdir(vfs.dirname(self.fxdfile)): ! if vfs.dirname(self.fxdfile): ! os.makedirs(vfs.dirname(self.fxdfile)) *************** *** 362,388 **** "post bugreport, tracebacks and fxd file.""") except (IOError, FxdImdb_IO_Error), error: ! if not config.MOVIE_DATA_DIR: ! raise FxdImdb_IO_Error('error saving the file: %s' % str(error)) ! ! self.fxdfile = os.path.abspath(self.fxdfile) ! ! # could not save, try new directory ! if self.fxdfile.find(config.MOVIE_DATA_DIR) == 0: ! # can't write in MOVIE_DATA_DIR ! raise FxdImdb_IO_Error('error saving the file: %s' % str(error)) ! ! # find new filename inside MOVIE_DATA_DIR ! for item in config.REMOVABLE_MEDIA: ! if self.fxdfile.find(item.mountdir) == 0: ! self.fxdfile = os.path.join(config.MOVIE_DATA_DIR, 'disc', ! self.getmedia_id(item.devicename), ! relative_path(self.fxdfile)) ! break ! ! else: ! self.fxdfile = os.path.join(config.MOVIE_DATA_DIR, self.fxdfile[1:]) ! if not os.path.isdir(os.path.dirname(self.fxdfile)): ! os.makedirs(os.path.dirname(self.fxdfile)) ! self.writeFxd() --- 340,344 ---- "post bugreport, tracebacks and fxd file.""") except (IOError, FxdImdb_IO_Error), error: ! raise FxdImdb_IO_Error('error saving the file: %s' % str(error)) *************** *** 415,419 **** None for invalid file""" try: ! file = open(self.fxdfile + '.fxd') except IOError: return None --- 371,375 ---- None for invalid file""" try: ! file = vfs.open(self.fxdfile + '.fxd') except IOError: return None *************** *** 430,434 **** name = filename ! name = os.path.basename(os.path.splitext(name)[0]) name = re.sub('([a-z])([A-Z])', point_maker, name) name = re.sub('([a-zA-Z])([0-9])', point_maker, name) --- 386,390 ---- name = filename ! name = vfs.basename(vfs.splitext(name)[0]) name = re.sub('([a-z])([A-Z])', point_maker, name) name = re.sub('([a-zA-Z])([0-9])', point_maker, name) *************** *** 457,461 **** try: ! i = codecs.open( (self.fxdfile + '.fxd') , 'w', encoding='utf-8') except IOError, error: raise FxdImdb_IO_Error("Writing FXD file failed : " + str(error)) --- 413,417 ---- try: ! i = vfs.codecs_open( (self.fxdfile + '.fxd') , 'w', encoding='utf-8') except IOError, error: raise FxdImdb_IO_Error("Writing FXD file failed : " + str(error)) *************** *** 509,513 **** try: ! i = codecs.open( (self.fxdfile + '.fxd') , 'w', encoding='utf-8') except IOError, error: raise FxdImdb_IO_Error("Writing FXD file failed : " + str(error)) --- 465,469 ---- try: ! i = vfs.codecs_open( (self.fxdfile + '.fxd') , 'w', encoding='utf-8') except IOError, error: raise FxdImdb_IO_Error("Writing FXD file failed : " + str(error)) *************** *** 557,561 **** #read existing file in memory try: ! file = open(self.fxdfile + '.fxd') except IOError, error: raise FxdImdb_IO_Error("Updating FXD file failed : " + str(error)) --- 513,517 ---- #read existing file in memory try: ! file = vfs.open(self.fxdfile + '.fxd') except IOError, error: raise FxdImdb_IO_Error("Updating FXD file failed : " + str(error)) *************** *** 572,576 **** regexp_video_end = re.compile(' *</video>', re.I) ! file = open(self.fxdfile + '.fxd', 'w') --- 528,532 ---- regexp_video_end = re.compile(' *</video>', re.I) ! file = vfs.open(self.fxdfile + '.fxd', 'w') *************** *** 608,612 **** #read existing file in memory try: ! file = open(self.fxdfile + '.fxd') except IOError, error: raise FxdImdb_IO_Error("Updating FXD file failed : " + str(error)) --- 564,568 ---- #read existing file in memory try: ! file = vfs.open(self.fxdfile + '.fxd') except IOError, error: raise FxdImdb_IO_Error("Updating FXD file failed : " + str(error)) *************** *** 621,625 **** regexp_discset_end = re.compile(' *</disc-set>', re.I) ! file = open(self.fxdfile + '.fxd', 'w') for line in content.split('\n'): --- 577,581 ---- regexp_discset_end = re.compile(' *</disc-set>', re.I) ! file = vfs.open(self.fxdfile + '.fxd', 'w') for line in content.split('\n'): *************** *** 792,796 **** req = urllib2.Request(self.image_url, txdata, txheaders) r = urllib2.urlopen(req) ! i = open(self.image, 'w') i.write(r.read()) i.close() --- 748,752 ---- req = urllib2.Request(self.image_url, txdata, txheaders) r = urllib2.urlopen(req) ! i = vfs.open(self.image, 'w') i.write(r.read()) i.close() *************** *** 806,810 **** pass ! self.image = os.path.basename(self.image) print "Downloaded cover image from %s" % self.image_url --- 762,766 ---- pass ! self.image = vfs.basename(self.image) print "Downloaded cover image from %s" % self.image_url *************** *** 837,841 **** return a unique identifier for the disc""" ! if not os.path.exists(drive): return drive return cdrom_disc_id(drive)[1] --- 793,797 ---- return a unique identifier for the disc""" ! if not vfs.exists(drive): return drive return cdrom_disc_id(drive)[1] Index: videoitem.py =================================================================== RCS file: /cvsroot/freevo/freevo/src/video/videoitem.py,v retrieving revision 1.93 retrieving revision 1.94 diff -C2 -d -r1.93 -r1.94 *** videoitem.py 22 Nov 2003 15:31:34 -0000 1.93 --- videoitem.py 22 Nov 2003 20:35:50 -0000 1.94 *************** *** 11,14 **** --- 11,17 ---- # ----------------------------------------------------------------------- # $Log$ + # Revision 1.94 2003/11/22 20:35:50 dischi + # use new vfs + # # Revision 1.93 2003/11/22 15:31:34 dischi # renamed config.PREFERED_VIDEO_PLAYER to config.VIDEO_PREFERED_PLAYER *************** *** 138,146 **** # find image for this file ! # First check in COVER_DIR ! if config.COVER_DIR: ! self.image = util.getimage(config.COVER_DIR+self.basename, self.image) ! ! # Then check for episode in TV_SHOW_DATA_DIR self.image = util.getimage(os.path.splitext(filename)[0], self.image) --- 141,145 ---- # find image for this file ! # check for episode in TV_SHOW_DATA_DIR self.image = util.getimage(os.path.splitext(filename)[0], self.image) Index: xml_parser.py =================================================================== RCS file: /cvsroot/freevo/freevo/src/video/xml_parser.py,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** xml_parser.py 4 Nov 2003 11:49:09 -0000 1.42 --- xml_parser.py 22 Nov 2003 20:35:50 -0000 1.43 *************** *** 10,13 **** --- 10,16 ---- # ----------------------------------------------------------------------- # $Log$ + # Revision 1.43 2003/11/22 20:35:50 dischi + # use new vfs + # # Revision 1.42 2003/11/04 11:49:09 dischi # only parse existing files with mmpython *************** *** 19,45 **** # moved the encoding type (latin-1) to the config file config.LOCALE # - # Revision 1.39 2003/10/01 18:56:25 dischi - # bugfix if no MOVIE_DATA_DIR is set - # - # Revision 1.38 2003/09/23 13:45:20 outlyer - # Making more informational text quiet by default. - # - # Revision 1.37 2003/09/20 15:08:26 dischi - # some adjustments to the missing testfiles - # - # Revision 1.36 2003/09/14 20:09:37 dischi - # removed some TRUE=1 and FALSE=0 add changed some debugs to _debug_ - # - # Revision 1.35 2003/08/30 19:00:56 dischi - # multi movie files fixed - # - # Revision 1.34 2003/08/30 12:20:10 dischi - # Respect the given parent for parsing. This avoids calling mmpython again - # with maybe wrong informations (disc or not). Also restructured the code - # - # Revision 1.33 2003/08/23 12:51:43 dischi - # removed some old CVS log messages - # - # # ----------------------------------------------------------------------- # Freevo - A Home Theater PC framework --- 22,25 ---- *************** *** 147,151 **** i['data'] = util.format_text(node.textof().encode(config.LOCALE)) - video['items'][id] = i video['items-list'] += [ id ] --- 127,130 ---- *************** *** 272,276 **** part_ref = part['ref'] f = video['items'][part_ref]['data'] ! if os.path.isfile(f): subitem = VideoItem(f, vitem) else: --- 251,255 ---- part_ref = part['ref'] f = video['items'][part_ref]['data'] ! if vfs.isfile(f): subitem = VideoItem(f, vitem) else: *************** *** 300,304 **** part_ref = variant['parts'][0]['ref'] f = video['items'][part_ref]['data'] ! if os.path.isfile(f): vitem = VideoItem(f, parent) else: --- 279,283 ---- part_ref = variant['parts'][0]['ref'] f = video['items'][part_ref]['data'] ! if vfs.isfile(f): vitem = VideoItem(f, parent) else: *************** *** 337,341 **** for v in video['items-list']: f = video['items'][v]['data'] ! if os.path.isfile(f): subitem = VideoItem(f, vitem) else: --- 316,320 ---- for v in video['items-list']: f = video['items'][v]['data'] ! if vfs.isfile(f): subitem = VideoItem(f, vitem) else: *************** *** 356,360 **** ref = video['items-list'][0] f = video['items'][ref]['data'] ! if os.path.isfile(f): vitem = VideoItem(f, parent) else: --- 335,339 ---- ref = video['items-list'][0] f = video['items'][ref]['data'] ! if vfs.isfile(f): vitem = VideoItem(f, parent) else: *************** *** 416,420 **** pass ! dir = os.path.dirname(file) for disc_set_child in node.children: --- 395,399 ---- pass ! dir = vfs.dirname(file) for disc_set_child in node.children: *************** *** 477,482 **** # disc_child == /freevo/disc_set/disc/cover-img img = disc_set_child.textof().encode('ascii') ! if os.path.isfile(os.path.join(dir, img)): ! disc_set['cover'] = os.path.join(dir,img) elif disc_set_child.name == u'info': --- 456,461 ---- # disc_child == /freevo/disc_set/disc/cover-img img = disc_set_child.textof().encode('ascii') ! if vfs.isfile(vfs.join(dir, img)): ! disc_set['cover'] = vfs.join(dir,img) elif disc_set_child.name == u'info': *************** *** 516,532 **** image = "" ! dir = os.path.dirname(file) ! # find the realdir in case this file is in MOVIE_DATA_DIR ! if config.MOVIE_DATA_DIR and dir.find(config.MOVIE_DATA_DIR) == 0: ! realdir = os.path.join('/', dir[len(config.MOVIE_DATA_DIR):]) ! if realdir.find('/disc/') == 0: ! realdir = realdir[6:] ! for c in config.REMOVABLE_MEDIA: ! if realdir.find(c.id) == 0: ! realdir = os.path.join(c.mountdir, realdir[len(c.id)+1:]) ! break ! else: ! realdir = dir for movie_child in node.children: --- 495,501 ---- image = "" ! dir = vfs.dirname(file) ! realdir = vfs.normalize(dir) for movie_child in node.children: *************** *** 545,550 **** # the image file must be stored in the same # directory than that XML file ! if os.path.isfile(os.path.join(dir, img)): ! image = os.path.join(dir, img) title = None --- 514,519 ---- # the image file must be stored in the same # directory than that XML file ! if vfs.isfile(vfs.join(dir, img)): ! image = vfs.join(dir, img) title = None *************** *** 559,571 **** filename = video['items'][p]['data'] if filename.find('://') == -1 and not video['items'][p]['media-id']: ! video['items'][p]['data'] = os.path.join(realdir, filename) for i in range(len(duplicate_check)): try: if (unicode(duplicate_check[i], 'latin1', 'ignore') == \ ! os.path.join(realdir, filename)): del duplicate_check[i] break except: ! if duplicate_check[i] == os.path.join(realdir, filename): del duplicate_check[i] break --- 528,540 ---- filename = video['items'][p]['data'] if filename.find('://') == -1 and not video['items'][p]['media-id']: ! video['items'][p]['data'] = vfs.join(realdir, filename) for i in range(len(duplicate_check)): try: if (unicode(duplicate_check[i], 'latin1', 'ignore') == \ ! vfs.join(realdir, filename)): del duplicate_check[i] break except: ! if duplicate_check[i] == vfs.join(realdir, filename): del duplicate_check[i] break *************** *** 578,583 **** if p.has_key( i ) and p[ i ].has_key( 'file' ): filename = p[ i ][ 'file' ] ! filename = os.path.join( realdir, filename ) ! if os.path.isfile( filename ): p[ i ][ 'file' ] = filename --- 547,552 ---- if p.has_key( i ) and p[ i ].has_key( 'file' ): filename = p[ i ][ 'file' ] ! filename = vfs.join( realdir, filename ) ! if vfs.isfile( filename ): p[ i ][ 'file' ] = filename *************** *** 630,634 **** parser = qp_xml.Parser() # Let's name node variables after their XML names ! f = open(file) freevo = parser.parse(f.read()) f.close() --- 599,603 ---- parser = qp_xml.Parser() # Let's name node variables after their XML names ! f = vfs.open(file) freevo = parser.parse(f.read()) f.close() *************** *** 639,647 **** elif freevo_child.name == 'movie': movies += parse_movie(freevo_child, file, parent, duplicate_check) for m in movies: m.fxd_file = file ! return movies except: --- 608,617 ---- elif freevo_child.name == 'movie': + file = vfs.normalize(file) movies += parse_movie(freevo_child, file, parent, duplicate_check) for m in movies: m.fxd_file = file ! return movies except: *************** *** 663,667 **** config.TV_SHOW_INFORMATIONS = {} ! if os.path.exists("/tmp/freevo-rebuild-database"): try: os.remove('/tmp/freevo-rebuild-database') --- 633,637 ---- config.TV_SHOW_INFORMATIONS = {} ! if vfs.exists("/tmp/freevo-rebuild-database"): try: os.remove('/tmp/freevo-rebuild-database') *************** *** 691,697 **** config.MOVIE_INFORMATIONS_LABEL += [(l_re, info)] ! if config.MOVIE_DATA_DIR: ! for file in util.recursefolders(config.MOVIE_DATA_DIR,1, ! '*'+config.SUFFIX_VIDEO_DEF_FILES[0],1): infolist = parseMovieFile(file) for info in infolist: --- 661,670 ---- config.MOVIE_INFORMATIONS_LABEL += [(l_re, info)] ! if config.OVERLAY_DIR: ! files = [] ! for subdir in ('disc', 'disc-set'): ! files += util.recursefolders(vfs.join(config.OVERLAY_DIR, 'disc'), ! 1, '*'+config.SUFFIX_VIDEO_DEF_FILES[0],1) ! for file in files: infolist = parseMovieFile(file) for info in infolist: *************** *** 713,717 **** infolist = parseMovieFile(file) for info in infolist: ! k = os.path.splitext(os.path.basename(file))[0] config.TV_SHOW_INFORMATIONS[k] = (info.image, info.info, info.mplayer_options, file) --- 686,690 ---- infolist = parseMovieFile(file) for info in infolist: ! k = vfs.splitext(vfs.basename(file))[0] config.TV_SHOW_INFORMATIONS[k] = (info.image, info.info, info.mplayer_options, file) ------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/ _______________________________________________ Freevo-cvslog mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/freevo-cvslog