myMPD
Internal API documentation
Loading...
Searching...
No Matches
playlists.h File Reference

Playlist helper functions. More...

Include dependency graph for playlists.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Enumerations

enum  playlist_types { PLTYPE_ALL = 0 , PLTYPE_STATIC = 1 , PLTYPE_SMART = 2 , PLTYPE_SMARTPLS_ONLY = 3 }
 
enum  playlist_sort_types { PLSORT_UNKNOWN = -1 , PLSORT_NAME , PLSORT_LAST_MODIFIED }
 

Functions

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)
 
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_client_playlist_get (struct t_partition_state *partition_state, const char *plist, bool reverse, struct t_list *l, sds *error)
 
bool mympd_client_playlist_shuffle (struct t_partition_state *partition_state, const char *uri, sds *error)
 
bool mympd_client_playlist_sort (struct t_partition_state *partition_state, const char *uri, 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)
 
int mympd_client_playlist_validate (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)
 
int64_t mympd_client_playlist_dedup (struct t_partition_state *partition_state, const char *playlist, bool remove, sds *error)
 
int64_t mympd_client_playlist_dedup_all (struct t_partition_state *partition_state, bool remove, sds *error)
 
enum playlist_sort_types playlist_parse_sort (const char *str)
 
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)
 

Detailed Description

Playlist helper functions.

Enumeration Type Documentation

◆ playlist_sort_types

Playlist sort types

◆ playlist_types

Playlist types

Function Documentation

◆ mympd_client_enum_playlist()

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

Parameters
partition_statepointer to partition specific states
plistplaylist to enumerate
countpointer to unsigned for entity count
durationpointer to unsigned for total playtime
errorpointer to an already allocated sds string for the error message
Returns
number of songs or -1 on error

◆ mympd_client_get_all_playlists()

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.

Parameters
partition_statepointer to partition state
lpointer to list to populate
smartplstrue = integrate smart playlists, false = ignore smart playlists
errorpointer to an already allocated sds string for the error message
Returns
true on success, else false

◆ mympd_client_get_playlist_mtime()

time_t mympd_client_get_playlist_mtime ( struct t_partition_state partition_state,
const char *  playlist 
)

Returns the playlists last modification time

Parameters
partition_statepointer to partition specific states
playlistname of the playlist to check
Returns
last modification time

◆ mympd_client_playlist_clear()

bool mympd_client_playlist_clear ( struct t_partition_state partition_state,
const char *  plist,
sds *  error 
)

Clears a playlist

Parameters
partition_statepointer to partition specific states
plistplaylist name
errorpointer to an already allocated sds string for the error message
Returns
true on success, else false

◆ mympd_client_playlist_crop()

bool mympd_client_playlist_crop ( struct t_partition_state partition_state,
const char *  plist,
unsigned  num_entries 
)

Crops a playlist

Parameters
partition_statePointer to partition specific states
plistPlaylist name
num_entriesMay number of songs
Returns
true on success, else false

◆ mympd_client_playlist_dedup()

int64_t mympd_client_playlist_dedup ( struct t_partition_state partition_state,
const char *  playlist,
bool  remove,
sds *  error 
)

Deduplicates the playlist content

Parameters
partition_statepointer to partition state
playlistplaylist to check
removetrue = remove duplicate songs, else count duplicate songs
errorpointer to an already allocated sds string for the error message
Returns
-1 on error, else number of duplicate songs

◆ mympd_client_playlist_dedup_all()

int64_t mympd_client_playlist_dedup_all ( struct t_partition_state partition_state,
bool  remove,
sds *  error 
)

Deduplicates all static playlists

Parameters
partition_statepointer to partition state
removetrue = remove duplicate songs, else count duplicate songs
errorpointer to an already allocated sds string for the error message
Returns
-1 on error, else number of removed songs

◆ mympd_client_playlist_get()

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+

Parameters
partition_statePointer to partition specific states
plistPlaylist name
reverseList in reverse order?
lAlready allocated list
errorPointer to an already allocated sds string for the error message
Returns
true on success, else false

◆ mympd_client_playlist_shuffle()

bool mympd_client_playlist_shuffle ( struct t_partition_state partition_state,
const char *  playlist,
sds *  error 
)

Shuffles a playlist

Parameters
partition_statepointer to partition specific states
playlistplaylist to shuffle
errorpointer to an already allocated sds string for the error message
Returns
true on success else false

◆ mympd_client_playlist_sort()

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

Parameters
partition_statepointer to partition specific states
playlistplaylist to shuffle
tagstrmpd tag to sort by
sortdescsort descending?
errorpointer to an already allocated sds string for the error message
Returns
true on success else false

◆ mympd_client_playlist_validate()

int mympd_client_playlist_validate ( struct t_partition_state partition_state,
const char *  playlist,
bool  remove,
sds *  error 
)

Validates the playlist entries

Parameters
partition_statepointer to partition state
playlistplaylist to check
removetrue = remove invalid songs, else count invalid songs
errorpointer to an already allocated sds string for the error message
Returns
-1 on error, else number of removed songs

◆ mympd_client_playlist_validate_all()

int mympd_client_playlist_validate_all ( struct t_partition_state partition_state,
bool  remove,
sds *  error 
)

Validates all entries from all static playlists

Parameters
partition_statepointer to partition state
removetrue = remove invalid songs, else count invalid songs
errorpointer to an already allocated sds string for the error message
Returns
-1 on error, else number of removed songs

◆ mympd_send_list_playlist_range()

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.

Parameters
partition_statePointer to partition specific states
plistPlaylist name
startStart position (including)
endEnd position (excluding)
Returns
true on success, else false

◆ mympd_send_list_playlist_range_meta()

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.

Parameters
partition_statePointer to partition specific states
plistPlaylist name
startStart position (including)
endEnd position (excluding)
Returns
true on success, else false

◆ playlist_parse_sort()

enum playlist_sort_types playlist_parse_sort ( const char *  str)

Parses the provided string to the playlist_sort_type

Parameters
strString to parse
Returns
enum playlist_sort_types or PLSORT_UNKNOWN on error