spotify-node-applescript

Control Spotify on Mac OSX with NodeJS and AppleScript.

spotify-node-applescript

Control Spotify on Mac OSX with NodeJS and AppleScript.

npm install spotify-node-applescript

Open track with Spotify URI uri.

var spotify = require('spotify-node-applescript');

spotify.playTrack('spotify:track:3AhXZa8sUQht0UEdBJgpGc', function(){
    // track is playing
});

Get the current track. callback is called with the current track as second argument.

var spotify = require('spotify-node-applescript');

spotify.getTrack(function(err, track){
    
    /*
    track = {
        artist: 'Bob Dylan',
        album: 'Highway 61 Revisited',
        disc_number: 1,
        duration: 370,
        played count: 0,
        track_number: 1,
        starred: false,
        popularity: 71,
        id: 'spotify:track:3AhXZa8sUQht0UEdBJgpGc',
        name: 'Like A Rolling Stone',
        album_artist: 'Bob Dylan',
        spotify_url: 'spotify:track:3AhXZa8sUQht0UEdBJgpGc' }
    }
    */
    
});

Get player status.

var spotify = require('spotify-node-applescript');

spotify.getState(function(err, state){
    /*
    state = {
        volume: 99,
        position: '232.639999389648',
        state: 'playing'
    }
    */
});

Resume playing current track.

Pause playing track.

Toggle play.

Play next track.

Play previous track.

Turn volume up.

Turn volume down.