diff --git a/core/support.py b/core/support.py index 7b039b69..f675a9bf 100755 --- a/core/support.py +++ b/core/support.py @@ -979,6 +979,7 @@ def controls(itemlist, item, AutoPlay=True, CheckLinks=True, down_load=True): channel_node = autoplay_node.get(item.channel, {}) settings_node = channel_node.get('settings', {}) AP = get_setting('autoplay') or settings_node['active'] + APS = get_setting('autoplay_server_list') if CL and not AP: if get_setting('checklinks', item.channel): @@ -991,7 +992,7 @@ def controls(itemlist, item, AutoPlay=True, CheckLinks=True, down_load=True): checklinks_number = get_setting('checklinks_number') itemlist = servertools.check_list_links(itemlist, checklinks_number) - if AutoPlay == True and inspect.stack()[3][3] not in ['download_from_best_server', 'select_server']: + if AutoPlay == True and not 'downloads' in inspect.stack()[3][1] + inspect.stack()[4][1]: autoplay.start(itemlist, item) if item.contentChannel != 'videolibrary': videolibrary(itemlist, item, function_level=3) @@ -999,7 +1000,7 @@ def controls(itemlist, item, AutoPlay=True, CheckLinks=True, down_load=True): VL = False try: - if inspect.stack()[3][3] in ['download_from_best_server', 'select_server'] or \ + if 'downloads' in inspect.stack()[3][1] + inspect.stack()[4][1] or \ inspect.stack()[4][3] == 'play_from_library' or \ inspect.stack()[5][3] == 'play_from_library' or \ 'videolibrary' in inspect.stack()[3][1] or \ @@ -1007,7 +1008,7 @@ def controls(itemlist, item, AutoPlay=True, CheckLinks=True, down_load=True): VL = True except: pass - if not AP or VL: + if not AP or VL or not APS: return itemlist def filterLang(item, itemlist): diff --git a/platformcode/launcher.py b/platformcode/launcher.py index 9da0a118..5e9644f9 100644 --- a/platformcode/launcher.py +++ b/platformcode/launcher.py @@ -463,7 +463,7 @@ def play_from_library(item): window_type = config.get_setting("window_type", "videolibrary") - if autoplay.is_active(item.contentChannel): + if autoplay.is_active(item.contentChannel) and config.get_setting('autoplay_server_list'): itemlist = videolibrary.findvideos(item) # y volvemos a lanzar kodi diff --git a/resources/language/English/strings.po b/resources/language/English/strings.po index ee933baf..3c9a4a96 100644 --- a/resources/language/English/strings.po +++ b/resources/language/English/strings.po @@ -5701,6 +5701,10 @@ msgctxt "#70745" msgid "Enter another year..." msgstr "" +msgctxt "#70746" +msgid "Hide server selection from Autoplay" +msgstr "" + # DNS start [ settings and declaration ] msgctxt "#707401" msgid "Enable DNS Check Alert" diff --git a/resources/language/Italian/strings.po b/resources/language/Italian/strings.po index c9a879f2..18fb8d7e 100644 --- a/resources/language/Italian/strings.po +++ b/resources/language/Italian/strings.po @@ -5705,6 +5705,10 @@ msgctxt "#70745" msgid "Enter another year..." msgstr "Inserisci un altro anno..." +msgctxt "#70746" +msgid "Hide server selection from Autoplay" +msgstr "Nascondi la selezione del server da Autoplay" + # DNS start [ settings and declaration ] msgctxt "#707401" msgid "Enable DNS Check Alert" diff --git a/resources/settings.xml b/resources/settings.xml index f06c3501..3eb677a6 100644 --- a/resources/settings.xml +++ b/resources/settings.xml @@ -5,6 +5,7 @@ + diff --git a/specials/community.py b/specials/community.py index a494a75e..9dacf7f6 100644 --- a/specials/community.py +++ b/specials/community.py @@ -240,8 +240,35 @@ def show_menu(item): return itemlist +def filter_thread(filter,item): + itemlist = [] + thumbnail = '' + plot = '' + dict_ = {'url': 'search/person', 'language': lang, 'query': filter, 'page': 1} + tmdb_inf = tmdb.discovery(item, dict_=dict_) + results = tmdb_inf.results[0] + id = results['id'] + if id: + thumbnail = 'http://image.tmdb.org/t/p/original' + results['profile_path'] if results['profile_path'] else item.thumbnail + json_file = httptools.downloadpage('http://api.themoviedb.org/3/person/'+ str(id) + '?api_key=' + tmdb_api + '&language=en', use_requests=True).data + plot += jsontools.load(json_file)['biography'] + + item = Item(channel=item.channel, + title=typo(filter, 'bold'), + url=item.url, + media_type=item.media_type, + action='list_filtered', + thumbnail=thumbnail, + plot=plot, + path=item.path, + filterkey=item.filterkey, + filter=filter) + return item + + def submenu(item): support.log() + from lib.concurrent import futures itemlist = [] filter_list = [] @@ -262,33 +289,15 @@ def submenu(item): for f in media[item.filterkey]: if f not in filter_list: filter_list.append(f) + filter_list.sort() - support.log(filter_list) - for filter in filter_list: - thumbnail = '' - plot = '' - if item.filterkey in ['director','actors']: - tmdb.set_infoLabels(itemlist, seekTmdb=True) - load_info = load_json('http://api.themoviedb.org/3/search/person/?api_key=' + tmdb_api + '&language=' + lang + '&query=' + filter) - id = str(load_info['results'][0]['id']) if load_info.has_key('results') else '' - if id: - info = load_json('http://api.themoviedb.org/3/person/'+ id + '?api_key=' + tmdb_api + '&language=' + lang) if id else '' - if info.has_key('biography') and not info['biography']: - bio = load_json('http://api.themoviedb.org/3/person/'+ id + '?api_key=' + tmdb_api + '&language=en')['biography'] - thumbnail = 'https://image.tmdb.org/t/p/w600_and_h900_bestv2' + info['profile_path'] if info['profile_path'] else item.thumbnail - plot += info['biography'] if info['biography'] else bio if bio else '' - - itemlist.append(Item(channel=item.channel, - title=typo(filter, 'bold'), - url=item.url, - media_type=item.media_type, - action='list_filtered', - thumbnail=thumbnail, - plot=plot, - path=item.path, - filterkey=item.filterkey, - filter=filter)) + with futures.ThreadPoolExecutor() as executor: + List = [executor.submit(filter_thread, filter, item) for filter in filter_list] + for res in futures.as_completed(List): + if res.result(): + itemlist.append(res.result()) + itemlist = sorted(itemlist, key=lambda it: it.title) return itemlist