def print_general_info(id, verbose=False): ia = imdb.IMDb() media = ia.get_movie(id) title = media['title'] plot = media['plot'][0] year = media['year'] kind = media['kind'] genres = media['genres'] rating = media['rating'] runtime = media['runtime'][0] countries = media['countries'] languages = media['languages'] text.print_header("Media Description") text.print_info("Title: {}".format(title)) text.print_info("ID: {}".format(media.getID())) text.print_info("Year: {}".format(year)) text.print_info("Media Type: {}".format(kind)) text.print_info("Avg. Runtime: {} mins".format(runtime)) text.print_info_no_end('Genres: ') for x in range(len(genres)): print(genres[x] + ', ', end=' ') print("") text.print_info("Countries: {}".format(countries)) text.print_info('Languages: {}'.format(languages)) text.print_info('Rating: {}/10'.format(rating)) text.print_info("Plot: {}".format(plot))
def print_audio_only(file): verify_file_existance(file) media_info = MediaInfo.parse(file) for track in media_info.tracks: if track.track_type == 'Audio': text.print_header("Audio Track") text.print_info("Language: {}".format(track.other_language[1])) text.print_info("Codec ID: {}".format(track.codec_id)) text.print_info("Delay: {}".format(track.delay)) text.print_info("Format Info: {}".format(track.format)) text.print_info("Channel #: {}".format(track.channel)) print("")
def print_codec_info(file): verify_file_existance(file) media_info = MediaInfo.parse(file) for track in media_info.tracks: if track.track_type == 'Video': text.print_header('Codec Information') text.print_info("File Name: {}".format(track.complete_name)) text.print_info("Date Encoded: {}".format(track.encoded_date)) text.print_info("Format: {}".format(track.other_format[0])) text.print_info("Encoded Library: {}".format(track.encoded_library_name)) text.print_info("Other Encoded Library: {}".format(track.internet_media_type)) text.print_info("Codec ID: {}".format(track.codec_id)) text.print_info("Encoded Settings: {}".format(track.encoding_settings)) print("")
def print_hashes(file): verify_file_existance(file) text.print_header("Getting hashes") sha1 = return_sha1_hash(file) sha256 = return_sha256_hash(file) sha512 = return_sha512_hash(file) md5 = return_md5_hash(file) uid = MediaInfo.parse(file) text.print_info("SHA-1 Hash: " + sha1) text.print_info("SHA-256 Hash: " + sha256) text.print_info("SHA-512 Hash: " + sha512) text.print_info("MD5 Hash: " + md5) for track in uid.tracks: if track.track_type == 'General': text.print_info("Unique ID (.mkv only): {}".format(track.unique_id))
def episode_map(id): ia = imdb.IMDb() media = ia.get_movie(id) kind = media['kind'] media_title = media['title'] text.print_info('Title: {}'.format(media_title)) if kind == 'tv series' or kind == 'tv mini series': episode_count = 0 season_count = 0 ia.update(media, 'episodes') all_episodes = media['episodes'] for e in all_episodes: episode_count = episode_count + len(all_episodes[e]) text.print_tv('Episode Count: ', episode_count) season_keys = sorted(all_episodes.keys()) for x in season_keys: text.print_header('Season {}'.format(x)) for z in all_episodes[x].items(): obj = z[1] episode_number = obj['episode'] episode_title = obj['title'] try: rating = obj['rating'] except KeyError: rating = None try: year = obj['year'] except KeyError: year = None try: print('- Episode {en}: {t} - ({y}) - [{r}/10]'.format(en=episode_number, t=episode_title, y=year, r=round(rating))) except TypeError: print('- Episode {en}: {t} - ({y})'.format(en=episode_number, t=episode_title, y=year)) else: text.print_error('Episode map is only supported on TV Shows')
def print_video_only(file): verify_file_existance(file) media_info = MediaInfo.parse(file) for track in media_info.tracks: if track.track_type == 'Video': text.print_header("Video Track") text.print_info("File Name: {}".format(track.complete_name)) text.print_info("File Size: {}".format(track.other_file_size[0])) text.print_info("Date Encoded: {}".format(track.encoded_date)) text.print_info("Duration: {}".format(track.other_duration[1])) text.print_info("Resolution: {w}x{h}".format(w=track.width, h=track.height)) text.print_info("Pixel Aspect Ratio: {}".format(track.pixel_aspect_ratio)) text.print_info("Frame Count: {}".format(track.frame_count)) text.print_info("Frame Rate (FPS): {}".format(track.frame_rate)) text.print_info("Bit Rate: {}".format(track.bit_rate)) text.print_info("Bit Depth: {}".format(track.bit_depth)) text.print_info("Format: {}".format(track.other_format[0])) text.print_info("Encoded Library: {}".format(track.encoded_library_name)) text.print_info("Other Encoded Library: {}".format(track.internet_media_type)) text.print_info("Codec ID: {}".format(track.codec_id)) text.print_info("Encoded Settings: {}".format(track.encoding_settings)) print("")
def print_specific_information(id): ia = imdb.IMDb() media = ia.get_movie(id) kind = media['kind'] if kind == 'movie': text.print_header('Movie Information') o = check_for_key('original air date', media) if o: text.print_movie('Original Air Date: ', media['original air date']) w = check_for_key('writer', media) if w: text.print_movie('Writer: ', media['writer'][0]) d = check_for_key('director', media) if d: text.print_movie('Director: ', media['director'][0]) # still need to implemennt box office information elif kind == 'tv series': text.print_header('TV Information') sy = check_for_key('series years', media) if sy: text.print_tv("Series Years: ", media['series years']) s = check_for_key('seasons', media) if s: text.print_tv('Seasons: ', media['seasons']) ia.update(media, 'episodes') e = check_for_key('episodes', media) if e: episode_count = 0 episodes = media['episodes'] for e in episodes: episode_count = episode_count + len(episodes[e]) text.print_tv('Epsiode Count: ', episode_count)
def print_everything(file, verbose=False): verify_file_existance(file) media_info = MediaInfo.parse(file) for track in media_info.tracks: if track.track_type == 'General': text.print_header("General Track") text.print_info("Title: {}".format(track.title)) text.print_info("File Name: {}".format(track.complete_name)) text.print_info("File Size: {}".format(track.other_file_size[0])) text.print_info("Date Encoded: {}".format(track.encoded_date)) text.print_info("Unique ID: {}".format(track.unique_id)) text.print_info("Writing Application: {}".format(track.writing_application)) text.print_info("Writing Library: {}".format(track.writing_library)) text.print_info("Format: {}".format(track.format)) text.print_info("Duration: {}".format(track.other_duration[1])) text.print_info("Container: {}".format(track.container)) print("") elif track.track_type == 'Video': text.print_header("Video Track") text.print_info("Resolution: {w}x{h}".format(w=track.width, h=track.height)) text.print_info("Pixel Aspect Ratio: {}".format(track.pixel_aspect_ratio)) text.print_info("Frame Count: {}".format(track.frame_count)) text.print_info("Frame Rate (FPS): {}".format(track.frame_rate)) text.print_info("Bit Rate: {}".format(track.bit_rate)) text.print_info("Bit Depth: {}".format(track.bit_depth)) text.print_info("Format: {}".format(track.other_format[0])) text.print_info("Encoded Library: {}".format(track.encoded_library_name)) text.print_info("Other Encoded Library: {}".format(track.internet_media_type)) text.print_info("Codec ID: {}".format(track.codec_id)) if verbose: text.print_info("Encoded Settings: {}".format(track.encoding_settings)) print("") elif track.track_type == 'Audio': text.print_header("Audio Track") text.print_info("Language: {}".format(track.other_language[1])) text.print_info("Codec ID: {}".format(track.codec_id)) text.print_info("Delay: {}".format(track.delay)) text.print_info("Format Info: {}".format(track.format)) text.print_info("Channel #: {}".format(track.channel)) print("") elif track.track_type == 'Text': text.print_header("Subtitles Track") text.print_info("Hard Coded: {}".format(track.forced)) print("")