andrehaveman / spotify-node-applescript

Control Spotify on Mac OSX with NodeJS and AppleScript
MIT License
316 stars 38 forks source link

Implement isRunning to check whether Spotify is running or not #7

Closed mrnugget closed 11 years ago

mrnugget commented 11 years ago

This commit adds a isRunning method, that checks via AppleScript if the Spotify application is running or not.

isRunning takes a callback as argument. The callback gets passed two arguments: error and response. error is a possible error bubbling up from node-applescript.

response is a boolean, indicating whether Spotify is running (true) or not (false).

The included test assumes that Spotify is running (as does the whole test suite) and expects isRunning to return true. I did not bother to include the negative version of the test, since that would mean changing a lot of the test suite (including quitting and restarting spotify). But the method has been tested manually and works as expected.

mrnugget commented 11 years ago

Thanks for merging this :)