|
myMPD
Internal API documentation
|
myMPD playlists API More...
#include "compile_time.h"#include "src/mympd_api/playlists.h"#include "dist/utf8/utf8.h"#include "src/lib/api.h"#include "src/lib/cache/cache_rax_album.h"#include "src/lib/filehandler.h"#include "src/lib/json/json_print.h"#include "src/lib/json/json_rpc.h"#include "src/lib/list.h"#include "src/lib/log.h"#include "src/lib/mem.h"#include "src/lib/rax_extras.h"#include "src/lib/sds_extras.h"#include "src/lib/search.h"#include "src/lib/smartpls.h"#include "src/lib/utility.h"#include "src/mympd_api/sticker.h"#include "src/mympd_client/errorhandler.h"#include "src/mympd_client/playlists.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 <dirent.h>#include <errno.h>#include <limits.h>#include <string.h>#include <unistd.h>
Data Structures | |
| struct | t_pl_data |
Functions | |
| static void | free_t_pl_data (void *data) |
| bool | mympd_api_playlist_content_move_to_playlist (struct t_partition_state *partition_state, sds src_plist, sds dst_plist, struct t_list *positions, unsigned mode, sds *error) |
| bool | mympd_api_playlist_copy (struct t_partition_state *partition_state, struct t_list *src_plists, sds dst_plist, enum plist_copy_modes mode, sds *error) |
| bool | mympd_api_playlist_content_insert (struct t_partition_state *partition_state, sds plist, struct t_list *uris, unsigned to, sds *error) |
| bool | mympd_api_playlist_content_append (struct t_partition_state *partition_state, sds plist, struct t_list *uris, sds *error) |
| bool | mympd_api_playlist_content_replace (struct t_partition_state *partition_state, sds plist, struct t_list *uris, sds *error) |
| bool | mympd_api_playlist_content_insert_search (struct t_partition_state *partition_state, sds expression, sds plist, unsigned to, const char *sort, bool sort_desc, sds *error) |
| bool | mympd_api_playlist_content_append_search (struct t_partition_state *partition_state, sds expression, sds plist, const char *sort, bool sort_desc, sds *error) |
| bool | mympd_api_playlist_content_replace_search (struct t_partition_state *partition_state, sds expression, sds plist, const char *sort, bool sort_desc, sds *error) |
| bool | mympd_api_playlist_content_insert_albums (struct t_partition_state *partition_state, struct t_cache *album_cache, sds plist, struct t_list *albumids, unsigned to, sds *error) |
| bool | mympd_api_playlist_content_append_albums (struct t_partition_state *partition_state, struct t_cache *album_cache, sds plist, struct t_list *albumids, sds *error) |
| bool | mympd_api_playlist_content_replace_albums (struct t_partition_state *partition_state, struct t_cache *album_cache, sds plist, struct t_list *albumids, sds *error) |
| bool | mympd_api_playlist_content_insert_album_tag (struct t_partition_state *partition_state, struct t_cache *album_cache, sds plist, sds albumid, enum mpd_tag_type tag, sds value, unsigned to, sds *error) |
| bool | mympd_api_playlist_content_append_album_tag (struct t_partition_state *partition_state, struct t_cache *album_cache, sds plist, sds albumid, enum mpd_tag_type tag, sds value, sds *error) |
| bool | mympd_api_playlist_content_replace_album_tag (struct t_partition_state *partition_state, struct t_cache *album_cache, sds plist, sds albumid, enum mpd_tag_type tag, sds value, sds *error) |
| bool | mympd_api_playlist_content_move (struct t_partition_state *partition_state, sds plist, unsigned from, unsigned to, sds *error) |
| bool | mympd_api_playlist_content_rm_range (struct t_partition_state *partition_state, sds plist, unsigned start, int end, sds *error) |
| bool | mympd_api_playlist_content_rm_positions (struct t_partition_state *partition_state, sds plist, struct t_list *positions, sds *error) |
| sds | mympd_api_playlist_list (struct t_partition_state *partition_state, struct t_stickerdb_state *stickerdb, sds buffer, unsigned request_id, unsigned offset, unsigned limit, sds searchstr, enum playlist_types type, enum playlist_sort_types sort, bool sortdesc, const struct t_fields *tagcols) |
| static sds | print_plist_entry (sds buffer, struct mpd_song *song, unsigned pos, bool stickers, struct t_partition_state *partition_state, struct t_stickerdb_state *stickerdb, const struct t_fields *tagcols, time_t *last_played_max, sds *last_played_song_uri, unsigned *last_played_pos, sds *last_played_song_title) |
| sds | mympd_api_playlist_content_search (struct t_partition_state *partition_state, struct t_stickerdb_state *stickerdb, sds buffer, unsigned request_id, sds plist, unsigned offset, unsigned limit, sds expression, const struct t_fields *tagcols) |
| sds | mympd_api_playlist_rename (struct t_partition_state *partition_state, sds buffer, unsigned request_id, const char *old_playlist, const char *new_playlist) |
| bool | mympd_api_playlist_delete (struct t_partition_state *partition_state, struct t_list *playlists, sds *error) |
| enum plist_delete_criterias | parse_plist_delete_criteria (const char *str) |
| sds | mympd_api_playlist_delete_all (struct t_partition_state *partition_state, sds buffer, unsigned request_id, enum plist_delete_criterias criteria) |
myMPD playlists API
|
static |
Frees the t_pl_data struct used as callback for rax_free_data
| data | void pointer to a t_sticker_value struct |
| bool mympd_api_playlist_content_append | ( | struct t_partition_state * | partition_state, |
| sds | plist, | ||
| struct t_list * | uris, | ||
| sds * | error | ||
| ) |
Appends uris to the stored playlist
| partition_state | pointer to partition state |
| plist | stored playlist name |
| uris | list of positions to remove |
| error | pointer to an already allocated sds string for the error message |
| bool mympd_api_playlist_content_append_album_tag | ( | struct t_partition_state * | partition_state, |
| struct t_cache * | album_cache, | ||
| sds | plist, | ||
| sds | albumid, | ||
| enum mpd_tag_type | tag, | ||
| sds | value, | ||
| sds * | error | ||
| ) |
Appends songs of an album filted by tag to a playlist
| partition_state | pointer to partition state |
| album_cache | pointer to album cache |
| plist | stored playlist name |
| 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_playlist_content_append_albums | ( | struct t_partition_state * | partition_state, |
| struct t_cache * | album_cache, | ||
| sds | plist, | ||
| struct t_list * | albumids, | ||
| sds * | error | ||
| ) |
Appends albums to a playlist
| partition_state | pointer to partition state |
| album_cache | pointer to album cache |
| plist | stored playlist name |
| albumids | album ids to append |
| error | pointer to an already allocated sds string for the error message |
| bool mympd_api_playlist_content_append_search | ( | struct t_partition_state * | partition_state, |
| sds | expression, | ||
| sds | plist, | ||
| 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 |
| plist | stored playlist name |
| sort | sort by tag |
| sort_desc | sort descending? |
| error | pointer to an already allocated sds string for the error message |
| bool mympd_api_playlist_content_insert | ( | struct t_partition_state * | partition_state, |
| sds | plist, | ||
| struct t_list * | uris, | ||
| unsigned | to, | ||
| sds * | error | ||
| ) |
Inserts uris at defined position to the stored playlist
| partition_state | pointer to partition state |
| plist | stored playlist name |
| to | position to insert after |
| uris | list of positions to remove |
| error | pointer to an already allocated sds string for the error message |
| bool mympd_api_playlist_content_insert_album_tag | ( | struct t_partition_state * | partition_state, |
| struct t_cache * | album_cache, | ||
| sds | plist, | ||
| sds | albumid, | ||
| enum mpd_tag_type | tag, | ||
| sds | value, | ||
| unsigned | to, | ||
| sds * | error | ||
| ) |
Insert songs of an album filtered by tag into a playlist
| partition_state | pointer to partition state |
| album_cache | pointer to album cache |
| plist | stored playlist name |
| albumid | album id to insert |
| tag | MPD tag |
| value | MPD tag value |
| to | position to insert |
| error | pointer to an already allocated sds string for the error message |
| bool mympd_api_playlist_content_insert_albums | ( | struct t_partition_state * | partition_state, |
| struct t_cache * | album_cache, | ||
| sds | plist, | ||
| struct t_list * | albumids, | ||
| unsigned | to, | ||
| sds * | error | ||
| ) |
Insert albums into a playlist
| partition_state | pointer to partition state |
| album_cache | pointer to album cache |
| plist | stored playlist name |
| albumids | album ids to insert |
| to | position to insert |
| error | pointer to an already allocated sds string for the error message |
| bool mympd_api_playlist_content_insert_search | ( | struct t_partition_state * | partition_state, |
| sds | expression, | ||
| sds | plist, | ||
| unsigned | to, | ||
| const char * | sort, | ||
| bool | sort_desc, | ||
| sds * | error | ||
| ) |
Inserts search results into a playlist
| partition_state | pointer to partition state |
| expression | mpd search expression |
| plist | stored playlist name |
| to | position to insert |
| sort | sort by tag |
| sort_desc | sort descending? |
| error | pointer to an already allocated sds string for the error message |
| bool mympd_api_playlist_content_move | ( | struct t_partition_state * | partition_state, |
| sds | plist, | ||
| unsigned | from, | ||
| unsigned | to, | ||
| sds * | error | ||
| ) |
Moves a song inside a playlist
| partition_state | pointer to partition state |
| plist | stored playlist name |
| from | from position |
| to | to position |
| error | pointer to an already allocated sds string for the error message |
| bool mympd_api_playlist_content_move_to_playlist | ( | struct t_partition_state * | partition_state, |
| sds | src_plist, | ||
| sds | dst_plist, | ||
| struct t_list * | positions, | ||
| unsigned | mode, | ||
| sds * | error | ||
| ) |
Moves entries from one playlist to another.
| partition_state | pointer to partition state |
| src_plist | source playlist |
| dst_plist | destination playlist |
| positions | source playlist positions to move |
| mode | 0=append, 1=insert to destination playlist |
| error | pointer to an already allocated sds string for the error message |
| bool mympd_api_playlist_content_replace | ( | struct t_partition_state * | partition_state, |
| sds | plist, | ||
| struct t_list * | uris, | ||
| sds * | error | ||
| ) |
Replaces the stored playlist with uris
| partition_state | pointer to partition state |
| plist | stored playlist name |
| uris | list of positions to remove |
| error | pointer to an already allocated sds string for the error message |
| bool mympd_api_playlist_content_replace_album_tag | ( | struct t_partition_state * | partition_state, |
| struct t_cache * | album_cache, | ||
| sds | plist, | ||
| sds | albumid, | ||
| enum mpd_tag_type | tag, | ||
| sds | value, | ||
| sds * | error | ||
| ) |
Replaces the playlist with songs of an album filtered by tag
| partition_state | pointer to partition state |
| album_cache | pointer to album cache |
| plist | stored playlist name |
| 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_playlist_content_replace_albums | ( | struct t_partition_state * | partition_state, |
| struct t_cache * | album_cache, | ||
| sds | plist, | ||
| struct t_list * | albumids, | ||
| sds * | error | ||
| ) |
Replaces the playlist with albums
| partition_state | pointer to partition state |
| album_cache | pointer to album cache |
| plist | stored playlist name |
| albumids | album ids to insert |
| error | pointer to an already allocated sds string for the error message |
| bool mympd_api_playlist_content_replace_search | ( | struct t_partition_state * | partition_state, |
| sds | expression, | ||
| sds | plist, | ||
| 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 |
| plist | stored playlist name |
| sort | sort by tag |
| sort_desc | sort descending? |
| error | pointer to an already allocated sds string for the error message |
| bool mympd_api_playlist_content_rm_positions | ( | struct t_partition_state * | partition_state, |
| sds | plist, | ||
| struct t_list * | positions, | ||
| sds * | error | ||
| ) |
Removes entries defined by positions from the stored playlist
| partition_state | pointer to partition state |
| plist | stored playlist name |
| positions | list of positions to remove |
| error | pointer to an already allocated sds string for the error message |
| bool mympd_api_playlist_content_rm_range | ( | struct t_partition_state * | partition_state, |
| sds | plist, | ||
| unsigned | start, | ||
| int | end, | ||
| sds * | error | ||
| ) |
Removes a range of songs in a playlist
| partition_state | pointer to partition state |
| plist | stored playlist name |
| start | start position (including) |
| end | end position (excluded), -1 for open ended range |
| error | pointer to an already allocated sds string for the error message |
| sds mympd_api_playlist_content_search | ( | struct t_partition_state * | partition_state, |
| struct t_stickerdb_state * | stickerdb, | ||
| sds | buffer, | ||
| unsigned | request_id, | ||
| sds | plist, | ||
| unsigned | offset, | ||
| unsigned | limit, | ||
| sds | expression, | ||
| const struct t_fields * | tagcols | ||
| ) |
Lists the content of a mpd playlist
| partition_state | pointer to partition state |
| stickerdb | pointer to stickerdb state |
| buffer | already allocated sds string to append the response |
| request_id | jsonrpc request id |
| plist | playlist name to list contents |
| offset | list offset |
| limit | maximum number of entries to print |
| expression | mpd search expression |
| tagcols | columns to print |
| bool mympd_api_playlist_copy | ( | struct t_partition_state * | partition_state, |
| struct t_list * | src_plists, | ||
| sds | dst_plist, | ||
| enum plist_copy_modes | mode, | ||
| sds * | error | ||
| ) |
Copies or moves source playlists to a destination playlist.
| partition_state | pointer to partition state |
| src_plists | playlists to copy |
| dst_plist | destination playlist |
| mode | copy mode enum |
| error | pointer to an already allocated sds string for the error message |
| bool mympd_api_playlist_delete | ( | struct t_partition_state * | partition_state, |
| struct t_list * | playlists, | ||
| sds * | error | ||
| ) |
Deletes the mpd playlists and the myMPD smart playlists
| partition_state | pointer to partition state |
| playlists | playlist to delete |
| error | pointer to an already allocated sds string for the error message |
| sds mympd_api_playlist_delete_all | ( | struct t_partition_state * | partition_state, |
| sds | buffer, | ||
| unsigned | request_id, | ||
| enum plist_delete_criterias | criteria | ||
| ) |
Deletes the mpd playlists and the myMPD smart playlist
| partition_state | pointer to partition state |
| buffer | already allocated sds string to append the response |
| request_id | jsonrpc request id |
| criteria | deletion criteria |
| sds mympd_api_playlist_list | ( | struct t_partition_state * | partition_state, |
| struct t_stickerdb_state * | stickerdb, | ||
| sds | buffer, | ||
| unsigned | request_id, | ||
| unsigned | offset, | ||
| unsigned | limit, | ||
| sds | searchstr, | ||
| enum playlist_types | type, | ||
| enum playlist_sort_types | sort, | ||
| bool | sortdesc, | ||
| const struct t_fields * | tagcols | ||
| ) |
Lists mpd playlists and myMPD smart playlists
| partition_state | pointer to partition state |
| stickerdb | pointer to stickerdb state |
| buffer | already allocated sds string to append the response |
| request_id | jsonrpc request id |
| offset | list offset |
| limit | maximum number of entries to print |
| searchstr | string to search in the playlist name |
| type | playlist type to list |
| sort | Sort playlists by name or Last-Modified |
| sortdesc | Sort descending? |
| tagcols | columns to print |
| sds mympd_api_playlist_rename | ( | struct t_partition_state * | partition_state, |
| sds | buffer, | ||
| unsigned | request_id, | ||
| const char * | old_playlist, | ||
| const char * | new_playlist | ||
| ) |
Rename the mpd playlists and the corresponding myMPD smart playlist
| partition_state | pointer to partition state |
| buffer | already allocated sds string to append the response |
| request_id | jsonrpc request id |
| old_playlist | old playlist name |
| new_playlist | new playlist name |
| enum plist_delete_criterias parse_plist_delete_criteria | ( | const char * | str | ) |
Parses the playlist delete criteria from string to enum
| str | string to parse |
|
static |
Appends a playlist entry to buffer
| buffer | already allocated sds string to append the response |
| song | mpd song to print |
| pos | position in playlist |
| stickers | print stickers? |
| partition_state | pointer to partition state |
| stickerdb | pointer to stickerdb state |
| tagcols | columns to print |
| last_played_max | played time from last played song |
| last_played_song_uri | last played song uri |
| last_played_pos | last played position in playlist |
| last_played_song_title | last played song title tag |