def play_channel_from_guide(channel, program, language, mode): # Get channelers to use if mode == 'select': play_plugin = ADDON_PICKER.id elif mode == 'default': play_plugin = plugin.get_setting(SETTING_LIVE_DEFAULT_CHANNELER, unicode) else: play_plugin = mode channelers = active_channelers("live") channelers = [p for p in channelers if p.id == play_plugin] or channelers if not channelers: dialogs.notify(msg="{0} {1} {2}".format(_("No cache").replace(_("Cache").lower(),_("TV")), _("Player").lower(), _("Enabled").lower()), title=_("Error"), delay=5000, image=get_icon_path("live")) action_cancel() return # Get parameters params = {} for lang in get_needed_langs(channelers): params[lang] = get_channel_parameters(channel, program, language) params[lang] = to_unicode(params[lang]) # Go for it link = on_play_video(mode, channelers, params) if link: action_play({ 'label': channel, 'path': link, 'is_playable': True, 'info_type': 'video', })
def play_channel(channel, mode="default"): # Get players to use if mode == 'select': play_plugin = ADDON_SELECTOR.id else: play_plugin = plugin.get_setting(SETTING_LIVE_DEFAULT_PLAYER) players = active_players("live", filters = {"channel": channel}) players = [p for p in players if p.id == play_plugin] or players if not players: xbmc.executebuiltin( "Action(Info)") action_cancel() return # Get parameters params = {} for lang in get_needed_langs(players): params[lang] = get_channel_parameters(channel) params[lang] = to_unicode(params[lang]) # Go for it link = on_play_video(mode, players, params) if link: action_play({ 'label': channel, 'path': link, 'is_playable': True, 'info_type': 'video', })
def play_channel_from_guide(channel, program, language, mode): # Get channelers to use if mode == 'select': play_plugin = ADDON_PICKER.id elif mode == 'default': play_plugin = plugin.get_setting(SETTING_LIVE_DEFAULT_CHANNELER) else: play_plugin = mode channelers = active_channelers("live") channelers = [p for p in channelers if p.id == play_plugin] or channelers if not channelers: plugin.notify(msg=_('Install live addons'), title=_('First'), delay=1000, image=get_icon_path("live")) action_cancel() return # Get parameters params = {} for lang in get_needed_langs(channelers): params[lang] = get_channel_parameters(channel, program, language) params[lang] = to_unicode(params[lang]) # Go for it link = on_play_video(mode, channelers, params) if link: action_play({ 'label': channel, 'path': link, 'is_playable': True, 'info_type': 'video', })
def play_channel(channel, mode="default"): # Get players to use if mode == 'select': play_plugin = ADDON_SELECTOR.id else: play_plugin = plugin.get_setting(SETTING_LIVE_DEFAULT_PLAYER) players = active_players("live", filters={"channel": channel}) players = [p for p in players if p.id == play_plugin] or players if not players: xbmc.executebuiltin("Action(Info)") action_cancel() return # Get parameters params = {} for lang in get_needed_langs(players): params[lang] = get_channel_parameters(channel) params[lang] = to_unicode(params[lang]) # Go for it link = on_play_video(mode, players, params) if link: action_play({ 'label': channel, 'path': link, 'is_playable': True, 'info_type': 'video', })
def play_music(artist_name, track_name, album_name, mode = "default"): # Get players to use if mode == 'select': play_plugin = ADDON_SELECTOR.id elif mode == 'context': play_plugin = plugin.get_setting(SETTING_MUSIC_DEFAULT_PLAYER_FROM_CONTEXT) elif mode == 'library': play_plugin = plugin.get_setting(SETTING_MUSIC_DEFAULT_PLAYER_FROM_LIBRARY) elif mode == 'default': play_plugin = plugin.get_setting(SETTING_MUSIC_DEFAULT_PLAYER) else: play_plugin = mode players = active_players("music") players = [p for p in players if p.id == play_plugin] or players if not players: xbmc.executebuiltin("Action(Info)") action_cancel() return # Get parameters params = {} for lang in get_needed_langs(players): params[lang] = get_music_parameters(artist_name, album_name, track_name) params[lang] = to_unicode(params[lang]) # Go for it link = on_play_video(mode, players, params) if link: action_play({ 'label': "{0} - {1} - {2}".format(artist_name, album_name, track_name), 'path': link, 'is_playable': True, 'info_type': 'music', })
def play_movie(tmdb_id, mode): import_tmdb() # Get players to use if mode == 'select': play_plugin = ADDON_SELECTOR.id elif mode == 'context': play_plugin = plugin.get_setting(SETTING_MOVIES_DEFAULT_PLAYER_FROM_CONTEXT, unicode) elif mode == 'library': play_plugin = get_movie_player_plugin_from_library(tmdb_id) if not play_plugin or play_plugin == "default": play_plugin = plugin.get_setting(SETTING_MOVIES_DEFAULT_PLAYER_FROM_LIBRARY, unicode) elif mode == 'default': play_plugin = plugin.get_setting(SETTING_MOVIES_DEFAULT_PLAYER, unicode) else: play_plugin = mode if mode == 'default' or mode == 'select': players = active_players("movies") else: players = get_players("movies") players = [p for p in players if p.id == play_plugin] or players if not players: xbmc.executebuiltin( "Action(Info)") action_cancel() return # Get movie data from TMDB movie = tmdb.Movies(tmdb_id).info(language=LANG, append_to_response="external_ids,videos") movie_info = get_movie_metadata(movie) # Get movie ids from Trakt trakt_ids = get_trakt_ids("tmdb", tmdb_id, movie['original_title'], "movie", parse_year(movie['release_date'])) # Get parameters params = {} for lang in get_needed_langs(players): if lang == LANG: tmdb_data = movie else: tmdb_data = tmdb.Movies(tmdb_id).info(language=lang) params[lang] = get_movie_parameters(tmdb_data) if trakt_ids != None: params[lang].update(trakt_ids) params[lang]['info'] = movie_info params[lang] = to_unicode(params[lang]) # Go for it link = on_play_video(mode, players, params, trakt_ids) if link: movie = tmdb.Movies(tmdb_id).info(language=LANG) action_play({ 'label': movie_info['title'], 'path': link, 'info': movie_info, 'is_playable': True, 'info_type': 'video', 'thumbnail': movie_info['poster'], 'poster': movie_info['poster'], 'properties' : {'fanart_image' : movie_info['fanart']}, })
def play_movie(tmdb_id, mode): import_tmdb() # Get players to use if mode == 'select': play_plugin = ADDON_SELECTOR.id elif mode == 'context': play_plugin = plugin.get_setting(SETTING_MOVIES_DEFAULT_PLAYER_FROM_CONTEXT, unicode) elif mode == 'library': play_plugin = get_movie_player_plugin_from_library(tmdb_id) if not play_plugin or play_plugin == "default": play_plugin = plugin.get_setting(SETTING_MOVIES_DEFAULT_PLAYER_FROM_LIBRARY, unicode) elif mode == 'default': play_plugin = plugin.get_setting(SETTING_MOVIES_DEFAULT_PLAYER, unicode) else: play_plugin = mode if mode != 'context': players = active_players("movies") else: players = get_players("movies") players = [p for p in players if p.id == play_plugin] or players if not players or len(players) == 0: xbmc.executebuiltin( "Action(Info)") action_cancel() return # Get movie data from TMDB movie = tmdb.Movies(tmdb_id).info(language=LANG, append_to_response="external_ids,alternative_titles,credits,images,keywords,releases,videos,translations,similar,reviews,lists,rating") movie_info = get_movie_metadata(movie) # Get movie ids from Trakt trakt_ids = get_trakt_ids("tmdb", tmdb_id, movie['original_title'], "movie", parse_year(movie['release_date'])) # Get parameters params = {} for lang in get_needed_langs(players): if lang == LANG: tmdb_data = movie else: tmdb_data = tmdb.Movies(tmdb_id).info(language=lang, append_to_response="external_ids,alternative_titles,credits,images,keywords,releases,videos,translations,similar,reviews,lists,rating") params[lang] = get_movie_parameters(tmdb_data) if trakt_ids != None: params[lang].update(trakt_ids) params[lang]['info'] = movie_info params[lang] = to_unicode(params[lang]) # Go for it link = on_play_video(mode, players, params, trakt_ids) if link: movie = tmdb.Movies(tmdb_id).info(language=LANG) action_play({ 'label': movie_info['title'], 'path': link, 'info': movie_info, 'is_playable': True, 'info_type': 'video', 'thumbnail': movie_info['poster'], 'poster': movie_info['poster'], 'properties' : {'fanart_image' : movie_info['fanart']}, })
def play_movie(tmdb_id, mode): import_tmdb() # Get players to use if mode == 'select': play_plugin = ADDON_SELECTOR.id elif mode == 'library': play_plugin = plugin.get_setting(SETTING_MOVIES_DEFAULT_PLAYER_FROM_LIBRARY) else: play_plugin = plugin.get_setting(SETTING_MOVIES_DEFAULT_PLAYER) players = active_players("movies") players = [p for p in players if p.id == play_plugin] or players if not players: xbmc.executebuiltin( "Action(Info)") action_cancel() return # Get movie data from TMDB movie = tmdb.Movies(tmdb_id).info(language=LANG) movie_info = get_movie_metadata(movie) # Get movie ids from Trakt trakt_ids = get_trakt_ids("tmdb", tmdb_id, movie['original_title'], "movie", parse_year(movie['release_date'])) # Get parameters params = {} for lang in get_needed_langs(players): if lang == LANG: tmdb_data = movie else: tmdb_data = tmdb.Movies(tmdb_id).info(language=lang) params[lang] = get_movie_parameters(tmdb_data) params[lang].update(trakt_ids) params[lang]['info'] = movie_info params[lang] = to_unicode(params[lang]) # Go for it link = on_play_video(mode, players, params, trakt_ids) if link: movie = tmdb.Movies(tmdb_id).info(language=LANG) action_play({ 'label': movie_info['title'], 'path': link, 'info': movie_info, 'is_playable': True, 'info_type': 'video', 'thumbnail': movie_info['poster'], 'poster': movie_info['poster'], 'properties' : {'fanart_image' : movie_info['fanart']}, })
def play_movie_from_guide(tmdb_id, mode): import_tmdb() if mode == 'select': play_plugin = ADDON_PICKER.id elif mode == 'default': play_plugin = plugin.get_setting(SETTING_MOVIES_DEFAULT_CHANNELER, unicode) else: play_plugin = mode channelers = active_channelers("movies") channelers = [p for p in channelers if p.id == play_plugin] or channelers if not channelers: xbmc.executebuiltin("Action(Info)") action_cancel() return movie = tmdb.Movies(tmdb_id).info(language=LANG, append_to_response="external_ids,videos") movie_info = get_movie_metadata(movie) trakt_ids = get_trakt_ids("tmdb", tmdb_id, movie['original_title'], "movie", parse_year(movie['release_date'])) params = {} for lang in get_needed_langs(channelers): if lang == LANG: tmdb_data = movie else: tmdb_data = tmdb.Movies(tmdb_id).info(language=lang) params[lang] = get_movie_parameters(tmdb_data) if trakt_ids != None: params[lang].update(trakt_ids) params[lang]['info'] = movie_info params[lang] = to_unicode(params[lang]) link = on_play_video(mode, channelers, params, trakt_ids) if link: movie = tmdb.Movies(tmdb_id).info(language=LANG) action_play({ 'label': movie_info['title'], 'path': link, 'info': movie_info, 'is_playable': True, 'info_type': 'video', 'thumbnail': movie_info['poster'], 'poster': movie_info['poster'], 'properties': { 'fanart_image': movie_info['fanart'] }, })
def play_movie_from_guide(tmdb_id, mode): import_tmdb() if mode == 'select': play_plugin = ADDON_PICKER.id elif mode == 'default': play_plugin = plugin.get_setting(SETTING_MOVIES_DEFAULT_CHANNELER) else: play_plugin = mode channelers = active_channelers("movies") channelers = [p for p in channelers if p.id == play_plugin] or channelers if not channelers: xbmc.executebuiltin( "Action(Info)") action_cancel() return movie = tmdb.Movies(tmdb_id).info(language=LANG) movie_info = get_movie_metadata(movie) trakt_ids = get_trakt_ids("tmdb", tmdb_id, movie['original_title'], "movie", parse_year(movie['release_date'])) params = {} for lang in get_needed_langs(channelers): if lang == LANG: tmdb_data = movie else: tmdb_data = tmdb.Movies(tmdb_id).info(language=lang) params[lang] = get_movie_parameters(tmdb_data) if trakt_ids != None: params[lang].update(trakt_ids) params[lang]['info'] = movie_info params[lang] = to_unicode(params[lang]) link = on_play_video(mode, channelers, params, trakt_ids) if link: movie = tmdb.Movies(tmdb_id).info(language=LANG) action_play({ 'label': movie_info['title'], 'path': link, 'info': movie_info, 'is_playable': True, 'info_type': 'video', 'thumbnail': movie_info['poster'], 'poster': movie_info['poster'], 'properties' : {'fanart_image' : movie_info['fanart']}, })
def play_channel(channel, program, language, mode): # Get players to use if mode == 'select': play_plugin = ADDON_SELECTOR.id elif mode == 'context': play_plugin = plugin.get_setting( SETTING_LIVE_DEFAULT_PLAYER_FROM_CONTEXT) elif mode == 'library': play_plugin = plugin.get_setting( SETTING_LIVE_DEFAULT_PLAYER_FROM_LIBRARY) elif mode == 'default': play_plugin = plugin.get_setting(SETTING_LIVE_DEFAULT_PLAYER) else: play_plugin = mode players = active_players("live") players = [p for p in players if p.id == play_plugin] or players if not players: plugin.notify(msg=_('Enable live players'), title=_('First'), delay=1000, image=get_icon_path("live")) action_cancel() return # Get parameters params = {} for lang in get_needed_langs(players): params[lang] = get_channel_parameters(channel, program, language) params[lang] = to_unicode(params[lang]) # Go for it link = on_play_video(mode, players, params) if link: action_play({ 'label': channel, 'path': link, 'is_playable': True, 'info_type': 'video', })
def play_episode(id, season, episode, mode): import_tvdb() id = int(id) season = int(season) episode = int(episode) # Get database id dbid = xbmc.getInfoLabel("ListItem.DBID") try: dbid = int(dbid) except: dbid = None # Get show data from TVDB show = tvdb[id] show_info = get_tvshow_metadata_tvdb(show, banners=False) # Get players to use if mode == 'select': play_plugin = ADDON_SELECTOR.id elif mode == 'library': play_plugin = get_player_plugin_from_library(id) if not play_plugin: play_plugin = plugin.get_setting( SETTING_TV_DEFAULT_PLAYER_FROM_LIBRARY) else: play_plugin = plugin.get_setting(SETTING_TV_DEFAULT_PLAYER) players = active_players("tvshows", filters={'network': show.get('network')}) players = [p for p in players if p.id == play_plugin] or players if not players: xbmc.executebuiltin("Action(Info)") action_cancel() return # Get show ids from Trakt trakt_ids = get_trakt_ids("tvdb", id, show['seriesname'], "show", show.get('year', 0)) # Get parameters params = {} for lang in get_needed_langs(players): if lang == LANG: tvdb_data = show else: tvdb_data = create_tvdb(lang)[id] if tvdb_data['seriesname'] is None: continue params[lang] = get_episode_parameters(tvdb_data, season, episode) params[lang].update(trakt_ids) params[lang]['info'] = show_info params[lang] = to_unicode(params[lang]) # Go for it link = on_play_video(mode, players, params, trakt_ids) if link: # set properties set_property( "data", json.dumps({ 'dbid': dbid, 'tvdb': id, 'season': season, 'episode': episode })) # Play season_info = get_season_metadata_tvdb(show_info, show[season], banners=False) episode_info = get_episode_metadata_tvdb(season_info, show[season][episode]) action_play({ 'label': episode_info['title'], 'path': link, 'info': episode_info, 'is_playable': True, 'info_type': 'video', 'thumbnail': episode_info['poster'], 'poster': episode_info['poster'], 'properties': { 'fanart_image': episode_info['fanart'] }, })
def play_episode_from_guide(id, season, episode, mode): import_tvdb() id = int(id) season = int(season) episode = int(episode) dbid = xbmc.getInfoLabel("ListItem.DBID") try: dbid = int(dbid) except: dbid = None show = tvdb[id] show_info = get_tvshow_metadata_tvdb(show, banners=False) if mode == 'select': play_plugin = ADDON_PICKER.id elif mode == 'default': play_plugin = plugin.get_setting(SETTING_TV_DEFAULT_CHANNELER) else: play_plugin = mode channelers = active_channelers("tvshows", filters = {'network': show.get('network')}) channelers = [p for p in channelers if p.id == play_plugin] or channelers if not channelers: xbmc.executebuiltin( "Action(Info)") action_cancel() return trakt_ids = get_trakt_ids("tvdb", id, show['seriesname'], "show", show.get('year', 0)) params = {} for lang in get_needed_langs(channelers): if lang == LANG: tvdb_data = show else: tvdb_data = create_tvdb(lang)[id] if tvdb_data['seriesname'] is None: continue episode_parameters = get_episode_parameters(tvdb_data, season, episode) if episode_parameters is not None: params[lang] = episode_parameters else: msg = "{0} {1} - S{1}E{2}".format(_("No tvdb information found for"), show['seriesname'], season, episode) dialogs.ok(_("Episode info not found"), msg) return if trakt_ids != None: params[lang].update(trakt_ids) params[lang]['info'] = show_info params[lang] = to_unicode(params[lang]) link = on_play_video(mode, channelers, params, trakt_ids) if link: set_property("data", json.dumps({'dbid': dbid, 'tvdb': id, 'season': season, 'episode': episode})) season_info = get_season_metadata_tvdb(show_info, show[season], banners=False) episode_info = get_episode_metadata_tvdb(season_info, show[season][episode]) action_play({ 'label': episode_info['title'], 'path': link, 'info': episode_info, 'is_playable': True, 'info_type': 'video', 'thumbnail': episode_info['poster'], 'poster': episode_info['poster'], 'properties' : {'fanart_image' : episode_info['fanart']}, })
def play_episode(id, season, episode, mode): import_tvdb() id = int(id) season = int(season) episode = int(episode) # Get database id dbid = xbmc.getInfoLabel("ListItem.DBID") try: dbid = int(dbid) except: dbid = None # Get show data from TVDB show = tvdb[id] show_info = get_tvshow_metadata_tvdb(show, banners=False) # Get active players players = active_players("tvshows", filters = {'network': show.get('network')}) if not players: xbmc.executebuiltin( "Action(Info)") action_cancel() return # Get player to use if mode == 'select': play_plugin = ADDON_SELECTOR.id elif mode == 'library': play_plugin = get_player_plugin_from_library(id) if not play_plugin: play_plugin = plugin.get_setting(SETTING_TV_DEFAULT_PLAYER_FROM_LIBRARY) else: play_plugin = plugin.get_setting(SETTING_TV_DEFAULT_PLAYER) # Use just selected player if exists (selectors excluded) players = [p for p in players if p.id == play_plugin] or players # Get show ids from Trakt trakt_ids = get_trakt_ids("tvdb", id, show['seriesname'], "show", show.get('year', 0)) # Preload params params = {} for lang in get_needed_langs(players): if lang == LANG: tvdb_data = show else: tvdb_data = create_tvdb(lang)[id] if tvdb_data['seriesname'] is None: continue params[lang] = get_episode_parameters(tvdb_data, season, episode) params[lang].update(trakt_ids) params[lang]['info'] = show_info params[lang] = to_unicode(params[lang]) # BETA action_cancel() # Get single video selection use_simple_selector = plugin.get_setting(SETTING_USE_SIMPLE_SELECTOR, converter=bool) selection = get_video_link(players, params, mode, use_simple_selector) if not selection: #action_cancel() return # Get selection details link = selection['path'] action = selection.get('action', '') plugin.log.info('Playing url: %s' % link.encode('utf-8')) # Activate link if action == "ACTIVATE": action_activate(link) else: # Build list item (needed just for playback from widgets) season_info = get_season_metadata_tvdb(show_info, show[season], banners=False) episode_info = get_episode_metadata_tvdb(season_info, show[season][episode]) listitem = { 'label': episode_info['title'], 'path': link, 'info': episode_info, 'is_playable': True, 'info_type': 'video', 'thumbnail': episode_info['poster'], 'poster': episode_info['poster'], 'properties' : {'fanart_image' : episode_info['fanart']}, } # set properties if trakt_ids: set_property('script.trakt.ids', json.dumps(trakt_ids)) set_property("data", json.dumps({'dbid': dbid, 'tvdb': id, 'season': season, 'episode': episode})) # Play if action == "PLAY": action_play(listitem) else: action_resolve(listitem)
def play_episode(id, season, episode, mode): import_tvdb() id = int(id) season = int(season) episode = int(episode) # Get database id dbid = xbmc.getInfoLabel("ListItem.DBID") try: dbid = int(dbid) except: dbid = None # Get show data from TVDB show = tvdb[id] show_info = get_tvshow_metadata_tvdb(show, banners=False) # Get players to use if mode == 'select': play_plugin = ADDON_SELECTOR.id elif mode == 'library': play_plugin = get_player_plugin_from_library(id) if not play_plugin or play_plugin == "default": play_plugin = plugin.get_setting(SETTING_TV_DEFAULT_PLAYER_FROM_LIBRARY) else: play_plugin = plugin.get_setting(SETTING_TV_DEFAULT_PLAYER) players = active_players("tvshows", filters = {'network': show.get('network')}) players = [p for p in players if p.id == play_plugin] or players if not players: xbmc.executebuiltin( "Action(Info)") action_cancel() return # Get show ids from Trakt trakt_ids = get_trakt_ids("tvdb", id, show['seriesname'], "show", show.get('year', 0)) # Get parameters params = {} for lang in get_needed_langs(players): if lang == LANG: tvdb_data = show else: tvdb_data = create_tvdb(lang)[id] if tvdb_data['seriesname'] is None: continue episode_parameters = get_episode_parameters(tvdb_data, season, episode) if episode_parameters is not None: params[lang] = episode_parameters else: msg = "{0} {1} - S{1}E{2}".format(_("No tvdb information found for"), show['seriesname'], season, episode) dialogs.ok(_("Episode info not found"), msg) return params[lang].update(trakt_ids) params[lang]['info'] = show_info params[lang] = to_unicode(params[lang]) # Go for it link = on_play_video(mode, players, params, trakt_ids) if link: # set properties set_property("data", json.dumps({'dbid': dbid, 'tvdb': id, 'season': season, 'episode': episode})) # Play season_info = get_season_metadata_tvdb(show_info, show[season], banners=False) episode_info = get_episode_metadata_tvdb(season_info, show[season][episode]) action_play({ 'label': episode_info['title'], 'path': link, 'info': episode_info, 'is_playable': True, 'info_type': 'video', 'thumbnail': episode_info['poster'], 'poster': episode_info['poster'], 'properties' : {'fanart_image' : episode_info['fanart']}, })
def play_episode_from_guide(id, season, episode, mode): import_tvdb() id = int(id) season = int(season) episode = int(episode) dbid = xbmc.getInfoLabel("ListItem.DBID") try: dbid = int(dbid) except: dbid = None show = tvdb[id] show_info = get_tvshow_metadata_tvdb(show, banners=False) if mode == 'select': play_plugin = ADDON_PICKER.id elif mode == 'default': play_plugin = plugin.get_setting(SETTING_TV_DEFAULT_CHANNELER, unicode) else: play_plugin = mode channelers = active_channelers("tvshows", filters = {'network': show.get('network')}) channelers = [p for p in channelers if p.id == play_plugin] or channelers if not channelers: xbmc.executebuiltin( "Action(Info)") action_cancel() return trakt_ids = get_trakt_ids("tvdb", id, show['seriesname'], "show", show.get('year', 0)) params = {} for lang in get_needed_langs(channelers): if lang == LANG: tvdb_data = show else: tvdb_data = create_tvdb(lang)[id] if tvdb_data['seriesname'] is None: continue episode_parameters = get_episode_parameters(tvdb_data, season, episode) if episode_parameters is not None: params[lang] = episode_parameters else: msg = "{0} {1} - S{1}E{2}".format(_("No tvdb information found for"), show['seriesname'], season, episode) dialogs.ok(_("%s not found") % _("Episode information"), msg) return if trakt_ids != None: params[lang].update(trakt_ids) params[lang]['info'] = show_info params[lang] = to_unicode(params[lang]) link = on_play_video(mode, channelers, params, trakt_ids) if link: set_property("data", json.dumps({'dbid': dbid, 'tvdb': id, 'season': season, 'episode': episode})) season_info = get_season_metadata_tvdb(show_info, show[season], banners=False) episode_info = get_episode_metadata_tvdb(season_info, show[season][episode]) action_play({ 'label': episode_info['title'], 'path': link, 'info': episode_info, 'is_playable': True, 'info_type': 'video', 'thumbnail': episode_info['poster'], 'poster': episode_info['poster'], 'properties' : {'fanart_image' : episode_info['fanart']}, })
def play_movie(tmdb_id, mode): import_tmdb() # Get active players players = active_players("movies") if not players: xbmc.executebuiltin( "Action(Info)") action_cancel() return # Get player to use if mode == 'select': play_plugin = ADDON_SELECTOR.id elif mode == 'library': play_plugin = plugin.get_setting(SETTING_MOVIES_DEFAULT_PLAYER_FROM_LIBRARY) else: play_plugin = plugin.get_setting(SETTING_MOVIES_DEFAULT_PLAYER) # Use just selected player if exists (selectors excluded) players = [p for p in players if p.id == play_plugin] or players # Get movie data from TMDB movie = tmdb.Movies(tmdb_id).info(language=LANG) movie_info = get_movie_metadata(movie) # Get movie ids from Trakt trakt_ids = get_trakt_ids("tmdb", tmdb_id, movie['original_title'], "movie", parse_year(movie['release_date'])) # Preload params params = {} for lang in get_needed_langs(players): if lang == LANG: tmdb_data = movie else: tmdb_data = tmdb.Movies(tmdb_id).info(language=lang) params[lang] = get_movie_parameters(tmdb_data) params[lang].update(trakt_ids) params[lang]['info'] = movie_info params[lang] = to_unicode(params[lang]) # BETA action_cancel() # Get single video selection use_simple_selector = plugin.get_setting(SETTING_USE_SIMPLE_SELECTOR, converter=bool) selection = get_video_link(players, params, mode, use_simple_selector) if not selection: #action_cancel() return # Get selection details link = selection['path'] action = selection.get('action', '') plugin.log.info('Playing url: %s' % link.encode('utf-8')) # Activate link if action == "ACTIVATE": action_activate(link) else: movie = tmdb.Movies(tmdb_id).info(language=LANG) listitem = { 'label': movie_info['title'], 'path': link, 'info': movie_info, 'is_playable': True, 'info_type': 'video', 'thumbnail': movie_info['poster'], 'poster': movie_info['poster'], 'properties' : {'fanart_image' : movie_info['fanart']}, } if trakt_ids: set_property('script.trakt.ids', json.dumps(trakt_ids)) if action == "PLAY": action_play(listitem) else: action_resolve(listitem)