paracusia v0.2.11 Paracusia.MpdClient.Queue

Functions related to the current playlist / queue.

See also: https://musicpd.org/doc/protocol/queue.html

Note that, unlike the official specification, we use the term "queue" rather than "playlist" in order to distinguish MPD playlists saved in the playlists directory in m3u format from the current playlist. Furthermore, we use the term id when referring to the unique identifier of a song in the entire database, and the term position when referring to a zero-based index inside the queue. According to the authors of MPD, "Using song ids [instead of positions] is a safer method when multiple clients are interacting with MPD."

Link to this section Summary

Functions

Adds the file uri to the queue

Adds the uri to the end of the queue (non-recursively) and returns the song id

Adds the uri at the given position to the queue (non-recursively) and returns the song id

Adds a tag to the song with the given id

Returns a list of maps containing all songs from the queue that changed since version

Similar to changes/1 but the songs contain only the position and the id instead of the complete metadata

Clears the queue

Removes all tags from the song with the given id

Removes the given tag from the song with the given id

Deletes the song with the given id from the queue

Deletes the song at position from the queue

Deletes songs from the given range from the queue

Same as Paracusia.MpdClient.Database.find/1, except that it searches for songs from the queue

Moves the song/songs from the given position/range to to in the queue

Moves the song with id from to position to in the queue

Specifies the portion of the song that shall be played

Removes the range that was previously set by calling range_id/3

Searches case-insensitively for partial matches in the queue

Sets the priority of the songs in the given range to prio

Same as set_priority/2, except songs are addressed with their id

Shuffles the queue

Shuffles the queue in the given range

Returns a map containing info about the songs with the given id

Returns a map containing info about the song at position songpos

Returns a list of maps containing info about the songs currently in the queue

Returns a list of maps containing info about the songs in the given range

Swaps the positions of the songs at the given positions pos1 and pos2

Swaps the positions of the songs with ids id1 and id2

Link to this section Functions

Adds the file uri to the queue.

Directories are added recursively. uri can also be a single file.

Adds the uri to the end of the queue (non-recursively) and returns the song id.

Adds the uri at the given position to the queue (non-recursively) and returns the song id.

Adds a tag to the song with the given id.

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.

Link to this function

changed_since(version)
changed_since(integer()) :: {:ok, [map()]} | Paracusia.MpdTypes.mpd_error()

Returns a list of maps containing all songs from the queue that changed since version.

To detect songs that were deleted at the end of the queue, use the playlist_length key inside the map returned by Paracusia.MpdClient.Status.status/0.

Link to this function

changed_since_pos_id(version)
changed_since_pos_id(integer()) ::
  {:ok, [map()]} | Paracusia.MpdTypes.mpd_error()

Similar to changes/1 but the songs contain only the position and the id instead of the complete metadata.

This is more bandwith efficient than changes/1. To detect songs that were deleted at the end of the queue, use the playlist_length key inside the map returned by Paracusia.MpdClient.Status.status/0.

Clears the queue.

Link to this function

clear_all_tags(id)

Removes all tags from the song with the given id.

Removes the given tag from the song with the given id.

Deletes the song with the given id from the queue.

Deletes the song at position from the queue.

Deletes songs from the given range from the queue.

Same as Paracusia.MpdClient.Database.find/1, except that it searches for songs from the queue.

Moves the song/songs from the given position/range to to in the queue.

from can be either a position or a range.

Link to this function

move_id(from, to)

Moves the song with id from to position to in the queue.

If to is negative, it is relative to the current song in the queue (if there is one).

Link to this function

range_id(id, start, until)

Specifies the portion of the song that shall be played.

start and until are offsets in seconds (fractional seconds allowed). A song that is currently playing cannot be manipulated this way.

Removes the range that was previously set by calling range_id/3.

Searches case-insensitively for partial matches in the queue.

See Paracusia.MpdClient.Database.find/1, for a usage example.

Link to this function

set_priority(prio, arg)

Sets the priority of the songs in the given range to prio.

A higher priority means that it will be played first when "random" mode is enabled. A priority is an integer between 0 and 255. The default priority of new songs is 0.

Link to this function

set_priority_from_id(prio, ids)

Same as set_priority/2, except songs are addressed with their id.

Shuffles the queue.

Shuffles the queue in the given range.

Link to this function

song_info_from_id(id)
song_info_from_id(Paracusia.MpdTypes.id()) ::
  {:ok, map()} | Paracusia.MpdTypes.mpd_error()

Returns a map containing info about the songs with the given id.

Link to this function

song_info_from_pos(songpos)
song_info_from_pos(Paracusia.MpdTypes.position()) ::
  {:ok, map()} | Paracusia.MpdTypes.mpd_error()

Returns a map containing info about the song at position songpos.

Link to this function

songs_info()
songs_info() :: {:ok, [map()]} | Paracusia.MpdTypes.mpd_error()

Returns a list of maps containing info about the songs currently in the queue.

Link to this function

songs_info_from_range(arg)
songs_info_from_range(Paracusia.MpdTypes.range()) ::
  {:ok, [map()]} | Paracusia.MpdTypes.mpd_error()

Returns a list of maps containing info about the songs in the given range.

Swaps the positions of the songs at the given positions pos1 and pos2.

Swaps the positions of the songs with ids id1 and id2.