All Projects β†’ onetune β†’ spotify-web-helper

onetune / spotify-web-helper

Licence: other
πŸŽ› Control Spotify from node.js

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to spotify-web-helper

Spotcommander
The most intuitive and feature-rich remote control for Spotify for Linux
Stars: ✭ 152 (+153.33%)
Mutual labels:  spotify, remote
Muse
An open-source Spotify controller with TouchBar support
Stars: ✭ 594 (+890%)
Mutual labels:  spotify, remote
manuarora.in
πŸ™ŒπŸ» Personal website built using Next.js & TailwindCSS.
Stars: ✭ 53 (-11.67%)
Mutual labels:  spotify
docker-chromium
Docker container with Chromium desktop and a Web VNC client allowing you to run Chromium on any server you have
Stars: ✭ 64 (+6.67%)
Mutual labels:  remote
neovim-spotify
Neovim plugin to control Spotify and Apple Music on macOS
Stars: ✭ 67 (+11.67%)
Mutual labels:  spotify
DownOnSpot
🎡 A Spotify music and playlist downloader written in Rust which also works with a free Spotify account
Stars: ✭ 309 (+415%)
Mutual labels:  spotify
PuTTY-ng
An improved multi-tabbed PuTTY with better user experience. This project is based on noddle1983's putty-nd.
Stars: ✭ 37 (-38.33%)
Mutual labels:  remote
PasTerm
Genera combos a base de Keywords con Termux
Stars: ✭ 36 (-40%)
Mutual labels:  spotify
CoverMaster
Download covers arts from Spotify and Soundcloud and embeds them to your MP3 files. (My first GUI attempt in python.)
Stars: ✭ 64 (+6.67%)
Mutual labels:  spotify
Mutify
An android app built with java to mute Spotify ads.
Stars: ✭ 61 (+1.67%)
Mutual labels:  spotify
ideas-for-projects-people-would-use
Every time I have an idea, I write it down. These are a collection of my top software ideas -- problems I think enough people have that don't have solutions. I expect you can reach a decent userbase if marketed correctly, as I am surely not the only one with these problems.
Stars: ✭ 646 (+976.67%)
Mutual labels:  spotify
flex-originals
🎧 A video and audio streaming web application
Stars: ✭ 36 (-40%)
Mutual labels:  spotify
playlist-converter
[wip] convert your playlists between spotify and youtube 🎢
Stars: ✭ 19 (-68.33%)
Mutual labels:  spotify
laravel-devcontainer
πŸ‹ Fully-Dockerised Laravel development in Visual Studio Code
Stars: ✭ 80 (+33.33%)
Mutual labels:  remote
YoutubeDownloader
A Music downloader with Spotify integration for automatic metadata application. [Depricated]
Stars: ✭ 13 (-78.33%)
Mutual labels:  spotify
WiFi-remote-for-Bestway-Lay-Z-SPA
Hack - ESP8266 as WiFi remote control for Bestway Lay-Z spa Helsinki
Stars: ✭ 138 (+130%)
Mutual labels:  remote
github-now-playing
🎡 Display what you're listening to right on your Github profile
Stars: ✭ 75 (+25%)
Mutual labels:  spotify
awesome-freelancer
θ‡ͺη”±θŒδΈšθ€…&θΏœη¨‹ε·₯δ½œθ€…&独立开发者&开源ε·₯δ½œθ€…@η”Ÿε­˜ζŒ‡ε—
Stars: ✭ 67 (+11.67%)
Mutual labels:  remote
spotify-deb-install
MOVED: https://gitlab.com/q3aql/spotify-deb-install
Stars: ✭ 15 (-75%)
Mutual labels:  spotify
spotify-next
Small CLI app for filtering out music on Spotify.
Stars: ✭ 45 (-25%)
Mutual labels:  spotify

Please note that because of a recent Spotify update, the library is not working at the moment. Discussion here: #41


Spotify Web Helper for node.js

This is a rewrite of the excellent node-spotify-webhelper, but with support for events, so you don't have to do getStatus() all the time. It also is faster, and starts SpotifyWebHelper on OS X, not just on Windows.
I am also trying to maintain the project and handle issues, at least every 2 months. Pull requests welcome!

Install

$ npm install spotify-web-helper --save

Example

const SpotifyWebHelper = require('spotify-web-helper');

const helper = SpotifyWebHelper();

helper.player.on('error', err => {
  if (error.message.match(/No user logged in/)) {
    // also fires when Spotify client quits
  } else {
    // other errors: /Cannot start Spotify/ and /Spotify is not installed/
  }
});
helper.player.on('ready', () => {

  // Playback events
  helper.player.on('play', () => { });
  helper.player.on('pause', () => { });
  helper.player.on('seek', newPosition => {});
  helper.player.on('end', () => { });
  helper.player.on('track-will-change', track => {});
  helper.player.on('status-will-change', status => {});

  // Playback control. These methods return promises
  helper.player.play('spotify:track:4uLU6hMCjMI75M1A2tKUQC');
  helper.player.pause();
  helper.player.seekTo(60); // 60 seconds

  // Get current playback status, including up to date playing position
  console.log(helper.status);
  // 'status': {
  //    'track': ...,
  //    'shuffle': ...,
  //    'playing_position': ...
  //  }

});

API

Class: SpotifyWebHelper

new SpotifyWebHelper([opts])

  • opts <object> Options.
    • opts.port <number> Web helper port. Default is 4370.

helper.player

helper.status

Gets the current saved status.

helper.getStatus()

Refetches the status from Spotify and returns it.

Class: PlayerEventEmitter

Inherits from EventEmitter.

Event: 'end'

Playback has ended.

Event: 'error'

An error has occurred. The listener callback receive the <Error> as first argument. An error occurs when Spotify cannot be started, is not installed, or quits. Refer to the example above to see how to distinguish errors.

Event: 'pause'

Playback has paused.

Event: 'play'

Playback has started.

Event: 'seek'

User has changed the current playing positon.

Event: 'ready'

This player object is ready to use.

Event: 'status-will-change'

Current status has changed. The listener callback receive a <SpotifyStatus> object as first argument.

helper.status will be changed by the new status after this event is emitted.

Event: 'track-will-change'

Current track has changed. The listener callback receive a <SpotifyTrack> object as first argument.

player.pause([unpause]);

  • unpause <boolean> true to resume playback. Default is false.
  • Returns <Promise<SpotifyStatus>>

player.play(spotifyUri);

  • spotifyUri <string> Spotify URI.
  • Returns <Promise<SpotifyStatus>>

Typedef: SpotifyStatus

status.version

  • <number> Web helper API version. Currently 9.

status.client_version

  • <string> Client version.

status.playing

  • <boolean> true if a track is playing.

status.shuffle

  • <boolean> true if shuffle is enabled.

status.repeat

  • <boolean> true if repeat is enabled.

status.play_enabled

  • <boolean> true if playing is available.

status.prev_enabled

  • <boolean> true if skipping to previous track is available.

status.next_enabled

  • <boolean> true if skipping to next track is available.

status.track

status.context

  • <object>

status.playing_position

  • <number> Current track position, in counting seconds.

status.server_time

  • <number> Server time in UNIX time.

status.volume

  • <number> Audio volume, from 0 to 1.

status.online

  • <boolean>

status.open_graph_state

  • <object>

status.running

  • <boolean>

Typedef: SpotifyTrack

track.track_resource

track.artist_resource

track.album_resource

track.length

  • <number> Track length in seconds.

track.track_type

  • <string>

Typedef: SpotifyResource

res.name

  • <string> Name.

res.uri

  • <string> Spotify URI.

res.location

  • <object> Object containing attribute og, which represent an HTTPS URL to the resource.

Compatibility

Since 1.3.0 node >=4.0 is required. Use 1.2.0 for older node versions.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].