Skip to content

Commit

Permalink
Merge pull request #1899 from glensc/title-no-reload
Browse files Browse the repository at this point in the history
Performance: Add year property to PlexLibraryItem
  • Loading branch information
glensc authored Apr 11, 2024
2 parents 0aff216 + 7849120 commit 5e4875e
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions plextraktsync/plex/PlexLibraryItem.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,13 @@ def edition_title(self):
return self.item.__dict__.get("editionTitle")
return None

@cached_property
def year(self):
if self.type == "artist":
return None

return self.item.__dict__.get("year")

@cached_property
def title(self):
value = self.item.title
Expand All @@ -143,8 +150,8 @@ def title(self):
if self.type == "episode":
value = f"{self.item.grandparentTitle}/{self.item.seasonEpisode}/{value}"

if self.type != "artist" and self.item.year:
value = f"{value} ({self.item.year})"
if self.year:
value = f"{value} ({self.year})"

return value

Expand Down

0 comments on commit 5e4875e

Please sign in to comment.