Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix title/year fallback ignoring year #632

Merged
merged 2 commits into from
May 29, 2024

Conversation

ZelKami
Copy link
Contributor

@ZelKami ZelKami commented Jan 10, 2024

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

  • findMediaObject is called with Gossip Girl (2007) as mediaObjectToMatch
  • It is not matched with either the IMDB ID, TMDB ID or TVDB Id, so the result is still None
  • Matching the show by title and year still gives no result, so the result is still none
  • Matching the show only by title returns Gossip Girl (2021) from the Kodi library as a match, which is wrong

Behavior after the fix

  • The mediaObjectToMatch has a title and year, so the if clause to look for a match by title and year is true
  • There is no match in the Kodi library, so the result is still None
  • The library listToSearch is not searched for a match only by title anymore, so the method correctly returns no match

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
Copy link
Contributor Author

ZelKami commented Jan 10, 2024

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
Copy link
Collaborator

razzeee commented Jan 14, 2024

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.

This way the media object will not fall back to only matching by title if title and year did not match to anything
@razzeee razzeee merged commit 86af16f into trakt:main May 29, 2024
3 checks passed
@razzeee
Copy link
Collaborator

razzeee commented May 29, 2024

@ZelKami thanks for looking into this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wrong movies matched when falling back on title and year
2 participants