def login(self, server=None): ga = GoogleAnalytics() ga.sendEventData("Connect", "UserLogin") # Return user or raise error server = server or self.state['Servers'][0] server_address = connectionmanager.getServerAddress( server, server['LastConnectionMode']) users = "" try: users = self.emby.getUsers(server_address) except Exception as error: log.info("Error getting users from server: " + str(error)) if not users: try: return self.login_manual(server_address) except RuntimeError: raise RuntimeError("No user selected") dialog = UsersConnect("script-emby-connect-users.xml", *XML_PATH) dialog.set_server(server_address) dialog.set_users(users) dialog.doModal() if dialog.is_user_selected(): user = dialog.get_user() username = user['Name'] if user['HasPassword']: log.debug("User has password, present manual login") try: return self.login_manual(server_address, username) except RuntimeError: return self.login(server) else: try: user = self.emby.loginUser(server_address, username) except Exception as error: log.info("Error logging in user: "******"No user selected")
def login(self, server=None): ga = GoogleAnalytics() ga.sendEventData("Connect", "UserLogin") # Return user or raise error server = server or self.state['Servers'][0] server_address = connectionmanager.getServerAddress(server, server['LastConnectionMode']) users = ""; try: users = self.emby.getUsers(server_address) except Exception as error: log.info("Error getting users from server: " + str(error)) if not users: try: return self.login_manual(server_address) except RuntimeError: raise RuntimeError("No user selected") dialog = UsersConnect("script-emby-connect-users.xml", *XML_PATH) dialog.set_server(server_address) dialog.set_users(users) dialog.doModal() if dialog.is_user_selected(): user = dialog.get_user() username = user['Name'] if user['HasPassword']: log.debug("User has password, present manual login") try: return self.login_manual(server_address, username) except RuntimeError: return self.login(server) else: try: user = self.emby.loginUser(server_address, username) except Exception as error: log.info("Error logging in user: "******"No user selected")
def login(self): users = self.connect_manager.get_public_users() server_data = self.connect_manager.get_server_info( self.connect_manager.server_id) server = self.connect_manager.get_server_address( server_data, server_data['LastConnectionMode']) if not users: try: return self.login_manual() except RuntimeError: raise RuntimeError("No user selected") dialog = UsersConnect("script-jellyfin-connect-users.xml", *XML_PATH) dialog.set_args(**{'server': server, 'users': users}) dialog.doModal() if dialog.is_user_selected(): user = dialog.get_user() username = user['Name'] if user['HasPassword']: LOG.debug("User has password, present manual login") try: return self.login_manual(username) except RuntimeError: pass else: return self.connect_manager.login(server, username) elif dialog.is_manual_login(): try: return self.login_manual() except RuntimeError: pass else: raise RuntimeError("No user selected") return self.login()