Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix inspect of discover url #2011

Merged
merged 3 commits into from
Jul 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions plextraktsync/plex/PlexLibraryItem.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,20 @@ def is_legacy_agent(self):
return not self.item.guid.startswith("plex://")

@cached_property
def is_discover(self):
def section_id(self):
# Use __dict__ access to prevent reloads:
# https://github.com/pkkid/python-plexapi/pull/1093
return self.item.__dict__["librarySectionID"] is None
section_id = self.item.__dict__["librarySectionID"]
# For some odd reason (or bug) section id is NaN.
# Treat it as None instead
# This is same as math.isnan(section_id)
if section_id != section_id:
return None
return section_id

@cached_property
def is_discover(self):
return self.section_id is None

@property
def web_url(self):
Expand Down Expand Up @@ -122,10 +132,10 @@ def library(self):
if self.is_discover:
return None

if self.item.librarySectionID not in self.plex.library_sections:
if self.section_id not in self.plex.library_sections:
return None

return self.plex.library_sections[self.item.librarySectionID]
return self.plex.library_sections[self.section_id]

@cached_property
def edition_title(self):
Expand Down
Loading