diff --git a/plextraktsync/plex_api.py b/plextraktsync/plex_api.py index 055ee01687..15bb9ca8db 100644 --- a/plextraktsync/plex_api.py +++ b/plextraktsync/plex_api.py @@ -339,6 +339,12 @@ def __repr__(self): except IndexError: return f"<{self.item}>" + def __rich__(self) -> str: + guid = self.guids[0] + url = self.plex.media_url(self) + + return f"<[link={url}]{guid.provider}:{guid.id}:{self.item}[/link]>" + def to_json(self): metadata = { "collected_at": timestamp(self.collected_at), @@ -431,7 +437,7 @@ def movie_sections(self, library=None): continue if library and section.title != library: continue - result.append(PlexLibrarySection(section)) + result.append(PlexLibrarySection(section, plex=self)) return result @@ -442,7 +448,7 @@ def show_sections(self, library=None): continue if library and section.title != library: continue - result.append(PlexLibrarySection(section)) + result.append(PlexLibrarySection(section, plex=self)) return result diff --git a/plextraktsync/walker.py b/plextraktsync/walker.py index 5f7e97f3a8..827c1bc317 100644 --- a/plextraktsync/walker.py +++ b/plextraktsync/walker.py @@ -254,7 +254,7 @@ def get_plex_episodes(self, episodes): show = self.mf.resolve_guid(guid) if not show: continue - me = self.mf.resolve_any(PlexLibraryItem(pe), show.trakt) + me = self.mf.resolve_any(PlexLibraryItem(pe, plex=self.plex), show.trakt) if not me: continue @@ -275,7 +275,7 @@ def media_from_sections(self, sections: List[PlexLibrarySection], titles: List[s def media_from_items(self, libtype: str, items: List): it = self.progressbar(items, desc=f"Processing {libtype}s") for m in it: - yield PlexLibraryItem(m) + yield PlexLibraryItem(m, plex=self.plex) @deprecated("No longer used") def media_from_titles(self, libtype: str, titles: List[str]):