Git Product home page Git Product logo

spotify-local-control's Introduction

spotify-local-control stability

npm version downloads js-standard-style

Usage

var connect = require('spotify-local-control')
var client = connect()

client.play('spotify:track:0JhKJg5ejeQ8jq89UQtnw8')
client.pause()
client.resume()
client.status().then(res => console.log(res))

Can also be used on the command line:

$ spotify-local-control

  Usage:
      $ spotify-local-control <command>

    Commands:
      <default>    Show usage
      play <uri>   Play a track
      status       Show artist and track
      pause        Pause the current track
      resume       Resume the current track

    Examples:
      $ spotify-local-control play spotify:track:0JhKJg5ejeQ8jq89UQtnw8

API

client = connect()

Initialize a new client.

client.play(spotifyUri, spotifyContext?)

Plays the given song by spotifyUri. spotifyContext can be specified to display a related song, playlist, album or artist.

client.pause()

Pauses the playback.

client.resume()

Resumes the playback.

client.status(returnOn?, returnAfter?)

Get status information about the local client.

Installation

$ npm install spotify-local-control

See Also

License

MIT

spotify-local-control's People

Contributors

f-mer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

vac-porn flowr-es

spotify-local-control's Issues

File not found - token.json

Hey, i like the idea of your package :-)
I want to use it for a little project, but get an error if i test it.

I use a WIN10 with local installed node, and execute the above testscript.
(Spotify is also installed and running in this Windows session)

var spotify_local = require('spotify-local-control');
var client = spotify_local();
//client.play('spotify:track:5biH03AebX5BpsrMlCwv98');
client.pause();
console.log('done');

I recieve every time the following error:

C:\Users\staff\Desktop\lucy>node test
done
(node:6168) UnhandledPromiseRejectionWarning: Error: connect ECONNREFUSED 127.0.0.1:80
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1056:14)
(node:6168) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:6168) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

I think you try to access a file like "/simplecsrf/token.json" on the local system.
Are there any special spotify configurations or a separate Webserver to delivery the requested file?
Where the file should be located on the local system?

Thank you so much!

[edit]
ok, like i have seen in other solutions the remote control doesnt work anymore :(
Do you have any new way to start, stop or skip a song from an nodeJS environment?

Spotify closed the local API?

Hey!

it looks like Spotify disabled the local API. I cannot find a Port where the API is running and the Tool is throwing errors.
The Web Player now uses Spotify Connect to access and control the local Player

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.