Merge pull request #189 from angelblue05/develop

Fix multi-server support
This commit is contained in:
angelblue05 2019-01-25 07:03:31 -06:00 committed by GitHub
commit 9346cd6368
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 4 deletions

View file

@ -40,11 +40,16 @@ def ensure_client():
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
default_client = Emby()['config/app']
another_client = Emby('123456')['config/app']
Emby('123456')['config/app']
# Permanent client reference
client = Emby('123456').get_client()
client['config/app']
'''
# Borg - multiple instances, shared state
@ -57,6 +62,9 @@ class Emby(object):
self.__dict__ = self._shared_state
self.server_id = server_id or "default"
def get_client(self):
return self.client[self.server_id]
@classmethod
def set_loghandler(cls, func=loghandler, level=logging.INFO):

View file

@ -148,7 +148,7 @@ class Player(xbmc.Player):
'CurrentPosition': item.get('CurrentPosition') or int(seektime),
'Muted': muted,
'Volume': volume,
'Server': Emby(item['ServerId']),
'Server': Emby(item['ServerId']).get_client(),
'Paused': False
})