Members
-
raw_buffer
-
running string of partial responces from MPD
- Source:
-
raw_lines
-
running list of lines we have gotten from the server
- Source:
-
inited
-
false if we are disconnected or have not completed out initial data load yet
- Source:
-
queued_events
-
events that have been held until we are consistent
- Source:
-
tag_types
-
list of tags that are acceptable for this server
- Source:
-
outputs
-
list of available outputs
- Source:
-
responceProcessor
-
method called when we get a responce from MPD
- Source:
-
command_queue
-
commands that are yet to be processed
- Source:
-
last_error
-
last error we had
- Source:
Type Definitions
-
state
-
Our understanding of what the server looks like
Type:
- Object
- Source:
Properties:
Name Type Description version
String server protocol version
connected
Boolean if we are currently connected to the server or not
playstate
String enum, PLAYING, STOPPED, PAUSED
actual MPD attribute: state (int 0,1,2)volume
Integer 0 to 1 the current volume
repeat
Boolean true if the server is configured to repeat the current song
single
Boolean true if the server is configured to just play one song then quit
consume
Boolean true if the server is configured to not repeat songs in a playlist
random
Boolean true if the server is configured to play music in a random order
crossfade
Integer nonnegitive integer representing number of seconds to crossfade songs
mix_ramp_threshold
Float not sure what this is, but it's reported
actual MPD attribute: mixrampdbcurrent_song
Object info about the currently playing song
Properties
Name Type Description queue_idx
Integer which song in the current playlist is active
actual MPD attribute: songelapsed_time
Float time into the currently playing song in seconds
actual MPD attribute: elapsedid
Integer the id of the current song
actual MPD attribute: songidnext_song
Object info about the song next to play on the queue
Properties
Name Type Description queue_idx
Integer which song in the current playlist is active
actual attribute: songid
Integer the id of the current song
actual attribute: songidcurrent_queue
Queue the songs that are currently in rotation for playing, in the order they are to play (unless random is set to true)
queue_version
Integer a number associated with the queue that changes every time the queue changes
playlists
Array.<String> names of all of the saved playlists
-
song_metadata
-
Object representation of a song. This is a direct translation of the data that MPD returns, if MPD does not think a particular
song should have a property it won't return one. What is documented here are the properties I have seen MPD return, not all of
these will be returned all of the time. The properties file, date, and time appear to be consistently returned, but MPD makes
no promises. All other properties I frequently find missing, you will need to check to make sure they are present before using.Type:
- Object
- Source:
Properties:
Name Type Argument Description file
String the full path to the music file in MPD's music directory. relative path.
last_modified
Date last time the file was altered
time
Integer duration of song in seconds
artist
String <optional>
optional metadata
title
String <optional>
optional metadata
album
String <optional>
optional metadata
track
String <optional>
optional metadata
genre
String <optional>
optional metadata
disk
String <optional>
optional metadata
id
Integer ( queue songs only @see QueueSong ) a persistent identifer for this song on the queue, is only relevent to the queue, is not associated with the song it's self
pos
Integer ( queue songs only @see QueueSong ) the position of the song on the queue. the queue index.
-
directory_metadata
-
metadata returned about a directory from MPD
- Source:
Properties:
Name Type Description directory
String file path relative to MPD's music folders
last_modified
Date last time this directory was modified
-
output_metadata
-
metadata returned about an output from MPD
- Source:
Properties:
Name Type Description outputenabled
Integer outputid
Integer outputname
String -
playlistCallback(playlist)
-
Is passed a playlist
Parameters:
Name Type Description playlist
Playlist a playlist
- Source:
-
searchResultsCallback(directory_contents, search_results)
-
Lists all songs and directories in path (blank string for root). also returns song file metadata info
Parameters:
Name Type Argument Description directory_contents
Array.<directory> <optional>
the contents of the directory, will be an array of objects representing director(y|ies) and/or song(s) interleived
/**
is given search results when the search is completesearch_results
Array.<song> all of the songs that match the tag values you asked for
- Source:
-
searchCountCallback(search_result_count)
-
is passed the number of songs matching the given search criteria
Parameters:
Name Type Description search_result_count
Integer number of songs matched by the tag values
- Source:
-
errorEventHandler(responce_event, client)
-
event handler for 'Error' events
error event hander callbackParameters:
Name Type Argument Description responce_event
Object <optional>
-
client
MPD the client that this event happened on
- Source:
-
errorEventHandler(responce_event, client)
-
event handler for 'AuthFailure' events
when we get a responce from MPD that we aren't allowed to do somethingParameters:
Name Type Argument Description responce_event
Object <optional>
-
client
MPD the client that this event happened on
- Source:
-
eventHandler(responce_event, client)
-
generic event hander callback called when any sort of event happens
Parameters:
Name Type Argument Description responce_event
Object <optional>
{type:String:data:Object} data depends onf type, see the other event handlers
client
MPD the client that this event happened on
- Source:
-
unhandledEventHandler(responce_event, client)
-
generic event hander callback called when any sort of event happens that doesn't have any handler set for it
Parameters:
Name Type Argument Description responce_event
Object <optional>
{type:String:data:Object} data depends onf type, see the other event handlers
client
MPD the client that this event happened on
- Source:
-
databaseChangingEventHandler(responce_event, client)
-
event handler for 'DatabaseChanging' events
event hander callback for when the music database has started changing, there will be a DataLoaded event following this (unless something goes HORRIBLY wrong)Parameters:
Name Type Argument Description responce_event
Object <optional>
-
client
MPD the client that this event happened on
- Source:
-
dataLoadedEventHandler(state, client)
-
event handler for 'DataLoaded' events
called when a bulk dataload has completed and the mpd client's data is in a ocnsistent state. fired when a client has finished recovering from a reload which might be caused by a database change or (re)connectingParameters:
Name Type Description state
state state object, the same as is returned by getState
client
MPD the client that this event happened on
- Source:
-
stateChangedEventHandler(state, client)
-
event handler for 'StateChanged' events
called when the state of the player has changed. This can be an scalar value. Things like currently playing song changing, volume, settings (consume, repeat, etc)
NOT called when the current play time changes, because that changes continuusly, you will need to poll thatParameters:
Name Type Description state
state state object, the same as is returned by getState
client
MPD the client that this event happened on
- Source:
-
OutputChangedEventHandler(outputs, client)
-
event handler for 'OutputChanged' events
called when an output of the player has changed (enabled/disabled).Parameters:
Name Type Description outputs
Array.<Output> state object, the same as is returned by getState
client
MPD the client that this event happened on
- Source:
-
queueChangedEventHandler(queue, client)
-
event handler for 'QueueChanged' events
something about the queue of playing songs changedParameters:
Name Type Description queue
Queue the new queue
client
MPD the client that this event happened on
- Source:
-
playlistsChangedEventHandler(playlists, client)
-
event handler for 'PlaylistsChanged' events
some playlist somewhere changed. is an array of {playlist:String, last_modified:Date}Parameters:
Name Type Argument Description playlists
array <optional>
[string] array of names of all playlists. note: there doesn't seem to be a way to get just the changed ones, so you get the list of everything, you can tell if something was added or removed but you have no way of telling if any particular playlist has been changed. this is a limitation of MPD
client
MPD the client that this event happened on
- Source:
-
connectEventHandler(client)
-
event handler for 'Connect' events
the client has connected, but no data has yet loaded
you can use this to setup event handlers, or just do that before connectingParameters:
Name Type Description client
MPD the client that this event happened on
- Source:
-
disconnectEventHandler(client)
-
event handler for 'Disconnect' events
the client has disconnectedParameters:
Name Type Description client
MPD the client that this event happened on
- Source: