Skip to content

Commit

Permalink
Merge pull request #1351 from glensc/online-id
Browse files Browse the repository at this point in the history
  • Loading branch information
glensc authored Jan 11, 2023
2 parents 27dd4eb + a9f9980 commit 2aa3333
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion plextraktsync/plex/PlexLibraryItem.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,10 +277,20 @@ def date_value(date):
def __repr__(self):
try:
guid = self.guids[0]
return f"<{guid.provider}:{guid.id}:{str(self.item).strip('<>')}>"
except IndexError:
return f"<{self.item}>"

plex = str(self.item).strip('<>')

# assemble ourselves to handle online sources nan issue
# https://github.com/pkkid/python-plexapi/issues/1072
if not isinstance(self.item.ratingKey, int):
parts = plex.split(":")
parts[1] = self.item.guid.rsplit('/', 1)[-1]
plex = ":".join(parts)

return f"<{guid.provider}:{guid.id}:{plex}>"

def to_json(self):
collected_at = None if not self.collected_at else timestamp(
self.collected_at)
Expand Down

0 comments on commit 2aa3333

Please sign in to comment.