|
myMPD
Internal API documentation
|
Functions to select random songs or albums. More...
#include "compile_time.h"#include "src/mympd_client/random_select.h"#include "src/lib/convert.h"#include "src/lib/log.h"#include "src/lib/random.h"#include "src/lib/sds_extras.h"#include "src/lib/search.h"#include "src/mympd_client/errorhandler.h"#include "src/mympd_client/playlists.h"#include "src/mympd_client/stickerdb.h"#include "src/mympd_client/tags.h"#include <string.h>
Enumerations | |
| enum | random_add_uniq_result { RANDOM_ADD_UNIQ_IN_QUEUE = -2 , RANDOM_ADD_UNIQ_IS_UNIQ = -1 } |
Functions | |
| static bool | check_min_duration (const struct mpd_song *song, unsigned min_duration) |
| static bool | check_max_duration (const struct mpd_song *song, unsigned max_duration) |
| static bool | check_expression_song (const struct mpd_song *song, struct t_mympd_mpd_tags *tags, struct t_list *include_expr_list, struct t_list *exclude_expr_list) |
| static bool | check_expression_album (const struct t_album *album, struct t_mympd_mpd_tags *tags, struct t_list *include_expr_list, struct t_list *exclude_expr_list) |
| static bool | check_not_hated (rax *stickers_like, const char *uri, bool ignore_hated) |
| static bool | check_last_played_album (rax *stickers_last_played, const char *uri, time_t since, enum album_modes album_mode) |
| static bool | check_last_played (rax *stickers_last_played, const char *uri, time_t since) |
| static long | check_uniq_tag (const char *uri, const char *value, struct t_list *queue_list, struct t_list *add_list) |
| static bool | add_uri_constraint_or_expression (const char *include_expression, struct t_partition_state *partition_state) |
| unsigned | random_select_albums (struct t_partition_state *partition_state, struct t_stickerdb_state *stickerdb, struct t_cache *album_cache, unsigned add_albums, struct t_list *queue_list, struct t_list *add_list, struct t_random_add_constraints *constraints) |
| unsigned | random_select_songs (struct t_partition_state *partition_state, struct t_stickerdb_state *stickerdb, unsigned add_songs, const char *playlist, struct t_list *queue_list, struct t_list *add_list, struct t_random_add_constraints *constraints) |
Functions to select random songs or albums.
Uniq constraints for random select
|
static |
Adds an expression if not empty, else adds an empty uri constraint to match all songs
| expression | include expression |
| partition_state | pointer to partition state |
|
static |
Checks if the album matches the expression lists
| album | album to apply the expressions |
| tags | tags to search |
| include_expr_list | include expression list |
| exclude_expr_list | exclude expression list |
|
static |
Checks if the song matches the expression lists
| song | song to apply the expressions |
| tags | tags to search |
| include_expr_list | include expression list |
| exclude_expr_list | exclude expression list |
|
static |
Checks if the songs last_played time is older then since
| stickers_last_played | last_played stickers |
| uri | uri to check against the stickers_last_played |
| since | timestamp to check against |
|
static |
Checks if the album last_played time is older then since
| stickers_last_played | last_played stickers |
| uri | uri to check against the stickers_last_played |
| since | timestamp to check against |
| album_mode | myMPD album mode |
|
static |
Checks for maximum duration constraint for songs
| song | mpd song struct to check |
| max_duration | the maximum duration, 0 for no limit |
|
static |
Private functions Checks for minimum duration constraint for songs
| song | mpd song struct to check |
| min_duration | the minimum duration, 0 for no limit |
|
static |
Checks if the song is not hated and ignore_hated is set to true
| stickers_like | like stickers |
| uri | uri to check against the stickers_like |
| ignore_hated | ignore hated value |
|
static |
Checks for the uniq tag constraint for songs
| uri | song uri or albumid |
| value | tag value to check |
| queue_list | list of current songs in mpd queue and last played |
| add_list | list to add the entries |
| unsigned random_select_albums | ( | struct t_partition_state * | partition_state, |
| struct t_stickerdb_state * | stickerdb, | ||
| struct t_cache * | album_cache, | ||
| unsigned | add_albums, | ||
| struct t_list * | queue_list, | ||
| struct t_list * | add_list, | ||
| struct t_random_add_constraints * | constraints | ||
| ) |
Adds albums to the add_list
| partition_state | pointer to myMPD partition state |
| stickerdb | pointer to stickerdb state |
| album_cache | pointer to album cache |
| add_albums | number of albums expected in add_list |
| queue_list | list of current songs in mpd queue and last played |
| add_list | list to add the albums |
| constraints | constraints for album selection |
| unsigned random_select_songs | ( | struct t_partition_state * | partition_state, |
| struct t_stickerdb_state * | stickerdb, | ||
| unsigned | add_songs, | ||
| const char * | playlist, | ||
| struct t_list * | queue_list, | ||
| struct t_list * | add_list, | ||
| struct t_random_add_constraints * | constraints | ||
| ) |
Adds songs to the add_list
| partition_state | pointer to myMPD partition state |
| stickerdb | pointer to stickerdb state |
| add_songs | number of songs expected in add_list |
| playlist | playlist from which songs are added |
| queue_list | list of current songs in mpd queue and last played |
| add_list | list to add the songs |
| constraints | constraints for song selection |