Project

spotilocal

0.0
No commit activity in last 3 years
No release in over 3 years
Wrapper to remote control a local spotify client
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.12
>= 0
~> 10.0

Runtime

>= 0
 Project Readme

Spotilocal

Gem Version Build Status Code Climate

Spotilocal allows you to query the local spotify client and fetch informations about the current status and perform actions such as start/stop.

Installation

Add this line to your application's Gemfile:

gem 'spotilocal'

And then execute:

$ bundle

Or install it yourself as:

$ gem install spotilocal

Usage

Library

You can specify a port to create the instance faster. Otherwise spotilocal will try to discover the port.

# Create a new spotify object
s = Spotilocal::Client.new port: 4382

After that you can simply fetch some informations.

s.status
s.pause   # true if paused
s.unpause # true if playing

Cli

Spotilocal comes with a thor cli. The cli is currently a bit slow due to port autodiscover. You can use it like this

spotilocal play URI # plays uri
spotilocal pause    # guess what
spotilocal unpause  # yup..

To display or fetch information about the current status you can use spotilocal current [RESOURCE] Available resources are album, track and artist

spotilocal current album | jq
# {
#   "name": "Die bekannteste unbekannte Band der Welt",
#   "uri": "spotify:album:6EcMsNVKYMpA2Kqi1GSUAA"
# }

spotilocal current artist | jq
# {
#   "name": "SDP",
#   "uri": "spotify:artist:1EfwyuCzDQpCslZc8C9gkG"
# }

spotilocal current track | jq
# {
#   "name": "Wenn ich groß bin",
#   "uri": "spotify:track:5oEoQtl4qDwR7kstlTTBRu",
#   "length": 206,
#   "type": "normal"
# }

If you only want one specific information you can use --only or -o

spotilocal current track -o name
#> Wenn ich groß bin

Thor allows argument guessing. So commands like spotilocal un will work too.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/Flipez/spotilocal.

License

The gem is available as open source under the terms of the MIT License.