This is a Python tool I built to organize my own Spotify playlists by language or genre.
It connects to my Spotify account, analyzes the tracks in a playlist, and creates a new one sorted by the selected criterion. It uses:
- The Spotify Web API to access artist and track metadata
- The AudD API to detect lyrics language
- CSV files to store known artist-language and artist-genre mappings for future use
- You choose a playlist and whether to sort it by language or genre.
- The script builds a new playlist in your Spotify account with the songs sorted accordingly.
- Artist metadata is saved locally so detection improves over time.
- Clone this repository and install the dependencies:
pip install spotipy python-dotenv requests pandas langdetect pycountry
- Create a .env file in the root directory with your credentials:
SPOTIPY_CLIENT_ID=your_spotify_client_id SPOTIPY_CLIENT_SECRET=your_spotify_client_secret SPOTIPY_REDIRECT_URI=http://127.0.0.1:8888/callback AUDD_API_KEY=your_audd_api_key
- Run the script:
python main.py
- Follow the prompts in the terminal to choose a playlist and how you want to sort it.
Esta es una herramienta en Python que desarrollé para organizar mis playlists de Spotify por idioma o género.
Se conecta a mi cuenta de Spotify, analiza las canciones de una playlist, y crea una nueva con las canciones ordenadas según el criterio que elija. Utiliza:
- La API de Spotify para acceder a metadatos de artistas y canciones
- La API de AudD para detectar el idioma de las letras
- Archivos CSV para guardar los géneros e idiomas ya conocidos por artista
- Elegís una playlist y si querés ordenarla por idioma o género.
- El script crea una nueva playlist ordenada dentro de tu cuenta de Spotify.
- Los datos de los artistas se guardan localmente, por lo que la detección mejora con el uso.
- Cloná este repositorio e instalá las dependencias:
pip install spotipy python-dotenv requests pandas langdetect pycountry
- Creá un archivo .env con tus credenciales:
SPOTIPY_CLIENT_ID=your_spotify_client_id SPOTIPY_CLIENT_SECRET=your_spotify_client_secret SPOTIPY_REDIRECT_URI=http://127.0.0.1:8888/callback AUDD_API_KEY=your_audd_api_key
- Ejecutá el script:
python main.py
- Seguí las instrucciones en la terminal para elegir una playlist y cómo querés ordenarla.