mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-11-10 04:06:11 +00:00
Fix user client loading user ordering
This commit is contained in:
parent
644783fae5
commit
334206b334
3 changed files with 11 additions and 9 deletions
|
@ -136,13 +136,13 @@ class DownloadUtils():
|
||||||
|
|
||||||
# User is identified from this point
|
# User is identified from this point
|
||||||
# Attach authenticated header to the session
|
# Attach authenticated header to the session
|
||||||
verify = False
|
|
||||||
header = self.getHeader()
|
header = self.getHeader()
|
||||||
|
|
||||||
# If user enabled host certificate verification
|
# If user enabled host certificate verification
|
||||||
try:
|
try:
|
||||||
verify = self.sslverify
|
verify = self.sslverify
|
||||||
except:
|
except:
|
||||||
|
verify = False
|
||||||
log.info("Could not load SSL settings.")
|
log.info("Could not load SSL settings.")
|
||||||
|
|
||||||
# Start session
|
# Start session
|
||||||
|
@ -172,6 +172,7 @@ class DownloadUtils():
|
||||||
auth = (
|
auth = (
|
||||||
'MediaBrowser UserId="%s", Client="Kodi", Device="%s", DeviceId="%s", Version="%s"'
|
'MediaBrowser UserId="%s", Client="Kodi", Device="%s", DeviceId="%s", Version="%s"'
|
||||||
% (self.userId, deviceName, deviceId, version))
|
% (self.userId, deviceName, deviceId, version))
|
||||||
|
|
||||||
header = {
|
header = {
|
||||||
|
|
||||||
'Content-type': 'application/json',
|
'Content-type': 'application/json',
|
||||||
|
@ -185,6 +186,7 @@ class DownloadUtils():
|
||||||
auth = (
|
auth = (
|
||||||
'MediaBrowser Client="Kodi", Device="%s", DeviceId="%s", Version="%s"'
|
'MediaBrowser Client="Kodi", Device="%s", DeviceId="%s", Version="%s"'
|
||||||
% (deviceName, deviceId, version))
|
% (deviceName, deviceId, version))
|
||||||
|
|
||||||
header = {
|
header = {
|
||||||
|
|
||||||
'Content-type': 'application/json',
|
'Content-type': 'application/json',
|
||||||
|
|
|
@ -57,7 +57,7 @@ class InitialSetup(object):
|
||||||
if server['Id'] == settings('serverId'):
|
if server['Id'] == settings('serverId'):
|
||||||
server_address = self.connectmanager.get_address(server)
|
server_address = self.connectmanager.get_address(server)
|
||||||
self._set_server(server_address, server)
|
self._set_server(server_address, server)
|
||||||
self._set_user(server['UserId'], server['AccessToken'])
|
#self._set_user(server['UserId'], server['AccessToken'])
|
||||||
break
|
break
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
@ -159,6 +159,7 @@ class UserClient(threading.Thread):
|
||||||
self._load_user()
|
self._load_user()
|
||||||
except Warning:
|
except Warning:
|
||||||
log.info("token is invalid")
|
log.info("token is invalid")
|
||||||
|
self._reset_client()
|
||||||
else:
|
else:
|
||||||
log.info("current user: %s", self.get_username())
|
log.info("current user: %s", self.get_username())
|
||||||
log.info("current userid: %s", self.get_userid())
|
log.info("current userid: %s", self.get_userid())
|
||||||
|
@ -176,7 +177,7 @@ class UserClient(threading.Thread):
|
||||||
user_found = user
|
user_found = user
|
||||||
break
|
break
|
||||||
try:
|
try:
|
||||||
user = self.connectmanager.login_manual(server, user_found)
|
user = connectmanager.ConnectManager().login_manual(server, user_found)
|
||||||
except RuntimeError:
|
except RuntimeError:
|
||||||
window('emby_serverStatus', value="stop")
|
window('emby_serverStatus', value="stop")
|
||||||
self._auth = False
|
self._auth = False
|
||||||
|
@ -219,17 +220,17 @@ class UserClient(threading.Thread):
|
||||||
doutils.setToken(token)
|
doutils.setToken(token)
|
||||||
doutils.setSSL(self.get_ssl())
|
doutils.setSSL(self.get_ssl())
|
||||||
|
|
||||||
# Start downloadutils.py session
|
|
||||||
doutils.startSession()
|
|
||||||
|
|
||||||
# Set _user and _server
|
|
||||||
self._set_user_server()
|
|
||||||
# verify user access
|
# verify user access
|
||||||
try:
|
try:
|
||||||
self._set_access()
|
self._set_access()
|
||||||
except Warning: # We don't need to raise any exceptions
|
except Warning: # We don't need to raise any exceptions
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
# Start downloadutils.py session
|
||||||
|
doutils.startSession()
|
||||||
|
# Set _user and _server
|
||||||
|
self._set_user_server()
|
||||||
|
|
||||||
def _reset_client(self):
|
def _reset_client(self):
|
||||||
|
|
||||||
log.info("reset UserClient authentication")
|
log.info("reset UserClient authentication")
|
||||||
|
@ -245,7 +246,6 @@ class UserClient(threading.Thread):
|
||||||
def run(self):
|
def run(self):
|
||||||
|
|
||||||
monitor = xbmc.Monitor()
|
monitor = xbmc.Monitor()
|
||||||
self.connectmanager = connectmanager.ConnectManager()
|
|
||||||
|
|
||||||
log.warn("----===## Starting UserClient ##===----")
|
log.warn("----===## Starting UserClient ##===----")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue