From 99bfdb81298d0f6f104c83d85bb902601406e92d Mon Sep 17 00:00:00 2001 From: blacktwin Date: Mon, 16 Mar 2020 13:52:35 -0400 Subject: [PATCH] add __repr__ to Agent and AgentMediaType classes --- plexapi/media.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/plexapi/media.py b/plexapi/media.py index ebe673b7..008bec1f 100644 --- a/plexapi/media.py +++ b/plexapi/media.py @@ -668,6 +668,10 @@ class Agent(PlexObject): """ TAG = 'Agent' + def __repr__(self): + uid = self._clean(self.firstAttr('shortIdentifier')) + return '<%s>' % ':'.join([p for p in [self.__class__.__name__, uid] if p]) + def _loadData(self, data): self._data = data self._initpath = '/system/agents' @@ -685,6 +689,11 @@ class Agent(PlexObject): class AgentMediaType(Agent): + + def __repr__(self): + uid = self._clean(self.firstAttr('name')) + return '<%s>' % ':'.join([p for p in [self.__class__.__name__, uid] if p]) + def _loadData(self, data): self.mediaType = data.attrib.get('mediaType') self.name = data.attrib.get('name')