Giter Site home page Giter Site logo

spotilocal's Introduction

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.

spotilocal's People

Contributors

flipez avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

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.