Skip to content

Instantly share code, notes, and snippets.

@smpanaro
Created August 24, 2019 16:51
Show Gist options
  • Save smpanaro/5e7fd28efb6fd9a6c8e2ee43e3b6be97 to your computer and use it in GitHub Desktop.
Save smpanaro/5e7fd28efb6fd9a6c8e2ee43e3b6be97 to your computer and use it in GitHub Desktop.
Spotify ChromeCast BitBar Plugin

Switch Spotify's audio output to a ChromeCast from your menu bar.

  1. Clone my fork of pychromecast.
    1. cd to the pychromecast directory and create a virtualenv: python3 -m venv env
    2. Checkout the spotify-transfer-example branch: git checkout spotify-transfer-example
    3. Install dependencies: pip install -r requirements.txt
    4. Save transfer_spotify_to_chromecast.sh to your pychromecast directory
    5. Update the paths and your spotify credentials in transfer_spotify_to_chromecast.sh
  2. Install BitBar
    1. Move SpotifyChromeCast.1d.sh to your BitBar plugins folder
    2. Update the paths and your ChromeCast names in SpotifyChromeCast.1d.sh
#!/usr/bin/env bash
# Spotify ChromeCast: Scripts to switch Spotify output to Chromecast Audio
export PATH=$PATH:/usr/local/bin
# Hack for language not being set properly and unicode support
export LANG="${LANG:-en_US.UTF-8}"
echo "| templateImage=iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAACBklEQVQ4y61UOy8EURSehEIi2Zm5dx47s0uWSERFqZRIFP6AH6CiEZVSgy00OvELbCESrWLRik5hSVTEWoVGPHYZ4zt3zt2dHaszyZc5c+45537nNYbRefq14LruVCBlOS9lFagxqqSjs14+XYph07TzQuzDKQ4dJw4yIB2dkQ3ZZoP1M4sxGNXZ+Av4AJpAC/hkkByxTZ18uoIpJlI+BIkBBfjFRjFBEA72yrp6iplhENXQddMOz9Dd4n0FXNMlxE6nx3avipnjVFQQz/Mm+eANWC4IUTR6PL7vD/pCTOOCddhdKqbJpXGBGoCPLWIDRQM55+EwCodFX8oNnO3AcTsQYjUUYq5kWVY7sJSz1E2ViZSbhmprwihS1DspUqFfdEq4NWanG+iWVEmk3CU9gh7TRy3g4kI+hTwBm75saqjHOM7X4HRf8LyYL2mxX60rEIwOiTJS24P+BLig4PQNLJRKpQHFxLbnqdj5DoFaOrWmTg3yO0/zORWWbg85NcgHnmVNcjd1oCoVuxx22t6g1GzbNh3HCX3THClKWSjmcgLFHgKrFepuyr4ZJt0rq71iZcJEiDO873iS9RA+AkeYmRnqLOQnPqMNiNv7B+dKmNSolZlkhYB3TzFJBrWp2ZBvuyO8InU9scziO4VI71u6ntkV6bW0UWpZI8aX1v25tP/1G/mXH9sP6IQJcX7WhdwAAAAASUVORK5CYII="
echo "---"
echo "🔊 Chromecast 1 | bash='/path/to/pychromecast/transfer_spotify_to_chromecast.sh' param1='Chromecast 1 Name' terminal=false"
echo "🔊 Chromecast 2 | bash='/path/to/pychromecast/transfer_spotify_to_chromecast.sh' param1='Chromecast 2 Name' terminal=false"
#!/usr/bin/env bash
set -eu
CHROMECAST=$1
source /path/to/pychromecast/env/bin/activate
python /path/to/pychromecast/examples/spotify_example_transfer.py --cast "$CHROMECAST" --user <your-spotify-username> --password <your-spotify-password>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment