Skip to content

Commit

Permalink
Make genres comparison case insensitive
Browse files Browse the repository at this point in the history
  • Loading branch information
iiacoban42 committed Jun 15, 2023
1 parent e8991d2 commit f143b97
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions backend/src/home/recommender.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def filter_playlist(blended_spotify_playlist: list, preferences_list: list, excl
for track, artist, genres in blended_spotify_playlist:
track_score = 0
for genre, genre_score in result.items():
if genre in genres:
if genre.lower() in genres:
track_score = track_score + genre_score
if track_score >= 0:
filtered_playlist.append(tuple((track_score, track, artist, genres)))
Expand Down Expand Up @@ -248,4 +248,4 @@ def find_youtube_urls_of_spotify_playlist(spotify_playlist: list) -> list:
# print(yt_urls)

# blend_playlist_curated("Designing", [['rock']], [['pop']])
# print(blend_playlist_curated("Designing", [['classical']], [[]]))
print(blend_playlist_curated("Designing", [['classical']], [[]]))
1 change: 1 addition & 0 deletions backend/src/home/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ def get_new_playlist(request):

return JsonResponse({"playlist_blend": blend})


def get_dummy_playlist(request):
"""Create new playlist based on genres and context"""

Expand Down

0 comments on commit f143b97

Please sign in to comment.