mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-24 09:46:11 +00:00
Save serverId to settings
This commit is contained in:
parent
71abbd4129
commit
feda0cb9df
1 changed files with 15 additions and 12 deletions
|
@ -43,17 +43,20 @@ class InitialSetup(object):
|
||||||
###$ Begin transition phase $###
|
###$ Begin transition phase $###
|
||||||
if settings('server') == "":
|
if settings('server') == "":
|
||||||
current_server = self.user_client.get_server()
|
current_server = self.user_client.get_server()
|
||||||
self.connectmanager.get_server(current_server)
|
server = self.connectmanager.get_server(current_server)
|
||||||
|
settings('ServerId', value=server['Id'])
|
||||||
self.user_client.get_userid()
|
self.user_client.get_userid()
|
||||||
self.user_client.get_token()
|
self.user_client.get_token()
|
||||||
###$ End transition phase $###
|
###$ End transition phase $###
|
||||||
|
|
||||||
current_state = self.connectmanager.get_state()
|
if settings('server'):
|
||||||
if current_state['State'] == STATE['SignedIn']:
|
current_state = self.connectmanager.get_state()
|
||||||
server = current_state['Servers'][0]
|
for server in current_state['Servers']:
|
||||||
server_address = self.connectmanager.get_address(server)
|
if server['Id'] == settings('serverId'):
|
||||||
self._set_server(server_address, server['Name'])
|
server_address = self.connectmanager.get_address(server)
|
||||||
self._set_user(server['UserId'], server['AccessToken'])
|
self._set_server(server_address, server)
|
||||||
|
self._set_user(server['UserId'], server['AccessToken'])
|
||||||
|
break
|
||||||
return
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -67,7 +70,7 @@ class InitialSetup(object):
|
||||||
|
|
||||||
else:
|
else:
|
||||||
server_address = self.connectmanager.get_address(server)
|
server_address = self.connectmanager.get_address(server)
|
||||||
self._set_server(server_address, server['Name'])
|
self._set_server(server_address, server)
|
||||||
|
|
||||||
if not server.get('AccessToken') and not server.get('UserId'):
|
if not server.get('AccessToken') and not server.get('UserId'):
|
||||||
try:
|
try:
|
||||||
|
@ -113,11 +116,11 @@ class InitialSetup(object):
|
||||||
settings('streamMusic', value="true")
|
settings('streamMusic', value="true")
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _set_server(cls, server, name):
|
def _set_server(cls, server_address, server):
|
||||||
|
|
||||||
settings('serverName', value=name)
|
settings('serverName', value=server['Name'])
|
||||||
settings('server', value=server)
|
settings('serverId', value=server['Id'])
|
||||||
log.info("Saved server information: %s", server)
|
settings('server', value=server_address)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _set_user(cls, user_id, token):
|
def _set_user(cls, user_id, token):
|
||||||
|
|
Loading…
Reference in a new issue