From 364a73d13745b8b98a2892d3cd301247e074af1c Mon Sep 17 00:00:00 2001 From: Alhaziel Date: Sat, 21 Mar 2020 13:00:24 +0100 Subject: [PATCH 1/7] =?UTF-8?q?Community=20Channels,=20possibilit=C3=A0=20?= =?UTF-8?q?di=20aggiungere:=20Thumbnails,=20Fanart=20e=20Plot=20ai=20filtr?= =?UTF-8?q?i=20tramite=20tag=20description?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- specials/community.py | 37 ++++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/specials/community.py b/specials/community.py index beb0911c..73967bb5 100644 --- a/specials/community.py +++ b/specials/community.py @@ -446,7 +446,8 @@ def get_sub_menu(item, json, key, itemlist=[]): action = 'show_menu', menu = level2 if not item.menu else None, filterkey = filterkey, - context = CONTEXT) + context = CONTEXT, + description = extra.description) itemlist.append(it) if 'search' in option: @@ -468,7 +469,6 @@ def get_search_menu(item, json='', itemlist=[], channel_name=''): else: title = 'Cerca ' + item.fulltitle + '...' extra = set_extra_values(item, json, item.path) - support.log('EXTRA',extra) itemlist.append(Item(channel=item.channel, title=support.typo(title,'submenu bold'), @@ -488,12 +488,23 @@ def get_search_menu(item, json='', itemlist=[], channel_name=''): def submenu(item, json, key, itemlist = []): + support.log() import sys if sys.version_info[0] >= 3: from concurrent import futures else: from concurrent_py2 import futures + if item.description: + if type(item.description) == dict: + description = item.description + else: + if ':/' in item.description: url = item.description + else: url = filetools.join(item.path, item.description) + description = load_json(url) + else: + description = None + filter_list = [] for option in json[key]: if item.filterkey in option and option[item.filterkey]: @@ -507,7 +518,7 @@ def submenu(item, json, key, itemlist = []): filter_list.sort() with futures.ThreadPoolExecutor() as executor: - List = [executor.submit(filter_thread, filter, key, item) for filter in filter_list] + List = [executor.submit(filter_thread, filter, key, item, description) for filter in filter_list] for res in futures.as_completed(List): if res.result(): itemlist.append(res.result()) @@ -518,9 +529,8 @@ def submenu(item, json, key, itemlist = []): ################################ Filter results ################################ # filter results -def filter_thread(filter, key, item): - thumbnail = '' - plot = '' +def filter_thread(filter, key, item, description): + thumbnail = plot = fanart = None if item.filterkey in ['actors', 'director']: dict_ = {'url': 'search/person', 'language': lang, 'query': filter, 'page': 1} tmdb_inf = tmdb.discovery(item, dict_=dict_) @@ -532,13 +542,21 @@ def filter_thread(filter, key, item): 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'] + if description: + if filter in description: + extra = set_extra_values(item, description[filter], item.path) + thumbnail = extra.thumb if extra.thumb else item.thumbnail + fanart = extra.fanart if extra.fanart else item.fanart + plot = extra.plot if extra.plot else item.plot + item = Item(channel=item.channel, title=support.typo(filter, 'bold'), url=item.url, media_type=item.media_type, action='peliculas', - thumbnail=thumbnail, - plot=plot, + thumbnail=thumbnail if thumbnail else item.thumbnail, + fanart=thumbnail if thumbnail else item.thumbnail, + plot=plot if plot else item.plot, path=item.path, filterkey=item.filterkey, filter=filter, @@ -619,9 +637,10 @@ def set_extra_values(item, json, path): filterkey = json[key].keys()[0] ret.filter = json[key][filterkey] ret.filterkey = filterkey + elif key == 'description': + ret.description = json[key] if not ret.thumb: - support.log('STACK=',inspect.stack()[1][3]) if 'get_search_menu' in inspect.stack()[1][3]: ret.thumb = get_thumb('search.png') else: From 57c29eceab69198e0ebd2ca505a8baa5ed1d97eb Mon Sep 17 00:00:00 2001 From: Alhaziel Date: Sat, 21 Mar 2020 15:24:04 +0100 Subject: [PATCH 2/7] Fix Community Channels --- specials/community.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/specials/community.py b/specials/community.py index 73967bb5..6b9373e9 100644 --- a/specials/community.py +++ b/specials/community.py @@ -530,7 +530,7 @@ def submenu(item, json, key, itemlist = []): # filter results def filter_thread(filter, key, item, description): - thumbnail = plot = fanart = None + thumbnail = plot = fanart = '' if item.filterkey in ['actors', 'director']: dict_ = {'url': 'search/person', 'language': lang, 'query': filter, 'page': 1} tmdb_inf = tmdb.discovery(item, dict_=dict_) @@ -555,7 +555,7 @@ def filter_thread(filter, key, item, description): media_type=item.media_type, action='peliculas', thumbnail=thumbnail if thumbnail else item.thumbnail, - fanart=thumbnail if thumbnail else item.thumbnail, + fanart=fanart if fanart else item.fanart, plot=plot if plot else item.plot, path=item.path, filterkey=item.filterkey, From dfbc96a018471ae330445c37973f0a6cadf33391 Mon Sep 17 00:00:00 2001 From: Alhaziel Date: Sat, 21 Mar 2020 16:03:04 +0100 Subject: [PATCH 3/7] Migliorie Community Channels --- specials/community.py | 45 ++++++++++++++++++++++++++++++------------- 1 file changed, 32 insertions(+), 13 deletions(-) diff --git a/specials/community.py b/specials/community.py index 6b9373e9..15c21100 100644 --- a/specials/community.py +++ b/specials/community.py @@ -487,8 +487,8 @@ def get_search_menu(item, json='', itemlist=[], channel_name=''): return itemlist -def submenu(item, json, key, itemlist = []): - support.log() +def submenu(item, json, key, itemlist = [], filter_list = []): + support.log(item) import sys if sys.version_info[0] >= 3: from concurrent import futures @@ -505,23 +505,41 @@ def submenu(item, json, key, itemlist = []): else: description = None - filter_list = [] - for option in json[key]: - if item.filterkey in option and option[item.filterkey]: - if type(option[item.filterkey]) == str and option[item.filterkey] not in filter_list: - filter_list.append(option[item.filterkey]) - elif type(option[item.filterkey]) == list: - for f in option[item.filterkey]: - if f not in filter_list: - filter_list.append(f) + if item.thumb: item.thumbnail = item.thumb - filter_list.sort() + if not filter_list: + for option in json[key]: + if item.filterkey in option and option[item.filterkey]: + if type(option[item.filterkey]) == str and option[item.filterkey] not in filter_list: + filter_list.append(option[item.filterkey]) + elif type(option[item.filterkey]) == list: + for f in option[item.filterkey]: + if f not in filter_list: + filter_list.append(f) + + filter_list.sort() + + Pagination = int(defp) if defp.isdigit() else '' + pag = item.page if item.page else 1 + filters = [] + for i, filter in enumerate(filter_list): + if Pagination and (pag - 1) * Pagination > i: continue # pagination + if Pagination and i >= pag * Pagination: break + filters.append(filter) with futures.ThreadPoolExecutor() as executor: - List = [executor.submit(filter_thread, filter, key, item, description) for filter in filter_list] + List = [executor.submit(filter_thread, filter, key, item, description) for filter in filters] for res in futures.as_completed(List): if res.result(): itemlist.append(res.result()) + + if Pagination and len(itemlist) >= Pagination: + item.title = support.typo(config.get_localized_string(30992), 'color kod bold') + item.page = pag + 1 + item.thumb = item.thumbnail + item.thumbnail = support.thumb() + itemlist.append(item) + itemlist = sorted(itemlist, key=lambda it: it.title) return itemlist @@ -534,6 +552,7 @@ def filter_thread(filter, key, item, description): if item.filterkey in ['actors', 'director']: dict_ = {'url': 'search/person', 'language': lang, 'query': filter, 'page': 1} tmdb_inf = tmdb.discovery(item, dict_=dict_) + id = None if tmdb_inf.results: results = tmdb_inf.results[0] id = results['id'] From d1135529d1ab3fdedf7133015cae06695e2b099b Mon Sep 17 00:00:00 2001 From: Alhaziel Date: Sat, 21 Mar 2020 17:33:17 +0100 Subject: [PATCH 4/7] Fix Settaggio Autostart KoD --- platformcode/config.py | 4 ++-- resources/settings.xml | 2 +- specials/setting.py | 6 ++++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/platformcode/config.py b/platformcode/config.py index c1d13fce..361776b0 100644 --- a/platformcode/config.py +++ b/platformcode/config.py @@ -152,7 +152,7 @@ def enable_disable_autorun(is_enabled): if is_enabled is False: with open(path, append_write) as file: file.write("import xbmc\nxbmc.executebuiltin('XBMC.RunAddon(plugin.video.kod)')") - set_setting('autostart', get_localized_string(707431)) + set_setting('autostart', 'ON') else: file = open(path, "r") old_content = file.read() @@ -160,7 +160,7 @@ def enable_disable_autorun(is_enabled): file.close() with open(path, "w") as file: file.write(new_content) - set_setting('autostart', get_localized_string(707432)) + set_setting('autostart', 'OFF') return True def get_all_settings_addon(): diff --git a/resources/settings.xml b/resources/settings.xml index 799a6c18..232bf67b 100644 --- a/resources/settings.xml +++ b/resources/settings.xml @@ -2,7 +2,7 @@ - + diff --git a/specials/setting.py b/specials/setting.py index 5242dd42..12ee2e3f 100644 --- a/specials/setting.py +++ b/specials/setting.py @@ -100,9 +100,11 @@ def channel_config(item): def autostart(item): # item necessario launcher.py linea 265 if config.enable_disable_autorun(AUTOSTART): - xbmcgui.Dialog().ok(config.get_localized_string(20000), config.get_localized_string(70709)) + logger.info('AUTOSTART ENABLED') + # xbmcgui.Dialog().ok(config.get_localized_string(20000), config.get_localized_string(70709)) else: - xbmcgui.Dialog().ok(config.get_localized_string(20000), config.get_localized_string(70710)) + logger.info('AUTOSTART ENABLED') + # xbmcgui.Dialog().ok(config.get_localized_string(20000), config.get_localized_string(70710)) def setting_torrent(item): From b0212de4d453f1a60bba6dd94bba43220868ec9d Mon Sep 17 00:00:00 2001 From: Alhaziel Date: Sat, 21 Mar 2020 18:28:19 +0100 Subject: [PATCH 5/7] Pcoolo fix per spostamento videoteca --- specials/move_videolibrary.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/specials/move_videolibrary.py b/specials/move_videolibrary.py index 1369bfd9..2ec0737c 100644 --- a/specials/move_videolibrary.py +++ b/specials/move_videolibrary.py @@ -10,20 +10,26 @@ from xml.dom import minidom global p p = 0 progress = platformtools.dialog_progress('Spostamento Videoteca','Spostamento File') -progress.update(p, '') + + + def set_videolibrary_path(item): log() + global p previous_path = config.get_setting('videolibrarypath') path = xbmcgui.Dialog().browse(3, 'Seleziona la cartella', 'files', '', False, False, config.get_setting('videolibrarypath')) log('New Videolibrary path:', path) log('Previous Videolibrary path:', previous_path) if path != previous_path: config.set_setting('videolibrarypath', path) + progress.update(p, '') set_new_path(path, previous_path) - if platformtools.dialog_yesno('Spostare la Videoteca?', 'vuoi postare la videoteca e il relativo contenuto nella nuova posizione?'): + if platformtools.dialog_yesno('Spostare la Videoteca?', 'vuoi spostare la videoteca e il relativo contenuto nella nuova posizione?'): move_videolibrary(path, previous_path) + progress.update(p, 'Spostamento Database') move_db(path, previous_path) + clear_cache() progress.close() platformtools.dialog_ok('Spostamento Completato','') @@ -176,3 +182,10 @@ def set_new_path(new, old): nodo_type.appendChild(element_default) source_nodes.appendChild(nodo_type) xmldoc.appendChild(source_nodes) + + +def clear_cache(): + path = xbmc.translatePath('special://home/cache/archive_cache/') + for file in filetools.listdir(path): + log(file) + filetools.remove(filetools.join(path, file)) \ No newline at end of file From 7ae36b72e6fd12592fab64d3a33260e59b1574db Mon Sep 17 00:00:00 2001 From: axlt2002 Date: Sat, 21 Mar 2020 18:55:35 +0100 Subject: [PATCH 6/7] Corretti alcuni testi --- platformcode/config.py | 4 ++-- resources/language/English/strings.po | 22 ++++++++++----------- resources/language/Italian/strings.po | 28 +++++++++++++-------------- resources/settings.xml | 3 +-- 4 files changed, 28 insertions(+), 29 deletions(-) diff --git a/platformcode/config.py b/platformcode/config.py index 361776b0..650e01db 100644 --- a/platformcode/config.py +++ b/platformcode/config.py @@ -152,7 +152,7 @@ def enable_disable_autorun(is_enabled): if is_enabled is False: with open(path, append_write) as file: file.write("import xbmc\nxbmc.executebuiltin('XBMC.RunAddon(plugin.video.kod)')") - set_setting('autostart', 'ON') + set_setting('autostart', 'On') else: file = open(path, "r") old_content = file.read() @@ -160,7 +160,7 @@ def enable_disable_autorun(is_enabled): file.close() with open(path, "w") as file: file.write(new_content) - set_setting('autostart', 'OFF') + set_setting('autostart', 'Off') return True def get_all_settings_addon(): diff --git a/resources/language/English/strings.po b/resources/language/English/strings.po index 659f0a72..a82aa558 100644 --- a/resources/language/English/strings.po +++ b/resources/language/English/strings.po @@ -42,7 +42,7 @@ msgid "Automatically update channels" msgstr "" msgctxt "#30005" -msgid "Play mode" +msgid "Video quality" msgstr "" msgctxt "#30006" @@ -50,11 +50,11 @@ msgid "Ask" msgstr "" msgctxt "#30007" -msgid "Watch in low quality" +msgid "Low" msgstr "" msgctxt "#30008" -msgid "Watch in high quality" +msgid "High" msgstr "" msgctxt "#30010" @@ -206,7 +206,7 @@ msgid "Unsopported Server" msgstr "" msgctxt "#30067" -msgid "Video library path" +msgid "Path" msgstr "" msgctxt "#30068" @@ -286,7 +286,7 @@ msgid "Adult" msgstr "" msgctxt "#30130" -msgid "Recent" +msgid "News" msgstr "" msgctxt "#30131" @@ -1483,7 +1483,7 @@ msgid "Restart Kodi to apply changes" msgstr "" msgctxt "#60327" -msgid "Novelties" +msgid "News" msgstr "" msgctxt "#60328" @@ -3231,7 +3231,7 @@ msgid "Syncronize with Trakt.tv" msgstr "" msgctxt "#70110" -msgid "Priority Method" +msgid "Priority method" msgstr "" msgctxt "#70111" @@ -3263,7 +3263,7 @@ msgid "Confirm new password" msgstr "" msgctxt "#70118" -msgid "TV shows folder +msgid "TV shows folder" msgstr "" msgctxt "#70119" @@ -3715,7 +3715,7 @@ msgid "Move the downloaded file to the video library" msgstr "" msgctxt "#70232" -msgid "View downloaded files +msgid "View downloaded files" msgstr "" msgctxt "#70233" @@ -3747,7 +3747,7 @@ msgid "Preferred quality" msgstr "" msgctxt "#70241" -msgid "The highest" +msgid "Highest" msgstr "" msgctxt "#70242" @@ -5590,7 +5590,7 @@ msgid "Use your custom channel URLs" msgstr "" msgctxt "#70706" -msgid "Start KoD at Kodi boot" +msgid "Launch KoD at Kodi start" msgstr "" msgctxt "#70707" diff --git a/resources/language/Italian/strings.po b/resources/language/Italian/strings.po index 5140b8a4..32105a30 100644 --- a/resources/language/Italian/strings.po +++ b/resources/language/Italian/strings.po @@ -42,20 +42,20 @@ msgid "Automatically update channels" msgstr "Aggiorna automaticamente i canali" msgctxt "#30005" -msgid "Play mode" -msgstr "Modalità di riproduzione" +msgid "Video quality" +msgstr "Qualità video" msgctxt "#30006" msgid "Ask" msgstr "Chiedi" msgctxt "#30007" -msgid "Watch in low quality" -msgstr "Guarda in bassa qualità" +msgid "Low" +msgstr "Bassa" msgctxt "#30008" -msgid "Watch in high quality" -msgstr "Guarda in alta qualità" +msgid "High" +msgstr "Alta" msgctxt "#30010" msgid "Channel icons view" @@ -206,8 +206,8 @@ msgid "Unsopported Server" msgstr "Server non supportato" msgctxt "#30067" -msgid "Video library path" -msgstr "Percorso videoteca" +msgid "Path" +msgstr "Percorso" msgctxt "#30068" msgid "Filter by servers" @@ -286,7 +286,7 @@ msgid "Adult" msgstr "Adulti" msgctxt "#30130" -msgid "Recent" +msgid "News" msgstr "Novità" msgctxt "#30131" @@ -1482,7 +1482,7 @@ msgid "Restart Kodi to apply changes" msgstr "Riavvia Kodi per applicare le modifiche" msgctxt "#60327" -msgid "Novelties" +msgid "News" msgstr "Novità" msgctxt "#60328" @@ -3230,7 +3230,7 @@ msgid "Syncronize with Trakt.tv" msgstr "Sincronizza con Trakt.tv" msgctxt "#70110" -msgid "Priority Method" +msgid "Priority method" msgstr "Priorità" msgctxt "#70111" @@ -3746,8 +3746,8 @@ msgid "Preferred quality" msgstr "Qualità preferita" msgctxt "#70241" -msgid "The highest" -msgstr "La più alta" +msgid "Highest" +msgstr "Più alta" msgctxt "#70242" msgid "Choose fastest servers" @@ -5590,7 +5590,7 @@ msgid "Use your custom channel URLs" msgstr "Utilizza URL personalizzati per i canali" msgctxt "#70706" -msgid "Start KoD at Kodi boot" +msgid "Launch KoD at Kodi start" msgstr "Esegui KoD all'avvio di Kodi" msgctxt "#70707" diff --git a/resources/settings.xml b/resources/settings.xml index 232bf67b..68ebfdb9 100644 --- a/resources/settings.xml +++ b/resources/settings.xml @@ -2,7 +2,7 @@ - + @@ -63,7 +63,6 @@ - From 93e0ba9a4b31e905f276d190e512b21d8da675f8 Mon Sep 17 00:00:00 2001 From: MaxE <29448127+EMaX0@users.noreply.github.com> Date: Sun, 22 Mar 2020 03:01:36 +0800 Subject: [PATCH 7/7] Updated akvideo.py (#199) Fixed situation when no vres are found. Trying to get it from data unpacked or excluding any usage of it --- servers/akvideo.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/servers/akvideo.py b/servers/akvideo.py index c756cb35..3782780e 100644 --- a/servers/akvideo.py +++ b/servers/akvideo.py @@ -54,14 +54,24 @@ def get_video_url(page_url, premium=False, user="", password="", video_password= data = block if block else data # URL # logger.info(data) - matches = scrapertools.find_multiple_matches(data, '''src:\s*["']?(http.*?\.mp4)''') - # logger.info(str(matches)) + if vres: + matches = scrapertools.find_multiple_matches(data, '''src:\s*["']?(http.*?\.mp4)''') + else: + matches = scrapertools.find_multiple_matches(data, '''src:\s*["']?(http.*?\.mp4)(?:[^,]+,[^,]+,res:([^,]+))?''') + if matches: + if len(matches[0])==2: + i=0 + for m in matches: + vres.append("%sx" % m[1]) + matches[i]=m[0] + i+=1 + _headers = urllib.urlencode(httptools.default_headers) i = 0 for media_url in matches: # URL del vídeo - video_urls.append([vres[i] + " mp4 [Akvideo] ", media_url.replace('https://', 'http://') + '|' + _headers]) + video_urls.append([vres[i] if i