mirror of
https://github.com/pkkid/python-plexapi
synced 2024-11-26 13:40:22 +00:00
Raise not found for missing bandwidth account/device
This commit is contained in:
parent
345d0b2743
commit
b7b32fb99d
1 changed files with 8 additions and 2 deletions
|
@ -865,12 +865,18 @@ class StatisticsBandwidth(PlexObject):
|
|||
def account(self):
|
||||
""" Returns the :class:`~plexapi.server.SystemAccount` associated with the bandwidth data. """
|
||||
accounts = self._server.systemAccounts()
|
||||
try:
|
||||
return next(account for account in accounts if account.id == self.accountID)
|
||||
except StopIteration:
|
||||
raise NotFound('Unknown account for this bandwidth data: accountID=%s' % self.accountID)
|
||||
|
||||
def device(self):
|
||||
""" Returns the :class:`~plexapi.server.SystemDevice` associated with the bandwidth data. """
|
||||
devices = self._server.systemDevices()
|
||||
try:
|
||||
return next(device for device in devices if device.id == self.deviceID)
|
||||
except StopIteration:
|
||||
raise NotFound('Unknown device for this bandwidth data: deviceID=%s' % self.deviceID)
|
||||
|
||||
|
||||
class StatisticsResources(PlexObject):
|
||||
|
|
Loading…
Reference in a new issue