Pulizia settings e immagini registi in videoteca

This commit is contained in:
Alhaziel01
2021-06-18 20:04:44 +02:00
parent 7965daf524
commit acaed1c036
5 changed files with 230 additions and 457 deletions
+74 -82
View File
@@ -5,15 +5,37 @@
from __future__ import division from __future__ import division
import sys, os, inspect, xbmcgui, xbmc import sys, os, inspect, xbmcgui, xbmc
from core import support
PY3 = False PY3 = False
if sys.version_info[0] >= 3: PY3 = True; unicode = str; unichr = chr; long = int if sys.version_info[0] >= 3: PY3 = True; unicode = str; unichr = chr; long = int
from builtins import range from builtins import range
from past.utils import old_div from past.utils import old_div
from core import channeltools, servertools, scrapertools from core import channeltools, servertools
from platformcode import config, logger, platformtools from platformcode import config, logger, platformtools
from core.support import info, dbg, match from core.support import match
BACKGROUND = 100
HEADER = 101
CLOSE = 102
OK = 103
CANCEL = 104
DEFAULT = 105
PARAMETERS = 106
SCROLLBARBG = 107
SCROLLBARFG = 108
LOADING = 109
LEFT = 1
RIGHT =2
UP = 3
DOWN = 4
SCROLLDOWN = 104
SCROLLUP = 105
BACK = 92
PREVIOUS = 10
GESTUREBEGIN = 501
GESTUREPAN = 504
class SettingsWindow(xbmcgui.WindowXMLDialog): class SettingsWindow(xbmcgui.WindowXMLDialog):
@@ -142,7 +164,7 @@ class SettingsWindow(xbmcgui.WindowXMLDialog):
""" """
def start(self, list_controls=None, dict_values=None, caption="", callback=None, item=None, custom_button=None, channelpath=None): def start(self, list_controls=None, dict_values=None, caption="", callback=None, item=None, custom_button=None, channelpath=None):
info() logger.debug()
# Media Path # Media Path
self.mediapath = os.path.join(config.get_runtime_path(), 'resources', 'skins', 'Default', 'media') self.mediapath = os.path.join(config.get_runtime_path(), 'resources', 'skins', 'Default', 'media')
@@ -427,9 +449,9 @@ class SettingsWindow(xbmcgui.WindowXMLDialog):
c['image'] = image c['image'] = image
def onInit(self): def onInit(self):
self.getControl(10004).setEnabled(False) self.getControl(OK).setEnabled(False)
self.getControl(10005).setEnabled(False) self.getControl(CANCEL).setEnabled(False)
self.getControl(10006).setEnabled(False) self.getControl(DEFAULT).setEnabled(False)
self.ok_enabled = False self.ok_enabled = False
self.default_enabled = False self.default_enabled = False
@@ -441,19 +463,19 @@ class SettingsWindow(xbmcgui.WindowXMLDialog):
self.setCoordinateResolution(5) self.setCoordinateResolution(5)
# Title # Title
self.getControl(10002).setLabel(self.caption) self.getControl(HEADER).setLabel(self.caption)
if self.custom_button is not None: if self.custom_button is not None:
if self.custom_button['visible']: if self.custom_button['visible']:
self.getControl(10006).setLabel(self.custom_button['label']) self.getControl(DEFAULT).setLabel(self.custom_button['label'])
else: else:
self.getControl(10006).setVisible(False) self.getControl(DEFAULT).setVisible(False)
# Control Area Dimensions # Control Area Dimensions
self.controls_width = self.getControl(10007).getWidth() - 30 self.controls_width = self.getControl(PARAMETERS).getWidth() - 30
self.controls_height = self.getControl(10007).getHeight() -100 self.controls_height = self.getControl(PARAMETERS).getHeight() -100
self.controls_pos_x = self.getControl(10007).getPosition()[0] + self.getControl(10001).getPosition()[0] + 10 self.controls_pos_x = self.getControl(PARAMETERS).getPosition()[0] + self.getControl(BACKGROUND).getPosition()[0] + 10
self.controls_pos_y = self.getControl(10007).getPosition()[1] + self.getControl(10001).getPosition()[1] self.controls_pos_y = self.getControl(PARAMETERS).getPosition()[1] + self.getControl(BACKGROUND).getPosition()[1]
self.height_control = 60 self.height_control = 60
self.font = "font16" self.font = "font16"
@@ -511,10 +533,10 @@ class SettingsWindow(xbmcgui.WindowXMLDialog):
self.evaluate_conditions() self.evaluate_conditions()
self.index = -1 self.index = -1
self.dispose_controls(0) self.dispose_controls(0)
self.getControl(100010).setVisible(False) self.getControl(LOADING).setVisible(False)
self.getControl(10004).setEnabled(True) self.getControl(OK).setEnabled(True)
self.getControl(10005).setEnabled(True) self.getControl(CANCEL).setEnabled(True)
self.getControl(10006).setEnabled(True) self.getControl(DEFAULT).setEnabled(True)
self.ok_enabled = True self.ok_enabled = True
self.default_enabled = True self.default_enabled = True
self.check_default() self.check_default()
@@ -560,10 +582,10 @@ class SettingsWindow(xbmcgui.WindowXMLDialog):
hidden_controls = len(self.visible_controls) - show_controls - 1 hidden_controls = len(self.visible_controls) - show_controls - 1
if hidden_controls < 0: hidden_controls = 0 if hidden_controls < 0: hidden_controls = 0
scrollbar_height = self.getControl(10008).getHeight() - (hidden_controls * 3) scrollbar_height = self.getControl(SCROLLBARBG).getHeight() - (hidden_controls * 3)
scrollbar_y = self.getControl(10008).getPosition()[1] + (new_index * 3) scrollbar_y = self.getControl(SCROLLBARBG).getPosition()[1] + (new_index * 3)
self.getControl(10009).setPosition(self.getControl(10008).getPosition()[0], scrollbar_y) self.getControl(SCROLLBARFG).setPosition(self.getControl(SCROLLBARBG).getPosition()[0], scrollbar_y)
self.getControl(10009).setHeight(scrollbar_height) self.getControl(SCROLLBARFG).setHeight(scrollbar_height)
self.index = new_index self.index = new_index
@@ -574,15 +596,15 @@ class SettingsWindow(xbmcgui.WindowXMLDialog):
if not self.callback: if not self.callback:
if dict_values: if dict_values:
self.init_values = dict_values.copy() self.init_values = dict_values.copy()
self.getControl(10004).setEnabled(False) self.getControl(OK).setEnabled(False)
self.ok_enabled = False self.ok_enabled = False
else: else:
if self.init_values == self.values: if self.init_values == self.values:
self.getControl(10004).setEnabled(False) self.getControl(OK).setEnabled(False)
self.ok_enabled = False self.ok_enabled = False
else: else:
self.getControl(10004).setEnabled(True) self.getControl(OK).setEnabled(True)
self.ok_enabled = True self.ok_enabled = True
def check_default(self): def check_default(self):
@@ -590,15 +612,15 @@ class SettingsWindow(xbmcgui.WindowXMLDialog):
def_values = dict([[c["id"], c.get("default")] for c in self.list_controls if not c["type"] == "label"]) def_values = dict([[c["id"], c.get("default")] for c in self.list_controls if not c["type"] == "label"])
if def_values == self.values: if def_values == self.values:
self.getControl(10006).setEnabled(False) self.getControl(DEFAULT).setEnabled(False)
self.default_enabled = False self.default_enabled = False
else: else:
self.getControl(10006).setEnabled(True) self.getControl(DEFAULT).setEnabled(True)
self.default_enabled = True self.default_enabled = True
def onClick(self, id): def onClick(self, control):
# Default values # Default values
if id == 10006: if control in [DEFAULT]:
if self.custom_button is not None: if self.custom_button is not None:
if self.custom_button["close"]: if self.custom_button["close"]:
self.close() self.close()
@@ -611,7 +633,7 @@ class SettingsWindow(xbmcgui.WindowXMLDialog):
else: else:
self.return_value = getattr(cb_channel, self.custom_button['function'])(self.item, self.values) self.return_value = getattr(cb_channel, self.custom_button['function'])(self.item, self.values)
if not self.custom_button["close"]: if not self.custom_button["close"]:
if isinstance(self.return_value, dict) and "label" in self.return_value: self.getControl(10006).setLabel(self.return_value['label']) if isinstance(self.return_value, dict) and "label" in self.return_value: self.getControl(DEFAULT).setLabel(self.return_value['label'])
for c in self.list_controls: for c in self.list_controls:
if c["type"] == "text": c["control"].setText(self.values[c["id"]]) if c["type"] == "text": c["control"].setText(self.values[c["id"]])
@@ -639,11 +661,11 @@ class SettingsWindow(xbmcgui.WindowXMLDialog):
self.check_ok() self.check_ok()
# Cancel button [X] # Cancel button [X]
if id == 10003 or id == 10005: if control in [CLOSE, CANCEL]:
self.close() self.close()
# OK button # OK button
if id == 10004: if control in [OK]:
self.close() self.close()
if self.callback and '.' in self.callback: package, self.callback = self.callback.rsplit('.', 1) if self.callback and '.' in self.callback: package, self.callback = self.callback.rsplit('.', 1)
else: package = '%s.%s' % (self.ch_type, self.channel) else: package = '%s.%s' % (self.ch_type, self.channel)
@@ -672,17 +694,17 @@ class SettingsWindow(xbmcgui.WindowXMLDialog):
# We look it up in the list of controls # We look it up in the list of controls
for cont in self.list_controls: for cont in self.list_controls:
if cont['type'] == "list" and cont["control"].getId() == id: if cont['type'] == "list" and cont["control"].getId() == control:
select = platformtools.dialog_select(config.get_localized_string(30041), cont["lvalues"], self.values[cont["id"]]) select = platformtools.dialog_select(config.get_localized_string(30041), cont["lvalues"], self.values[cont["id"]])
if select >= 0: if select >= 0:
cont["label"].setLabel(cont["lvalues"][select]) cont["label"].setLabel(cont["lvalues"][select])
self.values[cont["id"]] = cont["lvalues"].index(cont["label"].getLabel()) self.values[cont["id"]] = cont["lvalues"].index(cont["label"].getLabel())
# If the control is a "bool", we save the new value True / False # If the control is a "bool", we save the new value True / False
if cont["type"] == "bool" and cont["control"].getId() == id: self.values[cont["id"]] = bool(cont["control"].isSelected()) if cont["type"] == "bool" and cont["control"].getId() == control: self.values[cont["id"]] = bool(cont["control"].isSelected())
# If the control is a "text", we save the new value # If the control is a "text", we save the new value
if cont["type"] == "text" and cont["control"].getId() == id: if cont["type"] == "text" and cont["control"].getId() == control:
# Older versions require opening the keyboard manually # Older versions require opening the keyboard manually
if xbmcgui.ControlEdit == ControlEdit: if xbmcgui.ControlEdit == ControlEdit:
keyboard = xbmc.Keyboard(cont["control"].getText(), cont["control"].getLabel(), cont["control"].isPassword) keyboard = xbmc.Keyboard(cont["control"].getText(), cont["control"].getLabel(), cont["control"].isPassword)
@@ -704,37 +726,34 @@ class SettingsWindow(xbmcgui.WindowXMLDialog):
def onAction(self, raw_action): def onAction(self, raw_action):
# Get Focus # Get Focus
focus = self.getFocusId() focus = self.getFocusId()
action = raw_action.getId() action = raw_action.getId()
# On Left
if action == 1: if action in [LEFT]:
# if Focus is on close button # if Focus is on close button
if focus == 10003: if focus == CLOSE:
self.dispose_controls(0, True) self.dispose_controls(0, True)
self.setFocusId(3001) self.setFocusId(3001)
# if focus is on List # if focus is on List
else: else:
if self.ok_enabled: if self.ok_enabled:
self.setFocusId(10004) self.setFocusId(OK)
else: else:
self.setFocusId(10005) self.setFocusId(CANCEL)
# On Right elif action in [RIGHT]:
elif action == 2:
# if Focus is on button # if Focus is on button
if focus in [10004, 10005, 10006]: if focus in [OK, CANCEL, DEFAULT]:
self.dispose_controls(0, True) self.dispose_controls(0, True)
self.setFocusId(3001) self.setFocusId(3001)
# if focus is on List # if focus is on List
else: else:
self.setFocusId(10003) self.setFocusId(CLOSE)
# On Down elif action in [DOWN]:
elif action == 4:
# if focus is on List # if focus is on List
if focus not in [10004, 10005, 10006]: if focus not in [OK, CANCEL, DEFAULT]:
try: try:
focus_control = [self.visible_controls.index(c) for c in self.visible_controls if c["control"].getId() == self.getFocus().getId()][0] focus_control = [self.visible_controls.index(c) for c in self.visible_controls if c["control"].getId() == self.getFocus().getId()][0]
focus_control += 1 focus_control += 1
@@ -751,20 +770,9 @@ class SettingsWindow(xbmcgui.WindowXMLDialog):
self.dispose_controls(focus_control, True) self.dispose_controls(focus_control, True)
# Else navigate on main buttons elif action in [UP]:
elif focus in [10004]:
self.setFocusId(10005)
elif focus in [10005]:
if self.default_enabled: self.setFocusId(10006)
elif self.ok_enabled: self.setFocusId(10004)
elif focus in [10006]:
if self.ok_enabled: self.setFocusId(10004)
else: self.setFocusId(10005)
# On Up
elif action == 3:
# if focus is on List # if focus is on List
if focus not in [10003, 10004, 10005, 10006]: if focus not in [CLOSE, OK, CANCEL, DEFAULT]:
try: try:
focus_control = \ focus_control = \
[self.visible_controls.index(c) for c in self.visible_controls if c["control"].getId() == self.getFocus().getId()][0] [self.visible_controls.index(c) for c in self.visible_controls if c["control"].getId() == self.getFocus().getId()][0]
@@ -782,35 +790,19 @@ class SettingsWindow(xbmcgui.WindowXMLDialog):
self.dispose_controls(focus_control, True) self.dispose_controls(focus_control, True)
# Else navigate on main buttons elif action in [SCROLLDOWN]:
elif focus in [10004]:
if self.default_enabled: self.setFocusId(10006)
else: self.setFocusId(10005)
elif focus in [10005]:
if self.ok_enabled: self.setFocusId(10004)
elif self.default_enabled: self.setFocusId(10006)
elif focus in [10006]:
self.setFocusId(10005)
# Accion 104: Scroll Down
elif action == 104:
self.dispose_controls(self.index - 1) self.dispose_controls(self.index - 1)
# Accion 105: Scroll Up elif action in [SCROLLUP]:
elif action == 105:
self.dispose_controls(self.index + 1) self.dispose_controls(self.index + 1)
# ACTION_PREVIOUS_MENU 10 elif action in [BACK, PREVIOUS]:
# ACTION_NAV_BACK 92
elif action in [10, 92]:
self.close() self.close()
elif action == 501: elif action in [GESTUREBEGIN]:
self.xx = int(raw_action.getAmount2()) self.xx = int(raw_action.getAmount2())
elif action == 504: elif action in [GESTUREPAN]:
if self.xx > raw_action.getAmount2(): if self.xx > raw_action.getAmount2():
if old_div((self.xx - int(raw_action.getAmount2())), self.height_control): if old_div((self.xx - int(raw_action.getAmount2())), self.height_control):
+135 -118
View File
@@ -2,129 +2,146 @@
<window> <window>
<allowoverlays>false</allowoverlays> <allowoverlays>false</allowoverlays>
<animation type="WindowOpen" reversible="false"> <animation type="WindowOpen" reversible="false">
<effect type="slide" start="0,200" end="0,0" center="640,225" delay="160" tween="cubic" time="200" /> <effect type="slide" start="0,200" end="0,0" center="640,225" delay="160" tween="cubic" time="200" />
<effect type="fade" delay="160" end="100" time="240" /> <effect type="fade" delay="160" end="100" time="240" />
</animation> </animation>
<animation type="WindowClose" reversible="false"> <animation type="WindowClose" reversible="false">
<effect type="slide" start="0,0" end="0,200" center="640,225" easing="in" tween="cubic" time="200" /> <effect type="slide" start="0,0" end="0,200" center="640,225" easing="in" tween="cubic" time="200" />
<effect type="fade" start="100" end="0" time="240" /> <effect type="fade" start="100" end="0" time="240" />
</animation> </animation>
<controls> <controls>
<!-- Background --> <control type="group" id="100">
<control type="group" id="10001"> <description>Background</description>
<left>0</left>
<top>0</top>
<width>100%</width>
<height>100%</height>
<control type="image">
<width>100%</width>
<height>100%</height>
<texture colordiffuse="FF232323">white.png</texture>
</control>
<!-- Divider -->
<control type="image">
<top>80</top>
<right>0</right>
<width>100%</width>
<height>1</height>
<texture colordiffuse="33FFFFFF">white.png</texture>
</control>
<!-- Header -->
<control type="label" id="10002">
<top>20</top>
<left>70</left>
<height>40</height>
<width>80%</width>
<font>font30_title</font>
<textcolor>FFFFFFFF</textcolor>
<align>left</align>
<aligny>center</aligny>
<label>$ADDON[plugin.video.kod 70000]</label>
</control>
<!-- CLOSE BUTTON -->
<control type="button" id="10003">
<right>30</right>
<top>20</top>
<width>40</width>
<height>40</height>
<texturefocus colordiffuse="FFFFFFFF">close.png</texturefocus>
<texturenofocus colordiffuse="55FFFFFF">close.png</texturenofocus>
</control>
<!-- OK -->
<control type="button" id="10004">
<left>60</left>
<top>120</top>
<width>200</width>
<height>60</height>
<textwidth>110</textwidth>
<textcolor>FFFFFFFF</textcolor>
<texturefocus colordiffuse="FF0081C2">white.png</texturefocus>
<texturenofocus colordiffuse="FF191919">white.png</texturenofocus>
<align>center</align>
<aligny>center</aligny>
<label>$ADDON[plugin.video.kod 70001]</label>
</control>
<!-- CANCEL -->
<control type="button" id="10005">
<left>60</left>
<top>190</top>
<width>200</width>
<height>60</height>
<textwidth>110</textwidth>
<textcolor>FFFFFFFF</textcolor>
<texturefocus colordiffuse="FF0081C2">white.png</texturefocus>
<texturenofocus colordiffuse="FF191919">white.png</texturenofocus>
<align>center</align>
<aligny>center</aligny>
<label>$ADDON[plugin.video.kod 70002]</label>
</control>
<!-- DEFAULT -->
<control type="button" id="10006">
<left>60</left>
<top>260</top>
<width>200</width>
<height>60</height>
<textwidth>110</textwidth>
<textcolor>FFFFFFFF</textcolor>
<texturefocus colordiffuse="FF0081C2">white.png</texturefocus>
<texturenofocus colordiffuse="FF191919">white.png</texturenofocus>
<align>center</align>
<aligny>center</aligny>
<label>$ADDON[plugin.video.kod 70003]</label>
</control>
<!-- Parameters -->
<control type="group" id="10007">
<top>120</top>
<left>300</left>
<width>900</width>
<height>680</height>
<control type="label" id="100010">
<top>0</top>
<left>0</left> <left>0</left>
<width>900</width> <top>0</top>
<height>580</height> <width>100%</width>
<font>font20</font> <height>100%</height>
<textcolor>FFFFFFFF</textcolor> <control type="image">
<align>center</align> <width>100%</width>
<aligny>center</aligny> <height>100%</height>
<label>$ADDON[plugin.video.kod 70004]</label> <texture colordiffuse="FF232323">white.png</texture>
</control> </control>
<control type="label" id="101">
<description>Header</description>
<top>20</top>
<left>70</left>
<height>40</height>
<width>80%</width>
<font>font13</font>
<textcolor>FFFFFFFF</textcolor>
<align>left</align>
<aligny>center</aligny>
<label>[B]ADDON[plugin.video.kod 70000][/B]</label>
</control>
<control type="button" id="102">
<description>Close</description>
<right>25</right>
<top>15</top>
<width>50</width>
<height>50</height>
<texturefocus colordiffuse="FFFFFFFF">close.png</texturefocus>
<texturenofocus colordiffuse="55FFFFFF">close.png</texturenofocus>
</control>
<control type="image">
<description>Divider</description>
<top>80</top>
<right>0</right>
<width>100%</width>
<height>1</height>
<texture colordiffuse="33FFFFFF">white.png</texture>
</control>
<control type='grouplist'>
<description>Button Group</description>
<top>120</top>
<left>60</left>
<height>200</height>
<width>200</width>
<itemgap>10</itemgap>
<control type="button" id="103">
<description>Ok</description>
<left>0</left>
<top>0</top>
<width>100%</width>
<height>60</height>
<textwidth>110</textwidth>
<textcolor>FFFFFFFF</textcolor>
<texturefocus colordiffuse="FF0081C2">white.png</texturefocus>
<texturenofocus colordiffuse="FF191919">white.png</texturenofocus>
<align>center</align>
<aligny>center</aligny>
<label>$ADDON[plugin.video.kod 70001]</label>
</control>
<control type="button" id="104">
<description>Cancel</description>
<left>0</left>
<top>0</top>
<width>100%</width>
<height>60</height>
<textwidth>110</textwidth>
<textcolor>FFFFFFFF</textcolor>
<texturefocus colordiffuse="FF0081C2">white.png</texturefocus>
<texturenofocus colordiffuse="FF191919">white.png</texturenofocus>
<align>center</align>
<aligny>center</aligny>
<label>$ADDON[plugin.video.kod 70002]</label>
</control>
<control type="button" id="105">
<description>Default</description>
<left>0</left>
<top>0</top>
<width>100%</width>
<height>60</height>
<textwidth>110</textwidth>
<textcolor>FFFFFFFF</textcolor>
<texturefocus colordiffuse="FF0081C2">white.png</texturefocus>
<texturenofocus colordiffuse="FF191919">white.png</texturenofocus>
<align>center</align>
<aligny>center</aligny>
<label>$ADDON[plugin.video.kod 70003]</label>
</control>
</control>
<control type="group" id="106">
<description>Parameters</description>
<top>120</top>
<left>300</left>
<width>900</width>
<height>680</height>
<control type="label" id="109">
<description>Loading</description>
<top>0</top>
<left>0</left>
<width>100%</width>
<height>80%</height>
<font>font13</font>
<textcolor>FFFFFFFF</textcolor>
<align>center</align>
<aligny>center</aligny>
<label>$ADDON[plugin.video.kod 70004]</label>
</control>
</control>
<control type='group'>
<description>Scrollbar</description>
<top>120</top>
<right>0</right>
<width>10</width>
<height>540</height>
<control type="image" id="107">
<description>Scrollbar Background</description>
<top>0</top>
<right>0</right>
<width>100%</width>
<height>100%</height>
<texture border="2" colordiffuse="11FFFFFF">white.png</texture>
</control>
<control type="image" id="108">
<description>Scrollbar Foregrund</description>
<top>0</top>
<right>0</right>
<width>100%</width>
<height>100%</height>
<texture border="2" colordiffuse="33FFFFFF">white.png</texture>
</control>
</control>
</control> </control>
<!-- Scrollbar -->
<control type="image" id="10008">
<top>120</top>
<right>0</right>
<width>10</width>
<height>540</height>
<texture border="2" colordiffuse="FF232323">white.png</texture>
</control>
<control type="image" id="10009">
<top>120</top>
<right>0</right>
<width>10</width>
<height>540</height>
<texture border="2" colordiffuse="33FFFFFF">white.png</texture>
</control>
</control>
</controls> </controls>
</window> </window>
@@ -54,19 +54,19 @@
<label/> <label/>
</control> </control>
<control type="image"> <control type="image">
<description>Separator</description> <description>Divider</description>
<top>80</top> <top>80</top>
<left>0</left> <left>0</left>
<height>1</height> <height>1</height>
<width>480</width> <width>480</width>
<texture colordiffuse="FFFFFFFF">white.png</texture> <texture colordiffuse="33FFFFFF">white.png</texture>
</control> </control>
<control type="button" id="103"> <control type="button" id="103">
<description>CLOSE</description> <description>CLOSE</description>
<top>20</top> <top>10</top>
<right>20</right> <right>35</right>
<height>40</height> <height>50</height>
<width>40</width> <width>50</width>
<texturefocus colordiffuse="FFFFFFFF">close.png</texturefocus> <texturefocus colordiffuse="FFFFFFFF">close.png</texturefocus>
<texturenofocus colordiffuse="88FFFFFF">close.png</texturenofocus> <texturenofocus colordiffuse="88FFFFFF">close.png</texturenofocus>
<ondown>101</ondown> <ondown>101</ondown>
@@ -86,8 +86,8 @@
<textcolor>FFFFFFFF</textcolor> <textcolor>FFFFFFFF</textcolor>
<aligny>center</aligny> <aligny>center</aligny>
<align>center</align> <align>center</align>
<texturefocus border="10" colordiffuse="22FFFFFF">white.png</texturefocus> <texturefocus colordiffuse="FF0081C2">white.png</texturefocus>
<texturenofocus border="10"></texturenofocus> <texturenofocus colordiffuse="FF191919">white.png</texturenofocus>
</control> </control>
<control type="button" id="102"> <control type="button" id="102">
<description>ID</description> <description>ID</description>
@@ -96,8 +96,8 @@
<textcolor>FFFFFFFF</textcolor> <textcolor>FFFFFFFF</textcolor>
<aligny>center</aligny> <aligny>center</aligny>
<align>center</align> <align>center</align>
<texturefocus border="10" colordiffuse="22FFFFFF">white.png</texturefocus> <texturefocus colordiffuse="FF0081C2">white.png</texturefocus>
<texturenofocus border="10"></texturenofocus> <texturenofocus colordiffuse="FF191919">white.png</texturenofocus>
</control> </control>
</control> </control>
</control> </control>
+2 -240
View File
@@ -3,15 +3,11 @@
# Configuracion # Configuracion
# ------------------------------------------------------------ # ------------------------------------------------------------
from __future__ import division
#from builtins import str
import sys import sys
PY3 = False PY3 = False
if sys.version_info[0] >= 3: PY3 = True; unicode = str; unichr = chr; long = int if sys.version_info[0] >= 3: PY3 = True; unicode = str; unichr = chr; long = int
from builtins import range from builtins import range
from past.utils import old_div
from channelselector import get_thumb
from core import filetools, servertools from core import filetools, servertools
from core.item import Item from core.item import Item
from platformcode import config, logger, platformtools from platformcode import config, logger, platformtools
@@ -19,222 +15,14 @@ from platformcode import config, logger, platformtools
CHANNELNAME = "setting" CHANNELNAME = "setting"
def menu_channels(item):
logger.debug()
itemlist = list()
itemlist.append(Item(channel=CHANNELNAME, title=config.get_localized_string(60545), action="conf_tools", folder=False,
extra="channels_onoff", thumbnail=get_thumb("setting_0.png")))
itemlist.append(Item(channel=CHANNELNAME, title=config.get_localized_string(60546) + ":", action="", folder=False,
text_bold = True, thumbnail=get_thumb("setting_0.png")))
# Home - Configurable channels
import channelselector
from core import channeltools
channel_list = channelselector.filterchannels("all")
for channel in channel_list:
if not channel.channel:
continue
channel_parameters = channeltools.get_channel_parameters(channel.channel)
if channel_parameters["has_settings"]:
itemlist.append(Item(channel=CHANNELNAME, title=". " + config.get_localized_string(60547) % channel.title,
action="channel_config", config=channel.channel, folder=False,
thumbnail=channel.thumbnail))
# End - Configurable channels
itemlist.append(Item(channel=CHANNELNAME, action="", title="", folder=False, thumbnail=get_thumb("setting_0.png")))
itemlist.append(Item(channel=CHANNELNAME, title=config.get_localized_string(60548) + ":", action="", folder=False,
text_bold=True, thumbnail=get_thumb("channels.png")))
itemlist.append(Item(channel=CHANNELNAME, title=". " + config.get_localized_string(60549), action="conf_tools",
folder=True, extra="lib_check_datajson", thumbnail=get_thumb("channels.png")))
return itemlist
def channel_config(item): def channel_config(item):
return platformtools.show_channel_settings(channelpath=filetools.join(config.get_runtime_path(), "channels", item.config)) return platformtools.show_channel_settings(channelpath=filetools.join(config.get_runtime_path(), "channels", item.config))
# def setting_torrent(item):
# logger.debug()
# LIBTORRENT_PATH = config.get_setting("libtorrent_path", server="torrent", default="")
# LIBTORRENT_ERROR = config.get_setting("libtorrent_error", server="torrent", default="")
# default = config.get_setting("torrent_client", server="torrent", default=0)
# BUFFER = config.get_setting("mct_buffer", server="torrent", default="50")
# DOWNLOAD_PATH = config.get_setting("mct_download_path", server="torrent", default=config.get_setting("downloadpath"))
# if not DOWNLOAD_PATH: DOWNLOAD_PATH = filetools.join(config.get_data_path(), 'downloads')
# BACKGROUND = config.get_setting("mct_background_download", server="torrent", default=True)
# RAR = config.get_setting("mct_rar_unpack", server="torrent", default=True)
# DOWNLOAD_LIMIT = config.get_setting("mct_download_limit", server="torrent", default="")
# BUFFER_BT = config.get_setting("bt_buffer", server="torrent", default="50")
# DOWNLOAD_PATH_BT = config.get_setting("bt_download_path", server="torrent", default=config.get_setting("downloadpath"))
# if not DOWNLOAD_PATH_BT: DOWNLOAD_PATH_BT = filetools.join(config.get_data_path(), 'downloads')
# MAGNET2TORRENT = config.get_setting("magnet2torrent", server="torrent", default=False)
# torrent_options = [config.get_localized_string(30006), config.get_localized_string(70254), config.get_localized_string(70255)]
# torrent_options.extend(platformtools.torrent_client_installed())
# list_controls = [
# {
# "id": "libtorrent_path",
# "type": "text",
# "label": "Libtorrent path",
# "default": LIBTORRENT_PATH,
# "enabled": True,
# "visible": False
# },
# {
# "id": "libtorrent_error",
# "type": "text",
# "label": "libtorrent error",
# "default": LIBTORRENT_ERROR,
# "enabled": True,
# "visible": False
# },
# {
# "id": "list_torrent",
# "type": "list",
# "label": config.get_localized_string(70256),
# "default": default,
# "enabled": True,
# "visible": True,
# "lvalues": torrent_options
# },
# {
# "id": "mct_buffer",
# "type": "text",
# "label": "MCT - " + config.get_localized_string(70758),
# "default": BUFFER,
# "enabled": True,
# "visible": "eq(-1,%s)" % torrent_options[2]
# },
# {
# "id": "mct_download_path",
# "type": "text",
# "label": "MCT - " + config.get_localized_string(30017),
# "default": DOWNLOAD_PATH,
# "enabled": True,
# "visible": "eq(-2,%s)" % torrent_options[2]
# },
# {
# "id": "bt_buffer",
# "type": "text",
# "label": "BT - " + config.get_localized_string(70758),
# "default": BUFFER_BT,
# "enabled": True,
# "visible": "eq(-3,%s)" % torrent_options[1]
# },
# {
# "id": "bt_download_path",
# "type": "text",
# "label": "BT - " + config.get_localized_string(30017),
# "default": DOWNLOAD_PATH_BT,
# "enabled": True,
# "visible": "eq(-4,%s)" % torrent_options[1]
# },
# {
# "id": "mct_download_limit",
# "type": "text",
# "label": config.get_localized_string(70759),
# "default": DOWNLOAD_LIMIT,
# "enabled": True,
# "visible": "eq(-5,%s) | eq(-5,%s)" % (torrent_options[1], torrent_options[2])
# },
# {
# "id": "mct_rar_unpack",
# "type": "bool",
# "label": config.get_localized_string(70760),
# "default": RAR,
# "enabled": True,
# "visible": True
# },
# {
# "id": "mct_background_download",
# "type": "bool",
# "label": config.get_localized_string(70761),
# "default": BACKGROUND,
# "enabled": True,
# "visible": True
# },
# {
# "id": "magnet2torrent",
# "type": "bool",
# "label": config.get_localized_string(70762),
# "default": MAGNET2TORRENT,
# "enabled": True,
# "visible": True
# }
# ]
# platformtools.show_channel_settings(list_controls=list_controls, callback='save_setting_torrent', item=item,
# caption=config.get_localized_string(70257), custom_button={'visible': False})
# def save_setting_torrent(item, dict_data_saved):
# if dict_data_saved and "list_torrent" in dict_data_saved:
# config.set_setting("torrent_client", dict_data_saved["list_torrent"], server="torrent")
# if dict_data_saved and "mct_buffer" in dict_data_saved:
# config.set_setting("mct_buffer", dict_data_saved["mct_buffer"], server="torrent")
# if dict_data_saved and "mct_download_path" in dict_data_saved:
# config.set_setting("mct_download_path", dict_data_saved["mct_download_path"], server="torrent")
# if dict_data_saved and "mct_background_download" in dict_data_saved:
# config.set_setting("mct_background_download", dict_data_saved["mct_background_download"], server="torrent")
# if dict_data_saved and "mct_rar_unpack" in dict_data_saved:
# config.set_setting("mct_rar_unpack", dict_data_saved["mct_rar_unpack"], server="torrent")
# if dict_data_saved and "mct_download_limit" in dict_data_saved:
# config.set_setting("mct_download_limit", dict_data_saved["mct_download_limit"], server="torrent")
# if dict_data_saved and "bt_buffer" in dict_data_saved:
# config.set_setting("bt_buffer", dict_data_saved["bt_buffer"], server="torrent")
# if dict_data_saved and "bt_download_path" in dict_data_saved:
# config.set_setting("bt_download_path", dict_data_saved["bt_download_path"], server="torrent")
# if dict_data_saved and "magnet2torrent" in dict_data_saved:
# config.set_setting("magnet2torrent", dict_data_saved["magnet2torrent"], server="torrent")
def menu_servers(item):
logger.debug()
itemlist = list()
itemlist.append(Item(channel=CHANNELNAME, title=config.get_localized_string(60550), action="servers_blacklist", folder=False,
thumbnail=get_thumb("setting_0.png")))
itemlist.append(Item(channel=CHANNELNAME, title=config.get_localized_string(60551),
action="servers_favorites", folder=False, thumbnail=get_thumb("setting_0.png")))
itemlist.append(Item(channel=CHANNELNAME, title=config.get_localized_string(60552),
action="", folder=False, text_bold = True, thumbnail=get_thumb("setting_0.png")))
# Home - Configurable servers
server_list = list(servertools.get_debriders_list().keys())
for server in server_list:
server_parameters = servertools.get_server_parameters(server)
if server_parameters["has_settings"]:
itemlist.append(
Item(channel=CHANNELNAME, title = ". " + config.get_localized_string(60553) % server_parameters["name"],
action="server_debrid_config", config=server, folder=False, thumbnail=""))
itemlist.append(Item(channel=CHANNELNAME, title=config.get_localized_string(60554),
action="", folder=False, text_bold = True, thumbnail=get_thumb("setting_0.png")))
server_list = list(servertools.get_servers_list().keys())
for server in sorted(server_list):
server_parameters = servertools.get_server_parameters(server)
logger.debug(server_parameters)
if server_parameters["has_settings"] and [x for x in server_parameters["settings"] if x["id"] not in ["black_list", "white_list"]]:
itemlist.append(
Item(channel=CHANNELNAME, title=". " + config.get_localized_string(60553) % server_parameters["name"],
action="server_config", config=server, folder=False, thumbnail=""))
# End - Configurable servers
return itemlist
def server_config(item): def server_config(item):
return platformtools.show_channel_settings(channelpath=filetools.join(config.get_runtime_path(), "servers", item.config)) return platformtools.show_channel_settings(channelpath=filetools.join(config.get_runtime_path(), "servers", item.config))
def server_debrid_config(item): def server_debrid_config(item):
return platformtools.show_channel_settings(channelpath=filetools.join(config.get_runtime_path(), "servers", "debriders", item.config)) return platformtools.show_channel_settings(channelpath=filetools.join(config.get_runtime_path(), "servers", "debriders", item.config))
@@ -252,7 +40,6 @@ def servers_blacklist(item):
defaults = servertools.get_server_parameters(server) defaults = servertools.get_server_parameters(server)
control = server_parameters["name"] control = server_parameters["name"]
# control.setArt({'thumb:': server_parameters['thumb'] if 'thumb' in server_parameters else config.get_online_server_thumb(server)})
if not config.get_setting("black_list", server=server): if not config.get_setting("black_list", server=server):
list_controls.append(control) list_controls.append(control)
if defaults.get("black_list", False) or server in black_list: if defaults.get("black_list", False) or server in black_list:
@@ -261,23 +48,10 @@ def servers_blacklist(item):
ris = platformtools.dialog_multiselect(config.get_localized_string(60550), list_controls, preselect=blacklisted) ris = platformtools.dialog_multiselect(config.get_localized_string(60550), list_controls, preselect=blacklisted)
if ris is not None: if ris is not None:
cb_servers_blacklist({list_servers[n]: True if n in ris else False for n, it in enumerate(list_controls)}) cb_servers_blacklist({list_servers[n]: True if n in ris else False for n, it in enumerate(list_controls)})
# return platformtools.show_channel_settings(list_controls=list_controls, dict_values=dict_values, caption=config.get_localized_string(60550), callback="cb_servers_blacklist")
def cb_servers_blacklist(dict_values): def cb_servers_blacklist(dict_values):
blaklisted = [k for k in dict_values.keys()] blaklisted = [k for k in dict_values.keys()]
# progreso = platformtools.dialog_progress(config.get_localized_string(60557), config.get_localized_string(60558))
# n = len(dict_values)
# i = 1
# for k, v in list(dict_values.items()):
# if v: # If the server is blacklisted it cannot be in the favorites list
# config.set_setting("favorites_servers_list", 0, server=k)
# blaklisted.append(k)
# progreso.update(old_div((i * 100), n), config.get_localized_string(60559) % k)
# i += 1
# config.set_setting("black_list", blaklisted, server='servers')
# progreso.close()
def servers_favorites(item): def servers_favorites(item):
@@ -314,7 +88,7 @@ def servers_favorites(item):
orden = favorites.index(server) + 1 orden = favorites.index(server) + 1
dict_values[orden] = len(server_names) - 1 dict_values[orden] = len(server_names) - 1
for x in range(1, 12): for x in range(1, 21):
control = {'id': x, control = {'id': x,
'type': 'list', 'type': 'list',
'label': config.get_localized_string(60597) % x, 'label': config.get_localized_string(60597) % x,
@@ -368,18 +142,6 @@ def check_quickfixes(item):
return False return False
# def update_quasar(item):
# logger.debug()
# from platformcode import custom_code, platformtools
# stat = False
# stat = custom_code.update_external_addon("quasar")
# if stat:
# platformtools.dialog_notification("Actualización Quasar", "Realizada con éxito")
# else:
# platformtools.dialog_notification("Actualización Quasar", "Ha fallado. Consulte el log")
def conf_tools(item): def conf_tools(item):
logger.debug() logger.debug()
+4 -2
View File
@@ -84,14 +84,16 @@ def list_directors(item):
videolibrarydb.close() videolibrarydb.close()
directors = [] directors = []
director_images = []
for v in videos: for v in videos:
directors += v['item'].infoLabels['director'].split(',') directors += v['item'].infoLabels['director'].split(',')
director_images += v['item'].infoLabels['director_image']
itemlist = [] itemlist = []
for d in directors: for i, d in enumerate(directors):
d = d.strip() d = d.strip()
if d and d[0][0] == item.title and d not in [it.director for it in itemlist]: if d and d[0][0] == item.title and d not in [it.director for it in itemlist]:
it = item.clone(title = d, action='list_{}s'.format(item.contentType), director=d) it = item.clone(title = d, action='list_{}s'.format(item.contentType), director=d, thumbnail=director_images[i])
itemlist.append(it) itemlist.append(it)
itemlist.sort(key=lambda it: it.director) itemlist.sort(key=lambda it: it.director)