Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix episode matching for sync from trakt task #191

Merged
merged 3 commits into from
Dec 4, 2022

Conversation

h3llrais3r
Copy link
Contributor

@h3llrais3r h3llrais3r commented Nov 28, 2022

Explanation:

  • Trakt has switched from tvdb to tmdb as indexer
  • Episodes are often not aligned between tvdb and tmdb
  • Watched shows api does not contain episodes ids
  • History api does contain episode ids (not only season and number)
  • If no matching is found by season and number (from shows api), fallback to history api to determine a match by episode ids

Fixes #190

- Trakt has switched from tvdb to tmdb as indexer
- Episodes are often not aligned between tvdb and tmdb
- Watched shows api does not contain episodes ids
- History api does contain episode ids
- If no matching is found by season and number (from shows api), fallback to history api to determine a match by episode ids
When an episode is not matched with the season, let's find it in any season.
This happens when an episode of the next season in tvdb appears in the previous season in tmdb. (F.e. Hunter X Hunter S02E01 tvdb = S01E59 tmdb)
@h3llrais3r
Copy link
Contributor Author

I ran this updated plugin on my whole library and now watched status is properly imported! 🥳

@h3llrais3r
Copy link
Contributor Author

Works perfectly after adding the latest commit. 😉

Copy link
Contributor

@Shadowghost Shadowghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks fine but I haven't tested it since I don't have any unsynced items.

@h3llrais3r
Copy link
Contributor Author

h3llrais3r commented Nov 29, 2022

Code looks fine but I haven't tested it since I don't have any unsynced items.

Not sure if you are following tvdb or tmdb seasoning... It's mainly a fix when seasoning is different. It now has a fallback to match by ids (instead of season and number) by using the history api from trakt.

And it's a fallback, so existing logic still applies, I'm addtionally try to match further when no match is found on season and number.

And I think a lot of people are still following tvdb, as it's the only indexer source used in the sonarr tool. 😉

Trakt/Api/TraktApi.cs Outdated Show resolved Hide resolved
@crobibero crobibero added bug This PR or Issue describes or fixes something that isn't working feature This PR or Issue requests or introduces a new feature labels Dec 4, 2022
@crobibero crobibero merged commit 61db588 into jellyfin:master Dec 4, 2022
@h3llrais3r h3llrais3r deleted the fix-episode-matching branch February 27, 2023 16:37
h3llrais3r added a commit to h3llrais3r/jellyfin-plugin-trakt that referenced this pull request Mar 1, 2023
The history api includes more details (i.e. indexer id) which can be used to properly match episodes (i.e. when jellyfin is using other indexer than trakt).
Matching by indexer id is a lot more accurate than matching by season and number.
This is a rework of jellyfin#191 where we are now using the history by default for episode sync.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This PR or Issue describes or fixes something that isn't working feature This PR or Issue requests or introduces a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Show episodes marked as watched in trakt not being synced to jellyfin on import task
3 participants