Browse Source

New clients added that aren't in the current client cache now trigger a reload if the list isn't "stale" yet.

pull/2342/head
Dean Gardiner 12 years ago
parent
commit
bdeace8a68
  1. 4
      couchpotato/core/notifications/plex/main.py
  2. 8
      couchpotato/core/notifications/plex/server.py

4
couchpotato/core/notifications/plex/main.py

@ -43,14 +43,14 @@ class Plex(Notification):
client_success = False
client = self.server.clients.get(client_name)
if client:
if client and client['found']:
client_success = fireEvent('notify.plex.notifyClient', client, message, single=True)
if client_success:
client_names.pop(0)
if not client_success:
if self.server.staleClients():
if self.server.staleClients() or not client:
log.info('Failed to send notification to client "%s". '
'Client list is stale, updating the client list and retrying.', client_name)
self.server.updateClients(self.getClientNames())

8
couchpotato/core/notifications/plex/server.py

@ -58,11 +58,13 @@ class PlexServer(object):
if c.get('name') and c.get('name').lower() in client_names
]
# Store client details in cache
for client in found_clients:
name = client.get('name').lower()
self.clients[name] = {
'name': client.get('name'),
'found': True,
'address': client.get('address'),
'port': client.get('port'),
'protocol': client.get('protocol', 'xbmchttp')
@ -70,6 +72,12 @@ class PlexServer(object):
client_names.remove(name)
# Store dummy info for missing clients
for client_name in client_names:
self.clients[client_name] = {
'found': False
}
if len(client_names) > 0:
log.debug('Unable to find clients: %s', ', '.join(client_names))

Loading…
Cancel
Save