trakt / api-help

Trakt API docs at https://trakt.docs.apiary.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wrong episode being marked as watched when using TMDB ID

frlefebvre opened this issue · comments

Hi,

My app uses TMDB for its primary database and offers an optional sync with Trakt. As a result, when I add something to Trakt's watch history, it's via its TMDB id. Over the last few weeks I've received reports from users of some status rollbacks due to Trakt not marking the right episode as watched.

This happens when multiple episodes share the same TMDB id. One example of this is in Star Trek: Enterprise, season 1, episodes 2 and 3 (as well as episodes 13 & 14, 16 & 17, 18 & 19).

When a user marks episode 3 as watched I send the following
{ "episodes":[ { "number":3, "season":1, "watched_at":"2023-11-15T15:21:40.533+0000", "ids":{ "tmdb":4428745 } } ] }

But on Trakt's end, the episode watched is episode 2 as it appears that Trakt's picks the first item matching the id. A fix would be to first pick an episode that match all properties given (here, season and episode numbers) and, if none are found, to default to the first episode with a given id.

This seems like a bug on TMDB's side withe Star Trek: Enterprise. Notice they don't have episode 2 listed at https://www.themoviedb.org/tv/314-star-trek-enterprise/season/1. They also seem to be returning duplicate TMDB IDs for different episodes, which also shouldn't happen. Those are supposed to be unique IDs from TMDB.

I'll look into a workaround and see if we can handle this on our side.

Now that you mention it, I think every time I've seen it happen was when TMDB had gaps in episodes. Which episodes are you seeing them return duplicate IDs for? In this case, episode 2 and 3 have the same TMDB id on Trakt but since TMDB only references one of them, I assume you're talking of different episodes? I'll try and raise it to them if this can also be addressed on their end.

We have season 1 locked on Trakt, presumably since TMDB seemed to add and remove episodes for this season. That's why we don't have the newer IDs picked up. I'll manually fix this for now and you can also use the "report" button on the website to alert out moderator about any data issues.

As for the episode gaps, that is always a weird solution to me. I'm sure episodes 1 and 2 were a double part episode they combined, but it's weird to just omit episode 2. They typically have a reference website showing it like this, but on Trakt we don't want to lose the data so sometimes lock the data since TMDB sometimes reversed the decision.

I think it's a reasonable approach. TMDB has some odd content policies so that could be one of them… I've used the report button before but I need to hear about the issue from a frustrated user first before I can do anything about it which is never ideal. Do you think you'd be able to use the episode number alongside the TMDB id to disambiguate?