Skip to content

A program designed to download Spotify and SoundCloud songs, featuring built-in iBroadcast support.

License

Notifications You must be signed in to change notification settings

SiddhartaDutta/Spotify-to-MP3

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spotify to MP3

Disclaimer

This project is designed to be both a learning tool and for experimental purposes only; it is for educational purposes only. The author takes no responsibility for damage or misfunction of any kind caused by the software in this repository. Please use both caution and common sense when using this project.

Contents

  1. Description
  2. Badges
  3. Visuals
  4. General Notes & Warnings
  5. Usage Option 1 (Downloadable Docker Image)
  6. Usage Option 2 (Creating a Local Docker Image)
  7. Usage Option 3 (Cloning the Repository)
  8. Frequently Asked Questions
  9. Prerequisite Instructions
  10. Contributing

Description

Spotify to MP3 is a collection of scripts written and organized to help the user download their playlists in a relatively quick and organized manner. The MP3 files contain metadata in the ID3 format so that the MP3 files may be exported to an MP3 manager, such as iBroadcast, iTunes or Spotify, (although Spotify does not allow "premium" features for owned MP3 files), without the user having to edit metadata.

Badges

Python Docker Shell Script

Apple Music Spotify

Licence

Visuals

Coming soon...

General Notes & Warnings

WARNING: Please Update Playlists Regularly!

Large updates can fail regardless of steps taken to prevent errors. 
These errors are server sided and out of my control.

NOTE: These instructions will refer to a 'host directory'. 'Host directory' refers to the directory containing a generated folder where your music can be found (Host > Music > Album Folders).

NOTE: System administrator permissions are required due to Docker. The script and subsequently generated Docker image will not work without administrator permissions.

NOTE: Ensure that any directory in the full path where you are installing the program does NOT contain spaces. Docker will not work with any spaces in the destination path.

Usage Option 1 (Downloadable Docker Image)

Prerequisites

Docker Engine, and an MP3 manager are ALL required for this installation process (the least demanding option).

Please follow the relevant steps here: Prerequisite Instructions

Instructions

The downloadable Docker image can be found here: Link to Docker Hub

Installing Using the Command Line

  1. Open either WSL or a Bash Terminal

  2. Run the following command to pull the image:

    sudo docker pull siddhartadutta/spotify-to-mp3
  3. To run the image,

    • If it is your first time running the image, use

      • Option 1 - Using the Direct Path

        sudo docker run --name spotify_to_mp3 -it --mount type=bind,src=<PATH>,target=<PATH> siddhartadutta/spotify-to-mp3

        Where PATH is the path to where you would like to be your main directory (a music folder will be created in that directory).

        Example: PATH/Music/

        Where PATH is defined by you and Music/ is a folder created by the program (only enter the "PATH" portion).

      • Option 2 - Navigating to the Path Through the Terminal

        sudo docker run --name spotify_to_mp3 -it --mount type=bind,src=$PWD,target=$PWD siddhartadutta/spotify-to-mp3

        For this method, first use the cd command to navigate to your host directory's path. Then run the above command.

    • If you have ran the image before, use

    sudo docker start -ai spotify_to_mp3

Usage Option 2 (Creating a Docker Image)

Prerequisites

Docker Engine, and an MP3 manager are ALL required for this installation process (the second least demanding option).

Please follow the relevant steps here: Prerequisite Instructions

Instructions

The downloadable Docker image can be found here: Link to Docker Hub

Downloading the Source Files

  • Option 1 - Newest Stable Release

    1. Navigate to the home page of the repository (found here).
    2. On the right side of the screen, find the "Releases" tab. Select this tab.
    3. For the newest release (the top most release on this page), click on the "Assets" dropdown to access the source code downloads.
    4. Download the .zip file.
    5. Unzip the folder and move the files and folders contained inside into the host directory.
    6. Refer to the "Usage" section for the next steps.
  • Option 2 - Current Development

    CAUTION: Please only use this option if you are confident as this version is the most unstable and may not even work depending on the specific update being used. This version uses the last commit from the development branch.

    1. Near the top, find the branches dropdown. It should be defaulted to the "main" branch.
    2. Select the dev branch (will be either titled "dev" or "CLI_UI_DEV").
    3. Click on the green "Code" button and then download the the .zip (click the "Download ZIP" button).
    4. Unzip the folder and move the files and folders contained inside into the host directory.
    5. Refer to the "Usage" section for the next steps.

Usage

There is currently no native Powershell support. The following commands are universal to both Bash and WSL (macOS, Windows with WSL, and any Linux-based system should work).

  • To build the image and run a container, use:

    sudo ./setup.sh
    
  • If being told that the script cannot run, use:

    sudo chmod +x setup.sh
    

    before trying the first command again.

  • If you have run the setup script before, use:

    sudo docker start -ai spotify_to_mp3

Usage Option 3 (Cloning the Repository)

This option runs the program locally. There are option specific prerequisites that will be covered in this section rather than in the prerequisite section.

It is recommended you have a basic understanding of both Python and terminal usage for this option.

Language Prerequisite

Please follow the linked instructions should you not already have Python (this program utilizes Python 3.10.11)

Module Prerequisites

List of Modules to be Installed

Installing Modules

Running the following command in your virtual environment (or where ever you wish to have the modules) should download all required and non-standard modules:

pip3 install yt_dlp python-requests python-dotenv pydub ibroadcast tqdm && pip3 install spotipy --upgrade && pip3 install --upgrade yt-dlp

Cloning

First, navigate to the base directory in your terminal. Then you can then clone the repository using:

git clone https://github.com/SiddhartaDutta/Spotify-to-MP3.git

Running the Program

Ensuring you are in the clone's directory, you can run the following command:

python3 main.py

Frequently Asked Questions

How is the tool designed to be used?

Answer

When using iBroadcast for your music library, your songs will be added in the same order they appear when you decide to update your playlist. If you wish for iBroadcast to mirror Spotify (only when uploading initially), then you can use the tool regularly with no worry about song order specification.

When using Apple Music for your music library, it is highly recommended that when creating playlists on Spotify, you create them grouped as albums; all songs belonging to an album should be grouped chronologically together. This style of listening involves fully listening to an album at once and adding desired songs then.

Note for Apple Music: However, if you do not wish to listen to music in an album fashion, you can still easily add albums to your MP3 manager. After downloading your music, you can sort the album folders by those edited most recent. This way, all albums will be listed that need to be transferred (is beneficial when there are a large amount of albums/singles).


How do I get a Spotify playlist's ID?

Answer

First get the share link to a playlist. The playlist ID is after the '/playlist/' to the first question mark.

Example: https://open.spotify.com/playlist/0CdFo515yc2vcintnGYG3b?si=e8f762d893c64743

The ID is 0CdFo515yc2vcintnGYG3b


How do I get a Spotify song's ID?

Answer

First get the share link to a song. The song ID is after the '/track/' to the first question mark.

Example: https://open.spotify.com/track/4PTG3Z6ehGkBFwjybzWkR8?si=d6d587fe7439454f

The ID is 4PTG3Z6ehGkBFwjybzWkR8


How do I get a iBroadcast playlist's ID?

Answer

First locate the url when your playlist is open. The playlist ID follows the ID tag within the URL and prior to the apersand (&).

Example: https://media.ibroadcast.com/?view=container&container_id=######&type=playlists

The ID is ######


Prerequisite Instructions

| Back to install Option 1 | Back to install Option 2 |

NOTE: If using WSL on Ubuntu 22.xx, make sure to run the following commands prior to running the script (adds missing yet required tools):

sudo add-apt-repository ppa:wslutilities/wslu
sudo apt update
sudo apt install wslu

Prerequisite: Docker

Installing Docker

Detailed instructions will come in the future. Please follow the instructions here instead: https://docs.docker.com/get-docker/

NOTE: Docker Engine is required.


Prerequisite: MP3 Manager of Your Choice

MP3 Managers

If you have an Apple device, it is highly recommended you use either iBroadcast or Apple Music as your MP3 manager.

If you have an Android device, it is highly recommended you use iBroadcast.

Spotify is not recommended as even with your own MP3 files, Spotify still applies non-premium rules such as limited skips and ads.

Other managers may work, however, those previously mentioned have been tested with this program.


Prerequisite: pip3

Installing pip3

Please enter the following command into your terminal (if you are not sure if you have pip3, it is safe to run this command still):

sudo apt install python3-pip

Contributing

I am not currently looking for any collaborators.