diff --git a/resources/lib/clientinfo.py b/resources/lib/clientinfo.py index a6ab90ec..f2024eb5 100644 --- a/resources/lib/clientinfo.py +++ b/resources/lib/clientinfo.py @@ -70,7 +70,8 @@ class ClientInfo(object): else: return "Unknown" - def get_device_id(self, reset=False): + @classmethod + def get_device_id(cls, reset=False): client_id = window('emby_deviceId') if client_id: diff --git a/resources/lib/downloadutils.py b/resources/lib/downloadutils.py index f3d47bfc..cad71206 100644 --- a/resources/lib/downloadutils.py +++ b/resources/lib/downloadutils.py @@ -91,7 +91,7 @@ class DownloadUtils(object): window('emby_server%s.json' % server_id, value=info) window('emby_server%s.name' % server_id, value=name) - def post_capabilities(self, device_id): + def post_capabilities(self, device_id=clientinfo.ClientInfo.get_device_id()): # Post settings to session url = "{server}/emby/Sessions/Capabilities/Full?format=json" data = { diff --git a/resources/lib/service_entry.py b/resources/lib/service_entry.py index 3b67a3c0..75c68291 100644 --- a/resources/lib/service_entry.py +++ b/resources/lib/service_entry.py @@ -35,6 +35,7 @@ class Service(object): startup = False server_online = True + capabitilities = False warn_auth = True userclient_running = False @@ -151,6 +152,9 @@ class Service(object): # Start the syncing thread self.library_running = True self.library_thread.start() + if not self.capabitilities: + self.capabitilities = True + user_client.post_capabilities() else: if (user_client.get_user() is None) and self.warn_auth: @@ -262,6 +266,7 @@ class Service(object): sound=False) self.server_online = True + self.capabitilities = False window('emby_online', value="true") log.info("Server is online and ready") diff --git a/resources/lib/userclient.py b/resources/lib/userclient.py index 0775d036..039a45f5 100644 --- a/resources/lib/userclient.py +++ b/resources/lib/userclient.py @@ -222,6 +222,10 @@ class UserClient(threading.Thread): # Set _user and _server self._set_user_server() + def post_capabilities(self): + log.info("post capabilities") + self.doutils.post_capabilities() + def load_connect_servers(self): # Set connect servers if not settings('connectUsername'): diff --git a/resources/lib/websocket_client.py b/resources/lib/websocket_client.py index 961b3d55..fb2b6103 100644 --- a/resources/lib/websocket_client.py +++ b/resources/lib/websocket_client.py @@ -307,7 +307,7 @@ class WebSocketClient(threading.Thread): log.debug("closed") def on_open(self, ws): - self.doutils.post_capabilities(self.device_id) + log.debug("open") def on_error(self, ws, error):