New clients added that aren't in the current client cache now trigger a reload if the list isn't "stale" yet.
This commit is contained in:
@@ -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())
|
||||
|
||||
@@ -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))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user