def select_servers(self, state=None): state = state or self.connect_manager.connect( {'enableAutoLogin': False}) user = {} dialog = ServerConnect("script-jellyfin-connect-server.xml", *XML_PATH) dialog.set_args( **{ 'connect_manager': self.connect_manager, 'username': user.get('DisplayName', ""), 'user_image': user.get('ImageUrl'), 'servers': state.get('Servers', []) }) dialog.doModal() if dialog.is_server_selected(): LOG.debug("Server selected: %s", dialog.get_server()) return elif dialog.is_manual_server(): LOG.debug("Adding manual server") try: self.manual_server() except RuntimeError: pass else: raise RuntimeError("No server selected") return self.select_servers()
def manual_server(self, manager=None): ''' Return server or raise error. ''' dialog = ServerManual("script-jellyfin-connect-server-manual.xml", *XML_PATH) dialog.set_args(**{'connect_manager': manager or self.connect_manager}) dialog.doModal() if dialog.is_connected(): return dialog.get_server() else: raise RuntimeError("Server is not connected")