3.3.3 • Published 1 year ago

nowplaying v3.3.3

Weekly downloads
4
License
MIT
Repository
github
Last release
1 year ago

nowplaying

Simple Node.js event emitter for iTunes/Spotify playing/paused events.

Uses Electron's subscribeNotifications to observe macOS Distributed Notifications

Requires

  • macOS. Tested up to Monteray
  • Node.js

Install

npm install nowplaying

Usage

var nowplaying = require("nowplaying");

nowplaying.on("playing", (data) => {
    console.log("PLAYING!", data);
});

nowplaying.on("paused", (data) => {
    console.log("PAUSED!", data);
});

nowplaying.on("stopped", (data) => {
    console.log("STOPPED!", data);
});

nowplaying.on("error", (data) => {
    console.log("ERROR!", data);
});

//iTunes-specific "Connecting" state while it's looking up tracks
nowplaying.on("connecting", (data) => {
    console.log("CONNECTING!", data);
});

// data, if Spotify:

// { source: 'Spotify',
//   playerState: 'Playing',
//   name: 'Planet Party',
//   trackId: 'spotify:track:0X36qGG3g5yTLDIoIxWkLR',
//   starred: true,
//   discNumber: 1,
//   hasArtwork: true,
//   playCount: 0,
//   location: '/Volumes/Music/Games/That We Play/3-Planet_Party.mp3',
//   album: 'That We Can Play - EP',
//   popularity: 1,
//   duration: 168,
//   artist: 'Games',
//   albumArtist: 'Games',
//   playbackPosition: 0,
//   trackNumber: 3 }

// data, if iTunes:

// { source: 'iTunes',
//   discNumber: 1,
//   trackCount: 11,
//   trackNumber: 5,
//   name: 'Flightwave',
//   playerState: 'Playing',
//   persistentId: 1628654696,
//   albumArtist: 'Com Truise',
//   location: 'file://localhost/Volumes/Music/Com%20Truise/Galactic%20Melt/05%20Flightwave.mp3',
//   composer: 'Com Truise',
//   artist: 'Com Truise',
//   ratingComputed: true,
//   skipCount: 0,
//   year: 2011,
//   discCount: 1,
//   libraryPersistentId: 1522701079,
//   playCount: 3,
//   artworkCount: 1,
//   storeURL: 'itms://itunes.com/link?n=Flightwave&an=Com%20Truise&pn=Galactic%20Melt&cn=Com%20Truise',
//   playlistPersistentId: -862874234,
//   playDate: '2013-10-29 06:15:07 +0000',
//   rating: 80,
//   totalTime: 304587,
//   genre: 'Electronic',
//   albumRatingComputed: 0,
//   album: 'Galactic Melt',
//   albumRating: 80 }
3.3.3

1 year ago

3.3.2

2 years ago

3.3.1

3 years ago

3.3.0

3 years ago

3.2.0

3 years ago

3.1.0

4 years ago

3.0.1

4 years ago

3.0.0

4 years ago

2.0.0

8 years ago

1.1.0

10 years ago

1.0.6

11 years ago

1.0.5

12 years ago

1.0.4

12 years ago

1.0.3

12 years ago

1.0.2

12 years ago

1.0.1

12 years ago

1.0.0

12 years ago