Default Channel Settings:

- "not_active" = [ ] -> Disattiva le voci non volute
 - "default_off" = [ ] -> Default = False per le voci in lista
This commit is contained in:
Alhaziel
2019-09-30 19:59:58 +02:00
parent a38b843d41
commit a8db744cf1
2 changed files with 15 additions and 16 deletions
+15 -7
View File
@@ -227,40 +227,48 @@ def get_default_settings(channel_name):
default_controls = jsontools.load(filetools.read(default_path)).get('settings', list()) default_controls = jsontools.load(filetools.read(default_path)).get('settings', list())
default_controls_renumber = jsontools.load(filetools.read(default_path)).get('renumber', list()) default_controls_renumber = jsontools.load(filetools.read(default_path)).get('renumber', list())
categories = get_channel_json(channel_name).get('categories', list()) categories = get_channel_json(channel_name).get('categories', list())
not_active = get_channel_json(channel_name).get('not_active', list())
default_off = get_channel_json(channel_name).get('default_off', list())
# Apply default configurations if they do not exist # Apply default configurations if they do not exist
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 'include_in_newest' in control['id']: if 'include_in_newest' in control['id'] and 'include_in_newest' not in not_active:
label = control['id'].split('_') label = control['id'].split('_')
label = label[-1] label = label[-1]
if label == 'peliculas': if label == 'peliculas':
if 'movie' in categories: if 'movie' in categories:
control['label'] = config.get_localized_string(70727) + ' - ' + config.get_localized_string(30122) control['label'] = config.get_localized_string(70727) + ' - ' + config.get_localized_string(30122)
control['default'] = True if 'include_in_newest' not in default_off else False
channel_controls.append(control) channel_controls.append(control)
else: pass else: pass
elif label == 'series': elif label == 'series':
if 'tvshow' in categories: if 'tvshow' in categories:
control['label'] = config.get_localized_string(70727) + ' - ' + config.get_localized_string(30123) control['label'] = config.get_localized_string(70727) + ' - ' + config.get_localized_string(30123)
control['default'] = True if 'include_in_newest' not in default_off else False
channel_controls.append(control) channel_controls.append(control)
else: pass else: pass
elif label == 'anime': elif label == 'anime':
if 'anime' in categories: if 'anime' in categories:
control['label'] = config.get_localized_string(70727) + ' - ' + config.get_localized_string(30124) control['label'] = config.get_localized_string(70727) + ' - ' + config.get_localized_string(30124)
control['default'] = True if 'include_in_newest' not in default_off else False
channel_controls.append(control) channel_controls.append(control)
else: pass else: pass
else: else:
control['label'] = config.get_localized_string(70727) + ' - ' + label.capitalize() control['label'] = config.get_localized_string(70727) + ' - ' + label.capitalize()
control['default'] = True if control['id'] not in default_off else False
channel_controls.append(control) channel_controls.append(control)
elif control['id'] == 'filter_languages': # elif control['id'] == 'filter_languages':
if len(channel_language) > 1: # if len(channel_language) > 1:
control['lvalues'] = list_language # control['lvalues'] = list_language
channel_controls.append(control) # channel_controls.append(control)
else: pass # else: pass
else: elif control['id'] not in not_active:
if type(control['default']) == bool:
control['default'] = True if control['id'] not in default_off else False
channel_controls.append(control) channel_controls.append(control)
if renumber: if renumber:
-9
View File
@@ -56,15 +56,6 @@
"enabled": true, "enabled": true,
"visible": "eq(-1,true)", "visible": "eq(-1,true)",
"lvalues": [ "3", "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"]
} }
], ],