mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-24 09:46:11 +00:00
Fix multi-server support
This commit is contained in:
parent
caa758c3ec
commit
98ffa9b503
2 changed files with 12 additions and 4 deletions
|
@ -40,11 +40,16 @@ def ensure_client():
|
||||||
|
|
||||||
class Emby(object):
|
class Emby(object):
|
||||||
|
|
||||||
''' This is your Embyclient, you can create more than one. The server_id is only a temporary thing.
|
''' This is your Embyclient, you can create more than one. The server_id is only a temporary thing
|
||||||
|
to communicate with the EmbyClient().
|
||||||
|
|
||||||
from emby import Emby
|
from emby import Emby
|
||||||
|
|
||||||
default_client = Emby()['config/app']
|
Emby('123456')['config/app']
|
||||||
another_client = Emby('123456')['config/app']
|
|
||||||
|
# Permanent client reference
|
||||||
|
client = Emby('123456').get_client()
|
||||||
|
client['config/app']
|
||||||
'''
|
'''
|
||||||
|
|
||||||
# Borg - multiple instances, shared state
|
# Borg - multiple instances, shared state
|
||||||
|
@ -57,6 +62,9 @@ class Emby(object):
|
||||||
self.__dict__ = self._shared_state
|
self.__dict__ = self._shared_state
|
||||||
self.server_id = server_id or "default"
|
self.server_id = server_id or "default"
|
||||||
|
|
||||||
|
def get_client(self):
|
||||||
|
return self.client[self.server_id]
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def set_loghandler(cls, func=loghandler, level=logging.INFO):
|
def set_loghandler(cls, func=loghandler, level=logging.INFO):
|
||||||
|
|
||||||
|
|
|
@ -148,7 +148,7 @@ class Player(xbmc.Player):
|
||||||
'CurrentPosition': item.get('CurrentPosition') or int(seektime),
|
'CurrentPosition': item.get('CurrentPosition') or int(seektime),
|
||||||
'Muted': muted,
|
'Muted': muted,
|
||||||
'Volume': volume,
|
'Volume': volume,
|
||||||
'Server': Emby(item['ServerId']),
|
'Server': Emby(item['ServerId']).get_client(),
|
||||||
'Paused': False
|
'Paused': False
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue