A command-line tool that generates a new Tidal playlist with Last.fm recommended tracks based on a selection of your favorite tracks from Tidal.
-
Clone the repository.
-
Install dependencies with
uv:uv pip install -r requirements.txt -
Create a
.envfile and add your Last.fm API key. You can get one from your Last.fm API account page.LASTFM_API_KEY=your_api_key -
Run the script once interactively to authenticate with Tidal. This will create a
tidal_session.jsonfile in the root of the project, which will be used for all future non-interactive runs.
This tool has two main modes of operation and a shuffle modifier that can be combined with either mode.
This is the default mode. The script will select a random number of tracks from your "Favorite Tracks" on Tidal and use them as seeds to find similar music.
Example:
uv run python -m src.cli.main --num-tidal-tracks 5 --num-similar-tracks 10 --playlist-name "TDE {date}"You can also generate a playlist based on a single, specific song. This is perfect for exploring the sound of a track you've just discovered.
Example:
uv run python -m src.cli.main --artist "Lost Tribe" --track "Gamemaster" --num-similar-tracks 1000 --playlist-name "Gamemaster Vibes"For either of the modes above, you can add the --shuffle flag. This tells the script to fetch a large pool of similar tracks (up to 1000 per seed) and then randomly select the number specified by --num-similar-tracks. This is a great way to discover less obvious recommendations.
Example (with Mode 1):
uv run python -m src.cli.main --num-tidal-tracks 5 --num-similar-tracks 10 --playlist-name "TDE Shuffle {date}" --shuffle| Option | Description | Default | Required |
|---|---|---|---|
--num-tidal-tracks |
(Mode 1) The number of random favorite tracks to select from Tidal to use as seeds. | 10 |
No |
--num-similar-tracks |
The number of similar tracks to retrieve from Last.fm for each seed track. | 5 |
No |
--shuffle |
If enabled, fetches a large pool of similar tracks (1000) and randomly selects from it to increase variety. | False |
No |
--artist |
(Mode 2) The artist of a specific track to use as a seed. Must be used with --track. |
No | |
--track |
(Mode 2) The title of a specific track to use as a seed. Must be used with --artist. |
No | |
--playlist-name |
The name for the new Tidal playlist. You can use {date} to automatically insert the current date (YYYYMMDD). |
Yes |
You can schedule the script to run periodically using cron on Unix-like systems or Task Scheduler on Windows.
cron is a task scheduler for Unix-like systems. To set up a daily job, you need to edit your user's crontab file.
-
Open your crontab file by running the following command in your terminal:
crontab -e
-
Add the schedule line. Go to the end of the file and add the following line. Important: You must replace
/path/to/tidal-discovery-enginewith the absolute path to your project folder (you can get this by runningpwdfrom your project directory).The following example will run the script every day at 8:00 AM.
0 8 * * * cd /path/to/tidal-discovery-engine && /home/username/.local/bin/uv run python -m src.cli.main --num-tidal-tracks 5 --num-similar-tracks 10 --playlist-name "TDE {date}"
-
Save and close the file. The new schedule will be active immediately.
- Open Task Scheduler.
- Create a new task.
- Set a trigger for when you want the task to run.
- Set the action to "Start a program".
- Set the program/script to your Python executable inside the
.venvfolder (e.g.,C:\path\to\tidal-discovery-engine\.venv\Scripts\python.exe). - Set the arguments to
-m src.cli.main --playlist-name "Daily Discovery". - Set the "Start in" directory to the root of the project (e.g.,
C:\path\to\tidal-discovery-engine).
This project was developed using a unique, AI-driven workflow inside Visual Studio Code, leveraging the Spec Kit methodology. The entire process, from initial idea to final implementation, was guided by a series of structured prompts and automated scripts.
The primary tools used were:
- GitHub Copilot: Used as the core AI assistant for generating and refining code.
- Gemini 2.5 Pro: Integrated for advanced reasoning and to help guide the development process.
- Spec Kit: A set of prompts and scripts that enforce a rigorous, specification-driven development process. This included generating a constitution, a detailed specification, a project plan, and a task list before any code was written.
This approach ensured that the project was well-defined, robust, and implemented efficiently, with the AI agents handling the heavy lifting of code generation and iteration.
-
APIs
- Last.fm API - Used for finding similar tracks.
- Tidal API - Used for accessing user favorites and creating playlists.
-
Libraries