- Fix Blacklist
- Aggiunta opzione Priorità alla qualità
This commit is contained in:
@@ -223,6 +223,10 @@ msgctxt "#30068"
|
|||||||
msgid "Filter by servers"
|
msgid "Filter by servers"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
msgctxt "#30069"
|
||||||
|
msgid "Priority to quality"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgctxt "#30100"
|
msgctxt "#30100"
|
||||||
msgid "Settings"
|
msgid "Settings"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|||||||
@@ -223,6 +223,10 @@ msgctxt "#30068"
|
|||||||
msgid "Filter by servers"
|
msgid "Filter by servers"
|
||||||
msgstr "Filtra per server"
|
msgstr "Filtra per server"
|
||||||
|
|
||||||
|
msgctxt "#30069"
|
||||||
|
msgid "Priority to quality"
|
||||||
|
msgstr "Priorità alla qualità"
|
||||||
|
|
||||||
msgctxt "#30100"
|
msgctxt "#30100"
|
||||||
msgid "Settings"
|
msgid "Settings"
|
||||||
msgstr "Impostazioni"
|
msgstr "Impostazioni"
|
||||||
|
|||||||
@@ -66,6 +66,7 @@
|
|||||||
<setting id="servers_favorites" type="action" label="60551" action="RunPlugin(plugin://plugin.video.kod/?ew0KICAgICJhY3Rpb24iOiAic2VydmVyc19mYXZvcml0ZXMiLA0KICAgICJjaGFubmVsIjogInNldHRpbmciDQp9==)"/>
|
<setting id="servers_favorites" type="action" label="60551" action="RunPlugin(plugin://plugin.video.kod/?ew0KICAgICJhY3Rpb24iOiAic2VydmVyc19mYXZvcml0ZXMiLA0KICAgICJjaGFubmVsIjogInNldHRpbmciDQp9==)"/>
|
||||||
<setting id="favorites_servers" type="bool" label="60551" default="false" visible="false"/>
|
<setting id="favorites_servers" type="bool" label="60551" default="false" visible="false"/>
|
||||||
<setting id="filter_servers" type="bool" label="30068" default="false" visible="false"/>
|
<setting id="filter_servers" type="bool" label="30068" default="false" visible="false"/>
|
||||||
|
<setting id="quality_priority" type="bool" label="30069" default="false" visible="false"/>
|
||||||
|
|
||||||
<setting id="servers_blacklist" type="action" label="60550" action="RunPlugin(plugin://plugin.video.kod/?ew0KICAgICJhY3Rpb24iOiAic2VydmVyc19ibGFja2xpc3QiLA0KICAgICJjaGFubmVsIjogInNldHRpbmciDQp9==)"/>
|
<setting id="servers_blacklist" type="action" label="60550" action="RunPlugin(plugin://plugin.video.kod/?ew0KICAgICJhY3Rpb24iOiAic2VydmVyc19ibGFja2xpc3QiLA0KICAgICJjaGFubmVsIjogInNldHRpbmciDQp9==)"/>
|
||||||
<setting id="servers_config" type="action" label="60538" action="RunPlugin(plugin://plugin.video.kod/?ew0KICAgICJhY3Rpb24iOiAic2VydmVyc19tZW51IiwNCiAgICAiY2hhbm5lbCI6ICJzaG9ydGN1dHMiDQp9==)"/>
|
<setting id="servers_config" type="action" label="60538" action="RunPlugin(plugin://plugin.video.kod/?ew0KICAgICJhY3Rpb24iOiAic2VydmVyc19tZW51IiwNCiAgICAiY2hhbm5lbCI6ICJzaG9ydGN1dHMiDQp9==)"/>
|
||||||
|
|||||||
+28
-1
@@ -108,10 +108,14 @@ def start(itemlist, item):
|
|||||||
if 'server' not in item:
|
if 'server' not in item:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
if item.server.lower() in blacklisted_servers:
|
||||||
|
continue
|
||||||
|
|
||||||
# If it does not have a defined quality, it assigns a 'default' quality.
|
# If it does not have a defined quality, it assigns a 'default' quality.
|
||||||
if item.quality == '':
|
if item.quality == '':
|
||||||
item.quality = 'default'
|
item.quality = 'default'
|
||||||
# The list for custom settings is created
|
# The list for custom settings is created
|
||||||
|
|
||||||
if priority < 2: # 0: Servers and qualities or 1: Qualities and servers
|
if priority < 2: # 0: Servers and qualities or 1: Qualities and servers
|
||||||
|
|
||||||
# if the server and the quality are not in the favorites lists or the url is repeated, we discard the item
|
# if the server and the quality are not in the favorites lists or the url is repeated, we discard the item
|
||||||
@@ -152,15 +156,38 @@ def start(itemlist, item):
|
|||||||
# If the item reaches here we add it to the list of valid urls and to autoplay_list
|
# If the item reaches here we add it to the list of valid urls and to autoplay_list
|
||||||
url_list_valid.append(item.url)
|
url_list_valid.append(item.url)
|
||||||
item.plan_b=True
|
item.plan_b=True
|
||||||
|
|
||||||
autoplay_elem['videoitem'] = item
|
autoplay_elem['videoitem'] = item
|
||||||
autoplay_list.append(autoplay_elem)
|
autoplay_list.append(autoplay_elem)
|
||||||
|
|
||||||
# We order according to priority
|
# We order according to priority
|
||||||
if priority == 0: autoplay_list.sort(key=lambda orden: (orden['indice_server'], orden['indice_quality'])) # Servers and qualities
|
if priority == 0: autoplay_list.sort(key=lambda orden: (orden['indice_quality'], orden['indice_server'])) # Servers and qualities
|
||||||
elif priority == 1: autoplay_list.sort(key=lambda orden: (orden['indice_quality'], orden['indice_server'])) # Qualities and servers
|
elif priority == 1: autoplay_list.sort(key=lambda orden: (orden['indice_quality'], orden['indice_server'])) # Qualities and servers
|
||||||
elif priority == 2: autoplay_list.sort(key=lambda orden: (orden['indice_server'])) # Servers only
|
elif priority == 2: autoplay_list.sort(key=lambda orden: (orden['indice_server'])) # Servers only
|
||||||
elif priority == 3: autoplay_list.sort(key=lambda orden: (orden['indice_quality'])) # Only qualities
|
elif priority == 3: autoplay_list.sort(key=lambda orden: (orden['indice_quality'])) # Only qualities
|
||||||
|
|
||||||
|
# if quality priority is active
|
||||||
|
if priority == 0 and config.get_setting('quality_priority'):
|
||||||
|
max_quality = autoplay_list[0]["indice_quality"]
|
||||||
|
for n, item in enumerate(itemlist):
|
||||||
|
if 'server' not in item:
|
||||||
|
continue
|
||||||
|
|
||||||
|
if item.server.lower() in blacklisted_servers:
|
||||||
|
continue
|
||||||
|
|
||||||
|
# If it does not have a defined quality, it assigns a 'default' quality.
|
||||||
|
if item.quality == '':
|
||||||
|
item.quality = 'default'
|
||||||
|
|
||||||
|
if favorite_quality.index(item.quality.lower()) < max_quality:
|
||||||
|
item.type_b = False
|
||||||
|
autoplay_elem["indice_server"] = n
|
||||||
|
autoplay_elem["indice_quality"] = favorite_quality.index(item.quality.lower())
|
||||||
|
autoplay_elem['videoitem'] = item
|
||||||
|
autoplay_list.append(autoplay_elem)
|
||||||
|
autoplay_list.sort(key=lambda orden: (orden['indice_quality'], orden['indice_server']))
|
||||||
|
|
||||||
# Plan b is prepared, in case it is active the non-favorite elements are added at the end
|
# Plan b is prepared, in case it is active the non-favorite elements are added at the end
|
||||||
try: plan_b = settings_node['plan_b']
|
try: plan_b = settings_node['plan_b']
|
||||||
except: plan_b = True
|
except: plan_b = True
|
||||||
|
|||||||
+14
-5
@@ -348,12 +348,19 @@ def servers_favorites(item):
|
|||||||
dict_values = {}
|
dict_values = {}
|
||||||
|
|
||||||
list_controls = [{'id': 'favorites_servers',
|
list_controls = [{'id': 'favorites_servers',
|
||||||
'type': "bool",
|
'type': 'bool',
|
||||||
'label': config.get_localized_string(60577),
|
'label': config.get_localized_string(60577),
|
||||||
'default': False,
|
'default': False,
|
||||||
'enabled': True,
|
'enabled': True,
|
||||||
|
'visible': True},
|
||||||
|
{'id': 'quality_priority',
|
||||||
|
'type': 'bool',
|
||||||
|
'label': config.get_localized_string(30069),
|
||||||
|
'default': False,
|
||||||
|
'enabled': 'eq(-1,True)',
|
||||||
'visible': True}]
|
'visible': True}]
|
||||||
dict_values['favorites_servers'] = config.get_setting('favorites_servers')
|
dict_values['favorites_servers'] = config.get_setting('favorites_servers')
|
||||||
|
dict_values['quality_priority'] = config.get_setting('quality_priority')
|
||||||
if dict_values['favorites_servers'] == None:
|
if dict_values['favorites_servers'] == None:
|
||||||
dict_values['favorites_servers'] = False
|
dict_values['favorites_servers'] = False
|
||||||
|
|
||||||
@@ -368,15 +375,15 @@ def servers_favorites(item):
|
|||||||
orden = config.get_setting("favorites_servers_list", server=server)
|
orden = config.get_setting("favorites_servers_list", server=server)
|
||||||
|
|
||||||
if orden > 0:
|
if orden > 0:
|
||||||
dict_values[orden] = len(server_names) - 1
|
dict_values[orden] = len(server_names) - 2
|
||||||
|
|
||||||
for x in range(1, 11):
|
for x in range(2, 12):
|
||||||
control = {'id': x,
|
control = {'id': x,
|
||||||
'type': "list",
|
'type': 'list',
|
||||||
'label': config.get_localized_string(60597) % x,
|
'label': config.get_localized_string(60597) % x,
|
||||||
'lvalues': server_names,
|
'lvalues': server_names,
|
||||||
'default': 0,
|
'default': 0,
|
||||||
'enabled': "eq(-%s,True)" % x,
|
'enabled': 'eq(-%s,True)' % x,
|
||||||
'visible': True}
|
'visible': True}
|
||||||
list_controls.append(control)
|
list_controls.append(control)
|
||||||
|
|
||||||
@@ -392,6 +399,8 @@ def cb_servers_favorites(server_names, dict_values):
|
|||||||
for i, v in list(dict_values.items()):
|
for i, v in list(dict_values.items()):
|
||||||
if i == "favorites_servers":
|
if i == "favorites_servers":
|
||||||
config.set_setting("favorites_servers", v)
|
config.set_setting("favorites_servers", v)
|
||||||
|
if i == "quality_priority":
|
||||||
|
config.set_setting("quality_priority", v)
|
||||||
elif int(v) > 0:
|
elif int(v) > 0:
|
||||||
dict_name[server_names[v]] = int(i)
|
dict_name[server_names[v]] = int(i)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user