Skip to content

Commit a4e6ec6

Browse files
authored
Allow getting client by machine identifier (#1418)
1 parent dd80deb commit a4e6ec6

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

plexapi/server.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -413,16 +413,17 @@ def clients(self):
413413
return items
414414

415415
def client(self, name):
416-
""" Returns the :class:`~plexapi.client.PlexClient` that matches the specified name.
416+
""" Returns the :class:`~plexapi.client.PlexClient` that matches the specified name
417+
or machine identifier.
417418
418419
Parameters:
419-
name (str): Name of the client to return.
420+
name (str): Name or machine identifier of the client to return.
420421
421422
Raises:
422423
:exc:`~plexapi.exceptions.NotFound`: Unknown client name.
423424
"""
424425
for client in self.clients():
425-
if client and client.title == name:
426+
if client and (client.title == name or client.machineIdentifier == name):
426427
return client
427428

428429
raise NotFound(f'Unknown client name: {name}')

0 commit comments

Comments
 (0)