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
Discord music bot using discord.py, slash commands, and yt-dlp.

bop Discord music bot using discord.py, slash commands, and yt-dlp. Features Play music from YouTube videos and playlists Queue system with shuffle Sk

Hizkia Felix 3 Aug 11, 2022
A full-featured Python wrapper for the Onfleet API.

UPDATE: Please use Onfleet's wrapper instead. This repository is not maintained. https://github.com/onfleet/pyonfleet --- Python-Onfleet   python-onfl

Lionheart Software 11 Jan 13, 2022
Senditapp.com bot spammer, spam your friends

Sendit Spammer Python ⚠️ I am not responsible for how you use this tool. This tool is against "Sendit" ToS and shall not be used in a production envir

Glaukio 1 Dec 31, 2021
Unofficial GoPro API Library for Python - connect to GoPro via WiFi.

GoPro API for Python Unofficial GoPro API Library for Python - connect to GoPro cameras via WiFi. Compatibility: HERO3 HERO3+ HERO4 (including HERO Se

Konrad Iturbe 1.3k Jan 01, 2023
A demo titiler for Sentinel 2 Digital Twin dataset

This is a DEMO custom api built on top of TiTiler to create Web Map Tiles from the Digital Twin Sentinel-2 COG created by Sinergise

Development Seed 26 May 21, 2022
Herramienta para transferir eventos de Sucuri WAF hacia Azure Monitor Log Analytics.

Transfiere eventos de Sucuri hacia Azure LogAnalytics Script para transferir eventos del Sucuri Web Application Firewall (WAF) hacia Azure LogAnalytic

CSIRT-RD 1 Dec 22, 2021
Check your accounts/tokens fast with our checker!

Discord_Account_Checker How to use? Installing library's pip install -r reqs.txt Loading accounts Load your accounts to accounts.txt file. Launch pyth

1 Jan 11, 2022
Social Framework

Social Int Framework Social Int Framework its a Selenium script that scrape the IG photos and do a Reverse search on google and yandex for finding ano

29 Dec 06, 2022
Based on falcondai and fenhl's Python snowflake tool, but with documentation and simliarities to Discord.

python-snowflake-2 Based on falcondai and fenhl's Python snowflake tool, but with documentation and simliarities to Discord. Docs make_snowflake This

2 Mar 19, 2022
Lol qq parser - A League of Legends parser for QQ data

lol_qq_parser A League of Legends parser for QQ data Sources This package relies

Tolki 3 Jul 13, 2022
A simple message content sniping Discord bot which you can run yourself! Sniping API pulled from isobot and Arch bot

Discord Snipe Bot This is a bot made with the same message content sniping API from isobot and Arch bot. It's default prefix is -, however you can als

notsniped 5 Aug 11, 2022
streamlit translator is used to detect and translate between languages created using gTTS, googletrans, pillow and streamlit python packages

Streamlit Translator Streamlit Translator is a simple translator app to detect and translate between languages. Streamlit Translator gets text and lan

Siva Prakash 5 Apr 05, 2022
PaddleOCR推理的pytorch实现和模型转换

PaddleOCR2Pytorch 简介 ”真·白嫖“PaddleOCR 注意 PytorchOCR由PaddleOCR-2.0rc1+动态图版本移植。 特性 高质量推理模型,准确的识别效果 超轻量ptocr_mobile移动端系列 通用ptocr_server系列 支持中英文数字组合识别、竖排文本

519 Jan 08, 2023
List of twitch bots n bigots

This is a collection of bot account names NamelistMASTER contains all the names we reccomend you ban in your channel Sometimes people get on that list

62 Sep 05, 2021
Updated version of A discord token/password grabber thats grabs all of their tokens, passwords, credit card + alot more

Updated version of A discord token/password grabber thats grabs all of their tokens, passwords, credit card + alot more

Rdimo 556 Aug 05, 2022
Python API for Photoshop.

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

Hal 372 Jan 02, 2023
This repository will (hopefully) always contain the latest version of the libProfessorP.asm.so shared object.

libPuhfessorP - Deploy Repo This repo should (hopefully) always contain the latest version of the libPuhfessorP.asm.so shared object, to be linked wit

Puhfessor P - CPSC 240 3 Sep 30, 2021
A small and fun Discord Bot that is written in Python and discord-interactions (with discord.py)

Articuno (discord-interactions) A small and fun Discord Bot that is written in Python and discord-interactions (with discord.py) Get started If you wa

Blue 8 Dec 26, 2022
This is a discord bot, which tells you food recipes.

Discord Chef Bot You have a friend, familiy or other group / channel where the topic is the food? You cannot really decide what's for Saturday lunch?

2 Apr 25, 2022
KaydyPurge - Python Purge Script for Discord made by Kaydy Cain#0001

How to Install Open terminal Execute "git clone https://github.com/apolo1337/Kay

apolo 5 Jan 27, 2022