This script was written in order to aid in building my personal playlist. It utilizes Spotify A.P.I. for metadata content and uses the Invidious A.P.I. to provide the U.R.L. audio source(s). It uses the yt-dlp video downloader and appends the corresponding metadata adhereing to the ID3tag standard.
While there are many ways to skin the cat per say, we reccomend using the Mamba project for quick and frictionless experience. Specifically, this guide assumes you install the miniforge option. After installing, open an Unicode-enabled terminal (Miniforge Prompt is included with miniforge on Windows) and begin by cloning the repository to your machine (assuming SSH, which you can set up by following this tutorial) and entering the resulting directory using:
git clone git@github.com:me11203sci/Application-For-Tunes.git
cd Application-For-Tunes/
then use the included enviroment.yaml
file to create the python enviroment using the following
command:
mamba env create --file enviroment.yaml
Assuming there are no errors, then run:
mamba activate aft
And you should be good to go!
Ensure that the repository is cloned to your local machine, then proceed.
Before running the script, you need to provide valid Spotify application credentials in order to make calls to the Spotify A.P.I.:
- Begin by creating a Spotify Developer Account here.
- Once you have logged in, go to the Developer Dashboard and create a new application. Any link should work for the Redirect U.R.I., it is not important for our purposes. Be sure to select the tickbox labeled "Web API".
- Wait a bit for your application to be approved. Once that happens, open the application settings. Here you should be able to see both your Client ID and a Client Secret.
Finally, create a file named .env
in the project repository structured as follows:
spotify_id=[REPLACE EVERYTING AFTER EQUAL SIGN WITH CLIENT ID]
spotify_secret=[REPLACE EVERYTING AFTER EQUAL SIGN WITH CLIENT SECRET]
The script can be run with the following command:
python aft.py
Some Windows users may encounter the following error:
This is a known issue with ffmpeg and the solution is to run the included batch
file, install_patched_ffmpeg.bat
(REMEMBER: run this while the aft
python enviroment
is active.)