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
Auto Liker, Auto Reaction, Auto Comment, Auto Follower Tool. RajeLiker Credit Hacker.

Auto Liker, Auto Reaction, Auto Comment, Auto Follower Tool. RajeLiker Credit Hacker. Unlimited RajeLiker Credit Hack. Thanks To RajeLiker.

Md. Mehedi Hasan 32 Dec 28, 2022
An Async Bot/API wrapper for Twitch made in Python.

TwitchIO is an asynchronous Python wrapper around the Twitch API and IRC, with a powerful command extension for creating Twitch Chat Bots. TwitchIO co

TwitchIO 590 Jan 03, 2023
A community made discord bot coded in Python and running on AWS.

Pogbot Project Open Group Discord This is an open source community ran project. Join the discord for more information on how to participate. Coded in

Project Open Group 2 Jul 27, 2022
Python wrapper to simplify calls to AncestryDNA API.

AncestryDNA API wrapper Ancestry exposes an undocumented REST API for its DNA features. This Python wrapper inventories the available calls, and expos

Matt 2 Jun 10, 2022
Qbittorrent / Aria2 Mirror & Leech Telegram Bot

This is a Telegram Bot written in Python for mirroring files on the Internet to your Google Drive or Telegram. Based on python-aria-mirror-bot Feature

Hüzünlü Artemis [HuzunluArtemis] 81 Jul 15, 2022
Video Stream: an Advanced Telegram Bot that's allow you to play Video & Music on Telegram Group Video Chat

Video Stream is an Advanced Telegram Bot that's allow you to play Video & Music on Telegram Group Video Chat 🧪 Get SESSION_NAME from below: Pyrogram

Jonathan 6 Feb 08, 2022
Telegram-Discord Bridge

imperial-toilet Скрипт, пересылающий сообщения из нескольких каналов Telegram в один/несколько каналов Discord. Технически это Telegram-юзербот и Disc

1 Jan 17, 2022
Activate exitlag trial accounts

Exitlag Account Activator Activate exitlag trial accounts (unlimited trial accounts) ⭐ If you want to support me, follow me on github and star the pro

Benjamin 173 Nov 10, 2022
🐍 The official Python client library for Google's discovery based APIs.

Google API Client This is the Python client library for Google's discovery based APIs. To get started, please see the docs folder. These client librar

Google APIs 6.2k Dec 31, 2022
Resources for the AMLD 2022 workshop "DevOps on AWS"

MLOPS on AWS | AMLD 2022 This repository contains all the resources necessary to follow along and reproduce the workshop "MLOps on AWS: a Hands-On Tut

xtream 8 Jun 16, 2022
Create a roles overview page for all Ansible roles/playbooks in Gitlab

ansible-create-roles-overview Overview The script ./create_roles_overview.py queries a Gitlab API for Ansible roles and playbooks. It will iterate ove

2 Oct 11, 2021
Telegram bot that sends new offers from otomoto.pl

Telegram bot that sends new offers under certain filters from otomoto.pl How to use this bot? Install requirements with pip install -r requirements.tx

Mikhail Zanka 1 Feb 14, 2022
Easy & powerful bot to check if your all Telegram bots are working or not. This bot status bot updates every 45 minutes & runs for 24x7 hours.

PowerfulBotStatus-IDN-C-X Easy & powerful bot to check if your all Telegram bots are working or not. This bot status bot updates every 45 minutes & ru

IDNCoderX 5 Oct 06, 2022
A VCVideoPlayer Bot for Telegram made with 💞 By @TeamDeeCoDe

VC Video Player How To Host ✨ Heroku Deploy ✨ The easiest way to deploy this Bot is via Heroku. Credit 🔥 |🇮🇳 Louis |🇮🇳 Sammy |🇮🇳 Blaze |🇮🇳 S

TeamDeeCode 6 Feb 28, 2022
Python API to interact with Uwazi

Python Uwazi API Quick Start To use the API install the requirements pip3 install -r requirements.txt and use it like this: uwazi_adapter = UwaziAdap

HURIDOCS 2 Dec 16, 2021
Мои личные наработки по новому API Тинькофф. Не официально.

TinkoffNewAPI Мои личные наработки по новому API Тинькофф. Не официально. Официально по ссылке: https://github.com/Tinkoff/investAPI/ Выложено по прос

1 Jan 20, 2022
Python wrapper for the Intercom API.

python-intercom Not officially supported Please note that this is NOT an official Intercom SDK. The third party that maintained it reached out to us t

Intercom 215 Dec 22, 2022
Using DST's API with Python

A short guide on how to access Denmark's Statistics API with python, together with a helper class that facilitates the collection of data and metadata from any DST's table

Alessandro Martinello 16 Dec 02, 2022
The official Python library for the Plutto API

Plutto Ruby SDK This library will help you easily integrate Plutto API to your software, making your developer life a little bit more enjoyable. Insta

Plutto 3 Nov 23, 2021
Touca SDK for Python

Touca SDK For Python Touca helps you understand the true impact of your day to day code changes on the behavior and performance of your overall softwa

Touca 12 May 18, 2022