Ticket #4055: scanner.patch
File scanner.patch, 2.9 KB (added by , 17 years ago) |
---|
-
MythTV.py
363 363 else: 364 364 return None 365 365 366 def hasMetadata(self, videopath): 367 """ 368 Determines if the given videopath has any metadata in the DB 369 370 Returns False if no metadata was found. 371 """ 372 c = self.db.cursor() 373 c.execute(""" 374 SELECT category, year 375 FROM videometadata 376 WHERE filename = %s""", (videopath,)) 377 row = c.fetchone() 378 c.close() 379 380 if row is not None: 381 # If category is 0 and year is 1895, we can safely assume no metadata 382 if (row[0] == 0) and (row[1] == 1895): 383 return False 384 else: 385 return True 386 else: 387 return False 366 388 def getMetadata(self, id): 367 389 """ 368 390 Finds the MythVideo metadata for the given id from the MythDB, if any. -
imdbpy.py
158 158 159 159 movies = [] 160 160 for m in sorted_movies: 161 try: 162 movies.append([imdb_access.get_imdbID(m), m['title'], int(m['year'])]) 163 except KeyError: 164 movies.append([imdb_access.get_imdbID(m), m['title'], 1901]) 161 165 movies.append([imdb_access.get_imdbID(m), m['title'], int(m['year'])]) 162 166 return movies 163 167 -
find_meta.py
583 583 return None 584 584 585 585 print_verbose("Querying IMDb for meta data for ID %s..." % imdb_id) 586 meta = imdbpy.fetch_metadata(imdb_id) 587 if meta is not None: 588 if meta.series_episode: 589 title, season, episode = imdbpy.detect_series_title(title) 590 if meta.season is None: 591 meta.season = season 592 if meta.episode is None: 593 meta.episode = episode 594 metadata = meta.toMetadataString() 595 metadata += "IMDb:%s" % imdb_id + "\n" 596 return metadata 586 try: 587 meta = imdbpy.fetch_metadata(imdb_id) 588 if meta is not None: 589 if meta.series_episode: 590 title, season, episode = imdbpy.detect_series_title(title) 591 if meta.season is None: 592 meta.season = season 593 if meta.episode is None: 594 meta.episode = episode 595 metadata = meta.toMetadataString() 596 metadata += "IMDb:%s" % imdb_id + "\n" 597 return metadata 598 except: 599 print_verbose("Problem occured fetching metadata for ID %s..." % imdb_id) 600 return None 597 601 598 602 def video_file_list_metadata(videoPaths): 599 603 videoPaths = [os.path.basename(v) for v in videoPaths] … … 797 801 # Check if we are not in overwrite mode and there is existing data 798 802 # for the wanted targets (metadata files and/or MythDB). 799 803 if not overwrite: 800 need_mythdb_data = dbimport and mythvideo.getMetadataId(path) is None804 need_mythdb_data = dbimport and not mythvideo.hasMetadata(path) 801 805 need_metadata_file = metafiles 802 806 if metafiles and meta_file is not None: 803 807 need_metadata_file = not os.path.exists(meta_file)