ShokoAnime / ShokoServer

Repository for Shoko Server.
https://shokoanime.com/
MIT License
405 stars 74 forks source link

Existing Trakt Entries Removed on Sync #658

Open KingJ opened 7 years ago

KingJ commented 7 years ago

VERSION INFORMATION

Server Version: 349773ef555c53757a225688d398ce60bb0d0624

Desktop Version: ShokoAnime/ShokoDesktop@93b68d0dec64b40d565b6dee79cef80f5d746eac

LOG FILE

22:57:58| --- Sync Check Status:  AniDB: 6367 - Episode - 108586 - Collection: True - Watched: False
22:57:58| --- Sync Check Status:  Trakt: the-melancholy-of-haruhi-suzumiya - S:1 - EP:9 - Collection: True - Watched: True
22:57:58| --- SYNC LOCAL: Removing from Trakt History:  Slug: the-melancholy-of-haruhi-suzumiya - S:1 - EP:9
22:57:58| --- Trakt SEND Data
Verb: POST
uri: https://api-v2launch.trakt.tv/sync/collection
json: {"shows":[{"ids":{"slug":"wandering-son"},"seasons":[{"episodes":[{"collected_at":"2017-07-14T18:11:05Z","number":11},{"collected_at":"2017-07-14T18:11:05Z","number":10}],"number":1}]},{"ids":{"slug":"is-this-a-zombie"},"seasons":[{"episodes":[{"collected_at":"2017-07-14T18:11:09Z","number":1}],"number":0}]},{"ids":{"slug":"monogatari"},"seasons":[{"episodes":[{"collected_at":"2017-07-14T18:11:14Z","number":4},{"collected_at":"2017-07-14T18:11:14Z","number":3},{"collected_at":"2017-07-14T18:11:14Z","number":2},{"collected_at":"2017-07-14T18:11:14Z","number":1},{"collected_at":"2017-07-14T18:11:14Z","number":8},{"collected_at":"2017-07-14T18:11:14Z","number":7},{"collected_at":"2017-07-14T18:11:14Z","number":6},{"collected_at":"2017-07-14T18:11:14Z","number":5},{"collected_at":"2017-07-14T18:11:14Z","number":9},{"collected_at":"2017-07-14T18:11:14Z","number":11},{"collected_at":"2017-07-14T18:11:14Z","number":10}],"number":3}]},{"ids":{"slug":"neon-genesis-evangelion"},"seasons":[{"episodes":[{"collected_at":"2017-07-14T18:11:33Z","number":4},{"collected_at":"2017-07-14T18:11:33Z","number":3},{"collected_at":"2017-07-14T18:11:33Z","number":5},{"collected_at":"2017-07-14T18:11:33Z","number":2}],"number":0}]},{"ids":{"slug":"time-of-eve"},"seasons":[{"episodes":[{"collected_at":"2017-07-14T18:11:33Z","number":1}],"number":0}]},{"ids":{"slug":"kowarekake-no-orgel"},"seasons":[{"episodes":[{"collected_at":"2017-07-14T18:11:33Z","number":1}],"number":1}]},{"ids":{"slug":"little-witch-academia-2017"},"seasons":[{"episodes":[{"collected_at":"2017-07-14T18:11:33Z","number":1},{"collected_at":"2017-07-14T18:11:33Z","number":2}],"number":0}]},{"ids":{"slug":"pokemon-1997"},"seasons":[{"episodes":[{"collected_at":"2017-07-14T18:11:33Z","number":3}],"number":0}]},{"ids":{"slug":"the-melancholy-of-haruhi-suzumiya"},"seasons":[{"episodes":[{"collected_at":"2017-07-14T18:11:33Z","number":1}],"number":0}]},{"ids":{"slug":"the-seven-deadly-sins"},"seasons":[{"episodes":[{"collected_at":"2017-08-25T21:57:50Z","number":2},{"collected_at":"2017-08-25T21:57:50Z","number":3}],"number":0}]}]}
 22:58:00| --- Trakt SEND Data - Response
Status Code: 201
Response: {"added":{"movies":0,"episodes":26},"updated":{"movies":0,"episodes":0},"existing":{"movies":0,"episodes":0},"not_found":{"movies":[],"shows":[],"seasons":[],"episodes":[],"people":[]}}

DESCRIPTION

When performing a Trakt sync with a Trakt account with existing history but no history in Shoko, the Trakt history is removed to match Shoko's history. This is contrary to expectations, as I would expect Shoko to perform a 2 way sync and pull in my existing Trakt history rather than removing it.

Newer users are more likely to stumble across this, as they will likely not have any watch history in Shoko or AniDB, but have watch history in Trakt instead.

Any watched history on Trakt that wasn't linked to a show in Shoko (either due to a missing mapping or because it wasn't anime) was left alone. Only shows that had a Trakt link in Shoko, were marked as watched on Trakt and marked as unwatched in Shoko were removed.

(Luckily I did export my Trakt history as a CSV before running the sync just in case, but i'll need to go back and re-add ~1200 episodes by hand that were removed).

STEPS TO REPRODUCE

1) Mark some shows as Watched on Trakt. 2) Make some shows as Unwatched in Shoko. 3) Trigger /trakt/sync. 4) Shoko will remove any shows that are marked as Watched on Trakt, but Unwatched in Shoko.

KingJ commented 7 years ago

If anyone runs in to this issue in the interim, I hacked up a quick Python script to import entries back in to Trakt from an exported backup;

KingJ/ImporterForTrakt

ElementalCrisis commented 10 months ago

@krbrs could you confirm is this is still an issue please.

krbrs commented 10 months ago

Can confirm this still is the case, Shoko overwrites the Trakt state. iirc this is the same for MyList Sync, so both are one-way.

I think this was intended when the helper was written( see #525) - that thing needs a complete rewrite or switching to another nuget package for Trakt in the future, but this was delayed until tmdb support is finally added.