trakt / script.trakt

Trakt.tv movie and TV show scrobbler for Kodi
GNU General Public License v2.0
315 stars 149 forks source link

Fix title/year fallback ignoring year #632

Closed ZelKami closed 1 month ago

ZelKami commented 6 months ago

This fixes #620

Example: You have Gossip Girl (2007) in your Trakt history and Gossip Girl (2021) in your library. You have "Fallback to title and year if necessary" activated and you want to sync your watched episodes to your Kodi library.

Current behavior

Behavior after the fix

I tested it on my Kodi instance for the ratings sync and the "Mark episodes from Trakt history as watched" sync and it should also work for movies as compareMovies uses the same findMediaObject method

ZelKami commented 6 months ago

I think the failed test_findMediaObject_match_by_title_should_match() is wrong. It suggests that the remote movie Blind (2014) should be matched to the local movie Blind (2014) but in my opinion the difference in years should suggest that those are different movies. I understood the fallback to matching only by title if the remote movie has no year (which is suggested a the comment in findMediaObject) or did I misunderstand something?

razzeee commented 6 months ago

Yeah, your fix does seem valid/ the old logic is very obviously broken from a control flow POV.

Which also suggests, that we need a test case more (besides fixing the one you mentioned) that checks that year and title match, but don't get overwritten by a third item, where just title matches.

razzeee commented 1 month ago

@ZelKami thanks for looking into this