https://github.com/andersonshatch/spotify-connect-device-picker
Script to pick a Spotify Connect device to output music to
https://github.com/andersonshatch/spotify-connect-device-picker
python python-3-6 spotify spotify-api spotify-connect spotipy
Last synced: about 1 year ago
JSON representation
Script to pick a Spotify Connect device to output music to
- Host: GitHub
- URL: https://github.com/andersonshatch/spotify-connect-device-picker
- Owner: andersonshatch
- License: mit
- Created: 2017-04-08T15:02:24.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-04-09T17:25:35.000Z (about 9 years ago)
- Last Synced: 2025-03-26T22:03:57.509Z (about 1 year ago)
- Topics: python, python-3-6, spotify, spotify-api, spotify-connect, spotipy
- Language: Python
- Size: 2.93 KB
- Stars: 9
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Spotify Connect Device Picker Script
Presents a list of available Spotify Connect devices to direct output to.
```
$ python spotify-connect-device-picker.py
[1] Kitchen Echo
[2] Living Room
[3] Living Room Echo
[4] * picon
Select player index: 3
Selected 'Living Room Echo'
```
You can provide a device name as the first argument and it'll be used to set the device (if it's a valid device name), e.g.:
```
$ python spotify-connect-device-picker.py Living\ Room
Selected 'Living Room'
```
If you need to just list the available players, use `-l` as the first argument:
```
$ python spotify-connect-device-picker.py -l
Kitchen Echo
Living Room
Living Room Echo
picon
```
## Requirements
* Python 3.6
* Depends on `spotipy` (`pip install spotipy`)
* Spotify API app ID and secret - create one at https://developer.spotify.com/my-applications
* Spotify Premium account
* Some Spotify Connect devices to send your music to
## Configuration
Requires values for the following environment variables:
* `SPOTIFY_USERNAME` - username of the Spotify account (must be a Premium account)
* `SPOTIPY_CLIENT_ID` - Client ID of your Spotify API application
* `SPOTIPY_CLIENT_SECRET` - Client Secret of your Spotify API application
* `SPOTIPY_REDIRECT_URI` - URL to redirect to after authorization (doesn't need to be real,
but should ideally be a site under your control so you don't leak credentials)
On the first run, the app will open a page to authorize itself against your Spotify account, allow
it access and you'll be redirected to the URL specified in the `SPOTIPY_REDIRECT_URI`
environment variable. Paste the URL you were redirected to from the browser into the terminal, and it'll
save tokens to a hidden file in the current folder named `.cache-`.
To logout, trash the `.cache-` file.