Skip to content

Commit

Permalink
Add PlexLibraryItem method override to compare other PlexLibraryItem
Browse files Browse the repository at this point in the history
  • Loading branch information
glensc committed Jan 14, 2024
1 parent 3538397 commit 49301b5
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions plextraktsync/plex/PlexLibraryItem.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,17 @@ def discover_url(self):
def get_guids(self):
return self.item.guids

def __eq__(self, other: PlexLibraryItem):
"""
Compare with other PlexLibraryItem.
Items are equal if one of their guids matches
"""
for guid in self.guids:
for other_guid in other.guids:
if guid == other_guid:
return True
return False

@cached_property
def guids(self):
# return early if legacy agent
Expand Down

0 comments on commit 49301b5

Please sign in to comment.