Test Configurazione Canale di Default
This commit is contained in:
@@ -79,7 +79,7 @@ def get_channel_parameters(channel_name):
|
||||
# break
|
||||
# if found:
|
||||
# break
|
||||
|
||||
channel_parameters['settings'] = get_default_settings(channel_name)
|
||||
for s in channel_parameters['settings']:
|
||||
if 'id' in s:
|
||||
if s['id'] == "include_in_global_search":
|
||||
@@ -155,7 +155,8 @@ def get_channel_controls_settings(channel_name):
|
||||
# logger.info("channel_name=" + channel_name)
|
||||
dict_settings = {}
|
||||
# import web_pdb; web_pdb.set_trace()
|
||||
list_controls = get_channel_json(channel_name).get('settings', list())
|
||||
# list_controls = get_channel_json(channel_name).get('settings', list())
|
||||
list_controls = get_default_settings(channel_name)
|
||||
|
||||
for c in list_controls:
|
||||
if 'id' not in c or 'type' not in c or 'default' not in c:
|
||||
@@ -167,6 +168,24 @@ def get_channel_controls_settings(channel_name):
|
||||
|
||||
return list_controls, dict_settings
|
||||
|
||||
def get_default_settings(channel_name):
|
||||
import filetools
|
||||
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
|
||||
else:
|
||||
channel_controls.append(control)
|
||||
return channel_controls
|
||||
|
||||
|
||||
def get_channel_setting(name, channel, default=None):
|
||||
"""
|
||||
|
||||
61
default_channel_settings.json
Normal file
61
default_channel_settings.json
Normal file
@@ -0,0 +1,61 @@
|
||||
{
|
||||
"settings": [
|
||||
{
|
||||
"id": "include_in_global_search",
|
||||
"type": "bool",
|
||||
"label": "Includi in Ricerca Globale",
|
||||
"default": true,
|
||||
"enabled": true,
|
||||
"visible": true
|
||||
},
|
||||
{
|
||||
"id": "include_in_newest_peliculas",
|
||||
"type": "bool",
|
||||
"label": "Includi in Novità - Film",
|
||||
"default": true,
|
||||
"enabled": true,
|
||||
"visible": true
|
||||
},
|
||||
{
|
||||
"id": "include_in_newest_series",
|
||||
"type": "bool",
|
||||
"label": "Includi in Novità - Serie TV",
|
||||
"default": true,
|
||||
"enabled": true,
|
||||
"visible": true
|
||||
},
|
||||
{
|
||||
"id": "include_in_newest_anime",
|
||||
"type": "bool",
|
||||
"label": "Includi in Novità - Anime",
|
||||
"default": true,
|
||||
"enabled": true,
|
||||
"visible": true
|
||||
},
|
||||
{
|
||||
"id": "include_in_newest_italiano",
|
||||
"type": "bool",
|
||||
"label": "Includi in Novità - Italiano",
|
||||
"default": true,
|
||||
"enabled": true,
|
||||
"visible": true
|
||||
},
|
||||
{
|
||||
"id": "checklinks",
|
||||
"type": "bool",
|
||||
"label": "Verifica se i link esistono",
|
||||
"default": false,
|
||||
"enabled": true,
|
||||
"visible": true
|
||||
},
|
||||
{
|
||||
"id": "checklinks_number",
|
||||
"type": "list",
|
||||
"label": "Numero di link da verificare",
|
||||
"default": 1,
|
||||
"enabled": true,
|
||||
"visible": "eq(-1,true)",
|
||||
"lvalues": [ "5", "10", "15", "20" ]
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user