class MusicPD
package mpd
Represents a connection to mpd
Static methods
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
addURIToPlaylist(name:String, uri:String):Promise<Response>
Add song at uri
to playlist name
Parameters:
name | |
---|---|
uri |
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
count(filter:Filter, ?group:Tag):Promise<CollectionResponse<CountInfo>>
Return counts for Filter
filter
.
Parameters:
filter | |
---|---|
group | if present, groups results by tag |
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
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 |
Returns:
Promise
disableTagTypes(tags:Array<Tag>):Promise<Response>
Disable given tag types
Parameters:
tags |
---|
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 SongInfo
s for query finder
Parameters:
filter | |
---|---|
sort | if present, sort by tag |
window | if present, limits results to range |
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 |
window | if present, limits results to range |
Returns:
Promise
findInPlaylist(filter:Filter):Promise<SongInfos>
findStickers(type:String, uri:String, name:String):Promise<SongInfos>
Find stickers for given name
Parameters:
type | |
---|---|
uri | |
name |
Returns:
Promise
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
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>
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>
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
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
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
listFiles(uri:String):Promise<SongInfos>
Lists the contents of the directory uri
, including files are not recognized by mpd
listStickers(type:String, uri:String):Promise<CollectionResponse<NameValuePair>>
List all stickers for type
and uri
Parameters:
type | |
---|---|
uri |
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
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
passwordAuthenticate(pass:String):Promise<Response>
Authenticate with password pass
Parameters:
pass |
---|
Returns:
Promise
play(?songPos:Int):Promise<Response>
Plays current song or song at songPos
if given
Parameters:
songPos |
---|
Returns:
Promise
playID(?songID:Int):Promise<Response>
Plays song in playlist with given song id
Parameters:
songID | song id to play |
---|
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>
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
seekCur(time:Float, relativeType:RelativeType = RelativeType.Absolute):Promise<Response>
Seek in current song
Parameters:
time | time in seconds |
---|---|
relativeType | whether |
Returns:
Promise
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
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>
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 |
---|
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
unsubscribeFromChannel(channel:String):Promise<Response>
Unsubscribe from channel
Parameters:
channel |
---|
Returns:
Promise