Kodi Community Forum

Full Version: Last watched / last played from Trakt not ending up in NFO
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
First off all thanks for this nice piece of software! Overall it is working great but today I ran into something strange.

I connected tmm to Trakt and was under the impression that it will sync watched state for episodes including last played from Trakt to tmm and eventually the NFO files.
Is it indeed supposed to do that? The NFO file I end up with has the watched state and a play count (that does not seem to be equal to the playcount in trakt) but does not have the "lastplayed" field.

Since I am a Java developer and this is open source I decided to take a look at it. I can't yet grasp the whole project of course (let alone run it properly from source and debugging it) but from what I am seeing now it looks like tmm stores the date from Trakt (in syncTraktTvShowWatched) but later on disregards that info alltogether in the TvShowEpisodeGenericXmlConnector.

Based on the code I think the same thing applies to movies, but I did not yet run into that.

Am I onto something here or am I completely missing the point?
have to check the whole src too, but IIRC correctly we never used the last played data internally, only passed it from any existing NFO to the new one and passed it from/too trakt.tv

thw main reason here is, that tmm does not really care about this, because our focus is the meta data, whereas the last played information is something a media center cares.
But since we can get it from NFO/trakt, it should be possible to pass this to the other one, but what to do with conflicts? (e.g. NFO has 01.01.2020 and trakt.tv has 03.07.2020).. should we just take the highest one?
what to do if the user toggles the watched state in tmm? 

questions over questions..
I think you are absolutely correct.

I have begun changing the code to suit my usecase and it indeed keeps raising more questions.

What data should be considered the master? What to do if the nfo says 3 plays and trakt only 1?

For me trakt should be the master when it comes to watched state, but that is of course entirely personal preference. For me watched state should be managed by the player.

I also ran into sync issues with multipart episodes. Perhaps I did something wrong with my nfo's, but I managed to workaround that in the code by making sure it retrieves all matching episodes in tmm instead of just the first.
In the mean time i have been testing some Trakt.tv changes and fixes with my own fork.

The changes can be found here:

Are these changes you would be interested in as a merge request? 
I am not sure that this won't break other peoples setups, and i have not yet been able to run any of the unittests
Thanks for you contribution!

Yes, syncing with 2 (or even 3) different values for the SAME metadata is not that easy Wink
Playcount is historically not in TMM, since in pre-Trakt area there was no way to get that (and old Kodi did not export/import that w/o manual setup)
Syncing that might only work, if we take the higher value... but watching the same movie on both ends will then not be reflected (but we might ignore this)

Did a quick rush over your changes, which look pretty good.
We might take that Wink

But give us some time for merging - we are curently evaluating a complete rewrite of that function (since it is a bit... dated)