trakt / script.trakt

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

Wrong movies matched when falling back on title and year #620

Closed fdw closed 1 month ago

fdw commented 11 months ago

Assume there are two films with the same name, but released in different years. Both have valid and correct metadata in Trakt and Kodi. Let's call them A (1960) and B (1990). If Kodi only knows about A, but you have marked B as watched (and/or rated) in Trakt, the sync will mark A as watched (and/or rated).

Looking at https://github.com/trakt/script.trakt/blob/main/resources/lib/utilities.py#L92, the sync will first try to match using one of the IDs. This is sensible, but as A and B have different IDs, the result will be empty. Then, the script will try to match by title and year (if set in the configuration). Again, the result will be empty, as both have different years. Finally, as a final hail mary, it will match only based on titles - and this yields a match, even though it shouldn't.

Expected Behavior

Movies A and B should not be matched.

Current Behavior

The script should accept that A and B are different movies.

Possible Solution

One possibility: When comparing based only on title and year, check that there is no ID on the right side (if there is an ID, then you have already discarded the comparison). If you try to match only titles, check that the right hand side has no date.

Steps to Reproduce (for bugs)

See above.

Context

I would like to automatically sync my collection with Trakt, but I also want the watched states and ratings to be correct.

Your Environment