Skip to content

Commit

Permalink
0.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
AngryKiller committed Mar 18, 2018
1 parent 8149bd8 commit d2bbca5
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 9 deletions.
24 changes: 18 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# iTunes-bridge
A macOS only NodeJS package to control and get informations from iTunes through AppleScript
A macOS and Windows NodeJS package to control and get informations from iTunes through AppleScript

#### If you need OS X Mavericks and earlier support, use the 0.3.0-alpha. No Windows support and events in this version.

### This package is a WIP, a lot of functions will be added in the future and some that are already existing could change
# Documentation
No documentation yet, but you can look at the code of [iTunes-Discord integration](https://github.com/AngryKiller/iTunes-Discord-integration/tree/dev) that is a great example of the usages possible with iTunes-bridge.
There is also an example.js that you can run.

```js

var iTunes = require('./itunes-bridge');
var currentTrack = iTunes.getCurrentTrack();
// We load the iTunes-bridge emitter to receive events
Expand All @@ -34,14 +35,25 @@ switch(currentTrack.playerState){
};

// Do something when iTunes is playing
iTunesEmitter.on('playing', function(message){
console.log(message.name+" is now playing!");
iTunesEmitter.on('playing', function(type, currentTrack){
// If it is a paused track that restarts playing
if(type === "player_state_change") {
console.log(currentTrack.name + " has been resumed! ");
// Or if it is a new track
}else if(type === 'new_track'){
console.log(currentTrack.name+" is now playing!")
}
});

// Do something when iTunes is paused
iTunesEmitter.on('paused', function(message){
console.log(message.name+" is now paused!");
iTunesEmitter.on('paused', function(type, currentTrack){
console.log(currentTrack.name+" is now paused!");
});
// Do something when iTunes is stopped
iTunesEmitter.on('stopped', function(){
console.log("iTunes is not longer playing!");
});


```

1 change: 1 addition & 0 deletions example.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ iTunesEmitter.on('playing', function(type, currentTrack){
iTunesEmitter.on('paused', function(type, currentTrack){
console.log(currentTrack.name+" is now paused!");
});
// Do something when iTunes is stopped
iTunesEmitter.on('stopped', function(){
console.log("iTunes is not longer playing!");
});
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "itunes-bridge",
"version": "0.3.0",
"description": "A macOS only (for the moment) NodeJS package to control and get informations from iTunes through AppleScript",
"version": "0.4.0",
"description": "A macOS and Windows NodeJS package to control and get informations from iTunes through AppleScript",
"main": "itunes-bridge.js",
"repository": {
"type": "git",
Expand Down

0 comments on commit d2bbca5

Please sign in to comment.