jellyfin / jellyfin-plugin-trakt

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

Matching episodes by SxE and not TVDBid #23

Open SenorSmartyPants opened 5 years ago

SenorSmartyPants commented 5 years ago

I have some series that I watch that are DVD ordered. I watched an episode outside of JF and my video player marked it watched on trakt correctly.

local file - named to match DVD order Veronica Mars 1x10 - Silence of the Lamb

Trakt history shows this episode watched (trakt displays aired order) Veronica Mars 1x11 - Silence of the Lamb

That is correct.

However, when JF did it's sync it marked the wrong episode watched. local file = Veronica Mars 1x11 - An Echolls Family Christmas

Sync appears to match episodes only using season and episode number. Not TVDBid if present (which they are in my JF metadata)

Please sync via TVDBid to support DVD and absolute ordered shows.

SenorSmartyPants commented 5 years ago

i think I've found the relevant code.

https://github.com/jellyfin/jellyfin-plugin-trakt/blob/d75344410110492c14255ddfa65417e9cea12555/Trakt/ScheduledTasks/SyncFromTraktTask.cs#L208-L226

Before matching on season and then episode, it should check for external IDs and match on those. This will be more accurate and support dvd order and absolute ordering. If no match is found then existing code should be used to match on season and episode IndexNumbers

SenorSmartyPants commented 4 years ago

The Get Watched call this plugin uses gets the full watched history for a trakt user. From what I can tell this call only returns season and episode index numbers (aired order), no ids (tvdb, imdb, etc). This is why history is matched the way it currently is.

Get History does return ids for episodes. It does not return all history by default, there are start and end parameters.

I'm not sure why this was implemented in this fashion (history vs. watched).

Smallest impact on JF code base would be to get Trakt to returns ids with Get Watched. But IDK if they would do that.

Sync could be re-written (for episodes) to pull from Get History instead.

Thoughts?

Shadowghost commented 2 years ago

I tried to find a way to properly handle this but up until now I haven't found a sane way to do this.

Another problem with the Get History approach would be that we'd need to check each episode separatly (this will hammer the API) and we'd need to already have the Trakt ids available locally for properly lookup too...

HStep20 commented 2 years ago

I think this could also be related to a problem with specials being marked as unplayed because theyre listed on TVDB, but not listed as specials on Trakt. It mostly seems to happen with things like Movies that get categorized as Movies on trakt, but specials on TVDB.

South Park is a good example of it with their "Post Covid" specials that are listed as specials, whereas on Trakt they are listed as Movies and not included in the 'TV Series' listing at all.

Shadowghost commented 2 years ago

That's nothing we can properly handle tbh. Trakt switched to tmdb as main metadata provider.

HStep20 commented 2 years ago

Could it be possible to just ignore syncing items that don't exist on trakt, within a series?

Shadowghost commented 2 years ago

I'm really tempted to drop the fallback to syncing by season and episode number (this would achieve what you request) because it's so damn unreliable.

SenorSmartyPants commented 2 years ago

Make that an option if you do, don't drop it entirely. I worked on the fallback code and I don't want it deleted.

SenorSmartyPants commented 2 years ago

Which thing is unreliable?

I have a PR in progress that addresses the specials/movie problem but it's not quite ready.

Shadowghost commented 2 years ago

Your PR should be fine since we match on IDs (and I do like that). Matching on season and episode number is unreliable because they can be so extremly different between metadata services and if you don't adher to tmdb by default you get messed up playback tracking on trakt. Especially special naming and sorting is totally unreliable by number.

SenorSmartyPants commented 2 years ago

Scrobbling in my PR isn't the problem. It's manually marking as watched/unwatched. Trakt returns exactly what was provided when sending back what it didn't find. JF assumes this is always a episode object, but when it's a series/season/episode structure that is needed when doing SxE and deserializes it incorrectly. (I think that is the case, I know it is a problem with deserialization. Haven't worked on this in a bit)