Skip to content

Commit

Permalink
Merge pull request #632 from ZelKami/fix-title-year-matching
Browse files Browse the repository at this point in the history
Fix title/year fallback ignoring year
  • Loading branch information
razzeee authored May 29, 2024
2 parents e78d536 + b37c807 commit 86af16f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
22 changes: 11 additions & 11 deletions resources/lib/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def findMediaObject(mediaObjectToMatch, listToSearch, matchByTitleAndYear):
year=mediaObjectToMatch["year"],
)
# match only by title, as some items don't have a year on trakt
if result is None and "title" in mediaObjectToMatch:
elif result is None and "title" in mediaObjectToMatch:
result = __findInList(listToSearch, title=mediaObjectToMatch["title"])

return result
Expand Down Expand Up @@ -521,11 +521,11 @@ def compareEpisodes(
in season_col2[season][ep]["ids"]
):
if "ids" in eps:
eps[ep]["ids"][
"episodeid"
] = season_col2[season][ep]["ids"][
"episodeid"
]
eps[ep]["ids"]["episodeid"] = (
season_col2[season][ep]["ids"][
"episodeid"
]
)
else:
eps[ep]["ids"] = {
"episodeid": season_col2[season][
Expand Down Expand Up @@ -558,11 +558,11 @@ def compareEpisodes(
in collectedSeasons[season][ep]["ids"]
):
if "ids" in eps:
eps[ep]["ids"][
"episodeid"
] = collectedSeasons[season][ep]["ids"][
"episodeid"
]
eps[ep]["ids"]["episodeid"] = (
collectedSeasons[season][ep]["ids"][
"episodeid"
]
)
else:
eps[ep]["ids"] = {
"episodeid": collectedSeasons[
Expand Down
4 changes: 2 additions & 2 deletions tests/test_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -511,11 +511,11 @@ def test_findMediaObject_not_matchByTitleAndYear_add_collection_same_year_title_
assert utilities.findMediaObject(data1, data2, False) is None


def test_findMediaObject_match_by_title_should_match():
def test_findMediaObject_matchByTitleAndYear_should_not_match():
data1 = load_params_from_json("tests/fixtures/movies_local_blind.json")
data2 = load_params_from_json("tests/fixtures/movies_remote_blind_no_match.json")

assert utilities.findMediaObject(data1, data2, True) == data2[0]
assert utilities.findMediaObject(data1, data2, True) is None


def test_findMediaObject_matchByTitleAndYear_should_match():
Expand Down

0 comments on commit 86af16f

Please sign in to comment.