Control Spotify through the OS X Terminal
An AppleScript for controlling Spotify through a terminal:
The scenario for which it was originally designed is controlling Spotify, which is playing on a Mac, via ssh, while working on a Linux machine on the other side of the room.
Currently supported functions are: play/pause, next/previous track, jumping in time, toggling shuffle/repeat and changing volume. This pretty much covers everything the AppleScript hooks of Spotify allow.
The simplest way to install the script is to
clonethe repository,
cdinto repository's directory, and run the command below to make a symbolic link into
/usr/local/bin/:
ln -s $(pwd)/SpotifyControl /usr/local/bin/spotify
spotify startor
spotify play. If you do this locally and Spotify is not running, it will start. Remotely, Spotify will not start properly. Optionally, pass a Spotify URI as a second argument.
spotify play track [song name].
spotify play artist [artist name].
spotify play album [album name].
spotify stopor
spotify pause.
spotify play/pause.
spotify next.
spotify previousor
spotify prev.
spotify info
spotify jump N, where N is the track position in seconds.
spotify forward Nwhere N is the number of seconds to jump ahead.
spotify rewind Nwhere N is the number of seconds to jump backwards.
spotify volume Nwhere N is a number between 0 and 100.
spotify volume up.
spotify volume down.
spotify increasevolume Nwhere N is a number between 0 and 100 that you want to increment by.
spotify decreasevolume Nwhere N is a number between 0 and 100 that you want to decrement by.
spotify shuffle [on|off].
spotify repeat [on|off].
spotify.
To enable the SSH server on OS X, go to Sharing in the System Preferences and enable Remote Login. The Sharing screen will also then tell you the command to use to connect to your Mac in the local network.
You may use, adapt, modify, and etc. Any way you want.