From 481ee11301616238907e749174347a051b6a1cb4 Mon Sep 17 00:00:00 2001 From: Claus Vium Date: Sat, 2 Feb 2019 14:51:59 +0100 Subject: [PATCH] Remove Connect --- .../resource.language.de_de/strings.po | 8 - .../resource.language.en_gb/strings.po | 8 - .../resource.language.fr_fr/strings.po | 8 - .../resource.language.it_it/strings.po | 8 - .../resource.language.nl_nl/strings.po | 8 - .../resource.language.pl_pl/strings.po | 8 - resources/lib/connect.py | 40 +--- resources/lib/dialogs/__init__.py | 1 - resources/lib/dialogs/loginconnect.py | 147 ------------- resources/lib/dialogs/loginmanual.py | 2 +- resources/lib/dialogs/serverconnect.py | 13 +- resources/lib/emby/core/connection_manager.py | 34 --- resources/lib/emby/core/ws_client.py | 2 +- resources/lib/entrypoint/service.py | 3 - resources/settings.xml | 2 - .../1080i/script-jellyfin-connect-login.xml | 203 ------------------ .../1080i/script-jellyfin-connect-server.xml | 20 +- 17 files changed, 7 insertions(+), 508 deletions(-) delete mode 100644 resources/lib/dialogs/loginconnect.py delete mode 100644 resources/skins/default/1080i/script-jellyfin-connect-login.xml diff --git a/resources/language/resource.language.de_de/strings.po b/resources/language/resource.language.de_de/strings.po index 78a6e0be..13ab68da 100644 --- a/resources/language/resource.language.de_de/strings.po +++ b/resources/language/resource.language.de_de/strings.po @@ -352,10 +352,6 @@ msgctxt "#30547" msgid "Display message" msgstr "Nachricht anzeigen" -msgctxt "#30600" -msgid "Sign in with Jellyfin Connect" -msgstr "Mit Jellyfin Connect anmelden" - msgctxt "#30602" msgid "Password" msgstr "Passwort" @@ -412,10 +408,6 @@ msgctxt "#30617" msgid "Server or port cannot be empty" msgstr "Server oder Port muss eingetragen werden" -msgctxt "#30618" -msgid "Change Jellyfin Connect user" -msgstr "Jellyfin Connect Benutzer wechseln" - msgctxt "#33000" msgid "Welcome" msgstr "Willkommen" diff --git a/resources/language/resource.language.en_gb/strings.po b/resources/language/resource.language.en_gb/strings.po index ce954053..fa95164e 100644 --- a/resources/language/resource.language.en_gb/strings.po +++ b/resources/language/resource.language.en_gb/strings.po @@ -346,10 +346,6 @@ msgctxt "#30547" msgid "Display message" msgstr "" -msgctxt "#30600" -msgid "Sign in with Jellyfin Connect" -msgstr "" - msgctxt "#30602" msgid "Password" msgstr "" @@ -406,10 +402,6 @@ msgctxt "#30617" msgid "Server or port cannot be empty" msgstr "" -msgctxt "#30618" -msgid "Change Jellyfin Connect user" -msgstr "" - msgctxt "#33000" msgid "Welcome" msgstr "" diff --git a/resources/language/resource.language.fr_fr/strings.po b/resources/language/resource.language.fr_fr/strings.po index 09e453be..fab7aea9 100644 --- a/resources/language/resource.language.fr_fr/strings.po +++ b/resources/language/resource.language.fr_fr/strings.po @@ -351,10 +351,6 @@ msgctxt "#30547" msgid "Display message" msgstr "Afficher le message" -msgctxt "#30600" -msgid "Sign in with Jellyfin Connect" -msgstr "S'identifier avec Jellyfin Connect" - msgctxt "#30602" msgid "Password" msgstr "Mot de passe" @@ -411,10 +407,6 @@ msgctxt "#30617" msgid "Server or port cannot be empty" msgstr "Le serveur ou le port ne peuvent pas être vides" -msgctxt "#30618" -msgid "Change Jellyfin Connect user" -msgstr "Changer d'utilisateur Jellyfin Connect" - msgctxt "#33000" msgid "Welcome" msgstr "Bienvenue" diff --git a/resources/language/resource.language.it_it/strings.po b/resources/language/resource.language.it_it/strings.po index b5487cec..bb343b1a 100644 --- a/resources/language/resource.language.it_it/strings.po +++ b/resources/language/resource.language.it_it/strings.po @@ -350,10 +350,6 @@ msgctxt "#30547" msgid "Display message" msgstr "Mostra messggio" -msgctxt "#30600" -msgid "Sign in with Jellyfin Connect" -msgstr "Accedi con Jellyfin Connect" - msgctxt "#30602" msgid "Password" msgstr "Password" @@ -410,10 +406,6 @@ msgctxt "#30617" msgid "Server or port cannot be empty" msgstr "Server o porta non possono essere vuoti" -msgctxt "#30618" -msgid "Change Jellyfin Connect user" -msgstr "Cambia utente Jellyfin Connect" - msgctxt "#33000" msgid "Welcome" msgstr "Benvenuto" diff --git a/resources/language/resource.language.nl_nl/strings.po b/resources/language/resource.language.nl_nl/strings.po index 62f91c10..6b0a83a7 100644 --- a/resources/language/resource.language.nl_nl/strings.po +++ b/resources/language/resource.language.nl_nl/strings.po @@ -350,10 +350,6 @@ msgctxt "#30547" msgid "Display message" msgstr "Melding tonen" -msgctxt "#30600" -msgid "Sign in with Jellyfin Connect" -msgstr "Aanmelden met Jellyfin Connect" - msgctxt "#30602" msgid "Password" msgstr "Wachtwoord" @@ -410,10 +406,6 @@ msgctxt "#30617" msgid "Server or port cannot be empty" msgstr "Server of poort kan niet leeg zijn" -msgctxt "#30618" -msgid "Change Jellyfin Connect user" -msgstr "Jellyfin Connect gebruiker wijzigen" - msgctxt "#33000" msgid "Welcome" msgstr "Welkom" diff --git a/resources/language/resource.language.pl_pl/strings.po b/resources/language/resource.language.pl_pl/strings.po index 314f76ef..eccb5b3a 100644 --- a/resources/language/resource.language.pl_pl/strings.po +++ b/resources/language/resource.language.pl_pl/strings.po @@ -350,10 +350,6 @@ msgctxt "#30547" msgid "Display message" msgstr "Wyświetl wiadomość" -msgctxt "#30600" -msgid "Sign in with Jellyfin Connect" -msgstr "Zaloguj z Jellyfin Connect" - msgctxt "#30602" msgid "Password" msgstr "Hasło" @@ -410,10 +406,6 @@ msgctxt "#30617" msgid "Server or port cannot be empty" msgstr "Nazwa hosta i port nie mogą być puste" -msgctxt "#30618" -msgid "Change Jellyfin Connect user" -msgstr "Zmień użytkownika Jellyfin Connect" - msgctxt "#33000" msgid "Welcome" msgstr "Witaj" diff --git a/resources/lib/connect.py b/resources/lib/connect.py index c0525003..f417f3d5 100644 --- a/resources/lib/connect.py +++ b/resources/lib/connect.py @@ -12,7 +12,7 @@ import xbmcvfs import client from database import get_credentials, save_credentials -from dialogs import ServerConnect, UsersConnect, LoginConnect, LoginManual, ServerManual +from dialogs import ServerConnect, UsersConnect, LoginManual, ServerManual from helper import _, settings, addon_id, event, api, dialog, window from emby import Emby from emby.core.connection_manager import get_server_address, CONNECTION_STATE @@ -164,8 +164,7 @@ class Connect(object): 'connect_manager': self.connect_manager, 'username': user.get('DisplayName', ""), 'user_image': user.get('ImageUrl'), - 'servers': state.get('Servers', []), - 'jellyfin_connect': False if user else True + 'servers': state.get('Servers', []) }) dialog.doModal() @@ -173,12 +172,6 @@ class Connect(object): LOG.debug("Server selected: %s", dialog.get_server()) return - elif dialog.is_connect_login(): - LOG.debug("Login with jellyfin connect") - try: - self.login_connect() - except RuntimeError: pass - elif dialog.is_manual_server(): LOG.debug("Adding manual server") try: @@ -218,35 +211,6 @@ class Connect(object): else: raise RuntimeError("Server is not connected") - def setup_login_connect(self): - - ''' Setup jellyfin connect by itself. - ''' - client = self.get_client() - client.set_credentials(get_credentials()) - manager = client.auth - - try: - self.login_connect(manager) - except RuntimeError: - return - - credentials = client.get_credentials() - save_credentials(credentials) - - def login_connect(self, manager=None): - - ''' Return connect user or raise error. - ''' - dialog = LoginConnect("script-jellyfin-connect-login.xml", *XML_PATH) - dialog.set_args(**{'connect_manager': manager or self.connect_manager}) - dialog.doModal() - - if dialog.is_logged_in(): - return dialog.get_user() - else: - raise RuntimeError("Connect user is not logged in") - def login(self): users = self.connect_manager['public-users'] diff --git a/resources/lib/dialogs/__init__.py b/resources/lib/dialogs/__init__.py index a0208889..5b9b227f 100644 --- a/resources/lib/dialogs/__init__.py +++ b/resources/lib/dialogs/__init__.py @@ -1,5 +1,4 @@ from serverconnect import ServerConnect from usersconnect import UsersConnect -from loginconnect import LoginConnect from loginmanual import LoginManual from servermanual import ServerManual diff --git a/resources/lib/dialogs/loginconnect.py b/resources/lib/dialogs/loginconnect.py deleted file mode 100644 index 04ba48dc..00000000 --- a/resources/lib/dialogs/loginconnect.py +++ /dev/null @@ -1,147 +0,0 @@ -# -*- coding: utf-8 -*- - -################################################################################################## - -import logging -import os - -import xbmcgui -import xbmcaddon - -from helper import _, addon_id, settings, dialog - -################################################################################################## - -LOG = logging.getLogger("JELLYFIN."+__name__) -ACTION_PARENT_DIR = 9 -ACTION_PREVIOUS_MENU = 10 -ACTION_BACK = 92 -SIGN_IN = 200 -CANCEL = 201 -ERROR_TOGGLE = 202 -ERROR_MSG = 203 -ERROR = { - 'Invalid': 1, - 'Empty': 2 -} - -################################################################################################## - - -class LoginConnect(xbmcgui.WindowXMLDialog): - - _user = None - error = None - - - def __init__(self, *args, **kwargs): - - xbmcgui.WindowXMLDialog.__init__(self, *args, **kwargs) - - def set_args(self, **kwargs): - # connect_manager, user_image, servers, jellyfin_connect - for key, value in kwargs.iteritems(): - setattr(self, key, value) - - def is_logged_in(self): - return True if self._user else False - - def get_user(self): - return self._user - - - def onInit(self): - - self.user_field = self._add_editcontrol(755, 338, 40, 415) - self.setFocus(self.user_field) - self.password_field = self._add_editcontrol(755, 448, 40, 415, password=1) - self.signin_button = self.getControl(SIGN_IN) - self.remind_button = self.getControl(CANCEL) - self.error_toggle = self.getControl(ERROR_TOGGLE) - self.error_msg = self.getControl(ERROR_MSG) - - self.user_field.controlUp(self.remind_button) - self.user_field.controlDown(self.password_field) - self.password_field.controlUp(self.user_field) - self.password_field.controlDown(self.signin_button) - self.signin_button.controlUp(self.password_field) - self.remind_button.controlDown(self.user_field) - - def onClick(self, control): - - if control == SIGN_IN: - # Sign in to jellyfin connect - self._disable_error() - - user = self.user_field.getText() - password = self.password_field.getText() - - if not user or not password: - # Display error - self._error(ERROR['Empty'], _('empty_user_pass')) - LOG.error("Username or password cannot be null") - - elif self._login(user, password): - self.close() - - elif control == CANCEL: - # Remind me later - self.close() - - def onAction(self, action): - - if (self.error == ERROR['Empty'] - and self.user_field.getText() and self.password_field.getText()): - self._disable_error() - - if action in (ACTION_BACK, ACTION_PARENT_DIR, ACTION_PREVIOUS_MENU): - self.close() - - def _add_editcontrol(self, x, y, height, width, password=0): - - media = os.path.join(xbmcaddon.Addon(addon_id()).getAddonInfo('path'), 'resources', 'skins', 'default', 'media') - control = xbmcgui.ControlEdit(0, 0, 0, 0, - label="User", - font="font13", - textColor="FF52b54b", - disabledColor="FF888888", - focusTexture="-", - noFocusTexture="-", - isPassword=password) - control.setPosition(x, y) - control.setHeight(height) - control.setWidth(width) - - self.addControl(control) - return control - - def _login(self, username, password): - - result = self.connect_manager['login-connect'](username, password) - if result is False: - self._error(ERROR['Invalid'], _('invalid_auth')) - - return False - - self._user = result - username = result['User']['Name'] - settings('connectUsername', value=username) - settings('idMethod', value="1") - - dialog("notification", heading="{jellyfin}", message="%s %s" % (_(33000), username.decode('utf-8')), - icon=result['User'].get('ImageUrl') or "{jellyfin}", - time=2000, - sound=False) - - return True - - def _error(self, state, message): - - self.error = state - self.error_msg.setLabel(message) - self.error_toggle.setVisibleCondition('true') - - def _disable_error(self): - - self.error = None - self.error_toggle.setVisibleCondition('false') diff --git a/resources/lib/dialogs/loginmanual.py b/resources/lib/dialogs/loginmanual.py index 2122089e..2c587861 100644 --- a/resources/lib/dialogs/loginmanual.py +++ b/resources/lib/dialogs/loginmanual.py @@ -36,7 +36,7 @@ class LoginManual(xbmcgui.WindowXMLDialog): xbmcgui.WindowXMLDialog.__init__(self, *args, **kwargs) def set_args(self, **kwargs): - # connect_manager, user_image, servers, emby_connect + # connect_manager, user_image, servers for key, value in kwargs.iteritems(): setattr(self, key, value) diff --git a/resources/lib/dialogs/serverconnect.py b/resources/lib/dialogs/serverconnect.py index 497abb51..9c05fbe6 100644 --- a/resources/lib/dialogs/serverconnect.py +++ b/resources/lib/dialogs/serverconnect.py @@ -24,7 +24,6 @@ CANCEL = 201 MESSAGE_BOX = 202 MESSAGE = 203 BUSY = 204 -EMBY_CONNECT = 205 MANUAL_SERVER = 206 ################################################################################################## @@ -45,7 +44,7 @@ class ServerConnect(xbmcgui.WindowXMLDialog): xbmcgui.WindowXMLDialog.__init__(self, *args, **kwargs) def set_args(self, **kwargs): - # connect_manager, user_image, servers, jellyfin_connect + # connect_manager, user_image, servers for key, value in kwargs.iteritems(): setattr(self, key, value) @@ -76,9 +75,6 @@ class ServerConnect(xbmcgui.WindowXMLDialog): if self.user_image is not None: self.getControl(USER_IMAGE).setImage(self.user_image) - if not self.jellyfin_connect: # Change connect user - self.getControl(EMBY_CONNECT).setLabel("[B]%s[/B]" % _(30618)) - if self.servers: self.setFocus(self.list_) @@ -109,12 +105,7 @@ class ServerConnect(xbmcgui.WindowXMLDialog): def onClick(self, control): - if control == EMBY_CONNECT: - self.connect_manager.clear_data() - self._connect_login = True - self.close() - - elif control == MANUAL_SERVER: + if control == MANUAL_SERVER: self._manual_server = True self.close() diff --git a/resources/lib/emby/core/connection_manager.py b/resources/lib/emby/core/connection_manager.py index 64b71687..68411aeb 100644 --- a/resources/lib/emby/core/connection_manager.py +++ b/resources/lib/emby/core/connection_manager.py @@ -69,8 +69,6 @@ class ConnectionManager(object): return self.connect elif key == "login": return self.login - elif key == "login-connect": - return self.login_to_connect elif key == "connect-user": return self.connect_user() elif key == "connect-token": @@ -159,38 +157,6 @@ class ConnectionManager(object): return servers - def login_to_connect(self, username, password): - - if not username: - raise AttributeError("username cannot be empty") - - if not password: - raise AttributeError("password cannot be empty") - - try: - result = self._request_url({ - 'type': "POST", - 'url': self.get_connect_url("user/authenticate"), - 'data': { - 'nameOrEmail': username, - 'password': self._get_connect_password_hash(password) - }, - 'dataType': "json" - }) - except Exception as error: # Failed to login - LOG.error(error) - return False - else: - credentials = self.credentials.get_credentials() - credentials['ConnectAccessToken'] = result['AccessToken'] - credentials['ConnectUserId'] = result['User']['Id'] - credentials['ConnectUser'] = result['User']['DisplayName'] - self.credentials.get_credentials(credentials) - # Signed in - self._on_connect_user_signin(result['User']) - - return result - def login(self, server, username, password=None, clear=True, options={}): if not username: diff --git a/resources/lib/emby/core/ws_client.py b/resources/lib/emby/core/ws_client.py index f2f52c3a..1784eca7 100644 --- a/resources/lib/emby/core/ws_client.py +++ b/resources/lib/emby/core/ws_client.py @@ -82,7 +82,7 @@ class WSClient(threading.Thread): message = json.loads(message) data = message.get('Data', {}) - if message['MessageType'] in ('RefreshProgress'): + if message['MessageType'] in ('RefreshProgress',): LOG.debug("Ignoring %s", message) return diff --git a/resources/lib/entrypoint/service.py b/resources/lib/entrypoint/service.py index 270f5b46..f0aa77e8 100644 --- a/resources/lib/entrypoint/service.py +++ b/resources/lib/entrypoint/service.py @@ -308,9 +308,6 @@ class Service(xbmc.Monitor): self.connect.register(data['Id']) xbmc.executebuiltin("Container.Refresh") - elif method == 'JellyfinConnect': - self.connect.setup_login_connect() - elif method == 'AddServer': self.connect.setup_manual_server() diff --git a/resources/settings.xml b/resources/settings.xml index dff56dec..3db34d32 100644 --- a/resources/settings.xml +++ b/resources/settings.xml @@ -5,8 +5,6 @@ - - diff --git a/resources/skins/default/1080i/script-jellyfin-connect-login.xml b/resources/skins/default/1080i/script-jellyfin-connect-login.xml deleted file mode 100644 index 7fbb8842..00000000 --- a/resources/skins/default/1080i/script-jellyfin-connect-login.xml +++ /dev/null @@ -1,203 +0,0 @@ - - - - - - - - - - - - - - -200 - -200 - -200 - -200 - white.png - stretch - WindowOpen - WindowClose - - - 50% - 50% - 470 - 660 - - -30 - - 20 - 100% - 25 - logo-white.png - keep - - - - 100% - 660 - dialogs/dialog_back.png - - - 50% - 10 - 460 - 660 - - vertical - 0 - - 100% - 75 - center - 20 - font13 - white - 66000000 - - - - 110 - - - ffe1e1e1 - 66000000 - font12 - top - 20 - - - 50 - - - 20 - 20 - 1 - 90 - white.png - - - - 110 - - - ffe1e1e1 - 66000000 - font12 - top - 20 - - - 50 - - - separator - 20 - 20 - 1 - 90 - white.png - - - - - 426 - 65 - font13 - ffe1e1e1 - white - ffe1e1e1 - 66000000 - 20 - center - center - buttons/shadow_smallbutton.png - buttons/shadow_smallbutton.png - no - Conditional - - - - 426 - 65 - font13 - ffe1e1e1 - white - ffe1e1e1 - 66000000 - 20 - center - center - buttons/shadow_smallbutton.png - buttons/shadow_smallbutton.png - no - Conditional - - - spacer - 20 - - - - - font_flag - ff464646 - 66000000 - true - true - top - 160 - 20 - 160 - - - 10 - 20 - 130 - - 130 - 130 - qrcode - qrcode_disclaimer.png - - - 135 - center - - font_flag - true - FF52b54b - 66000000 - top - - - - - - - 660 - false - - Error box - 100% - 70 - dialogs/dialog_back.png - - - 10 - 50 - ffe1e1e1 - true - 66000000 - font12 - 20 - center - center - - - - - - \ No newline at end of file diff --git a/resources/skins/default/1080i/script-jellyfin-connect-server.xml b/resources/skins/default/1080i/script-jellyfin-connect-server.xml index c20c535d..15056fea 100644 --- a/resources/skins/default/1080i/script-jellyfin-connect-server.xml +++ b/resources/skins/default/1080i/script-jellyfin-connect-server.xml @@ -1,6 +1,6 @@ - 205 + 206 @@ -160,24 +160,6 @@ spacer 20 - - - 476 - 65 - font13 - ffe1e1e1 - white - ffe1e1e1 - 66000000 - 20 - center - center - buttons/shadow_smallbutton.png - buttons/shadow_smallbutton.png - no - 155 - Conditional - 476