Skip to content

Commit

Permalink
calculate main artist match only if artists list is not empty
Browse files Browse the repository at this point in the history
  • Loading branch information
xnetcat committed Dec 1, 2022
1 parent 74fad7c commit 22be0a8
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions spotdl/providers/audio/ytmusic.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,10 +272,16 @@ def order_results(
if not common_word:
continue

# match the song's main artist with the result's main artist
main_artist_match = fuzz.ratio(
slug_song_main_artist, slugify(result["artists_list"][0])
)
# initialize match value to 0
main_artist_match = 0.0

# check if artists list is not empty
# if it isn't perform initial match
# on the main artists
if result["artists_list"]:
main_artist_match = fuzz.ratio(
slug_song_main_artist, slugify(result["artists_list"][0])
)

# print(f"? main_artist_match: {main_artist_match}")

Expand Down

0 comments on commit 22be0a8

Please sign in to comment.