def IMDBSearch(request): client = Imdb(locale='en_US') imdb = ImdbFacade(client=client) imdb2 = Imdb() results2 = set([]) search_term = '' if 'search' in request.GET and request.GET['search'] is not '': search_term = request.GET['search'] results = imdb2.search_for_title(search_term) else: results = Media.objects.none() ## Attempting to get the more detailed information, It works, sorta, but it'a really slow. # for r in results: # results2.add(r.imdb_id) # for r in results2: # print(imdb2.get_title(r) table = IMDBSearchTable(results) RequestConfig(request).configure(table) return render(request, 'pages/IMDBsearch.html', { 'search_term': search_term, 'table': table, } )
import discord import requests import json from imdbpie import Imdb, ImdbFacade import random from progress.bar import Bar from media_server.jellyfin import jellyfin_api as jf from media_server.jellyfin import jellyfin_stats as js from media_server.jellyfin import settings as settings from urllib.parse import quote imdbf = ImdbFacade() imdb = Imdb() owner_players = [] emoji_numbers = [u"1\u20e3", u"2\u20e3", u"3\u20e3", u"4\u20e3", u"5\u20e3"] most_common_letters = [ 'e', 't', 'a', 'o', 'i', 'n', 't', 's', 'r', 'h', 'l', 'u' ] accepted_types = ['movie', 'show', 'tv', 'series', 'episode'] class SmallMediaItem: def __init__(self, data): self.title = data.get('Name') self.year = data.get('ProductionYear') self.id = data.get('ItemId') self.type = data.get('Type')
def facade(): return ImdbFacade()
from imdbpie import ImdbFacade from modules.logs import * imdb = ImdbFacade() def get_imdb_item(title, analytics): try: search_results = imdb.search_for_title(title) if search_results: return imdb.get_title(search_results[0].imdb_id) except Exception as e: error(f"Could not get IMDb item: {e}") analytics.event(event_category="Error", event_action='get_imdb_item', random_uuid_if_needed=True) return None def build_ids_dict(ids): ids_dict = {} if ids.get('imdb'): ids_dict['imdb'] = ids['imdb'] if ids.get('tvdb'): ids_dict['thetvdb'] = ids['tvdb'] if ids.get('tmdb'): ids_dict['themoviedb'] = ids['tmdb'] return ids_dict