Coder Social home page Coder Social logo

shivasiddharth / spotify-playlist-player Goto Github PK

View Code? Open in Web Editor NEW
14.0 2.0 3.0 44 KB

Scripts to play your spotify playlist.

License: GNU General Public License v3.0

Python 100.00%
spotify spotify-playlist spotify-downloader spotify-api spotify-player spotify-playlist-downloader

spotify-playlist-player's Introduction

github-small

How to setup or use

Create Spotify credentials

  1. Click here and register for a spotify developer account, if you already don't have one.
  2. In the developer's dashboard, choose CREATE A CLIENT ID. In the pop-up window provide the requested details.
  3. Set the Redirect URIs to http://localhost:8888
  4. Click on the new app created and copy the CLIENT ID and CLIENT SECRET. Paste it in the config.yaml file in the indicated space.
  5. Access spotify from here and copy the username and enter it in the config.yaml

Create YouTube API Key

  1. Go to the projects page on Google Cloud Console-> https://console.cloud.google.com/project and sign in using your google account.
  2. Create a new project and give it a name.
  3. On the left top corner, click on the hamburger icon or three horizontal stacked lines.
  4. Move your mouse pointer over API and services and choose credentials.
  5. Click on create credentials and select API Key and choose close. Make a note of the created API Key and enter it in the config.yaml script at the indicated location.
  6. From the API and services option, select library and in the search bar type youtube, select YouTube Data API v3 API and click on ENABLE.

Install dependencies

System wide dependencies

sudo apt-get install python3 python3-dev python3-venv python3-pip python3-setuptools -y       

Create a environment

python3 -m venv spotifyenv      

Setup pip tools

spotifyenv/bin/python -m pip install --upgrade pip setuptools wheel    

Move into the created environment

source spotifyenv/bin/activate   

Install pip packages

pip3 install pafy google-api-python-client python-vlc git+https://github.com/plamere/spotipy.git pyyaml oauth2client youtube_dl   

Example usages

Open a terminal and run the example as follows:
Example 1-Playback by supplying playlistname as argument:

python3 -i /home/pi/Spotify-Playlist-Player/src/example-1-parseargs.py -p "Name of your playlist"   

Example 2-Playback control using Pimoroni's Button-SHIM:

python3 /home/pi/Spotify-Playlist-Player/src/example-2-button-shim.py   

Note

  1. For premium or paid users there are a number of programs like mopidy-spotify, spotify connect, volumio plugin, etc. For free users, there is limited scope of playing back spotify playlists such as mpsyt.

  2. Spotify API currently only supports playback in a web browser, but DRM content is being blocked in the Raspberry Pi.

  3. As a roundabout approach, these scripts get playlist details using Spotipy API and then fetch those tracks from YouTube.

  4. This custom program has a better accuracy than spotify playlist playback using mpsyt.

spotify-playlist-player's People

Contributors

shivasiddharth avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  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.