impostazioni server preferiti - bloccati sotto autoplay

This commit is contained in:
marco
2020-06-27 20:22:29 +02:00
parent 920156c55f
commit 935ee7f954
3 changed files with 28 additions and 24 deletions

View File

@@ -536,35 +536,35 @@ def get_server_parameters(server):
return dict_servers_parameters[server]
def get_server_json(server_name):
# logger.info("server_name=" + server_name)
try:
server_path = filetools.join(config.get_runtime_path(), "servers", server_name + ".json")
if not filetools.exists(server_path):
server_path = filetools.join(config.get_runtime_path(), "servers", "debriders", server_name + ".json")
# logger.info("server_path=" + server_path)
server_json = jsontools.load(filetools.read(server_path))
# logger.info("server_json= %s" % server_json)
except Exception as ex:
template = "An exception of type %s occured. Arguments:\n%r"
message = template % (type(ex).__name__, ex.args)
logger.error(" %s" % message)
server_json = None
return server_json
# def get_server_json(server_name):
# # logger.info("server_name=" + server_name)
# try:
# server_path = filetools.join(config.get_runtime_path(), "servers", server_name + ".json")
# if not filetools.exists(server_path):
# server_path = filetools.join(config.get_runtime_path(), "servers", "debriders", server_name + ".json")
#
# # logger.info("server_path=" + server_path)
# server_json = jsontools.load(filetools.read(server_path))
# # logger.info("server_json= %s" % server_json)
#
# except Exception as ex:
# template = "An exception of type %s occured. Arguments:\n%r"
# message = template % (type(ex).__name__, ex.args)
# logger.error(" %s" % message)
# server_json = None
#
# return server_json
def get_server_host(server_name):
from core import scrapertools
return [scrapertools.get_domain_from_url(pattern['url']) for pattern in get_server_json(server_name)['find_videos']['patterns']]
return [scrapertools.get_domain_from_url(pattern['url']) for pattern in get_server_parameters(server_name)['find_videos']['patterns']]
def get_server_controls_settings(server_name):
dict_settings = {}
list_controls = get_server_json(server_name).get('settings', [])
list_controls = get_server_parameters(server_name).get('settings', [])
import copy
list_controls = copy.deepcopy(list_controls)

View File

@@ -184,7 +184,7 @@ class SettingsWindow(xbmcgui.WindowXMLDialog):
# The call is made from a channel
self.list_controls, default_values = servertools.get_server_controls_settings(self.channel)
self.kwargs = {"server": self.channel}
self.channelName = servertools.get_server_json(self.channel)['name']
self.channelName = servertools.get_server_parameters(self.channel)['name']
# Else Exit
else:
@@ -225,6 +225,8 @@ class SettingsWindow(xbmcgui.WindowXMLDialog):
c["control"].setVisible(val)
def evaluate_conditions(self):
import time
t = time.time()
for c in self.list_controls:
c["active"] = self.evaluate(self.list_controls.index(c), c["enabled"])
self.set_enabled(c, c["active"])
@@ -232,6 +234,7 @@ class SettingsWindow(xbmcgui.WindowXMLDialog):
if not c["show"]:
self.set_visible(c, c["show"])
self.visible_controls = [c for c in self.list_controls if c["show"]]
logger.info(time.time()-t)
def evaluate(self, index, cond):
import re
@@ -506,7 +509,7 @@ class SettingsWindow(xbmcgui.WindowXMLDialog):
elif c["type"] == 'text': self.add_control_text(c)
elif c["type"] == 'list': self.add_control_list(c)
elif c["type"] == 'label': self.add_control_label(c)
logger.info(time.time()-t)
self.list_controls = [c for c in self.list_controls if "control" in c]
self.evaluate_conditions()

View File

@@ -20,6 +20,9 @@
<setting id="player_mode" type="select" lvalues="30026|30027|30028|30029" label="30044" default="1"/>
<setting id="default_action" type="select" lvalues="30006|30007|30008" label="30005" default="0"/>
<setting id="autoplay" type="bool" label="70562" default="false" visible="true"/>
<setting id="servers_favorites" visible="eq(-1,true)" subsetting="true" type="action" label="60551" action="RunPlugin(plugin://plugin.video.kod/?ew0KICAgICJhY3Rpb24iOiAic2VydmVyc19mYXZvcml0ZXMiLA0KICAgICJjaGFubmVsIjogInNldHRpbmciDQp9==)"/>
<setting id="servers_blacklist" visible="eq(-2,true)" subsetting="true" type="action" label="60550" action="RunPlugin(plugin://plugin.video.kod/?ew0KICAgICJhY3Rpb24iOiAic2VydmVyc19ibGFja2xpc3QiLA0KICAgICJjaGFubmVsIjogInNldHRpbmciDQp9==)"/>
<!-- <setting id="hide_servers" type="bool" label="70747" default="false" visible="eq(-1,true)" subsetting="true"/> -->
<setting id="checklinks" type="bool" label="30020" default="false"/>
<setting id="checklinks_number" type="slider" option="int" range="5,5,20" label="30021" default="5" visible="eq(-1,true)" subsetting="true"/>
@@ -64,12 +67,10 @@
<setting id="hidepremium" type="bool" label="70112" default="false"/>
<setting id="httptools_timeout" type="slider" option="int" range="0,5,120" label="70580" default="15"/>
<setting label="70145" type="lsep"/>
<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="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_config" type="action" label="60538" action="RunPlugin(plugin://plugin.video.kod/?ew0KICAgICJhY3Rpb24iOiAic2VydmVyc19tZW51IiwNCiAgICAiY2hhbm5lbCI6ICJzaG9ydGN1dHMiDQp9==)"/>
<setting id="debriders_config" type="action" label="60552" action="RunPlugin(plugin://plugin.video.kod/?ew0KICAgICJhY3Rpb24iOiAic2VydmVyc19tZW51IiwNCiAgICAiY2hhbm5lbCI6ICJzaG9ydGN1dHMiLA0KCSJ0eXBlIjogImRlYnJpZGVycyINCn0==)"/>
<setting label="70578" type="lsep"/>