Represents a connection to mpd

Static methods

@:value({ port : 6600 })staticconnect(host:String, port:Int = 6600):Promise<MusicPD>

Connect to given mpd server described by host and port.

Parameters:

host
port

Returns:

Promise

Methods

add(uri:String):Promise<Response>

Adds the file uri to the playlist (directories add recursively). uri can also be a single file.

Parameters:

uri

Returns:

Promise

addID(uri:String, ?position:Int):Promise<SongID>

Adds song with uri uri to playlist

Parameters:

uri

uri of song

position

optional position in playlist to add it to

Returns:

Promise id of song that was added

addURIToPlaylist(name:String, uri:String):Promise<Response>

Add song at uri to playlist name

Parameters:

name
uri

Returns:

Promise

cancelIdle():Void

Cancel a waiting idle command

clear():Promise<Response>

Clears the queue

Returns:

Promise

clearError():Promise<Response>

Clear error state

Returns:

Promise

clearPlaylist(name:String):Promise<Response>

Clear playlist name

Parameters:

name

Returns:

Promise

clearTag(id:Int, ?tag:Tag):Promise<Response>

Removes tags from the specified song. If tag is not specified, then all tag values will be removed. Editing song tags is only possible for remote songs.

Parameters:

id
tag

Returns:

Promise

clearTagTypes():Promise<Response>

Disable all tag types

Returns:

Promise

close():Promise<Response>

Close current connection to mpd

Returns:

Promise

count(filter:Filter, ?group:Tag):Promise<CollectionResponse<CountInfo>>

Return counts for Filter filter.

Parameters:

filter
group

if present, groups results by tag group

Returns:

Promise>

createPartition(partition:String):Promise<Response>

Create partition named partition

Parameters:

partition

Returns:

Promise

delete(posOrRange:PosOrRange):Promise<Response>

Deletes specified position(s) from the playlist

Parameters:

posOrRange

single position or range of positions to delete

Returns:

Promise

deleteID(songID:Int):Promise<Response>

Delete specified song from playlist

Parameters:

songID

id of song

Returns:

Promise

deletePartition(partition:String):Promise<Response>

Delete partition partition

Parameters:

partition

Returns:

Promise

deletePlaylist(name:String):Promise<Response>

Delete playlist name

Parameters:

name

Returns:

Promise

deleteSongFromPlaylist(name:String, pos:Int):Promise<Response>

Delete song at pos pos from playlist name

Parameters:

name
pos

Returns:

Promise

deleteSticker(type:String, uri:String, ?name:String):Promise<Response>

Delete sticker(s)

Parameters:

type
uri
name

if present, deletes given sticker otherwise delete all stickers for uri

Returns:

Promise

disableOutput(id:Int):Promise<Response>

Disable output id

Parameters:

id

Returns:

Promise

disableTagTypes(tags:Array<Tag>):Promise<Response>

Disable given tag types

Parameters:

tags

Returns:

Promise

enableAllTagTypes():Promise<Response>

Enable all tag types

Returns:

Promise

enableOutput(id:Int):Promise<Response>

Enable output id

Parameters:

id

Returns:

Promise

enableTagTypes(tags:Array<Tag>):Promise<Response>

Enable given tag types

Parameters:

tags

Returns:

Promise

find(filter:Filter, ?sort:Tag, ?window:Null<Range>):Promise<SongInfos>

Get SongInfos for query finder

Parameters:

filter
sort

if present, sort by tag sort

window

if present, limits results to range window

Returns:

Promise

findAndAdd(filter:Filter, ?sort:Tag, ?window:Null<Range>):Promise<Response>

Put results of query filter into current playlist

Parameters:

filter
sort

if present, sort by tag sort

window

if present, limits results to range window

Returns:

Promise

findInPlaylist(filter:Filter):Promise<SongInfos>

Find songs in current playlist using the given Filter

Parameters:

filter

Returns:

Promise

findStickers(type:String, uri:String, name:String):Promise<SongInfos>

Find stickers for given name

Parameters:

type
uri
name

Returns:

Promise

@:value({ comparison : EqualComparison })findStickersWithValue(type:String, uri:String, name:String, value:String, comparison:Comparison = EqualComparison):Promise<SongInfos>

Find stickers by value

Parameters:

type
uri
name
value
comparison

Returns:

Promise

getAlbumArt(uri:String, offset:Int):Promise<Response>

Get album art for uri. It's more convenient to use readAlbumArt as it returns all the data

Parameters:

uri
offset

Returns:

Promise

getConfig():Promise<Response>

Get current configuration

Returns:

Promise

getCurrentSong():Promise<SongInfo>

Get information about current song

Returns:

Promise

getFingerprint(uri:String):Promise<StringResponse>

Get fingerprint for uri. mpd must have fingerprint support turned on.

Parameters:

uri

Returns:

Promise

getPicture(uri:String, offset:Int):Promise<Response>

Get picture for song uri

Parameters:

uri
offset

Returns:

Promise

getPlaylist(?songID:Int):Promise<SongInfos>

Get SongInfos from current playlist or single song

Parameters:

songID

if specified, only gets SongInfo for given song id

Returns:

Promise

getPlaylistChanges(version:Int, ?range:Null<Range>):Promise<SongInfos>

Get changes to current playlist since playlist version version

Parameters:

version
range

if present, only returns changes in given range

Returns:

Promise

getPlaylistChangesIDs(version:Int, ?range:Null<Range>):Promise<CollectionResponse<PosAndID>>

Get changes to current playlist since playlist version version

Parameters:

version
range

if present, only returns changes in given range

Returns:

Promise>

getPlaylistInfo(posOrRange:PosOrRange):Promise<SongInfos>

Get SongInfos for given position or range

Parameters:

posOrRange

Returns:

Promise

getPlaylistInfoListing(name:String):Promise<SongInfos>

Get detailed list of songs in playlist name

Parameters:

name

Returns:

Promise

getPlaylistListing(name:String):Promise<CollectionResponse<String>>

Lists songs in playlist name

Parameters:

name

Returns:

Promise>

getPlaylists():Promise<CollectionResponse<PlaylistInfo>>

Get list of all playlists

Returns:

Promise>

getReplayGainStatus():Promise<ReplayGainStatus>

Get current replay gain status

Returns:

Promise

getStats():Promise<Stats>

Get statistics

Returns:

Promise

getStatus():Promise<Status>

Get current status of player and volume level

Returns:

Promise

getSticker(type:String, uri:String, name:String):Promise<StringResponse>

Get sticker value

Parameters:

type
uri
name

Returns:

Promise

idle(?subsystems:Array<Subsystem>):Promise<Response>

Wait until a change happens on mpd.

Parameters:

subsystems

if specified, only listens on given subsystem(s)

Returns:

Promise

kill():Promise<Response>

Tell mpd to shutdown. Do not use.

Returns:

Promise

list(type:Tag, ?filter:Null<Filter>, ?group:Tag):Promise<CollectionResponse<ListResultGroup>>

Lists unique tags values of the specified type.

Parameters:

type
filter
group

Returns:

Promise>

listAll(uri:String):Promise<CollectionResponse<FileSystemEntry>>

Recommended not to use. List all songs and directories in uri

listAllInfo(uri:String):Promise<SongInfos>

Recommended not to use. List all songs and directories in uri with metadata

listChannels():Promise<CollectionResponse<String>>

List available channels

Returns:

Promise>

listCommands():Promise<CollectionResponse<String>>

Get list of available commands

Returns:

Promise>

listDecoders():Promise<CollectionResponse<Decoder>>

Get list of available decoders

Returns:

Promise>

listFiles(uri:String):Promise<SongInfos>

Lists the contents of the directory uri, including files are not recognized by mpd

listInfo(uri:String):Promise<SongInfos>

Lists the contents of the directory uri.

listMounts():Promise<CollectionResponse<Mount>>

List current mounts

Returns:

Promise>

listNeighbors():Promise<CollectionResponse<Neighbor>>

List available network volume

Returns:

Promise>

listOutputs():Promise<CollectionResponse<AudioOutput>>

List available outputs

Returns:

Promise>

listPartitions():Promise<Response>

List available partitions

Returns:

Promise

listStickers(type:String, uri:String):Promise<CollectionResponse<NameValuePair>>

List all stickers for type and uri

Parameters:

type
uri

Returns:

Promise>

listTagTypes():Promise<CollectionResponse<Tag>>

List available tag types

Returns:

Promise>

listUnavailableCommands():Promise<CollectionResponse<String>>

Get list of disabled commands

Returns:

Promise>

listUriHandlers():Promise<CollectionResponse<String>>

Get list of uri handlers, as protocol strings

Returns:

Promise>

loadPlaylist(name:String, ?range:Null<Range>):Promise<Response>

Switch to playlist name

Parameters:

name
range

if present, only loads this portion of playlist

Returns:

Promise

mount(path:String, uri:String):Promise<Response>

Mount uri at path

Parameters:

path
uri

Returns:

Promise

move(posOrRange:PosOrRange, toPos:Int):Promise<Response>

Move song(s) at posOrRange to toPos in the playlist

Parameters:

posOrRange
toPos

Returns:

Promise

moveID(songID:Int, toPos:Int):Promise<Response>

Move song with id songID to position toPos in playlist

Parameters:

songID
toPos

Returns:

Promise

moveInPlaylist(name:String, from:Int, to:Int):Promise<Response>

Move song at pos from to pos to in playlist name

Parameters:

name
from
to

Returns:

Promise

moveOutput(outputName:String):Promise<Response>

Move output outputName to current partition

Parameters:

outputName

Returns:

Promise

next():Promise<Response>

Plays next song in playlist

Returns:

Promise

passwordAuthenticate(pass:String):Promise<Response>

Authenticate with password pass

Parameters:

pass

Returns:

Promise

ping():Promise<Response>

Ping for testing connectivity to mpd

Returns:

Promise

@:value({ songPos : null })play(?songPos:Int):Promise<Response>

Plays current song or song at songPos if given

Parameters:

songPos

Returns:

Promise

@:value({ songID : null })playID(?songID:Int):Promise<Response>

Plays song in playlist with given song id

Parameters:

songID

song id to play

Returns:

Promise

previous():Promise<Response>

Plays previous song in the playlist.

Returns:

Promise

readAlbumArt(uri:String):Promise<Bytes>

Get entire image data for song at uri

Parameters:

uri

Returns:

Promise

readComments(uri:String):Promise<Response>

Read “comments” (i.e. key-value pairs) from the file specified by uri

Parameters:

uri

path relative to the music directory or an absolute path

Returns:

Promise

readMessages():Promise<CollectionResponse<ChannelMessages>>

Read messages from all subscribed channels

Returns:

Promise>

readPicture(uri:String):Promise<Bytes>

Reads entire picture for song uri

Parameters:

uri

Returns:

Promise

renamePlaylist(name:String, newName:String):Promise<Response>

Rename playlist name to newName

Parameters:

name
newName

Returns:

Promise

rescan(uri:String):Promise<Response>

Searches and updates all files under uri

Parameters:

uri

Returns:

Promise

savePlaylist(name:String):Promise<Response>

Save current playlist as name

Parameters:

name

Returns:

Promise

search(filter:Filter, ?sort:Tag, ?window:Null<Range>):Promise<SongInfos>

Case insensitive search

Parameters:

filter
sort
window

Returns:

Promise

searchAndAdd(filter:Filter, ?sort:Tag, ?window:Null<Range>):Promise<Response>

Case insensitive search and add to current playlist

Parameters:

filter
sort
window

Returns:

Promise

searchAndAddToPlaylist(playlist:String, filter:String, ?sort:Tag, ?window:Null<Range>):Promise<Response>

Case-insensitive search and add to playlist playlist

Parameters:

playlist
filter
sort
window

Returns:

Promise

searchInPlaylist(filter:Filter):Promise<SongInfos>

Search using given Filter within the current playlist

Parameters:

filter

Returns:

Promise

@:value({ relativeType : RelativeType.Absolute })seek(songPos:Int, time:Float, relativeType:RelativeType = RelativeType.Absolute):Promise<Response>

Seeks to the position time of entry songPos in the playlist.

Parameters:

songPos

position in the playlist

time

time in seconds.

Returns:

Promise

@:value({ relativeType : RelativeType.Absolute })seekCur(time:Float, relativeType:RelativeType = RelativeType.Absolute):Promise<Response>

Seek in current song

Parameters:

time

time in seconds

relativeType

whether time is absolute, or relative to current playing position

Returns:

Promise

@:value({ relativeType : RelativeType.Absolute })seekID(songID:Int, time:Float, relativeType:RelativeType = RelativeType.Absolute):Promise<Response>

Seeks to the position time of song with songID in the playlist.

Parameters:

songID

songID of song to seek to

time

time in seconds.

Returns:

Promise

sendMessage(channel:String, text:String):Promise<Response>

Send message text to channel channel

Parameters:

channel
text

Returns:

Promise

setConsume(consume:Bool):Promise<Response>

Turn consume mode (whether to remove songs from playlist as they finish playing) on or off

Parameters:

consume

Returns:

Promise

setCrossfade(seconds:Int):Promise<Response>

Set crossfade in seconds

Parameters:

seconds

crossfade duration, in seconds

Returns:

Promise

setMixRampDB(db:Int):Promise<Response>

Set decibles at which to mix ramp, instead of crossfading

Parameters:

db

threshold at which songs will be overlapped

Returns:

Promise

setMixRampDelay(delay:Int):Promise<Response>

Set delay before applying mix ramp

Parameters:

delay

delay in seconds

Returns:

Promise

setOutputAttribute(id:Int, name:String, value:String):Promise<Response>

Set output attribute

Parameters:

id
name
value

Returns:

Promise

setPause(pause:Bool):Promise<Response>

Sets pause on or off

Parameters:

pause

Returns:

Promise

setPriority(priority:Int, range:Range):Promise<Response>

Set the priority of the specified songs. A higher priority means that it will be played first when random mode is enabled.

Parameters:

priority

value between 0 and 255. default is 0.

range

Returns:

Promise

setPriorityForID(priority:Int, ids:Array<Int>):Promise<Response>

Set the priority of the specified songs. A higher priority means that it will be played first when “random” mode is enabled.

Parameters:

priority

value between 0 and 255. default is 0.

ids

ids of songs to set priority on

Returns:

Promise

setRandom(random:Bool):Promise<Response>

Turns random state on or of

Parameters:

random

whether to turn random on or off

Returns:

Promise

setRangeForID(id:Int, ?timeRange:Null<TimeRange>):Promise<Response>

Sets range within song id to play

Parameters:

id

song id

timeRange

if present, limits playback to given range, otherwise clears any such restriction

Returns:

Promise

setRepeat(repeat:Bool):Promise<Response>

Turns repeat state on or off

Parameters:

repeat

whether to turn repeat mode on or off

Returns:

Promise

setReplayGainMode(replayGainMode:ReplayGainMode):Promise<Response>

Set replay gain mode

Parameters:

replayGainMode

Returns:

Promise

setSingle(singleState:SingleState):Promise<Response>

Set single mode state

Parameters:

singleState

SingleState to set to

Returns:

Promise

setSticker(type:String, uri:String, name:String, value:String):Promise<Response>

Set sticker value

Parameters:

type
uri
name
value

Returns:

Promise

setTag(id:Int, tag:Tag, value:String):Promise<Response>

Adds a tag to the specified song. Editing song tags is only possible for remote songs. This change is volatile: it may be overwritten by tags received from the server, and the data is gone when the song gets removed from the queue.

Parameters:

id

song id

tag
value

Returns:

Promise

setVolume(volume:Int):Promise<Response>

Sets volume of playback

Parameters:

volume

value between 0 and 100

Returns:

Promise

shuffle(?range:Null<Range>):Promise<Response>

Shuffles the queue

Parameters:

range

if present, restricts shuffling to range

Returns:

Promise

stop():Promise<Response>

Stops playback

Returns:

Promise

subscribeToChannel(channel:String):Promise<Response>

Subscribe to/open channel for messages

Parameters:

channel

Returns:

Promise

swap(song1:Int, song2:Int):Promise<Response>

Swaps the positions of song1 and song2.

Parameters:

song1
song2

Returns:

Promise

swapSongIDs(id1:Int, id2:Int):Promise<Response>

Swaps the positions of songs with ids id1 and id2

Parameters:

id1
id2

Returns:

Promise

switchToPartition(partition:String):Promise<Response>

Switch to partition partition

Parameters:

partition

Returns:

Promise

toggleOutput(id:Int):Promise<Response>

Toggle enabled/disabled state of output id

Parameters:

id

Returns:

Promise

unmount(path:String):Promise<Response>

Unmount path path

Parameters:

path

Returns:

Promise

unsubscribeFromChannel(channel:String):Promise<Response>

Unsubscribe from channel

Parameters:

channel

Returns:

Promise

update(uri:String):Promise<Response>

Searches and updates any modified files under uri

Parameters:

uri

Returns:

Promise