jellyfin / jellyfin-plugin-trakt

https://jellyfin.org
MIT License
179 stars 32 forks source link

Watching a show on Jellyfin reports multiple episodes to trakt at the same time #158

Closed Appoxo closed 2 years ago

Appoxo commented 2 years ago

Issue:

What I do to recreate the issue:

Troubleshoot steps taken so far:

A bit of a different issue: One Piece episodes are not scrobbled at all. Same library (Type: TV-show)

Environment:

How you installed Jellyfin (upgrade or fresh install) -> Fresh

What platform and operating system you're using (Debian, Arch, Docker, etc.) OS: -> x64, i5 11th gen, docker 5:20.10.17\~3-0\~debian-bullseye, docker-compose and Debian as underlying OS -> Docker Image at the time: Linuxserver.io version:- 10.8.1-1-ls171 Build-date:- 2022-07-20T22:44:26-05:00 -> Linuxserver/jellyfin:latest

Jellyfin: -> Server: Jellyfin, Version: 10.8.1, Operating System: Linux -> Plugin version: 19.0.0.0

What you were doing that caused the issue to appear -> Watched an episode of a show that released yesterday

Any relevant log output -> The truly relevant log output is always at the end but decided to create whole outputs in case it is needed. If you want more specific, please tell me

Any non-standard configurations you use -> I don't think so. Should be a standard config of an intel APU, docker and debian

How am I consuming? -> Chromecast with Android TV (Beta android App (jellyfin-androidtv 0.14.0-beta.2 release)), Jellyfin Web (Chrome), Jellyfin Media Player Windows

Some pictures describing my issue

What happened during replay of episode 4 of Overlord: image

After the episode stopped: (the crossed out episode is the one I watched initially. So just ignore that one) image

My Trakt-plugin settings: image

During playback of One Piece EP S18E16 image

During playback it corrected itself and showed the correct show but with incorrect progress image Update: Shortly after submitting, Trakt showed the following entries: (again the crossed out are the correct ones) image

Appoxo commented 2 years ago

In addition to this problem (please say if I should open a separate issue), the playback is not fully in sync with the progress in Trakt. My server is not reporting a completed episode and thus Trakt is not adding the episode to the history

[23:38:22] [INF] [10] Emby.Server.Implementations.Session.SessionManager: Playback stopped reported by app Android TV 0.14.0-beta.2 playing Mr. Bean. Stopped at 1463745 ms
[23:38:22] [INF] [76] Jellyfin.Plugin.PlaybackReporting.EventMonitorEntryPoint: Playback stop tracker found, processing stop : c2551dfbb1e251bd611f401995872bb2aa001062-fdfefd2803cf4e33a744ca3494afe174-3f5c996acb1bc11bfe6ff2e735bb99af
[23:38:22] [INF] [76] Jellyfin.Plugin.PlaybackReporting.Data.PlaybackTracker: PlaybackTracker : Adding Stop Event : 07/27/2022 23:38:22
[23:38:22] [INF] [76] Jellyfin.Plugin.PlaybackReporting.EventMonitorEntryPoint: Saving playback tracking activity in DB
[23:38:22] [INF] [76] Trakt.ServerMediator: Playback stopped

According to the logs the progress is told to Trakt immediately after playback stops however the progress saves it almost 2 minutes late (not that it matters to the second or minute but it seems like an error)

Shadowghost commented 2 years ago

Trakt heavily relies on IDs being present in your metadata. Do you use TMBD or TVDB for you metadata?

In the current iteration of the code there are not many places where multiple scrobbles can happen without it being marked multiple times within Jellyfin, did you try with only the trakt plugin installed? We're using the Pause event when syncing state to Trakt, Stop (and therefore the "I'm done watching this" event) marks things as watched when 80% of the playtime is watched. That's why we only use it when Jellyfin says the playback has completed. The Pause event sends a percentage to Trakt, which is calculated from the media metadata and the amount of ticks played from the playback tracker, if there's a bug I don't think it's in the plugin.

Can you try if https://github.com/jellyfin/jellyfin-plugin-trakt/pull/154 fixes your problem? If you'Ve enabled exporting metadata there is a bug which may cause duplicate entries.

Appoxo commented 2 years ago

Regarding my metadata: I primarily use theTVDB IMG_20220728_132027.jpg

I will try your fix later this evening. I will update this comment.

Shadowghost commented 2 years ago

That might be a problem because Trakt matches against TMDb and IMDb, While tvdb works in some cases, tvdb deprecated it and we fall back to matching series + episode number (which is unrealiable).

Appoxo commented 2 years ago

That might be a problem because Trakt matches against TMDb and IMDb, While tvdb works in some cases, tvdb deprecated it and we fall back to matching series + episode number (which is unrealiable).

In that case I will try to use TMDb (is there even an IMDb plugin?) for anime and tv and will report back how it works out.

crobibero commented 2 years ago

is there even an IMDb plugin?

IMDb doesn't have an api so there is no plugin

Appoxo commented 2 years ago

Okay new update: When I set everything up I noticed that something added 30 plays to each of the last 15 remaining episodes of a season. Let's see if the ideas can fix it:

Can you try if #154 fixes your problem? If you've enabled exporting metadata there is a bug which may cause duplicate entries.

I removed the option (Export media info) in the plugin, restarted the container and rewatched Overwatch S4E4 (because Overwatch has a reliable hitrate on this issue): The playback is recognized immediately by trakt (according to the website). BUT it still shows several other episodes being scrobbled. In the end it "played back". According to jellyfin my playback stopped at 22:27. According to trakt I had playback of S4E4 at 22:31 and a slow trickle of the following episodes (5-8) at the times: S4E5 22:35, S4E6 22:39, S4E7 22:43, S4E8 22:48 and again S4E4 at 22:56 After another restart I have the same issue again. Seems like this is not the solution are at least the only one and only a part... :(

PS: After the first restart I got hit again by the playback bomb with One Piece episodes on trakt.

That might be a problem because Trakt matches against TMDb and IMDb, While tvdb works in some cases, tvdb deprecated it and we fall back to matching series + episode number (which is unrealiable).

So far I uninstalled a number of not used plugins and disabled theTVDB for good measure as well. (If trakt deems it unnecessary I don't really need it right now) and now have those plugins enabled: image and Overlord is identified as this: image

I refreshed the whole library yesterday (without removing pictures) and have watched overlord S4E4. Unfortunately as soon as I hit F5 to refresh the trakt page I saw multiple scrobbles to trakt up to E13 :( The log after I hit play: https://pastebin.com/zNByjzT7

Shadowghost commented 2 years ago

Might be caused by your naming scheme: Overlord (2015) - S04E04 - E043 could be interpreted as S04E04-E043 which would then be most likely messed up by the parser into multiple plays.

Appoxo commented 2 years ago

Might be caused by your naming scheme: Overlord (2015) - S04E04 - E043 could be interpreted as S04E04-E043 which would then be most likely messed up by the parser into multiple plays.

Just to confirm: You think my current naming scheme makes the plugin and/or trakt interpret watching episode 04 (total episode number E43) think I am watching episode 04 up to 43?

Could make sense...I use the anime numbering of sonarr. As the anime naming scheme I use the one from trash guides (here). It would also explain why One Piece is messed up, but regular tv shows like Mr.Bean scrobble just fine. Afaik when I got a show that was combined beforehand (Halo 4 - Forward unto dawn) it is registered as S01E01-05 and probably should scrobble to trakt as watching all 5 eps at once, right? image

I will try the tv naming scheme from trash guides and report back if it works!

Appoxo commented 2 years ago

Renaming the episodes does absolutely nothing. It seems like the metadata is my problem. Some shows get absolute numbering (example: S2E2 - E22) and some get regular numbering as a title. I can't make out what decides to do what. My metadata is set up like this: image Any recommendation on what to change?

Appoxo commented 2 years ago

I think I figured the issue out and it's as you expected the naming convention of Jellyfin. If I set the country of the library to "Japan" and preferred download language to "English" as anime is usually originating from there and I want japanese metadata with english translation I get absolute numbering. When I set the country to "United States" I get regular season:episode numbering and Trakt seems to get what is which episode

Changing the country back to "Japan" gets back all my settings but for whatever reason does not (???) change it back to absolute numbering? I think I may have found a very weird niche bug regarding metadata sourcing?
Edit: As it is late I will confirm later if trakt now understands without issues what I am watching, what not and how long.

Appoxo commented 2 years ago

Well...I think I found the source of this problem: Absolute numbering seems to be the culprit so you assumption was correct. Could a a filter maybe help if jellyfin reports the episode as "S02E02 - 99"? So far I watched 2 episodes of One Piece without any trouble and was even able to import a new show (with country as "Japan") without absolute numbering. Should I raise an issue/suggestion on the main Jellyfin page about TV libraries option to enable/disable absolute numbering regardless of source whenever possible?

Shadowghost commented 2 years ago

Main problem should not be the absolute numbering but the absolute numbering and multiple episodes together. Absolute numbering with proper TMDB ids per episode would still work since we match on those ids before relying on episode and season numbers. There isn't much we can do in this specific case imo.

Appoxo commented 2 years ago

Main problem should not be the absolute numbering but the absolute numbering and multiple episodes together. Absolute numbering with proper TMDB ids per episode would still work since we match on those ids before relying on episode and season numbers. There isn't much we can do in this specific case imo.

Am i interpreting this correctly? I have to care that each episode is properly identified when mixing absolute and episode number or have only one of the systems running at once?

Shadowghost commented 2 years ago

Let me explain: The plugin does this when you watch an item:

This is done on an per-episode basis, so as long as the items are single episodes with proper ids it should work as intended.

Appoxo commented 2 years ago

Update since I actually watched some episodes of the troublemakers:

At this point I would probably close the ticket if you have no further questions