Test Configurazione Canale di Default
This commit is contained in:
+21
-2
@@ -79,7 +79,7 @@ def get_channel_parameters(channel_name):
|
|||||||
# break
|
# break
|
||||||
# if found:
|
# if found:
|
||||||
# break
|
# break
|
||||||
|
channel_parameters['settings'] = get_default_settings(channel_name)
|
||||||
for s in channel_parameters['settings']:
|
for s in channel_parameters['settings']:
|
||||||
if 'id' in s:
|
if 'id' in s:
|
||||||
if s['id'] == "include_in_global_search":
|
if s['id'] == "include_in_global_search":
|
||||||
@@ -155,7 +155,8 @@ def get_channel_controls_settings(channel_name):
|
|||||||
# logger.info("channel_name=" + channel_name)
|
# logger.info("channel_name=" + channel_name)
|
||||||
dict_settings = {}
|
dict_settings = {}
|
||||||
# import web_pdb; web_pdb.set_trace()
|
# 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:
|
for c in list_controls:
|
||||||
if 'id' not in c or 'type' not in c or 'default' not in c:
|
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
|
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):
|
def get_channel_setting(name, channel, default=None):
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -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