Add library property to PlexLibraryItem
If item is in excluded-libraries, library_sections will be missing
@@ -78,6 +78,16 @@ def media_type(self):
def type(self):
return self.item.type
+ @cached_property
+ def library(self):
+ if not self.plex:
+ raise RuntimeError("Need plex property to retrieve library")
+
+ if self.item.librarySectionID not in self.plex.library_sections:
+ return None
+
+ return self.plex.library_sections[self.item.librarySectionID]
+
@cached_property
def title(self):
value = self.item.title
