Extract TraktItem to own file
ADD
plextraktsync/trakt/TraktItem.py
+from __future__ import annotations
+
+from typing import Union
+
+from trakt.movies import Movie
+from trakt.tv import TVEpisode, TVSeason, TVShow
+
+from plextraktsync.decorators.cached_property import cached_property
+from plextraktsync.trakt_api import TraktApi
+
+
+class TraktItem:
+ def __init__(self, item: Union[Movie, TVShow, TVSeason, TVEpisode], trakt: TraktApi = None):
+ self.item = item
+ self.trakt = trakt
+
+ @cached_property
+ def type(self):
+ """
+ Return "movie", "show", "season", "episode"
+ """
+ # NB: TVSeason does not have "media_type" property
+ return self.item.media_type[:-1]

MODIFY
plextraktsync/trakt_api.py
plextraktsync/trakt_api.py
from plextraktsync.plex.PlexGuid import PlexGuid
from plextraktsync.plex_api import PlexLibraryItem
from plextraktsync.trakt.ScrobblerProxy import ScrobblerProxy
+from plextraktsync.trakt.TraktItem import TraktItem # noqa
from plextraktsync.trakt.TraktRatingCollection import TraktRatingCollection
from plextraktsync.util.Cleanup import Cleanup
-class TraktItem:
- def __init__(self, item: Union[Movie, TVShow, TVSeason, TVEpisode], trakt: TraktApi = None):
- self.item = item
- self.trakt = trakt
-
- @cached_property
- def type(self):
- """
- Return "movie", "show", "season", "episode"
- """
- # NB: TVSeason does not have "media_type" property
- return self.item.media_type[:-1]
-
-
class TraktApi:
"""
Trakt API class abstracting common data access and dealing with requests cache.

Extract TraktItem to own file