diff --git a/core/channeltools.py b/core/channeltools.py index 87b5e814..32395809 100644 --- a/core/channeltools.py +++ b/core/channeltools.py @@ -170,18 +170,52 @@ def get_channel_controls_settings(channel_name): def get_default_settings(channel_name): import filetools + channel = __import__('channels.%s' % channel_name, fromlist=["channels.%s" % channel_name]) + try: + list_language = channel.list_language + list_language.insert(0, config.get_localized_string(70522)) + except: + list_language = [] channel_controls = get_channel_json(channel_name).get('settings', list()) default_path = filetools.join(config.get_runtime_path(), 'default_channel_settings' + '.json') default_controls = jsontools.load(filetools.read(default_path)).get('settings', list()) categories = get_channel_json(channel_name).get('categories', list()) for control in default_controls: if control['id'] not in str(channel_controls): - if control['id'] == 'include_in_newest_peliculas' and 'movie' not in categories: - pass - elif control['id'] == 'include_in_newest_series' and 'tvshow' not in categories: - pass - elif control['id'] == 'include_in_newest_anime' and 'anime' not in categories: - pass + if 'include_in_newest' in control['id']: + label = control['id'].split('_') + label = label[-1] + if label == 'peliculas': + if 'movie' not in categories: + pass + else: + control['label'] = config.get_localized_string(70727) + ' - ' + config.get_localized_string(30122) + channel_controls.append(control) + logger.info(control) + elif label == 'series': + if 'tvshow' not in categories: + pass + else: + control['label'] = config.get_localized_string(70727) + ' - ' + config.get_localized_string(30123) + channel_controls.append(control) + elif label == 'anime': + if 'anime' not in categories: + pass + else: + control['label'] = config.get_localized_string(70727) + ' - ' + config.get_localized_string(30124) + channel_controls.append(control) + else: + control['label'] = config.get_localized_string(70727) + ' - ' + label.capitalize() + channel_controls.append(control) + + elif control['id'] == 'filter_languages': + if len(list_language) > 1: + control['lvalues'] = list_language + channel_controls.append(control) + else: + pass + + else: channel_controls.append(control) return channel_controls diff --git a/core/support.py b/core/support.py index f6f49b43..222edb13 100644 --- a/core/support.py +++ b/core/support.py @@ -331,6 +331,7 @@ def scrape(func): debug = args['debug'] if 'debug' in args else False if 'pagination' in args: pagination = args['pagination'] if args['pagination'] else 20 else: pagination = '' + list_language = func.__globals__['list_language'] if 'list_language' in func.__globals__ else {} pag = item.page if item.page else 1 # pagination matches = [] @@ -403,8 +404,19 @@ def scrape(func): if 'fullItemlistHook' in args: itemlist = args['fullItemlistHook'](itemlist) - - return itemlist + + filterLang = False + for item in itemlist: + if item.contentLanguage: + filterLang = True + break + + if list_language and filterLang: + log('Lista Lingue = ', list_language) + from specials import filtertools + return filtertools.get_links(itemlist, item, list_language) + else: + return itemlist return wrapper diff --git a/default_channel_settings.json b/default_channel_settings.json index 9a4f8aca..9cb44c0b 100644 --- a/default_channel_settings.json +++ b/default_channel_settings.json @@ -3,7 +3,7 @@ { "id": "include_in_global_search", "type": "bool", - "label": "Includi in Ricerca Globale", + "label": "@70728", "default": true, "enabled": true, "visible": true @@ -11,7 +11,7 @@ { "id": "include_in_newest_peliculas", "type": "bool", - "label": "Includi in Novità - Film", + "label": "@70727", "default": true, "enabled": true, "visible": true @@ -19,7 +19,7 @@ { "id": "include_in_newest_series", "type": "bool", - "label": "Includi in Novità - Serie TV", + "label": "@70727", "default": true, "enabled": true, "visible": true @@ -27,7 +27,7 @@ { "id": "include_in_newest_anime", "type": "bool", - "label": "Includi in Novità - Anime", + "label": "@70727", "default": true, "enabled": true, "visible": true @@ -35,7 +35,7 @@ { "id": "include_in_newest_italiano", "type": "bool", - "label": "Includi in Novità - Italiano", + "label": "@70727", "default": true, "enabled": true, "visible": true @@ -52,10 +52,19 @@ "id": "checklinks_number", "type": "list", "label": "Numero di link da verificare", - "default": 1, + "default": 2, "enabled": true, "visible": "eq(-1,true)", - "lvalues": [ "5", "10", "15", "20" ] + "lvalues": [ "3", "5", "10", "15", "20" ] + }, + { + "id": "filter_languages", + "type": "list", + "label": "@30019", + "default": 0, + "enabled": true, + "visible": true, + "lvalues": ["Non Filtrare"] } ] } diff --git a/resources/language/English/strings.po b/resources/language/English/strings.po index 3e6d9005..8e783f14 100644 --- a/resources/language/English/strings.po +++ b/resources/language/English/strings.po @@ -5615,4 +5615,20 @@ msgstr "" msgctxt "#70724" msgid "Channel" +msgstr "" + +msgctxt "#70725" +msgid "Select the language" +msgstr "" + +msgctxt "#70726" +msgid "Seleziona la qualità" +msgstr "" + +msgctxt "#70727" +msgid "Include in News" +msgstr "" + +msgctxt "#70728" +msgid "Include in Global Search" msgstr "" \ No newline at end of file diff --git a/resources/language/Italian/strings.po b/resources/language/Italian/strings.po index 30d17b66..f6373247 100644 --- a/resources/language/Italian/strings.po +++ b/resources/language/Italian/strings.po @@ -5615,4 +5615,20 @@ msgstr "collegamenti nella cartella" msgctxt "#70724" msgid "Channel" -msgstr "Canale" \ No newline at end of file +msgstr "Canale" + +msgctxt "#70725" +msgid "Select the language" +msgstr "Seleziona la lingua" + +msgctxt "#70726" +msgid "Seleziona la qualità" +msgstr "Select the quality" + +msgctxt "#70727" +msgid "Include in News" +msgstr "Includi in Novità" + +msgctxt "#70728" +msgid "Include in Global Search" +msgstr "Includi in Ricerca Globale" \ No newline at end of file diff --git a/specials/downloads.py b/specials/downloads.py index c8c28cea..d39d1ab7 100644 --- a/specials/downloads.py +++ b/specials/downloads.py @@ -778,6 +778,28 @@ def get_episodes(item): # Cualquier otro resultado no nos vale, lo ignoramos else: logger.info("Omitting invalid item: %s" % episode.tostring()) + + # if Multiple Languages or Qualities + list_lang = [] + list_quality = [] + for item in itemlist: + if not item.language: item.language = item.contentLanguage + if item.language not in list_lang: list_lang.append(item.language) + if item.infoLabels['quality'] not in list_quality: list_quality.append(item.infoLabels['quality']) + if len(list_lang) > 1: + selection = platformtools.dialog_select(config.get_localized_string(70725),list_lang) + it = [] + for item in itemlist: + if not item.language: item.language = item.contentLanguage + if item.language == list_lang[selection]: + it.append(item) + itemlist = it + if len(list_quality) > 1: + selection = platformtools.dialog_select(config.get_localized_string(70726),list_quality) + it = [] + for item in itemlist: + if item.infoLabels['quality'] == list_quality[selection]: it.append(item) + itemlist = it return itemlist diff --git a/specials/filtertools.py b/specials/filtertools.py index df4f4c8d..931e9b06 100644 --- a/specials/filtertools.py +++ b/specials/filtertools.py @@ -163,6 +163,8 @@ def load(item): def check_conditions(_filter, list_item, item, list_language, list_quality, quality_count=0, language_count=0): + if not item.language: item.language = item.contentLanguage + is_language_valid = True if _filter.language: # logger.debug("title es %s" % item.title)