Fix Download, Filtro Lingua, default settings
This commit is contained in:
@@ -170,18 +170,52 @@ def get_channel_controls_settings(channel_name):
|
|||||||
|
|
||||||
def get_default_settings(channel_name):
|
def get_default_settings(channel_name):
|
||||||
import filetools
|
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())
|
channel_controls = get_channel_json(channel_name).get('settings', list())
|
||||||
default_path = filetools.join(config.get_runtime_path(), 'default_channel_settings' + '.json')
|
default_path = filetools.join(config.get_runtime_path(), 'default_channel_settings' + '.json')
|
||||||
default_controls = jsontools.load(filetools.read(default_path)).get('settings', list())
|
default_controls = jsontools.load(filetools.read(default_path)).get('settings', list())
|
||||||
categories = get_channel_json(channel_name).get('categories', list())
|
categories = get_channel_json(channel_name).get('categories', list())
|
||||||
for control in default_controls:
|
for control in default_controls:
|
||||||
if control['id'] not in str(channel_controls):
|
if control['id'] not in str(channel_controls):
|
||||||
if control['id'] == 'include_in_newest_peliculas' and 'movie' not in categories:
|
if 'include_in_newest' in control['id']:
|
||||||
pass
|
label = control['id'].split('_')
|
||||||
elif control['id'] == 'include_in_newest_series' and 'tvshow' not in categories:
|
label = label[-1]
|
||||||
pass
|
if label == 'peliculas':
|
||||||
elif control['id'] == 'include_in_newest_anime' and 'anime' not in categories:
|
if 'movie' not in categories:
|
||||||
pass
|
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:
|
else:
|
||||||
channel_controls.append(control)
|
channel_controls.append(control)
|
||||||
return channel_controls
|
return channel_controls
|
||||||
|
|||||||
@@ -331,6 +331,7 @@ def scrape(func):
|
|||||||
debug = args['debug'] if 'debug' in args else False
|
debug = args['debug'] if 'debug' in args else False
|
||||||
if 'pagination' in args: pagination = args['pagination'] if args['pagination'] else 20
|
if 'pagination' in args: pagination = args['pagination'] if args['pagination'] else 20
|
||||||
else: pagination = ''
|
else: pagination = ''
|
||||||
|
list_language = func.__globals__['list_language'] if 'list_language' in func.__globals__ else {}
|
||||||
|
|
||||||
pag = item.page if item.page else 1 # pagination
|
pag = item.page if item.page else 1 # pagination
|
||||||
matches = []
|
matches = []
|
||||||
@@ -403,8 +404,19 @@ def scrape(func):
|
|||||||
|
|
||||||
if 'fullItemlistHook' in args:
|
if 'fullItemlistHook' in args:
|
||||||
itemlist = args['fullItemlistHook'](itemlist)
|
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
|
return wrapper
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
{
|
{
|
||||||
"id": "include_in_global_search",
|
"id": "include_in_global_search",
|
||||||
"type": "bool",
|
"type": "bool",
|
||||||
"label": "Includi in Ricerca Globale",
|
"label": "@70728",
|
||||||
"default": true,
|
"default": true,
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"visible": true
|
"visible": true
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
{
|
{
|
||||||
"id": "include_in_newest_peliculas",
|
"id": "include_in_newest_peliculas",
|
||||||
"type": "bool",
|
"type": "bool",
|
||||||
"label": "Includi in Novità - Film",
|
"label": "@70727",
|
||||||
"default": true,
|
"default": true,
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"visible": true
|
"visible": true
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
{
|
{
|
||||||
"id": "include_in_newest_series",
|
"id": "include_in_newest_series",
|
||||||
"type": "bool",
|
"type": "bool",
|
||||||
"label": "Includi in Novità - Serie TV",
|
"label": "@70727",
|
||||||
"default": true,
|
"default": true,
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"visible": true
|
"visible": true
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
{
|
{
|
||||||
"id": "include_in_newest_anime",
|
"id": "include_in_newest_anime",
|
||||||
"type": "bool",
|
"type": "bool",
|
||||||
"label": "Includi in Novità - Anime",
|
"label": "@70727",
|
||||||
"default": true,
|
"default": true,
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"visible": true
|
"visible": true
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
{
|
{
|
||||||
"id": "include_in_newest_italiano",
|
"id": "include_in_newest_italiano",
|
||||||
"type": "bool",
|
"type": "bool",
|
||||||
"label": "Includi in Novità - Italiano",
|
"label": "@70727",
|
||||||
"default": true,
|
"default": true,
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"visible": true
|
"visible": true
|
||||||
@@ -52,10 +52,19 @@
|
|||||||
"id": "checklinks_number",
|
"id": "checklinks_number",
|
||||||
"type": "list",
|
"type": "list",
|
||||||
"label": "Numero di link da verificare",
|
"label": "Numero di link da verificare",
|
||||||
"default": 1,
|
"default": 2,
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"visible": "eq(-1,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"]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5615,4 +5615,20 @@ msgstr ""
|
|||||||
|
|
||||||
msgctxt "#70724"
|
msgctxt "#70724"
|
||||||
msgid "Channel"
|
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 ""
|
msgstr ""
|
||||||
@@ -5615,4 +5615,20 @@ msgstr "collegamenti nella cartella"
|
|||||||
|
|
||||||
msgctxt "#70724"
|
msgctxt "#70724"
|
||||||
msgid "Channel"
|
msgid "Channel"
|
||||||
msgstr "Canale"
|
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"
|
||||||
@@ -778,6 +778,28 @@ def get_episodes(item):
|
|||||||
# Cualquier otro resultado no nos vale, lo ignoramos
|
# Cualquier otro resultado no nos vale, lo ignoramos
|
||||||
else:
|
else:
|
||||||
logger.info("Omitting invalid item: %s" % episode.tostring())
|
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
|
return itemlist
|
||||||
|
|
||||||
|
|||||||
@@ -163,6 +163,8 @@ def load(item):
|
|||||||
|
|
||||||
|
|
||||||
def check_conditions(_filter, list_item, item, list_language, list_quality, quality_count=0, language_count=0):
|
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
|
is_language_valid = True
|
||||||
if _filter.language:
|
if _filter.language:
|
||||||
# logger.debug("title es %s" % item.title)
|
# logger.debug("title es %s" % item.title)
|
||||||
|
|||||||
Reference in New Issue
Block a user