mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-25 10:16:11 +00:00
Modify post capabilities
longer timeout + associate with http online instead of ws.
This commit is contained in:
parent
7e928a8fc5
commit
386e6bc14a
5 changed files with 13 additions and 3 deletions
|
@ -70,7 +70,8 @@ class ClientInfo(object):
|
||||||
else:
|
else:
|
||||||
return "Unknown"
|
return "Unknown"
|
||||||
|
|
||||||
def get_device_id(self, reset=False):
|
@classmethod
|
||||||
|
def get_device_id(cls, reset=False):
|
||||||
|
|
||||||
client_id = window('emby_deviceId')
|
client_id = window('emby_deviceId')
|
||||||
if client_id:
|
if client_id:
|
||||||
|
|
|
@ -91,7 +91,7 @@ class DownloadUtils(object):
|
||||||
window('emby_server%s.json' % server_id, value=info)
|
window('emby_server%s.json' % server_id, value=info)
|
||||||
window('emby_server%s.name' % server_id, value=name)
|
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
|
# Post settings to session
|
||||||
url = "{server}/emby/Sessions/Capabilities/Full?format=json"
|
url = "{server}/emby/Sessions/Capabilities/Full?format=json"
|
||||||
data = {
|
data = {
|
||||||
|
|
|
@ -35,6 +35,7 @@ class Service(object):
|
||||||
|
|
||||||
startup = False
|
startup = False
|
||||||
server_online = True
|
server_online = True
|
||||||
|
capabitilities = False
|
||||||
warn_auth = True
|
warn_auth = True
|
||||||
|
|
||||||
userclient_running = False
|
userclient_running = False
|
||||||
|
@ -151,6 +152,9 @@ class Service(object):
|
||||||
# Start the syncing thread
|
# Start the syncing thread
|
||||||
self.library_running = True
|
self.library_running = True
|
||||||
self.library_thread.start()
|
self.library_thread.start()
|
||||||
|
if not self.capabitilities:
|
||||||
|
self.capabitilities = True
|
||||||
|
user_client.post_capabilities()
|
||||||
else:
|
else:
|
||||||
|
|
||||||
if (user_client.get_user() is None) and self.warn_auth:
|
if (user_client.get_user() is None) and self.warn_auth:
|
||||||
|
@ -262,6 +266,7 @@ class Service(object):
|
||||||
sound=False)
|
sound=False)
|
||||||
|
|
||||||
self.server_online = True
|
self.server_online = True
|
||||||
|
self.capabitilities = False
|
||||||
window('emby_online', value="true")
|
window('emby_online', value="true")
|
||||||
log.info("Server is online and ready")
|
log.info("Server is online and ready")
|
||||||
|
|
||||||
|
|
|
@ -222,6 +222,10 @@ class UserClient(threading.Thread):
|
||||||
# Set _user and _server
|
# Set _user and _server
|
||||||
self._set_user_server()
|
self._set_user_server()
|
||||||
|
|
||||||
|
def post_capabilities(self):
|
||||||
|
log.info("post capabilities")
|
||||||
|
self.doutils.post_capabilities()
|
||||||
|
|
||||||
def load_connect_servers(self):
|
def load_connect_servers(self):
|
||||||
# Set connect servers
|
# Set connect servers
|
||||||
if not settings('connectUsername'):
|
if not settings('connectUsername'):
|
||||||
|
|
|
@ -307,7 +307,7 @@ class WebSocketClient(threading.Thread):
|
||||||
log.debug("closed")
|
log.debug("closed")
|
||||||
|
|
||||||
def on_open(self, ws):
|
def on_open(self, ws):
|
||||||
self.doutils.post_capabilities(self.device_id)
|
log.debug("open")
|
||||||
|
|
||||||
def on_error(self, ws, error):
|
def on_error(self, ws, error):
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue