def get_trakt_ids(*args, **kwargs): try: from trakt import trakt return trakt.find_trakt_ids(*args, **kwargs) except: return None
def people_list_movie_people(id, source, fanart): items = [] try: if source == "imdb": people = trakt.get_movie_people(id) elif source == "tmdb": ids = trakt.find_trakt_ids("tmdb", id) if ids: people = trakt.get_movie_people(ids["imdb"]) else: xbmcgui.Dialog().ok("Error", "No cast info found") return plugin.finish(items=[]) else: xbmcgui.Dialog().ok("Error", "No cast info found") return plugin.finish(items=[]) except: xbmcgui.Dialog().ok("Error", "No cast info found") return plugin.finish(items=[]) if "cast" in people: for actor in people["cast"]: context_menu = [("Convert to bob_xml", "RunPlugin({0})".format( plugin.url_for("bob_convert_person_to_xml", trakt_id=actor["person"]["ids"]["trakt"])))] image = get_person_artwork(actor) label = "{0} ({1})".format(to_utf8(actor["person"]["name"]), to_utf8(actor["character"])) info = actor["person"]["biography"] items.append({ 'label': label, 'path': plugin.url_for("people_list_person_select", id=actor["person"]["ids"]["trakt"], name=to_utf8(actor["person"]["name"])), 'info': info, 'thumbnail': image, 'poster': image, 'context_menu': context_menu, 'icon': "DefaultVideo.png", 'properties': { 'fanart_image': fanart }, }) return plugin.finish(items=items) else: xbmcgui.Dialog().ok("Error", "No cast info found")
def people_list_movie_people(id, source, fanart): items = [] try: if source == "imdb": people = trakt.get_movie_people(id) elif source == "tmdb": ids = trakt.find_trakt_ids("tmdb", id) if ids: people = trakt.get_movie_people(ids["imdb"]) else: xbmcgui.Dialog().ok("Error", "No cast info found") return plugin.finish(items=[]) else: xbmcgui.Dialog().ok("Error", "No cast info found") return plugin.finish(items=[]) except: xbmcgui.Dialog().ok("Error", "No cast info found") return plugin.finish(items=[]) if "cast" in people: for actor in people["cast"]: context_menu = [ ( "Convert to bob_xml", "RunPlugin({0})".format( plugin.url_for("bob_convert_person_to_xml", trakt_id=actor["person"]["ids"]["trakt"])) ) ] image = get_person_artwork(actor) label = "{0} ({1})".format(to_utf8(actor["person"]["name"]), to_utf8(actor["character"])) info = actor["person"]["biography"] items.append({'label': label, 'path': plugin.url_for("people_list_person_select", id=actor["person"]["ids"]["trakt"], name=to_utf8(actor["person"]["name"])), 'info': info, 'thumbnail': image, 'poster': image, 'context_menu': context_menu, 'icon': "DefaultVideo.png", 'properties': {'fanart_image': fanart}, }) return plugin.finish(items=items) else: xbmcgui.Dialog().ok("Error", "No cast info found")
def get_trakt_ids(*args, **kwargs): from trakt import trakt return trakt.find_trakt_ids(*args, **kwargs)