jellyfin/jellyfin-plugin-trakt

Marking an item as watched results in wrong(?) watched at time on trakt.tv

Gylesie opened this issue · 4 comments

When a local item with progress associated with it is being marked as watched via Jellyfin's API without providing the optional datePlayed query parameter, the Trakt.tv shows wrong time at which the media was played. The time that Trakt shows is the time at which the local item was last paused at, not the time at which the API request was sent.

Steps to reproduce:

0. Have this setting enabled in the plugin's settings: Set trakt.tv item to watched when local item is changed to watched.

  1. Watch an item and stop the playback arbitrarily in such a way that it is not automatically marked as watched by Jellyfin
  2. Wait few minutes
  3. Send a Jellyfin API request to mark the item as watched without the datePlayed parameter
  4. Check the time in Trakt's Recently Watched section in the dashboard
  5. The time does not correspond to the time at which the request in step 3 was sent.

Relevant logs:

[2022-10-02 16:11:09.122 +00:00] [DBG] [50] Trakt.Api.TraktApi: TraktSyncWatched { Movies: null, Shows: [], Episodes: [TraktEpisodeWatched { WatchedAt: "2022-10-02T16:00:03.2471363Z", Season: 0, Number: 0, Title: null, Ids: TraktEpisodeId { Tvdb: "123456789", Tvrage: null, Imdb: "tt12345678", Tmdb: null, Trakt: null, Slug: null } }] }

I think it would make more sense to default to the current time when the media is being marked as watched, as opposed to the media's last paused at time.

What do you think?

I'd need to take a deeper look but this sound more like Jellyfin not falling back to using the current date if no date is set in the API request but reusing the lastplayed date from the pause action instead.

I just checked the code and we're just using LastPlayedDate saved in the Jellyfin DB:

var lastPlayedDate = seen
? _userDataManager.GetUserData(traktUser.LinkedMbUserId, m).LastPlayedDate
: null;

var lastPlayedDate = seen
? _userDataManager.GetUserData(traktUser.LinkedMbUserId, episode)
.LastPlayedDate
: null;

So it seems to be a Jellyfin bug.

You might want to file a bugreport on the main repo.

To update this issue, I have opened an issue on the main repo. I have already found the culprit behind this and called for discussions there. I have also opened a PR to suggest a potential fix.

Should be fixed by jellyfin/jellyfin#8523