Git Product home page Git Product logo

spotify.google's Introduction

¡¡ Spotify introduced an additional captcha at login which causes the LOGIN part of the script to fail !!

Spotify Chromecast control using a Universal Remote

Chromecasts are not controllable using an IR remote control. This projects adds that function by using a raspberry pi with an IR sensor that receives the remote cotrol codes and converts them into http calls.

Dependencies:

download and install latest version of spotipy and pychromecast python3 Using sudo easy_install3 ... doesn't work as it retrieves an older version. (why?)

Spotify App

Login to the https://developer.spotify.com and create a new application. Remember client_id, client_secret and redirect_uri.

  • copy remote.py and config.py to /spotify.google/ (or other folder) then make it executable

  • update config.py with all the required credentials:

#name of the chromecast device
chromecast = "your_chromecast_name"
chromecast_ip = "x.x.x.x"
volume = 0.8

#spotify_client credentials 
accounts = {"default":{"username":"", "password":""}}

#Application
client_id = "as_created_above"
client_secret = "as_created_above"
redirect_uri = "as_created_above"
  • give your account a short name and you is later in the login url. ex: accounts = {"john":{"username":"[email protected]", "password":"73847893497389478389479374892398"}} becomes http://127.0.0.1:9999/login/john

The system loggs in to the last used account or to account "default" (if present), if no user is logged in yet. (calling http://127.0.0.1:9999/login is equivalent to calling http://127.0.0.1:9999/login/default if a default user has been provided)

  • run it once from terminal and follow instructions to activate/authorize Spotify.

Service

  • create /lib/systemd/system/spotify.service with content:
[Unit]
Description=Spotify Remote
After=network.target auditd.service

[Service]
ExecStart=/usr/bin/python3 /spotify.google/remote.py
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=on-failure

[Install]
WantedBy=multi-user.target
Alias=spotify.service
  • start service
sudo systemctl enable spotify
sudo systemctl start spotify

IR Receiver

The command map file for lirc (/etc/lirc/lircrc):

begin
prog = irexec
button = SPOTIFY_PLAY
config = curl http://127.0.0.1:9999/play
end
begin
prog = irexec
button = SPOTIFY_PAUSE
config = curl http://127.0.0.1:9999/pause
end
begin
prog = irexec
button = SPOTIFY_PREVIOUS
config = curl http://127.0.0.1:9999/previous
end
begin
prog = irexec
button = SPOTIFY_NEXT
config = curl http://127.0.0.1:9999/next
end
begin
prog = irexec
button = SPOTIFY_ON
config = curl http://127.0.0.1:9999/login/john
end
begin
prog = irexec
button = SPOTIFY_OFF
config = curl http://127.0.0.1:9999/off
end
begin
prog = irexec
button = SPOTIFY_REBOOT
config = curl http://127.0.0.1:9999/reboot
end

Where SPOTIFY_* buttons in the lircd.conf file recorded (irrecord --disable-namespace -d /dev/lirc0 /etc/lirc/lircd.conf) or random created codes and then taught to the remote (see https://github.com/MoonshineSG/remote.ir)

Remote control

Setup a new device and a new activity, thne configure the buttons as usual.

Donate

Accepting beer tips...

spotify.google's People

Contributors

moonshinesg avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

spotify.google's Issues

Spotify Web token - Error 400 Bad Request

Hi,

Is it still working for you? I get 400 Bad Request errors to get the spotify web token?
It seems Spotify modified their workflow and added some recaptcha technologies...

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.