riverscuomo / spotkin_server

A python package that updates one or more of your Spotify playlists every day with a random selection of songs from any playlists you specify. Here's mine: https://open.spotify.com/playlist/1HaQfSGjNzIsiC5qOsCUcW?si=ddc16d3e9524410c . This repo also contains the backend server for Spotkin webapp.
GNU General Public License v3.0
82 stars 9 forks source link

Fix 'banned genres' filtering not working #30

Closed urbainn closed 1 month ago

urbainn commented 1 month ago

hi, this PR should resolve this issue: https://github.com/riverscuomo/spotkin_flutter/issues/58

the issue seemed to occur because of a type mismatch between the _is_banned_by_genre method (that expects a list of genres to be passed as parameter), and the variable that extracts the genres from all the artists, that instead of containing a list of genres contained a list of Artists:

        artist_genre = next(
            (x for x in artists_genres if x["artist_id"] == artist_id), None
        )

I have patched this issue by extracting the genres directly instead:

        artist_genre = next(
            (x['genres'] for x in artists_genres if x["artist_id"] == artist_id and "genres" in x), None
        )

thanks.