Skip to content

Commit

Permalink
fix: none handling
Browse files Browse the repository at this point in the history
  • Loading branch information
add-n2x committed Jan 5, 2025
1 parent 2b309cb commit 7c6f3ff
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/ndtoolbox/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,12 @@ def fuzzy_match(path: str, media) -> bool:
"""Check if path and media file artist and title are similar using fuzzy matching."""
_, file = os.path.split(path)
file = Path(file).stem
r1 = fuzz.ratio(file, media.title)
r2 = fuzz.ratio(file, media.artist_name + " - " + media.title)
r3 = fuzz.ratio(file, media.artist_name + " - " + media.album_name + " - " + media.title)
title = str(media.title)
album = str(media.album_name)
artist = str(media.artist_name)
r1 = fuzz.ratio(file, title)
r2 = fuzz.ratio(file, artist + " - " + title)
r3 = fuzz.ratio(file, artist + " - " + album + " - " + title)
# print(f"Got ratios for '{media.title}': {r1}, {r2}, {r3}")
return max(r1, r2, r3)

Expand Down

0 comments on commit 7c6f3ff

Please sign in to comment.