def get_video_link(players, params, mode, use_simple=False): lister = Lister() # Extend parameters for lang, lang_params in params.items(): for key, value in lang_params.items(): if isinstance(value, basestring): params[lang][key + "_+"] = value.replace(" ", "+") params[lang][key + "_-"] = value.replace(" ", "-") params[lang][key + "_escaped"] = value.replace(" ", "%2520") params[lang][key + "_escaped+"] = value.replace(" ", "%252B") pDialog = None selection = None try: if len(players) > 1 and use_simple: index = dialogs.select(_("Play using..."), [player.title for player in players]) if index == -1: return None players = [players[index]] resolve_f = lambda p : resolve_player(p, lister, params) if len(players) > 1: pool_size = plugin.get_setting(SETTING_POOL_SIZE, int) populator = lambda : execute(resolve_f, players, lister.stop_flag, pool_size) selection = dialogs.select_ext(_("Play using..."), populator, len(players)) else: result = resolve_f(players[0]) if result: title, links = result if len(links) == 1: selection = links[0] else: index = dialogs.select(_("Play using..."), [x['label'] for x in links]) if index > -1: selection = links[index] else: dialogs.ok(_("Error"), _("%s not found") % _("Video")) finally: lister.stop() return selection
def get_video_link(players, params, mode, use_simple=False): lister = Lister() # Extend parameters for lang, lang_params in params.items(): for key, value in lang_params.items(): if isinstance(value, basestring): params[lang][key + "_+"] = value.replace(" ", "+") params[lang][key + "_-"] = value.replace(" ", "-") params[lang][key + "_escaped"] = value.replace(" ", "%2520") params[lang][key + "_escaped+"] = value.replace(" ", "%252B") pDialog = None selection = None try: if len(players) > 1 and use_simple: index = dialogs.select(_("Choose Your Channel..."), [player.title for player in players]) if index == -1: return None players = [players[index]] resolve_f = lambda p: resolve_player(p, lister, params) if len(players) > 1: pDialog = xbmcgui.DialogProgress() pDialog.create('Meta', 'Working...') dialogs.wait_for_dialog("progressdialog", 5) pool_size = plugin.get_setting(SETTING_POOL_SIZE, converter=int) populator = lambda: execute(resolve_f, players, lister.stop_flag, pool_size) selection = dialogs.select_ext(_("Choose Your Channel..."), populator, len(players)) else: result = resolve_f(players[0]) if result: title, links = result if len(links) == 1: selection = links[0] else: index = dialogs.select(_("Choose Your Channel..."), [x['label'] for x in links]) if index > -1: selection = links[index] else: dialogs.ok(_("Error"), _("Video not found :(")) finally: lister.stop() return selection
def get_video_link(players, params, mode, use_simple=False): lister = Lister() pDialog = None selection = None try: if len(players) > 1 and use_simple: index = dialogs.select(_("Play with..."), [player.title for player in players]) if index == -1: return None players = [players[index]] resolve_f = lambda p : resolve_player(p, lister, params) if len(players) > 1: pDialog = xbmcgui.DialogProgress() pDialog.create('Meta', 'Working...') dialogs.wait_for_dialog("progressdialog", 5) populator = lambda : execute(resolve_f, players, lister.stop_flag) selection = dialogs.select_ext(_("Play with..."), populator, len(players)) else: result = resolve_f(players[0]) if result: title, links = result if len(links) == 1: selection = links[0] else: index = dialogs.select(_("Play with..."), [x['label'] for x in links]) if index > -1: selection = links[index] else: dialogs.ok(_("Error"), _("Video not found :(")) finally: lister.stop() return selection