|
myMPD
Internal API documentation
|
myMPD queue API More...
#include "compile_time.h"#include "src/mympd_api/queue.h"#include "src/lib/cache/cache_rax_album.h"#include "src/lib/json/json_print.h"#include "src/lib/json/json_rpc.h"#include "src/lib/log.h"#include "src/lib/sds_extras.h"#include "src/lib/utility.h"#include "src/mympd_api/sticker.h"#include "src/mympd_api/webradio.h"#include "src/mympd_client/errorhandler.h"#include "src/mympd_client/queue.h"#include "src/mympd_client/search.h"#include "src/mympd_client/shortcuts.h"#include "src/mympd_client/stickerdb.h"#include "src/mympd_client/tags.h"#include <limits.h>#include <string.h>
Functions | |
| static bool | add_queue_search_adv_params (struct t_partition_state *partition_state, sds sort, bool sortdesc, unsigned offset, unsigned limit) |
| sds | print_queue_entry (struct t_mympd_state *mympd_state, struct t_partition_state *partition_state, sds buffer, const struct t_fields *tagcols, bool print_stickers, struct mpd_song *song) |
| bool | mympd_api_queue_save (struct t_partition_state *partition_state, sds name, sds mode, sds *error) |
| bool | mympd_api_queue_rm_song_ids (struct t_partition_state *partition_state, struct t_list *song_ids, sds *error) |
| bool | mympd_api_queue_prio_set (struct t_partition_state *partition_state, struct t_list *song_ids, unsigned priority, sds *error) |
| bool | mympd_api_queue_prio_set_highest (struct t_partition_state *partition_state, struct t_list *song_ids, sds *error) |
| bool | mympd_api_queue_move_relative (struct t_partition_state *partition_state, struct t_list *song_ids, unsigned to, unsigned whence, sds *error) |
| bool | mympd_api_queue_insert_uri_tags (struct t_partition_state *partition_state, sds uri, struct t_list *tags, unsigned to, unsigned whence, sds *error) |
| bool | mympd_api_queue_append_uri_tags (struct t_partition_state *partition_state, sds uri, struct t_list *tags, sds *error) |
| bool | mympd_api_queue_replace_uri_tags (struct t_partition_state *partition_state, sds uri, struct t_list *tags, sds *error) |
| bool | mympd_api_queue_insert_uri_resume (struct t_partition_state *partition_state, struct t_stickerdb_state *stickerdb, sds uri, unsigned to, unsigned whence, sds *error) |
| bool | mympd_api_queue_append_uri_resume (struct t_partition_state *partition_state, struct t_stickerdb_state *stickerdb, sds uri, sds *error) |
| bool | mympd_api_queue_replace_uri_resume (struct t_partition_state *partition_state, struct t_stickerdb_state *stickerdb, sds uri, sds *error) |
| bool | mympd_api_queue_insert (struct t_partition_state *partition_state, struct t_list *uris, unsigned to, unsigned whence, sds *error) |
| bool | mympd_api_queue_append (struct t_partition_state *partition_state, struct t_list *uris, sds *error) |
| bool | mympd_api_queue_replace (struct t_partition_state *partition_state, struct t_list *uris, sds *error) |
| bool | mympd_api_queue_insert_search (struct t_partition_state *partition_state, sds expression, unsigned to, unsigned whence, const char *sort, bool sort_desc, sds *error) |
| bool | mympd_api_queue_append_search (struct t_partition_state *partition_state, sds expression, const char *sort, bool sort_desc, sds *error) |
| bool | mympd_api_queue_replace_search (struct t_partition_state *partition_state, sds expression, const char *sort, bool sort_desc, sds *error) |
| bool | mympd_api_queue_insert_albums (struct t_partition_state *partition_state, struct t_cache *album_cache, struct t_list *albumids, unsigned to, unsigned whence, sds *error) |
| bool | mympd_api_queue_append_albums (struct t_partition_state *partition_state, struct t_cache *album_cache, struct t_list *albumids, sds *error) |
| bool | mympd_api_queue_replace_albums (struct t_partition_state *partition_state, struct t_cache *album_cache, struct t_list *albumids, sds *error) |
| bool | mympd_api_queue_insert_album_tag (struct t_partition_state *partition_state, struct t_cache *album_cache, sds albumid, enum mpd_tag_type tag, sds value, unsigned to, unsigned whence, sds *error) |
| bool | mympd_api_queue_append_album_tag (struct t_partition_state *partition_state, struct t_cache *album_cache, sds albumid, enum mpd_tag_type tag, sds value, sds *error) |
| bool | mympd_api_queue_replace_album_tag (struct t_partition_state *partition_state, struct t_cache *album_cache, sds albumid, enum mpd_tag_type tag, sds value, sds *error) |
| bool | mympd_api_queue_insert_album_range (struct t_partition_state *partition_state, struct t_cache *album_cache, sds albumid, unsigned start, int end, unsigned to, unsigned whence, sds *error) |
| bool | mympd_api_queue_append_album_range (struct t_partition_state *partition_state, struct t_cache *album_cache, sds albumid, unsigned start, int end, sds *error) |
| bool | mympd_api_queue_replace_album_range (struct t_partition_state *partition_state, struct t_cache *album_cache, sds albumid, unsigned start, int end, sds *error) |
| bool | mympd_api_queue_insert_plist_range (struct t_partition_state *partition_state, sds plist, unsigned to, unsigned whence, unsigned start, int end, sds *error) |
| bool | mympd_api_queue_append_plist_range (struct t_partition_state *partition_state, sds plist, unsigned start, int end, sds *error) |
| bool | mympd_api_queue_replace_plist_range (struct t_partition_state *partition_state, sds plist, unsigned start, int end, sds *error) |
| bool | mympd_api_queue_insert_plists (struct t_partition_state *partition_state, struct t_list *plists, unsigned to, unsigned whence, sds *error) |
| bool | mympd_api_queue_append_plists (struct t_partition_state *partition_state, struct t_list *plists, sds *error) |
| bool | mympd_api_queue_replace_plists (struct t_partition_state *partition_state, struct t_list *plists, sds *error) |
| sds | mympd_api_queue_crop (struct t_partition_state *partition_state, sds buffer, enum mympd_cmd_ids cmd_id, unsigned request_id, bool or_clear) |
| sds | mympd_api_queue_list (struct t_mympd_state *mympd_state, struct t_partition_state *partition_state, sds buffer, unsigned request_id, unsigned offset, unsigned limit, const struct t_fields *tagcols) |
| sds | mympd_api_queue_search (struct t_mympd_state *mympd_state, struct t_partition_state *partition_state, sds buffer, unsigned request_id, sds expression, sds sort, bool sortdesc, unsigned offset, unsigned limit, const struct t_fields *tagcols) |
myMPD queue API
|
static |
Private definitions
Adds sort and window parameter to queue search, if feat_advqueue is true
| partition_state | pointer to partition state |
| sort | tag to sort |
| sortdesc | sort descending? |
| offset | offset for the list - only relevant for feat_advqueue |
| limit | maximum entries to print - only relevant for feat_advqueue |
| bool mympd_api_queue_append | ( | struct t_partition_state * | partition_state, |
| struct t_list * | uris, | ||
| sds * | error | ||
| ) |
Appends uris to the queue
| partition_state | pointer to partition state |
| uris | uris to append |
| error | pointer to an already allocated sds string for the error message |
| bool mympd_api_queue_append_album_range | ( | struct t_partition_state * | partition_state, |
| struct t_cache * | album_cache, | ||
| sds | albumid, | ||
| unsigned | start, | ||
| int | end, | ||
| sds * | error | ||
| ) |
Appends a range of song from an album to the queue
| partition_state | pointer to partition state |
| album_cache | pointer to album cache |
| albumid | album id to append |
| start | start of the range (including) |
| end | end of the range (excluded) |
| error | pointer to an already allocated sds string for the error message |
| bool mympd_api_queue_append_album_tag | ( | struct t_partition_state * | partition_state, |
| struct t_cache * | album_cache, | ||
| sds | albumid, | ||
| enum mpd_tag_type | tag, | ||
| sds | value, | ||
| sds * | error | ||
| ) |
Appends songs of an album filtered by tag to the queue
| partition_state | pointer to partition state |
| album_cache | pointer to album cache |
| albumid | album id to append |
| tag | MPD tag |
| value | MPD tag value |
| error | pointer to an already allocated sds string for the error message |
| bool mympd_api_queue_append_albums | ( | struct t_partition_state * | partition_state, |
| struct t_cache * | album_cache, | ||
| struct t_list * | albumids, | ||
| sds * | error | ||
| ) |
Appends albums to the queue
| partition_state | pointer to partition state |
| album_cache | pointer to album cache |
| albumids | album ids to append |
| error | pointer to an already allocated sds string for the error message |
| bool mympd_api_queue_append_plist_range | ( | struct t_partition_state * | partition_state, |
| sds | plist, | ||
| unsigned | start, | ||
| int | end, | ||
| sds * | error | ||
| ) |
Appends a playlist range to the queue
| partition_state | pointer to partition state |
| plist | playlist to append |
| start | start of the range (including) |
| end | end of the range (excluded) |
| error | pointer to an already allocated sds string for the error message |
| bool mympd_api_queue_append_plists | ( | struct t_partition_state * | partition_state, |
| struct t_list * | plists, | ||
| sds * | error | ||
| ) |
Appends playlists to the queue
| partition_state | pointer to partition state |
| plists | playlists to append |
| error | pointer to an already allocated sds string for the error message |
| bool mympd_api_queue_append_search | ( | struct t_partition_state * | partition_state, |
| sds | expression, | ||
| const char * | sort, | ||
| bool | sort_desc, | ||
| sds * | error | ||
| ) |
Appends the search results to the queue
| partition_state | pointer to partition state |
| expression | mpd search expression |
| sort | sort by tag |
| sort_desc | sort descending? |
| error | pointer to an already allocated sds string for the error message |
| bool mympd_api_queue_append_uri_resume | ( | struct t_partition_state * | partition_state, |
| struct t_stickerdb_state * | stickerdb, | ||
| sds | uri, | ||
| sds * | error | ||
| ) |
Appends an uri to the queue and resumes playback.
| partition_state | pointer to partition state |
| stickerdb | pointer to stickerdb |
| uri | uri to add to the queue |
| error | pointer to an already allocated sds string for the error message |
| bool mympd_api_queue_append_uri_tags | ( | struct t_partition_state * | partition_state, |
| sds | uri, | ||
| struct t_list * | tags, | ||
| sds * | error | ||
| ) |
Appends an uri to the queue and sets tag values for it.
| partition_state | pointer to partition state |
| uri | uri to add to the queue |
| tags | list of tags with values to set |
| error | pointer to an already allocated sds string for the error message |
| sds mympd_api_queue_crop | ( | struct t_partition_state * | partition_state, |
| sds | buffer, | ||
| enum mympd_cmd_ids | cmd_id, | ||
| unsigned | request_id, | ||
| bool | or_clear | ||
| ) |
Crops (removes all but playing song) or clears the queue if no song is playing
| partition_state | pointer to partition state |
| buffer | already allocated sds string to append the response |
| cmd_id | jsonrpc method |
| request_id | jsonrpc id |
| or_clear | if true: clears the queue if there is no current playing or paused song |
| bool mympd_api_queue_insert | ( | struct t_partition_state * | partition_state, |
| struct t_list * | uris, | ||
| unsigned | to, | ||
| unsigned | whence, | ||
| sds * | error | ||
| ) |
Insert uris into the queue
| partition_state | pointer to partition state |
| uris | uris to insert |
| to | position to insert |
| whence | how to interpret the to parameter |
| error | pointer to an already allocated sds string for the error message |
| bool mympd_api_queue_insert_album_range | ( | struct t_partition_state * | partition_state, |
| struct t_cache * | album_cache, | ||
| sds | albumid, | ||
| unsigned | start, | ||
| int | end, | ||
| unsigned | to, | ||
| unsigned | whence, | ||
| sds * | error | ||
| ) |
Inserts a range of song from an album into the queue
| partition_state | pointer to partition state |
| album_cache | pointer to album cache |
| albumid | album id to insert |
| start | start of the range (including) |
| end | end of the range (excluded) |
| to | position to insert |
| whence | how to interpret the to parameter |
| error | pointer to an already allocated sds string for the error message |
| bool mympd_api_queue_insert_album_tag | ( | struct t_partition_state * | partition_state, |
| struct t_cache * | album_cache, | ||
| sds | albumid, | ||
| enum mpd_tag_type | tag, | ||
| sds | value, | ||
| unsigned | to, | ||
| unsigned | whence, | ||
| sds * | error | ||
| ) |
Inserts songs of an album filtered by tag into the queue
| partition_state | pointer to partition state |
| album_cache | pointer to album cache |
| albumid | album id to insert |
| tag | MPD tag |
| value | MPD tag value |
| to | position to insert |
| whence | how to interpret the to parameter |
| error | pointer to an already allocated sds string for the error message |
| bool mympd_api_queue_insert_albums | ( | struct t_partition_state * | partition_state, |
| struct t_cache * | album_cache, | ||
| struct t_list * | albumids, | ||
| unsigned | to, | ||
| unsigned | whence, | ||
| sds * | error | ||
| ) |
Inserts albums into the queue
| partition_state | pointer to partition state |
| album_cache | pointer to album cache |
| albumids | album ids to insert |
| to | position to insert |
| whence | how to interpret the to parameter |
| error | pointer to an already allocated sds string for the error message |
| bool mympd_api_queue_insert_plist_range | ( | struct t_partition_state * | partition_state, |
| sds | plist, | ||
| unsigned | to, | ||
| unsigned | whence, | ||
| unsigned | start, | ||
| int | end, | ||
| sds * | error | ||
| ) |
Inserts a playlist range into the queue
| partition_state | pointer to partition state |
| plist | playlist to insert |
| to | position to insert |
| whence | how to interpret the to parameter |
| start | start of the range (including) |
| end | end of the range (excluded) |
| error | pointer to an already allocated sds string for the error message |
| bool mympd_api_queue_insert_plists | ( | struct t_partition_state * | partition_state, |
| struct t_list * | plists, | ||
| unsigned | to, | ||
| unsigned | whence, | ||
| sds * | error | ||
| ) |
Insert playlists into the queue
| partition_state | pointer to partition state |
| plists | playlists to insert |
| to | position to insert |
| whence | how to interpret the to parameter |
| error | pointer to an already allocated sds string for the error message |
| bool mympd_api_queue_insert_search | ( | struct t_partition_state * | partition_state, |
| sds | expression, | ||
| unsigned | to, | ||
| unsigned | whence, | ||
| const char * | sort, | ||
| bool | sort_desc, | ||
| sds * | error | ||
| ) |
Inserts search results into the queue
| partition_state | pointer to partition state |
| expression | mpd search expression |
| to | position to insert |
| whence | how to interpret the to parameter |
| sort | sort by tag |
| sort_desc | sort descending? |
| error | pointer to an already allocated sds string for the error message |
| bool mympd_api_queue_insert_uri_resume | ( | struct t_partition_state * | partition_state, |
| struct t_stickerdb_state * | stickerdb, | ||
| sds | uri, | ||
| unsigned | to, | ||
| unsigned | whence, | ||
| sds * | error | ||
| ) |
Inserts an uri to the queue and resumes playback.
| partition_state | pointer to partition state |
| stickerdb | pointer to stickerdb |
| uri | uri to add to the queue |
| to | where to insert the uri |
| whence | How to interprete the to parameter |
| error | pointer to an already allocated sds string for the error message |
| bool mympd_api_queue_insert_uri_tags | ( | struct t_partition_state * | partition_state, |
| sds | uri, | ||
| struct t_list * | tags, | ||
| unsigned | to, | ||
| unsigned | whence, | ||
| sds * | error | ||
| ) |
Inserts an uri to the queue and sets tag values for it.
| partition_state | pointer to partition state |
| uri | uri to add to the queue |
| tags | list of tags with values to set |
| to | where to insert the uri |
| whence | How to interprete the to parameter |
| error | pointer to an already allocated sds string for the error message |
| sds mympd_api_queue_list | ( | struct t_mympd_state * | mympd_state, |
| struct t_partition_state * | partition_state, | ||
| sds | buffer, | ||
| unsigned | request_id, | ||
| unsigned | offset, | ||
| unsigned | limit, | ||
| const struct t_fields * | tagcols | ||
| ) |
Lists the queue, this is faster for older MPD servers than the search function below.
| mympd_state | pointer to mympd_state |
| partition_state | pointer to partition state |
| buffer | already allocated sds string to append the response |
| request_id | jsonrpc id |
| offset | offset for the list |
| limit | maximum entries to print |
| tagcols | columns to print |
| bool mympd_api_queue_move_relative | ( | struct t_partition_state * | partition_state, |
| struct t_list * | song_ids, | ||
| unsigned | to, | ||
| unsigned | whence, | ||
| sds * | error | ||
| ) |
Moves song ids to relative position after current song
| partition_state | pointer to partition state |
| song_ids | song ids to move |
| to | relative position |
| whence | how to interpret the to parameter |
| error | pointer to an already allocated sds string for the error message |
| bool mympd_api_queue_prio_set | ( | struct t_partition_state * | partition_state, |
| struct t_list * | song_ids, | ||
| unsigned | priority, | ||
| sds * | error | ||
| ) |
Sets the priority of entries in the queue. The priority has only an effect in random mode.
| partition_state | pointer to partition state |
| song_ids | song ids in the queue |
| priority | priority to set, max 255 |
| error | pointer to an already allocated sds string for the error message |
| bool mympd_api_queue_prio_set_highest | ( | struct t_partition_state * | partition_state, |
| struct t_list * | song_ids, | ||
| sds * | error | ||
| ) |
Sets the priority to the highest value of a song in the queue. The priority has only an effect in random mode.
| partition_state | pointer to partition state |
| song_ids | song ids in the queue |
| error | pointer to an already allocated sds string for the error message |
| bool mympd_api_queue_replace | ( | struct t_partition_state * | partition_state, |
| struct t_list * | uris, | ||
| sds * | error | ||
| ) |
Replaces the queue with uris
| partition_state | pointer to partition state |
| uris | uris to add |
| error | pointer to an already allocated sds string for the error message |
| bool mympd_api_queue_replace_album_range | ( | struct t_partition_state * | partition_state, |
| struct t_cache * | album_cache, | ||
| sds | albumid, | ||
| unsigned | start, | ||
| int | end, | ||
| sds * | error | ||
| ) |
Replaces the queue with a range of song from an album
| partition_state | pointer to partition state |
| album_cache | pointer to album cache |
| albumid | album id to insert |
| start | start of the range (including) |
| end | end of the range (excluded) |
| error | pointer to an already allocated sds string for the error message |
| bool mympd_api_queue_replace_album_tag | ( | struct t_partition_state * | partition_state, |
| struct t_cache * | album_cache, | ||
| sds | albumid, | ||
| enum mpd_tag_type | tag, | ||
| sds | value, | ||
| sds * | error | ||
| ) |
Replaces the queue with an album filted by tag
| partition_state | pointer to partition state |
| album_cache | pointer to album cache |
| albumid | album id to insert |
| tag | MPD tag |
| value | MPD tag value |
| error | pointer to an already allocated sds string for the error message |
| bool mympd_api_queue_replace_albums | ( | struct t_partition_state * | partition_state, |
| struct t_cache * | album_cache, | ||
| struct t_list * | albumids, | ||
| sds * | error | ||
| ) |
Replaces the queue with albums
| partition_state | pointer to partition state |
| album_cache | pointer to album cache |
| albumids | album ids to insert |
| error | pointer to an already allocated sds string for the error message |
| bool mympd_api_queue_replace_plist_range | ( | struct t_partition_state * | partition_state, |
| sds | plist, | ||
| unsigned | start, | ||
| int | end, | ||
| sds * | error | ||
| ) |
Replaces the queue with a playlist range
| partition_state | pointer to partition state |
| plist | playlist to add |
| start | start of the range (including) |
| end | end of the range (excluded) |
| error | pointer to an already allocated sds string for the error message |
| bool mympd_api_queue_replace_plists | ( | struct t_partition_state * | partition_state, |
| struct t_list * | plists, | ||
| sds * | error | ||
| ) |
Replaces the queue with playlists
| partition_state | pointer to partition state |
| plists | playlists to add |
| error | pointer to an already allocated sds string for the error message |
| bool mympd_api_queue_replace_search | ( | struct t_partition_state * | partition_state, |
| sds | expression, | ||
| const char * | sort, | ||
| bool | sort_desc, | ||
| sds * | error | ||
| ) |
Replaces the queue with the search result
| partition_state | pointer to partition state |
| expression | mpd search expression |
| sort | sort by tag |
| sort_desc | sort descending? |
| error | pointer to an already allocated sds string for the error message |
| bool mympd_api_queue_replace_uri_resume | ( | struct t_partition_state * | partition_state, |
| struct t_stickerdb_state * | stickerdb, | ||
| sds | uri, | ||
| sds * | error | ||
| ) |
Replaces the queue with the uri and resumes playback.
| partition_state | pointer to partition state |
| stickerdb | pointer to stickerdb |
| uri | uri to add to the queue |
| error | pointer to an already allocated sds string for the error message |
| bool mympd_api_queue_replace_uri_tags | ( | struct t_partition_state * | partition_state, |
| sds | uri, | ||
| struct t_list * | tags, | ||
| sds * | error | ||
| ) |
Replaces the queue with the uri and sets tag values for it.
| partition_state | pointer to partition state |
| uri | uri to add to the queue |
| tags | list of tags with values to set |
| error | pointer to an already allocated sds string for the error message |
| bool mympd_api_queue_rm_song_ids | ( | struct t_partition_state * | partition_state, |
| struct t_list * | song_ids, | ||
| sds * | error | ||
| ) |
Removes songs defined by id from the queue
| partition_state | pointer to partition state |
| song_ids | list of song_ids to remove |
| error | pointer to an already allocated sds string for the error message |
| bool mympd_api_queue_save | ( | struct t_partition_state * | partition_state, |
| sds | name, | ||
| sds | mode, | ||
| sds * | error | ||
| ) |
Public functions Saves the queue as a playlist
| partition_state | |
| name | pointer to partition state |
| mode | mpd queue save mode |
| error | pointer to an already allocated sds string for the error message |
| sds mympd_api_queue_search | ( | struct t_mympd_state * | mympd_state, |
| struct t_partition_state * | partition_state, | ||
| sds | buffer, | ||
| unsigned | request_id, | ||
| sds | expression, | ||
| sds | sort, | ||
| bool | sortdesc, | ||
| unsigned | offset, | ||
| unsigned | limit, | ||
| const struct t_fields * | tagcols | ||
| ) |
Searches the queue
| mympd_state | pointer to mympd_state |
| partition_state | pointer to partition state |
| buffer | already allocated sds string to append the response |
| request_id | jsonrpc id |
| expression | mpd filter expression |
| sort | tag to sort - only relevant for feat_advqueue |
| sortdesc | false = ascending, true = descending sort - only relevant for feat_advqueue |
| offset | offset for the list - only relevant for feat_advqueue |
| limit | maximum entries to print - only relevant for feat_advqueue |
| tagcols | columns to print |
| sds print_queue_entry | ( | struct t_mympd_state * | mympd_state, |
| struct t_partition_state * | partition_state, | ||
| sds | buffer, | ||
| const struct t_fields * | tagcols, | ||
| bool | print_stickers, | ||
| struct mpd_song * | song | ||
| ) |
Prints a queue entry as an json object string
| mympd_state | pointer to mympd_state |
| partition_state | pointer to partition state |
| buffer | already allocated sds string to append the response |
| tagcols | columns to print |
| print_stickers | Print stickers? |
| song | pointer to mpd song struct |