Add logic to fill collected_at for library items
MODIFY
plex_trakt_sync/commands/sync.py
plex_trakt_sync/commands/sync.py
@@ -18,7 +18,7 @@ def sync_collection(pm, tm, trakt: TraktApi, trakt_movie_collection):
return
logger.info(f"Add to Trakt Collection: {pm}")
- trakt.add_to_collection(tm)
+ trakt.add_to_collection(tm, pm)
def sync_show_collection(pm, tm, pe, te, trakt: TraktApi):
@@ -31,7 +31,7 @@ def sync_show_collection(pm, tm, pe, te, trakt: TraktApi):
return
logger.info(f"Add to Trakt Collection: {pm} S{pe.seasonNumber:02}E{pe.index:02}")
- trakt.add_to_collection(te.instance)
+ trakt.add_to_collection(te.instance, pe)
def sync_ratings(pm, tm, plex: PlexApi, trakt: TraktApi):

MODIFY
plex_trakt_sync/trakt_api.py
plex_trakt_sync/trakt_api.py
@@ -165,8 +165,12 @@ def mark_watched(self, m, time):
@nocache
@rate_limit(delay=TRAKT_POST_DELAY)
- def add_to_collection(self, m):
- m.add_to_library()
+ def add_to_collection(self, m, pm: PlexLibraryItem):
+ # support is missing, compose custom json ourselves
+ # https://github.com/moogar0880/PyTrakt/issues/143
+ json = m.to_json()
+ json.update(pm.to_json())
+ trakt.sync.add_to_collection(json)
@memoize
@nocache

Add logic to fill collected_at for library items