Modify post capabilities

longer timeout + associate with http online instead of ws.
This commit is contained in:
angelblue05 2018-05-10 04:09:25 -05:00
parent 7e928a8fc5
commit 386e6bc14a
5 changed files with 13 additions and 3 deletions

View File

@ -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:

View File

@ -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 = {

View File

@ -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")

View File

@ -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'):

View File

@ -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):