Fix profile auth

One device id per user.
This commit is contained in:
angelblue05 2018-09-12 22:51:28 -05:00
parent 2deb31b294
commit 60db191efa
5 changed files with 15 additions and 5 deletions

View file

@ -76,7 +76,12 @@ def get_device_id(reset=False):
if client_id: if client_id:
return client_id return client_id
emby_guid = xbmc.translatePath('special://temp/emby_guid').decode('utf-8') directory = xbmc.translatePath('special://special://profile/addon_data/plugin.video.emby/').decode('utf-8')
if not xbmcvfs.exists(directory):
xbmcvfs.mkdir(directory)
emby_guid = os.path.join(directory, "emby_guid")
file_guid = xbmcvfs.File(emby_guid) file_guid = xbmcvfs.File(emby_guid)
client_id = file_guid.read() client_id = file_guid.read()

View file

@ -61,13 +61,16 @@ class EmbyClient(object):
return state return state
def start(self, websocket=False): def start(self, websocket=False, keep_alive=True):
if not self.logged_in: if not self.logged_in:
raise ValueError("User is not authenticated.") raise ValueError("User is not authenticated.")
self.http.start_session() self.http.start_session()
if keep_alive:
self.http.keep_alive = True
if websocket: if websocket:
self.start_wsc() self.start_wsc()

View file

@ -461,7 +461,6 @@ class ConnectionManager(object):
def _get_min_server_version(self, val=None): def _get_min_server_version(self, val=None):
if val is not None: if val is not None:
LOG.info("hello?")
self.min_server_version = val self.min_server_version = val
return self.min_server_version return self.min_server_version
@ -809,9 +808,11 @@ class ConnectionManager(object):
} }
}) })
self._update_server_info(server, system_info) self._update_server_info(server, system_info)
except Exception: except Exception as error:
server['UserId'] = None server['UserId'] = None
server['AccessToken'] = None server['AccessToken'] = None
return False return False
def _update_server_info(self, server, system_info): def _update_server_info(self, server, system_info):

View file

@ -46,6 +46,7 @@ class HTTP(object):
return return
try: try:
LOG.warn("Closing session %s", id(self.session))
self.session.close() self.session.close()
except Exception as error: except Exception as error:
LOG.warn("The requests session could not be terminated: %s", error) LOG.warn("The requests session could not be terminated: %s", error)

View file

@ -398,7 +398,7 @@ class Service(xbmc.Monitor):
"emby_initialScan", "emby_initialScan",
"emby_play", "emby_online", "emby.connected", "emby_should_stop", "emby.resume", "emby_play", "emby_online", "emby.connected", "emby_should_stop", "emby.resume",
"emby.external", "emby.external_check" "emby.external", "emby.external_check", "emby_deviceId"
] ]
for prop in properties: for prop in properties:
window(prop, clear=True) window(prop, clear=True)