コード例 #1
0
ファイル: media_report.py プロジェクト: zbduid12/media-report
def open_in_vlc(file):
    verify_file_existance(file)
    execute = subprocess.Popen("open {f} -a /Applications/VLC.app".format(f=file), shell=True, stdout=subprocess.PIPE, stdin=subprocess.PIPE).communicate()
    if execute:
        print("Opening file in vlc")
    else:
        text.print_error('Failed to open file')
コード例 #2
0
ファイル: media_report.py プロジェクト: zbduid12/media-report
def print_movie_id():
    keyword = input("Get Movie ID: ")
    id = get_movie_id(keyword)
    if id is None:
        text.print_error('No movie found with that title')
    else:
        print('{k} [ID: {i}]'.format(k=keyword, i=id))
コード例 #3
0
ファイル: media_report.py プロジェクト: zbduid12/media-report
def soft_search():
    ia = imdb.IMDb()
    keyword = input('Search for media: ')
    i = 0
    for m in ia.search_movie(keyword):
        i = i + 1
        id = m.getID()
        print('{z} [ID: {i}]'.format(z=m, i=id))
    
    if i == 0:
        text.print_error('No media found with that title')
コード例 #4
0
ファイル: media_report.py プロジェクト: zbduid12/media-report
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')
コード例 #5
0
ファイル: media_report.py プロジェクト: zbduid12/media-report
def verify_file_existance(file):
    if os.path.exists(file):
        pass
    else:
        text.print_error('Failed to open file')