diff --git a/resources/lib/emby/__init__.py b/resources/lib/emby/__init__.py index fc478bd2..cc9f4775 100644 --- a/resources/lib/emby/__init__.py +++ b/resources/lib/emby/__init__.py @@ -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): diff --git a/resources/lib/player.py b/resources/lib/player.py index c94616a2..2f522008 100644 --- a/resources/lib/player.py +++ b/resources/lib/player.py @@ -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 })