Add is_legacy_agent helper
@@ -90,10 +90,14 @@ class PlexLibraryItem:
def __init__(self, item):
self.item = item
+ @memoize
+ def is_legacy_agent(self):
+ return not self.item.guid.startswith('plex://')
+
@property
@memoize
def guid(self):
- if self.item.guid.startswith('plex://') and len(self.item.guids) > 0:
+ if not self.is_legacy_agent:
return self.guids[0]
return PlexGuid(self.item.guid, self.type, self)
@@ -104,7 +108,7 @@ def guids(self):
# accessing .guids for legacy agent
# will make another round-trip to plex server
# and the result is always empty.
- if not self.item.guid.startswith('plex://'):
+ if self.is_legacy_agent:
return [self.guid]
guids = [PlexGuid(guid.id, self.type, self) for guid in self.item.guids]
