Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow getting a client by machine identifier #1418

Merged
merged 1 commit into from
Jun 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions plexapi/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,16 +413,17 @@ def clients(self):
return items

def client(self, name):
""" Returns the :class:`~plexapi.client.PlexClient` that matches the specified name.
""" Returns the :class:`~plexapi.client.PlexClient` that matches the specified name
or machine identifier.

Parameters:
name (str): Name of the client to return.
name (str): Name or machine identifier of the client to return.

Raises:
:exc:`~plexapi.exceptions.NotFound`: Unknown client name.
"""
for client in self.clients():
if client and client.title == name:
if client and (client.title == name or client.machineIdentifier == name):
return client

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