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
83 stars 8 forks source link

make sure quantity zero playlists aren't being fetched in the processjobs #29

Closed riverscuomo closed 2 months ago

riverscuomo commented 2 months ago

seems right


def get_all_tracks(job, spotify):
    """
    This function will get the tracks from the playlists the user has specified
    using parallel processing to speed up execution.
    """
    target_playlist_name = job["name"]
    log(
        f"Getting tracks from the playlists earmarked for the {target_playlist_name} playlist...")

    my_picks = []
    tasks = []

    # Prepare tasks for parallel execution
    for row in job["recipe"]:
        quantity = int(row["quantity"]) if row["quantity"] else None
        if quantity is None or quantity == "" or quantity < 1:
            continue