How I moved to Spotify with my custom script

October 10th, 2023
5 minutes read

I am a bit of an old school person and when it came to music, I loved having all my songs in a folder customly hand-picked and organized by me. Most of these songs were from the 2010 time when we used to get all the MP3 files and store them on our SD Cards. I was stuck with it for a long long time. I had always wanted to move to a music streaming service but I had my doubts and on the other hand, I had many songs by smaller unpopular artists who didn't even host their songs anywhere but Youtube. These would be hard to find.

But it was time and I had to move (to also avoid piracy). I decided to go with Spotify because of its popularity and the number of songs it has over other services like Apple Music.

The Problem

Now, I've had about 1500 songs sitting in my folder as .mp3 files. The problem was, I needed all of them transferred to Spotify. But this wasn't easily achievable. There were online tools that allowed migrating from one streaming service to another but not from MP3 files.
Spotify did have the feature of adding local files but this was not quite what I wanted. I no longer wanted to keep the files, I needed everything to be on Spotify and then make it available offline.

The Solution

MP3 to Spotify

I developed the MP3 to Spotify tool to help me with this problem. It's a simple interactive terminal based application that helps you add the songs to Spotify but the right way (not using local files). It actually finds the song on Spotify then adds it to the playlist of your choice. The process:

  • Provide the necessary information to allow the application to access your Spotify
  • Select the folder where your songs exist (if you provide a text file with the artist/song names, that works too)
  • Choose a Spotify playlist you want to add the songs to
  • Transfer!
    Spotify provides all the necessary APIs, so it wasn't too difficult to implement. It is open source so feel free to check out the code!

How it works

  • The tool separates the artist and song names using the delimiter specified by the user
  • Calls Spotify search with the artist name and track name filters
  • Picks the first song that shows up in search
  • Adds it to the playlist selected by the user

Some Issues

For one, the names of the tracks had to be properly organized for this to work. Thankfully, I was always following the same structure for my naming -- Artist Name - Song Name. Even then, there were a few songs which I hadn't named properly. Thankfully again, the tool provides a log and a count of the ones that failed. So all I had to do was check the log file for the songs that failed to migrate and either fix the name and try again or if the song didn't exist on Spotify, just feel bad about it. RIP covers that don't exist on Spotify.

The other minor downside was that the offical song uploaded by Spotify didn't always show up as the first search result. Sometimes, the first search result was uploaded by or part of someone else's playlist. They're the same songs but have different covers.


This script saved me a lot of time and efforts. It took me less than an hour to get all my songs on Spotify. I couldn't imagine adding the songs to Spotify one by one. Thank god I'm a developer! And I've been using Spotify for a while now, liking it so far, so everything's great 🕺