Dialog: manual PMS entry
This commit is contained in:
parent
7a9e0611ed
commit
d1346b2cd6
4 changed files with 61 additions and 34 deletions
|
@ -83,10 +83,35 @@ msgctxt "#30017"
|
||||||
msgid "Unauthorized for PMS"
|
msgid "Unauthorized for PMS"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
# Title of dialog for manual PMS connection
|
||||||
|
msgctxt "#30018"
|
||||||
|
msgid "Manually connect to PMS"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
# Button text for connect dialog
|
||||||
|
msgctxt "#30019"
|
||||||
|
msgid "PMS IP address or host name"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
# Button text for connect dialog
|
||||||
|
msgctxt "#30020"
|
||||||
|
msgid "Connect"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
# Button text for connect dialog
|
||||||
|
msgctxt "#30021"
|
||||||
|
msgid "Please fill in both server and port"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgctxt "#30022"
|
msgctxt "#30022"
|
||||||
msgid "Advanced"
|
msgid "Advanced"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
# Used to show that PKC is currently trying to connect to a PMS
|
||||||
|
msgctxt "#30023"
|
||||||
|
msgid "Connecting to"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgctxt "#30024"
|
msgctxt "#30024"
|
||||||
msgid "Username"
|
msgid "Username"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -96,7 +121,7 @@ msgid "Display message if PMS goes offline"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
msgctxt "#30030"
|
msgctxt "#30030"
|
||||||
msgid "Port Number"
|
msgid "Port number"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
msgctxt "#30031"
|
msgctxt "#30031"
|
||||||
|
|
|
@ -160,7 +160,7 @@ class ConnectManager(object):
|
||||||
dia.set_connect_manager(self.__connect)
|
dia.set_connect_manager(self.__connect)
|
||||||
dia.doModal()
|
dia.doModal()
|
||||||
|
|
||||||
if dia._is_connected():
|
if dia.is_connected():
|
||||||
return dia.get_server()
|
return dia.get_server()
|
||||||
else:
|
else:
|
||||||
raise RuntimeError("Server is not connected")
|
raise RuntimeError("Server is not connected")
|
||||||
|
|
|
@ -1,18 +1,17 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
###############################################################################
|
###############################################################################
|
||||||
from logging import getLogger
|
from logging import getLogger
|
||||||
import os
|
from os.path import join
|
||||||
|
|
||||||
import xbmcgui
|
import xbmcgui
|
||||||
import xbmcaddon
|
|
||||||
|
|
||||||
import connect.connectionmanager as connectionmanager
|
import connect.connectionmanager as connectionmanager
|
||||||
from utils import language as lang
|
from utils import language as lang, tryEncode
|
||||||
|
import variables as v
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
log = getLogger("PLEX."+__name__)
|
log = getLogger("PLEX."+__name__)
|
||||||
addon = xbmcaddon.Addon('plugin.video.plexkodiconnect')
|
|
||||||
|
|
||||||
CONN_STATE = connectionmanager.CONNECTIONSTATE
|
CONN_STATE = connectionmanager.CONNECTIONSTATE
|
||||||
ACTION_PARENT_DIR = 9
|
ACTION_PARENT_DIR = 9
|
||||||
|
@ -54,10 +53,10 @@ class ServerManual(xbmcgui.WindowXMLDialog):
|
||||||
self.cancel_button = self.getControl(CANCEL)
|
self.cancel_button = self.getControl(CANCEL)
|
||||||
self.error_toggle = self.getControl(ERROR_TOGGLE)
|
self.error_toggle = self.getControl(ERROR_TOGGLE)
|
||||||
self.error_msg = self.getControl(ERROR_MSG)
|
self.error_msg = self.getControl(ERROR_MSG)
|
||||||
self.host_field = self._add_editcontrol(725, 400, 40, 500)
|
self.host_field = self._add_editcontrol(725, 325, 40, 500)
|
||||||
self.port_field = self._add_editcontrol(725, 525, 40, 500)
|
self.port_field = self._add_editcontrol(725, 450, 40, 500)
|
||||||
|
|
||||||
self.port_field.setText('8096')
|
self.port_field.setText('32400')
|
||||||
self.setFocus(self.host_field)
|
self.setFocus(self.host_field)
|
||||||
|
|
||||||
self.host_field.controlUp(self.cancel_button)
|
self.host_field.controlUp(self.cancel_button)
|
||||||
|
@ -78,7 +77,7 @@ class ServerManual(xbmcgui.WindowXMLDialog):
|
||||||
|
|
||||||
if not server or not port:
|
if not server or not port:
|
||||||
# Display error
|
# Display error
|
||||||
self._error(ERROR['Empty'], lang(30617))
|
self._error(ERROR['Empty'], lang(30021))
|
||||||
log.error("Server or port cannot be null")
|
log.error("Server or port cannot be null")
|
||||||
|
|
||||||
elif self._connect_to_server(server, port):
|
elif self._connect_to_server(server, port):
|
||||||
|
@ -97,14 +96,14 @@ class ServerManual(xbmcgui.WindowXMLDialog):
|
||||||
self.close()
|
self.close()
|
||||||
|
|
||||||
def _add_editcontrol(self, x, y, height, width):
|
def _add_editcontrol(self, x, y, height, width):
|
||||||
|
media = tryEncode(join(
|
||||||
media = os.path.join(addon.getAddonInfo('path'), 'resources', 'skins', 'default', 'media')
|
v.ADDON_PATH, 'resources', 'skins', 'default', 'media'))
|
||||||
control = xbmcgui.ControlEdit(0, 0, 0, 0,
|
control = xbmcgui.ControlEdit(0, 0, 0, 0,
|
||||||
label="User",
|
label="User",
|
||||||
font="font10",
|
font="font10",
|
||||||
textColor="ffc2c2c2",
|
textColor="ffc2c2c2",
|
||||||
focusTexture=os.path.join(media, "button-focus.png"),
|
focusTexture=join(media, "button-focus.png"),
|
||||||
noFocusTexture=os.path.join(media, "button-focus.png"))
|
noFocusTexture=join(media, "button-focus.png"))
|
||||||
control.setPosition(x, y)
|
control.setPosition(x, y)
|
||||||
control.setHeight(height)
|
control.setHeight(height)
|
||||||
control.setWidth(width)
|
control.setWidth(width)
|
||||||
|
@ -115,11 +114,11 @@ class ServerManual(xbmcgui.WindowXMLDialog):
|
||||||
def _connect_to_server(self, server, port):
|
def _connect_to_server(self, server, port):
|
||||||
|
|
||||||
server_address = "%s:%s" % (server, port)
|
server_address = "%s:%s" % (server, port)
|
||||||
self._message("%s %s..." % (lang(30610), server_address))
|
self._message("%s %s..." % (lang(30023), server_address))
|
||||||
result = self.connect_manager.connectToAddress(server_address)
|
result = self.connect_manager.connectToAddress(server_address)
|
||||||
|
|
||||||
if result['State'] == CONN_STATE['Unavailable']:
|
if result['State'] == CONN_STATE['Unavailable']:
|
||||||
self._message(lang(30609))
|
self._message(lang(30204))
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
self._server = result['Servers'][0]
|
self._server = result['Servers'][0]
|
||||||
|
|
|
@ -43,34 +43,37 @@
|
||||||
</control>
|
</control>
|
||||||
|
|
||||||
<control type="image">
|
<control type="image">
|
||||||
<description>Emby logo</description>
|
<description>Plex logo</description>
|
||||||
<texture>logo-white.png</texture>
|
<texture>logo-white.png</texture>
|
||||||
<aspectratio>keep</aspectratio>
|
<aspectratio>keep</aspectratio>
|
||||||
<width>120</width>
|
<width>120</width>
|
||||||
<height>49</height>
|
<height>49</height>
|
||||||
<top>30</top>
|
<top>20</top>
|
||||||
<left>25</left>
|
<left>0</left>
|
||||||
|
<aligny>left</aligny>
|
||||||
|
<align>left</align>
|
||||||
</control>
|
</control>
|
||||||
|
|
||||||
<control type="group">
|
<control type="group">
|
||||||
<width>500</width>
|
<width>500</width>
|
||||||
<left>50</left>
|
<left>50</left>
|
||||||
<control type="label">
|
<control type="label">
|
||||||
<description>Connect to server</description>
|
<description>Connect to PMS</description>
|
||||||
<label>$ADDON[plugin.video.emby 30614]</label>
|
<label>$ADDON[plugin.video.plexkodiconnect 30018]</label>
|
||||||
<textcolor>white</textcolor>
|
<textcolor>white</textcolor>
|
||||||
<font>font12</font>
|
<font>font12</font>
|
||||||
<aligny>top</aligny>
|
<aligny>top</aligny>
|
||||||
<align>center</align>
|
<align>left</align>
|
||||||
<width>100%</width>
|
<width>100%</width>
|
||||||
<top>100</top>
|
<top>30</top>
|
||||||
|
<left>60</left>
|
||||||
</control>
|
</control>
|
||||||
|
|
||||||
<control type="group">
|
<control type="group">
|
||||||
<top>150</top>
|
<top>75</top>
|
||||||
<control type="label">
|
<control type="label">
|
||||||
<description>Host</description>
|
<description>PMS IP address or host name</description>
|
||||||
<label>$ADDON[plugin.video.emby 30615]</label>
|
<label>$ADDON[plugin.video.plexkodiconnect 30019]</label>
|
||||||
<textcolor>ffa6a6a6</textcolor>
|
<textcolor>ffa6a6a6</textcolor>
|
||||||
<font>font10</font>
|
<font>font10</font>
|
||||||
<aligny>top</aligny>
|
<aligny>top</aligny>
|
||||||
|
@ -87,7 +90,7 @@
|
||||||
|
|
||||||
<control type="label">
|
<control type="label">
|
||||||
<description>Host example</description>
|
<description>Host example</description>
|
||||||
<label>192.168.1.100 or https://myserver.com</label>
|
<label>https://192.168.1.2, https://myserver.com</label>
|
||||||
<textcolor>ff464646</textcolor>
|
<textcolor>ff464646</textcolor>
|
||||||
<font>font10</font>
|
<font>font10</font>
|
||||||
<aligny>top</aligny>
|
<aligny>top</aligny>
|
||||||
|
@ -97,10 +100,10 @@
|
||||||
|
|
||||||
<control type="group">
|
<control type="group">
|
||||||
<description>Port</description>
|
<description>Port</description>
|
||||||
<top>275</top>
|
<top>200</top>
|
||||||
<control type="label">
|
<control type="label">
|
||||||
<description>Port label</description>
|
<description>Port Number</description>
|
||||||
<label>$ADDON[plugin.video.emby 30030]</label>
|
<label>$ADDON[plugin.video.plexkodiconnect 30030]</label>
|
||||||
<textcolor>ffa6a6a6</textcolor>
|
<textcolor>ffa6a6a6</textcolor>
|
||||||
<font>font10</font>
|
<font>font10</font>
|
||||||
<aligny>top</aligny>
|
<aligny>top</aligny>
|
||||||
|
@ -121,9 +124,9 @@
|
||||||
<top>380</top>
|
<top>380</top>
|
||||||
<control type="button" id="200">
|
<control type="button" id="200">
|
||||||
<description>Connect</description>
|
<description>Connect</description>
|
||||||
<texturenofocus border="5" colordiffuse="ff0b8628">box.png</texturenofocus>
|
<texturenofocus border="5" colordiffuse="ff464646">box.png</texturenofocus>
|
||||||
<texturefocus border="5" colordiffuse="ff13a134">box.png</texturefocus>
|
<texturefocus border="5" colordiffuse="ff525252">box.png</texturefocus>
|
||||||
<label>[UPPERCASE][B]$ADDON[plugin.video.emby 30616][/B][/UPPERCASE]</label>
|
<label>$ADDON[plugin.video.plexkodiconnect 30020]</label>
|
||||||
<font>font10</font>
|
<font>font10</font>
|
||||||
<textcolor>ffa6a6a6</textcolor>
|
<textcolor>ffa6a6a6</textcolor>
|
||||||
<focusedcolor>white</focusedcolor>
|
<focusedcolor>white</focusedcolor>
|
||||||
|
@ -137,7 +140,7 @@
|
||||||
<description>Cancel</description>
|
<description>Cancel</description>
|
||||||
<texturenofocus border="5" colordiffuse="ff464646">box.png</texturenofocus>
|
<texturenofocus border="5" colordiffuse="ff464646">box.png</texturenofocus>
|
||||||
<texturefocus border="5" colordiffuse="ff525252">box.png</texturefocus>
|
<texturefocus border="5" colordiffuse="ff525252">box.png</texturefocus>
|
||||||
<label>[UPPERCASE][B]$ADDON[plugin.video.emby 30606][/B][/UPPERCASE]</label>
|
<label>$ADDON[plugin.video.plexkodiconnect 30602]</label>
|
||||||
<font>font10</font>
|
<font>font10</font>
|
||||||
<textcolor>ffa6a6a6</textcolor>
|
<textcolor>ffa6a6a6</textcolor>
|
||||||
<focusedcolor>white</focusedcolor>
|
<focusedcolor>white</focusedcolor>
|
Loading…
Reference in a new issue