Coder Social home page Coder Social logo

jakelauer / spotifymatcher Goto Github PK

View Code? Open in Web Editor NEW

This project forked from boscodomingo/spotifymatcher

0.0 0.0 0.0 74 KB

Match your local files to Spotify's database, so you can listen to them anywhere you go!

License: GNU General Public License v3.0

Python 100.00%

spotifymatcher's Introduction

SpotifyMatcher

Cross-platform tool to match your local files to Spotify's database! Easily move all your .mp3 files over to a playlist on Spotify

Before you start (5 minutes)

This isn't infalible, and it would be quite surprising if it matched 100% of songs. Be aware you'll probably have to do a bit of manual searching, but this will significantly reduce that amount by automating the majority of the process. On to the requirements and instructions:

Install Python >3.6

Make sure you have Python 3.6 or later installed, preferably the latest version. We tested it with Python 3.8.4 on a x64 PC with Windows 10 You'll need to install the libraries spotipy and eyed3

I suggest you create a virtual environment so you don't mess other libraries, with the built in venv

Using venv (OPTIONAL, RECOMMENDED)

For this, simply open a Terminal in the folder that the code is in (type 'wt' in the Windows Explorer address bar for Windows Terminal, or 'cmd' if that doesn't work) and write the following commands (make sure to change for your desired folder name):

python -m pip install --upgrade pip
python -m venv <MyEnv>
<MyEnv>\Scripts\activate.bat # <- on cmd
<MyEnv>\Scripts\Activate.ps1 # <- on PowerShell

This should make the terminal look something like this:

Terminal with venv active

To exit the virtual environment, simply type deactivate and press Enter. It is not necessary, though, as we'll be working within the environment and you can just close the console once it is done.

Installing the libraries

You can now install spotipy and eyed3 with:

pip install --upgrade spotipy
pip install --upgrade eyed3

Creating a Spotify Developer Application

Head over to the Spotify Developer website, log in with your Spotify account and create a new application (name doesn't matter).

Copy the client id and the client secret, open the settings and make sure to add a URL to the "Redirect URIs". It doesn't really matter what, try https://localhost/ if not sure, but take note of it because you'll need to write it in the source code later.

With these 3, open the file main.py with whatever IDE or Text Editor you like (preferably Wordpad if you use a text editor), and change this bit of code:

connect_to_spotify code

(Use the Find function to find it if you don't see it. It is inside the connect_to_spotify function)

Paste the aforementioned ids and the URL you chose in the corresponding lines. With this, setup is done and you can now use the tool!

Using SpotifyMatcher

Usage is very, very simple. You only have to call the program with

python ./main.py username playlist_id

(may have to use python3 if you have several versions of Python installed or if you're not on Windows).

With this, the application should open a new tab on your default browser. Accept the permissions it asks for, and copy the URL of the page it takes you to (if it's localhost, it will probably not load anything, that's perfectly ok. We only need the URL). Paste it in the terminal.

With that, authentication should be done and you can move on to the good stuff. Simply paste the path to your music directory (Tip: right click the address bar on Windows Explorer, 'Copy address as text'). You can also bypass this step if you manually enter a path in the source code. Simply find the music_dir variable and paste it there before you execute the program:

Imgur

If the path is valid, the program should start identifying your files and subsequently searching Spotify for a match. This may take several minutes, depending on your processor, internet speed, number of files... Just be patient!

Once done, if you specified a playlist_id it will try to add the matches to said playlist.

CAREFUL

If you don't own said playlist, can't add tracks or it has been deleted, the program will fail, and you'll have to start again, so make sure you have said permissions.

We recommend either creating a new playlist and getting its id (simply open it in the browser and copy the final string of numbers and letters) or leaving it blank, so the program creates a new one for you.

Only thing left is to check the .txt file with the failed matches and search those manually (I know, I know... blame Spotify's unconsistent artist - title debacle!)

Getting your username and playlist ids

Username

Open Spotify on PC, go to your user profile and click the 3 dots. Click share and "Copy Spotify URI". Paste and remove the spotify:user:

You can also copy your profile link and just take the stuff after /user but before the ?

Playlist id

We recommend you don't actually use a playlist id and rather leave it blank so the program creates one for you automatically, but if you insist, simply open the playlist, click the 3 dots > Share > Copy Spotify URI. As with the username, remove the spotify:playlist:.

Alternatively, you can simply copy the playlist link and just take the final string of numbers and letters. Same thing.

spotifymatcher's People

Contributors

boscodomingo avatar luisdemarcos avatar jakelauer avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.