|
myMPD
Internal API documentation
|
Playlist helper functions. More...
#include "compile_time.h"#include "src/mympd_client/playlists.h"#include "dist/rax/rax.h"#include "src/lib/convert.h"#include "src/lib/fields.h"#include "src/lib/log.h"#include "src/lib/random.h"#include "src/lib/rax_extras.h"#include "src/lib/sds_extras.h"#include "src/lib/smartpls.h"#include "src/lib/utility.h"#include "src/mympd_client/errorhandler.h"#include "src/mympd_client/shortcuts.h"#include "src/mympd_client/tags.h"#include <stdbool.h>#include <string.h>
Functions | |
| static bool | playlist_sort (struct t_partition_state *partition_state, const char *playlist, const char *tagstr, bool sortdesc, sds *error) |
| static bool | replace_playlist (struct t_partition_state *partition_state, const char *new_pl, const char *to_replace_pl, sds *error) |
| static bool | mympd_worker_playlist_content_enumerate_mpd (struct t_partition_state *partition_state, const char *plist, unsigned *count, unsigned *duration, sds *error) |
| static bool | mympd_worker_playlist_content_enumerate_manual (struct t_partition_state *partition_state, const char *plist, unsigned *count, unsigned *duration, sds *error) |
| static bool | song_exists (struct t_partition_state *partition_state, const char *uri) |
| bool | mympd_client_get_all_playlists (struct t_partition_state *partition_state, struct t_list *l, bool smartpls, sds *error) |
| time_t | mympd_client_get_playlist_mtime (struct t_partition_state *partition_state, const char *playlist) |
| int64_t | mympd_client_playlist_dedup_all (struct t_partition_state *partition_state, bool remove, sds *error) |
| int64_t | mympd_client_playlist_dedup (struct t_partition_state *partition_state, const char *playlist, bool remove, sds *error) |
| int | mympd_client_playlist_validate_all (struct t_partition_state *partition_state, bool remove, sds *error) |
| int | mympd_client_playlist_validate (struct t_partition_state *partition_state, const char *playlist, bool remove, sds *error) |
| bool | mympd_client_playlist_shuffle (struct t_partition_state *partition_state, const char *playlist, sds *error) |
| bool | mympd_client_playlist_sort (struct t_partition_state *partition_state, const char *playlist, const char *tagstr, bool sortdesc, sds *error) |
| bool | mympd_client_enum_playlist (struct t_partition_state *partition_state, const char *plist, unsigned *count, unsigned *duration, sds *error) |
| bool | mympd_client_playlist_crop (struct t_partition_state *partition_state, const char *plist, unsigned num_entries) |
| bool | mympd_client_playlist_clear (struct t_partition_state *partition_state, const char *plist, sds *error) |
| bool | mympd_send_list_playlist_range (struct t_partition_state *partition_state, const char *plist, unsigned start, unsigned end) |
| bool | mympd_send_list_playlist_range_meta (struct t_partition_state *partition_state, const char *plist, unsigned start, unsigned end) |
| bool | mympd_client_playlist_get (struct t_partition_state *partition_state, const char *plist, bool reverse, struct t_list *l, sds *error) |
| enum playlist_sort_types | playlist_parse_sort (const char *str) |
Playlist helper functions.
| bool mympd_client_enum_playlist | ( | struct t_partition_state * | partition_state, |
| const char * | plist, | ||
| unsigned * | count, | ||
| unsigned * | duration, | ||
| sds * | error | ||
| ) |
Counts the number of songs in the playlist
| partition_state | pointer to partition specific states |
| plist | playlist to enumerate |
| count | pointer to unsigned for entity count |
| duration | pointer to unsigned for total playtime |
| error | pointer to an already allocated sds string for the error message |
| bool mympd_client_get_all_playlists | ( | struct t_partition_state * | partition_state, |
| struct t_list * | l, | ||
| bool | smartpls, | ||
| sds * | error | ||
| ) |
Public functions Gets all playlists.
| partition_state | pointer to partition state |
| l | pointer to list to populate |
| smartpls | true = integrate smart playlists, false = ignore smart playlists |
| error | pointer to an already allocated sds string for the error message |
| time_t mympd_client_get_playlist_mtime | ( | struct t_partition_state * | partition_state, |
| const char * | playlist | ||
| ) |
Returns the playlists last modification time
| partition_state | pointer to partition specific states |
| playlist | name of the playlist to check |
| bool mympd_client_playlist_clear | ( | struct t_partition_state * | partition_state, |
| const char * | plist, | ||
| sds * | error | ||
| ) |
Clears a playlist
| partition_state | pointer to partition specific states |
| plist | playlist name |
| error | pointer to an already allocated sds string for the error message |
| bool mympd_client_playlist_crop | ( | struct t_partition_state * | partition_state, |
| const char * | plist, | ||
| unsigned | num_entries | ||
| ) |
Crops a playlist
| partition_state | Pointer to partition specific states |
| plist | Playlist name |
| num_entries | May number of songs |
| int64_t mympd_client_playlist_dedup | ( | struct t_partition_state * | partition_state, |
| const char * | playlist, | ||
| bool | remove, | ||
| sds * | error | ||
| ) |
Deduplicates the playlist content
| partition_state | pointer to partition state |
| playlist | playlist to check |
| remove | true = remove duplicate songs, else count duplicate songs |
| error | pointer to an already allocated sds string for the error message |
| int64_t mympd_client_playlist_dedup_all | ( | struct t_partition_state * | partition_state, |
| bool | remove, | ||
| sds * | error | ||
| ) |
Deduplicates all static playlists
| partition_state | pointer to partition state |
| remove | true = remove duplicate songs, else count duplicate songs |
| error | pointer to an already allocated sds string for the error message |
| bool mympd_client_playlist_get | ( | struct t_partition_state * | partition_state, |
| const char * | plist, | ||
| bool | reverse, | ||
| struct t_list * | l, | ||
| sds * | error | ||
| ) |
Gets the contents of a playlist. Uses the range feature for MPD 0.24+
| partition_state | Pointer to partition specific states |
| plist | Playlist name |
| reverse | List in reverse order? |
| l | Already allocated list |
| error | Pointer to an already allocated sds string for the error message |
| bool mympd_client_playlist_shuffle | ( | struct t_partition_state * | partition_state, |
| const char * | playlist, | ||
| sds * | error | ||
| ) |
Shuffles a playlist
| partition_state | pointer to partition specific states |
| playlist | playlist to shuffle |
| error | pointer to an already allocated sds string for the error message |
| bool mympd_client_playlist_sort | ( | struct t_partition_state * | partition_state, |
| const char * | playlist, | ||
| const char * | tagstr, | ||
| bool | sortdesc, | ||
| sds * | error | ||
| ) |
Sorts a playlist. Wrapper for playlist_sort that enables the mympd tags afterwards
| partition_state | pointer to partition specific states |
| playlist | playlist to shuffle |
| tagstr | mpd tag to sort by |
| sortdesc | sort descending? |
| error | pointer to an already allocated sds string for the error message |
| int mympd_client_playlist_validate | ( | struct t_partition_state * | partition_state, |
| const char * | playlist, | ||
| bool | remove, | ||
| sds * | error | ||
| ) |
Validates the playlist entries
| partition_state | pointer to partition state |
| playlist | playlist to check |
| remove | true = remove invalid songs, else count invalid songs |
| error | pointer to an already allocated sds string for the error message |
| int mympd_client_playlist_validate_all | ( | struct t_partition_state * | partition_state, |
| bool | remove, | ||
| sds * | error | ||
| ) |
Validates all entries from all static playlists
| partition_state | pointer to partition state |
| remove | true = remove invalid songs, else count invalid songs |
| error | pointer to an already allocated sds string for the error message |
| bool mympd_send_list_playlist_range | ( | struct t_partition_state * | partition_state, |
| const char * | plist, | ||
| unsigned | start, | ||
| unsigned | end | ||
| ) |
Wrapper for mpd_send_list_playlist_range that falls back to mpd_send_list_playlist if not supported by MPD.
| partition_state | Pointer to partition specific states |
| plist | Playlist name |
| start | Start position (including) |
| end | End position (excluding) |
| bool mympd_send_list_playlist_range_meta | ( | struct t_partition_state * | partition_state, |
| const char * | plist, | ||
| unsigned | start, | ||
| unsigned | end | ||
| ) |
Wrapper for mpd_send_list_playlist_range_meta that falls back to mpd_send_list_playlist_meta if not supported by MPD.
| partition_state | Pointer to partition specific states |
| plist | Playlist name |
| start | Start position (including) |
| end | End position (excluding) |
|
static |
Enumerates the playlist and returns the count and total length. For MPD versions < 0.24. This functions retrieves the complete playlist.
| partition_state | pointer to partition state |
| plist | playlist name to enumerate |
| count | pointer to unsigned for entity count |
| duration | pointer to unsigned for total playtime |
| error | pointer to an already allocated sds string for the error message |
|
static |
Enumerates the playlist and returns the count and total length This functions uses the playlistlength command of MPD 0.24
| partition_state | pointer to partition state |
| plist | playlist name to enumerate |
| count | pointer to unsigned for entity count |
| duration | pointer to unsigned for total playtime |
| error | pointer to an already allocated sds string for the error message |
| enum playlist_sort_types playlist_parse_sort | ( | const char * | str | ) |
Parses the provided string to the playlist_sort_type
| str | String to parse |
|
static |
Private definitions
Private functions Sorts a playlist.
| partition_state | pointer to partition specific states |
| playlist | playlist to shuffle |
| tagstr | mpd tag to sort by |
| sortdesc | sort descending? |
| error | pointer to an already allocated sds string for the error message |
|
static |
Safely replaces a playlist with a new one
| partition_state | pointer to partition specific states |
| new_pl | name of the new playlist to bring in place |
| to_replace_pl | name of the playlist to replace |
| error | pointer to an already allocated sds string for the error message |
|
static |
Checks for a song in the database
| partition_state | Pointer to partition state |
| uri | Song uri to check |