def do_movie_metadata(input_file_path, config, debug): try: moviedb = MovieDB(config, debug) database = Database(config, debug) thetvdb = TheTvDb(config, debug) file_manager = FileManager(config, database, thetvdb, moviedb, debug) match = file_manager.match_movie_file(input_file_path, True) if match is None: print "File name '%s' doesn't match any movie in the local cache or on IMDb." % input_file_path, return 2 else: (file_name, movie, disc) = match metadata = file_manager.generate_movie_metadata(movie) if metadata is None: print "Error generating metadata for file '%s'." % (file_name, ) return 4 for l in metadata: print l return 0 except: traceback.print_exc() return 11
def do_movie_name(input_file_name, config, debug): try: moviedb = MovieDB(config, debug) thetvdb = TheTvDb(config, debug) database = Database(config, debug) file_manager = FileManager(config, database, thetvdb, moviedb, debug) match = file_manager.match_movie_file(input_file_name, True) if match is None: print "File name '%s' doesn't match any movies." % input_file_name, return 2 else: (file_name, movie, disc) = match print file_manager.get_movie_library_file_name(file_name, movie, disc) return 0 except: traceback.print_exc() return 11