1.0.0 • Published 4 years ago

mpdrx v1.0.0

Weekly downloads
2
License
UNLICENSED
Repository
github
Last release
4 years ago

node mpd client as RX.JS streams

Uses mpd-api module and exposes a few streams to subscribe to.

Usage

npm i / yarn add mpdrx
const log = tag => console.log.bind(console, tag)
const streams = await cl.connect()

const {
  client, // reference to 'mpd-api' client
  event$,
  status$,
  currentSong$,
  currentSongUnique$,
  playlists$,
  message$,
  dbUpdate$,
  stats$,
  partition$,
  sticker$,
  subscription$,
  neighbor$,
  mount$,
  output$,
} = streams

event$.subscribe(log('event'))
status$.subscribe(log('status'))

// unique by `songid`
currentSong$.subscribe(log('currentSong'))

// unique by `file` in case of duplicate songs in the queue
currentSongUnique$.subscribe(log('currentSongUnique'))

playlists$.subscribe(log('playlists'))
message$.subscribe(log('message'))
dbUpdate$.subscribe(log('dbUpdate'))
stats$.subscribe(log('stats'))
partition$.subscribe(log('partition'))
sticker$.subscribe(log('sticker'))
subscription$.subscribe(log('subscription'))
neighbor$.subscribe(log('neighbor'))
mount$.subscribe(log('mount'))
output$.subscribe(log('output'))

setTimeout(async () => {
  console.log('disconnecting...')
  await client.disconnect()
}, 30000)