Giter Site home page Giter Site logo

spotcon's Introduction

Build Status Go Report Card

Spotcon

Spotcon is a WIP command line interface, written in Go, that controls media playback to Spotify connected devices using the Spotify Web API.

Usage

Syntax: spotcon> command [subcommand] [--flags] [arguments...]

NAME:
   Spotcon - Control Spotify Connect enabled devices via terminal.
USAGE:
   spotcon> command [subcommand] [--flags] [arguments...]
AUTHOR:
   Luke Hobbs <[email protected]>
COMMANDS:
     clear, clc  Clear the command window
     devices, d  List available devices
     next, n     Skip to the next track in queue
     now, np     Display information about "Now Playing"
     opt, o      Options for changing current playback parameters
     pause, pp   Pause playback
     play, p     Start/Resume playback
     prev, pr    Skip to the previous track in queue
     quit, q     Quit application
     search, s   Search Spotify for artists, albums, tracks, or playlists
     seek        Options for changing position in playback
     vol, v      Options for changing volume of playback
     help, h     Shows a list of commands or help for one command
GLOBAL OPTIONS:
   --help, -h     show help
   --version, -v  print the version

Subcommands

spotcon> opt

USAGE:
   spotcon> opt [command options]  
OPTIONS:
   --repeat value, -r value   Set playback option repeat [on, off]
   --shuffle value, -s value  Set playback option shuffle [on, off]

spotcon> play

USAGE:
   spotcon> play [command options]   
OPTIONS:
   --device 'NAME', -d 'NAME'    Start/resume playback on specified 'NAME' or number from device list
   --track 'NAME', --tr 'NAME'   Play track with specified 'NAME' or number from search results
   --album 'NAME', --al 'NAME'   Play album with specified 'NAME' or number from search results
   --artist 'NAME', --ar 'NAME'  Play artist with specified 'NAME' or number from search results
   --plist 'NAME', --pl 'NAME'   Play playlist with specified 'NAME' or number from search results

spotcon> search

USAGE:
   spotcon> search [command options]
OPTIONS:
   --artist, --ar    Show search results for artists
   --album, --al     Show search results for albums
   --track, --tr     Show search results for tracks
   --playlist, --pl  Show search results for playlists

spotcon> seek

USAGE:
   spotcon> seek command [command options] [arguments...]
COMMANDS:
     ff  Fast forward playback by SECONDS or 15 seconds if not specified
     rw  Rewind playback by SECONDS or 15 seconds if not specified

spotcon> vol

USAGE:
   spotcon> vol command [command options] [arguments...]
COMMANDS:
     up    Increase volume by PERCENT or 10% if not specified
     down  Decrease volume by PERCENT or 10% if not specified
     set   Set volume to PERCENT

Todo

  • Search should be prioritized to search user's saved library first
  • Seek options (fast forward, rewind)
  • Add an option to clear the console
  • Allow selection of devices using a search
  • Change options (shuffle/repeat)
  • Control device selection
  • Control media playback (pause/play, next/previous song)
  • Control volume of media playback
  • Get information about currently playing song
  • Login to Spotify through WebAPI
  • Search for a playlist to listen to
  • Search for a song to listen to
  • Search for an album to listen to
  • Skip track (next/previous song)
  • Store OAuth 2 Token in user's home directory to avoid having to login every run

Stretch Goals

  • Daemon to monitor and report currently playing media in plain text for scripting purposes (polybar, conky, etc.)

Example

$ spotcon
You are logged in as: lukehobbs
spotcon> devices
Devices:
  [1]: Samsung (TV)
  [2]: Desktop (Computer)
  [3]: Amazon Echo (Speaker) ACTIVE

spotcon> search bridge
Tracks:
  [1]:	"Water Under the Bridge" by Adele
  [2]:	"Under The Bridge" by Red Hot Chili Peppers
  [3]:	"Water Under the Bridge" by Adele
  [4]:	"London Bridge" by Fergie
  [5]:	"Under The Bridge" by Red Hot Chili Peppers
Artists:
  [1]:	Alter Bridge
  [2]:	Bridge to Grace
  [3]:	Bridge
  [4]:	Marcus Bridge
  [5]:	The Bridge
Albums:
  [1]:	"Bridge Over Troubled Water" by Simon & Garfunkel
  [2]:	"Water Under the Bridge" by Adele
  [3]:	"One Day Remains" by Alter Bridge
  [4]:	"The Last Hero" by Alter Bridge
  [5]:	"Blackbird" by Alter Bridge
Playlists:
  [1]:	"Alter Bridge Complete Collection" - officialalterbridge
  [2]:	"THE BRIDGE" - 1221493509
  [3]:	"bridge" - 11101296551
  [4]:	"Alter Bridge" - chemistry11
  [5]:	"Bridge Anytime" - 1259523134

spotcon> play --device 'amazon echo' --track 2
Device: Desktop
Track:  Under The Bridge
Artist:	Red Hot Chili Peppers
Album:	Blood Sugar Sex Magik (Deluxe Version)
Volume: 100%
[0:04/4:24]

spotcon> vol down 25
Volume: 75%

Acknowledgements

Thanks to Zac Bergquist for the Go wrapper for the Spotify Web API that made this project possible!

spotcon's People

Contributors

lukehobbs avatar

Watchers

 avatar  avatar

spotcon's Issues

Volume inconsistencies

How to reproduce:
spotify> vol
Volume: 50
spotify> vol --up
Volume: 59

vol --up should increase the volume by 10% but instead only increases by 9%. From my debugging it looks to be an issue deeper than this application. Plan to look into this at a later date as it is not high priority.

Play --plist

Not working properly. Can play albums, artists, and tracks but playlists are not working.

Auth issue after first login

You are logged in as: lukeehobbs
spotify> 2017/04/08 12:49:21 Got request for: /favicon.ico
d
panic: Get https://api.spotify.com/v1/me/player/devices: oauth2: token expired and refresh token is not set

goroutine 1 [running]:
main.listDevices()
	/home/luke/projects/go-workspace/src/github.com/lukehobbs/spotifycnct/spoticonn.go:299 +0x2a8
main.main.func1(0xc4203da780, 0x0, 0xc4203da780)

Search Priority

Searches should prioritize the user's saved tracks, artists, playlists, and albums to allow user to select their own playlist over another user's playlist with the same name.

TransferPlayback

Playback seems to get stuck on a specific device and not allow device changes through the API.

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.