Converts a text file of songs to a playlist on your Spotify account.

Overview

Playlist Converter

Python Tests License: MIT

Convert a text file of songs to a playlist on your Spotify account. Create your playlists faster instead of manually searching for songs.

Demo

Recorded using ScreenToGif.

Table of Contents

How It Works

  • This application reads the contents of every text file in a directory on your computer
  • You must provide details of how your files are structured in a configuration file
  • Getting a temporary access token from Spotify authorizes this app to access/change your account data
  • Using the Python requests library, this application sends the data to Spotify's web API to create the playlist

Credits

Getting Started

Before running this project locally, make sure you meet/install the prerequisites listed below. After meeting the prerequisites, follow the instructions in the Installation section.

Prerequisites

Spotify Account

If you don't already have a Spotify account, go to their sign up page and create one.

Python 3.6+

You must have Python version 3.6 or greater installed on your computer.

Once you've installed Python, open Git Bash or your preferred CLI on Windows, or Terminal on Linux/MAC. Run this command to verify you have the right version of Python:

python --version
# Python 3.*

Installation

1. Clone this repository on your machine.

git clone https://github.com/pa-aggarwal/playlist-converter.git

2. Create a python virtual environment, activate it, and install the packages in the requirements.txt file.

# Navigate to directory
cd playlist-converter

# Create virtual environment 'venv'
python -m venv venv

# Activate virtual environment
. venv/Scripts/activate

# Install packages from requirements.txt
python -m pip install -r requirements.txt

3. You must create your own configuration file called config.ini in the config directory, by copying the template config template.ini file.

# Copy the template config file
cp config/template.ini config/config.ini

Open the config.ini file in your preferred text editor and change the values of the config keys to match your file setup. See the Configuration section for what these keys are and how to fill them in.

4. Visit https://developer.spotify.com/console/get-search-item/ to get a temporary access token from Spotify. Check mark the following scopes to authenticate this application:

  • user-library-read
  • playlist-modify-public
  • playlist-modify-private

Copy and paste the access token into your configuration file under the access_token option.

Note: Spotify's access tokens expire after 1 hour, so you'll need to repeat this step if you're using this application again at a later time.

Configuration

What are the config keys and how do I fill them in?

  • directory_path: Absolute path to the directory containing the text file(s) you want to convert
  • data_order: track artist or artist track based on how songs are listed in your files.
  • data_delimiter: The characters separating track name from artist name(s), preferrably at least 3 chars long e.g. ---, ###
  • user_id: Your username on your spotify account
  • access_token: Token value from step 4 of Installation

Here is an example file setup (location and contents), along with a configuration file:

$ pwd
C:\Users\user\Desktop\playlists

$ ls
playlist-01.txt playlist-02.txt

$ cat playlist-01.txt
Name: My Playlist
3005---Childish Gambino
See You Again---Tyler, The Creator, Kali Uchis
...

config.ini

[FILE_INFO]
directory_path = C:\Users\user\Desktop\playlists
data_order = track artist
data_delimiter = ---

[API]
user_id = priyaaggarwal
access_token = long-key-from-spotify

Usage

Make sure you've completed steps from the Installation section before running this application. This includes making your configuration file and putting text files to convert in their own directory.

In the cloned repository with the venv activated, run this command to create your playlists:

python -m playlist_converter.app

This may take a couple of minutes depending on how large your files are.

You may see an error message if there was an issue trying to convert your files, like one of the following:

  • Missing configuration file or config keys
  • Invalid directory path
  • No text files found to convert
  • HTTP error from invalid access token or something else

If you received no errors, then open your spotify account to see your new playlists.

To check if tests are passing, run this command:

python -m unittest discover -s tests

Contributing

Contributions and feedback for improvements as well as new features are welcome!

  1. Fork this repository.
  2. Create a new branch for your contribution (git checkout -b new-feature).
  3. Add your contribution, and write tests if needed.
  4. Ensure the test suite passes.
  5. Commit your changes to the branch (git commit -m "My new feature does X").
  6. Push to the branch (git push origin new-feature).
  7. Open a pull request.

License

Distributed under the MIT License. See LICENSE.txt for more information.

Owner
Priya Aggarwal
CS Student at Ryerson University.
Priya Aggarwal
Process your transactions from etherscan (and other forks) into excel file for easier manipulation.

DEGEN TRACKER Read first This is my first Python open source project and it is very likely full of bad practices and security issues. You should not u

1 Oct 13, 2022
A simple Discord Bot created for basic functionality and fun chat commands for use in a private server.

LoveAndChaos-Bot v0.1.0 LoveAndChaos-Bot is a Discord Bot specifically designed for a private server; this bot is merely a test and a method to expose

Morgan Rose 1 Dec 12, 2021
Python API for Photoshop.

Python API for Photoshop. The example above was created with Photoshop Python API.

Hal 372 Jan 02, 2023
A discord webhook client written in Python.

DiscordWebhook A discord webhook client written in Python. Installation pip install webhook-client Example from webhook_client import WebhookClient, E

Elijah 4 Nov 28, 2022
→ Comando Básico para Python Discord

Discord.py · Código @client.event async def on_ready(): print('He iniciado sessión en: {0.user}'.format(client)) @client.event async def on_messa

Panda.xyz 4 Mar 12, 2022
TORNADO CASH Pancakeswap Sniper BOT 2022-V1 (MAC WINDOWS ANDROID LINUX)

TORNADO CASH Pancakeswap Sniper BOT 2022-V1 (MAC WINDOWS ANDROID LINUX)

Crypto Trader 1 Jan 06, 2022
Set of classes and tools to communicate with a Noso wallet using NosoP

NosoPy Set of classes and tools to communicate with a Noso wallet using NosoP(Noso Protocol). The data that can be retrieved consist of: Node informat

Noso Project 1 Jan 10, 2022
POC de uma AWS lambda que executa a consulta de preços de criptomoedas, e é implantada na AWS usando Github actions.

Cryptocurrency Prices Overview Instalação Repositório Configuração CI/CD Roadmap Testes Overview A ideia deste projeto é aplicar o conteúdo estudado s

Gustavo Santos 3 Aug 31, 2022
all-in-one wrapper for NASA API's

=========== About bowshock is an all-in-one wrapper for NASA API's. Here is a list of currently supported API's : NASA Earth API NASA APOD (Astronomy

Emir Ozer 85 Nov 09, 2022
A Chip-8 emulator written using Python's default libraries

Chippure A Chip-8 emulator written using Python's default libraries. Instructions: Simply launch the .py file and type the name of the Chip8 ROM you w

5 Sep 27, 2022
Track live sentiment for stocks from Reddit and Twitter and identify growing stocks

Market Sentiment About This repository can mainly be used for two things. a. Tracking the live sentiment of stocks from Reddit and Twitter b. Tracking

Market Sentiment 345 Dec 17, 2022
Decrypt PSSE layer of PSM Games (on PC)

psse-decrypt Decrypt PSSE layer of PSM Games (on PC) Works on Unity and PSM games, and meets all requirements of: https://github.com/vita-nuova/bounti

Bluzume 32 Oct 11, 2022
Rotten Tomatoes API for Python

rottentomatoes.py rottentomatoes offers an easy-to-use Python wrapper to interact with the Rotten Tomatoes API. Before you try and use the API, make s

Zach Williams 88 Dec 15, 2022
A Collection Manager for the objkt.com Minting Factory

Objkt Collection Manager A Collection Manager for the objkt.com Minting Factory. This contract can create a collection on objkt.com and mint into it.

Asbjorn Enge 5 Nov 22, 2022
🖥️ Windows Batch and powershell Discord Token grabber. Made for Troll (lmao)

Batched-Grabber Windows Batch and powershell Discord Token grabber. Made for Troll ! Setup. 1. pip(3) install numpy colored 2. python(3) Batched.py 3.

Ѵιcнч 41 Nov 01, 2022
Userbot untuk memutar video dan lagu di vcg/os

Userbot untuk memutar video dan lagu di vcg/os

FJ_GAMING 2 Nov 13, 2021
This is new discord nitro generator for discord

Hello! This is new discord nitro generator for discord. If you want use it, To generator i added checker for no seraching generator and checker. This tool maked by .

ItzBolt 1 Jan 16, 2022
Kali Kush - Account Nuker Tool

Kali Kush - Account Nuker Tool This is a discord tool made by me, and SSL :) antho#1731 How to use? pip3 install -r requirements.txt -py kalikush.py -

ryan 3 Dec 21, 2021
A part of HyRiver software stack for accessing hydrology data through web services

Package Description Status PyNHD Navigate and subset NHDPlus (MR and HR) using web services Py3DEP Access topographic data through National Map's 3DEP

Taher Chegini 51 Dec 10, 2022
API para realizar parser de frases

NLP API Simple api to parse and apply some preprocessing steps in portuguses phrases (pt_BR) This api uses the great FastAPI and spaCy packages! Usage

⟠ Rodolfo De Nadai 1 Dec 28, 2021