Skip to content

Commit 99bfdb8

Browse files
committed
add __repr__ to Agent and AgentMediaType classes
1 parent 07e3d66 commit 99bfdb8

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

plexapi/media.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -668,6 +668,10 @@ class Agent(PlexObject):
668668
"""
669669
TAG = 'Agent'
670670

671+
def __repr__(self):
672+
uid = self._clean(self.firstAttr('shortIdentifier'))
673+
return '<%s>' % ':'.join([p for p in [self.__class__.__name__, uid] if p])
674+
671675
def _loadData(self, data):
672676
self._data = data
673677
self._initpath = '/system/agents'
@@ -685,6 +689,11 @@ def _settings(self):
685689

686690

687691
class AgentMediaType(Agent):
692+
693+
def __repr__(self):
694+
uid = self._clean(self.firstAttr('name'))
695+
return '<%s>' % ':'.join([p for p in [self.__class__.__name__, uid] if p])
696+
688697
def _loadData(self, data):
689698
self.mediaType = data.attrib.get('mediaType')
690699
self.name = data.attrib.get('name')

0 commit comments

Comments
 (0)