|
myMPD
Internal API documentation
|
MPD sticker functions. More...
#include "src/lib/mympd_state.h"

Go to the source code of this file.
Functions | |
| bool | stickerdb_connect (struct t_stickerdb_state *stickerdb) |
| void | stickerdb_disconnect (struct t_stickerdb_state *stickerdb) |
| bool | stickerdb_idle (struct t_stickerdb_state *stickerdb) |
| bool | stickerdb_enter_idle (struct t_stickerdb_state *stickerdb) |
| bool | stickerdb_exit_idle (struct t_stickerdb_state *stickerdb) |
| bool | stickerdb_check_error_and_recover (struct t_stickerdb_state *stickerdb, const char *command) |
| sds | stickerdb_get (struct t_stickerdb_state *stickerdb, enum mympd_sticker_type type, const char *uri, const char *name) |
| int64_t | stickerdb_get_int64 (struct t_stickerdb_state *stickerdb, enum mympd_sticker_type type, const char *uri, const char *name) |
| struct t_sticker * | stickerdb_get_all (struct t_stickerdb_state *stickerdb, enum mympd_sticker_type type, const char *uri, struct t_sticker *sticker, bool user_defined) |
| sds | stickerdb_get_batch (struct t_stickerdb_state *stickerdb, enum mympd_sticker_type type, const char *uri, const char *name) |
| int64_t | stickerdb_get_int64_batch (struct t_stickerdb_state *stickerdb, enum mympd_sticker_type type, const char *uri, const char *name) |
| struct t_sticker * | stickerdb_get_all_batch (struct t_stickerdb_state *stickerdb, enum mympd_sticker_type type, const char *uri, struct t_sticker *sticker, bool user_defined) |
| rax * | stickerdb_find_stickers_by_name (struct t_stickerdb_state *stickerdb, enum mympd_sticker_type type, const char *name) |
| rax * | stickerdb_find_stickers_by_name_value (struct t_stickerdb_state *stickerdb, enum mympd_sticker_type type, const char *name, enum mpd_sticker_operator op, const char *value) |
| void | stickerdb_free_find_result (rax *stickers) |
| struct t_list * | stickerdb_find_stickers_sorted (struct t_stickerdb_state *stickerdb, enum mympd_sticker_type type, const char *baseuri, const char *name, enum mpd_sticker_operator op, const char *value, enum mpd_sticker_sort sort, bool sort_desc, unsigned start, unsigned end) |
| bool | stickerdb_set (struct t_stickerdb_state *stickerdb, enum mympd_sticker_type type, const char *uri, const char *name, const char *value) |
| bool | stickerdb_set_int64 (struct t_stickerdb_state *stickerdb, enum mympd_sticker_type type, const char *uri, const char *name, int64_t value) |
| bool | stickerdb_inc (struct t_stickerdb_state *stickerdb, enum mympd_sticker_type type, const char *uri, const char *name, unsigned value) |
| bool | stickerdb_dec (struct t_stickerdb_state *stickerdb, enum mympd_sticker_type type, const char *uri, const char *name, unsigned value) |
| bool | stickerdb_inc_set (struct t_stickerdb_state *stickerdb, enum mympd_sticker_type type, const char *uri, enum mympd_sticker_names name_inc, enum mympd_sticker_names name_timestamp, time_t timestamp) |
| bool | stickerdb_set_elapsed (struct t_stickerdb_state *stickerdb, enum mympd_sticker_type type, const char *uri, time_t elapsed) |
| bool | stickerdb_inc_play_count (struct t_stickerdb_state *stickerdb, enum mympd_sticker_type type, const char *uri, time_t timestamp) |
| bool | stickerdb_inc_skip_count (struct t_stickerdb_state *stickerdb, enum mympd_sticker_type type, const char *uri) |
| bool | stickerdb_set_like (struct t_stickerdb_state *stickerdb, enum mympd_sticker_type type, const char *uri, enum sticker_like value) |
| bool | stickerdb_set_rating (struct t_stickerdb_state *stickerdb, enum mympd_sticker_type type, const char *uri, int value) |
| bool | stickerdb_remove (struct t_stickerdb_state *stickerdb, enum mympd_sticker_type type, const char *uri, const char *name) |
| bool | stickerdb_get_names (struct t_stickerdb_state *stickerdb, enum mympd_sticker_type type, struct t_list *sticker_names) |
| bool | check_get_sticker (bool featSticker, const struct t_stickers *stickers) |
MPD sticker functions.
| bool check_get_sticker | ( | bool | featSticker, |
| const struct t_stickers * | stickers | ||
| ) |
Checks if stickers should be fetched
| featSticker | Flag indicating enabled sticker support |
| stickers | Pointer to t_stickers struct |
| bool stickerdb_check_error_and_recover | ( | struct t_stickerdb_state * | stickerdb, |
| const char * | command | ||
| ) |
Calls mpd_response_finish and checks for an mpd error and tries to recover.
| stickerdb | pointer to the stickerdb state |
| command | command to check for the error |
| bool stickerdb_connect | ( | struct t_stickerdb_state * | stickerdb | ) |
This function connects to mpd sticker instance on demand or exits the idle mode
| stickerdb | pointer to the stickerdb state |
| bool stickerdb_dec | ( | struct t_stickerdb_state * | stickerdb, |
| enum mympd_sticker_type | type, | ||
| const char * | uri, | ||
| const char * | name, | ||
| unsigned | value | ||
| ) |
Decrements a sticker
| stickerdb | pointer to the stickerdb state |
| type | MPD sticker type |
| uri | sticker uri |
| name | sticker name |
| value | value to decrement |
| void stickerdb_disconnect | ( | struct t_stickerdb_state * | stickerdb | ) |
Disconnects from MPD
| stickerdb | pointer to stickerdb state |
| bool stickerdb_enter_idle | ( | struct t_stickerdb_state * | stickerdb | ) |
Enters the idle mode
| stickerdb | pointer to the stickerdb state |
| bool stickerdb_exit_idle | ( | struct t_stickerdb_state * | stickerdb | ) |
Exits the idle mode, ignoring all idle events
| stickerdb | pointer to the stickerdb state |
| rax * stickerdb_find_stickers_by_name | ( | struct t_stickerdb_state * | stickerdb, |
| enum mympd_sticker_type | type, | ||
| const char * | name | ||
| ) |
Gets all stickers by name
| stickerdb | pointer to the stickerdb state |
| type | MPD sticker type |
| name | sticker name |
| rax * stickerdb_find_stickers_by_name_value | ( | struct t_stickerdb_state * | stickerdb, |
| enum mympd_sticker_type | type, | ||
| const char * | name, | ||
| enum mpd_sticker_operator | op, | ||
| const char * | value | ||
| ) |
Gets all stickers by name and value
| stickerdb | pointer to the stickerdb state |
| type | MPD sticker type |
| name | sticker name |
| op | compare operator: MPD_STICKER_OP_EQ, MPD_STICKER_OP_GT, MPD_STICKER_OP_LT |
| value | sticker value |
| struct t_list * stickerdb_find_stickers_sorted | ( | struct t_stickerdb_state * | stickerdb, |
| enum mympd_sticker_type | type, | ||
| const char * | baseuri, | ||
| const char * | name, | ||
| enum mpd_sticker_operator | op, | ||
| const char * | value, | ||
| enum mpd_sticker_sort | sort, | ||
| bool | sort_desc, | ||
| unsigned | start, | ||
| unsigned | end | ||
| ) |
Gets a sorted list of stickers by name and value
| stickerdb | pointer to the stickerdb state |
| type | MPD sticker type |
| baseuri | baseuri for search |
| name | sticker name |
| op | mpd sticker compare operator |
| value | sticker value or NULL to get all stickers with this name |
| sort | sticker sort type |
| sort_desc | sort descending? |
| start | window start (including) |
| end | window end (excluding), use UINT_MAX for open end |
| void stickerdb_free_find_result | ( | rax * | stickers | ) |
Frees the sticker find result
| stickers | pointer to stickers rax tree |
| sds stickerdb_get | ( | struct t_stickerdb_state * | stickerdb, |
| enum mympd_sticker_type | type, | ||
| const char * | uri, | ||
| const char * | name | ||
| ) |
Gets a sticker.
| stickerdb | pointer to the stickerdb state |
| type | MPD sticker type |
| uri | sticker uri |
| name | sticker name |
| struct t_sticker * stickerdb_get_all | ( | struct t_stickerdb_state * | stickerdb, |
| enum mympd_sticker_type | type, | ||
| const char * | uri, | ||
| struct t_sticker * | sticker, | ||
| bool | user_defined | ||
| ) |
Gets all stickers
| stickerdb | pointer to the stickerdb state |
| type | MPD sticker type |
| uri | sticker uri |
| sticker | pointer to t_sticker struct to populate |
| user_defined | get user defines stickers? |
| struct t_sticker * stickerdb_get_all_batch | ( | struct t_stickerdb_state * | stickerdb, |
| enum mympd_sticker_type | type, | ||
| const char * | uri, | ||
| struct t_sticker * | sticker, | ||
| bool | user_defined | ||
| ) |
Gets all stickers. You must manage the idle state manually.
| stickerdb | pointer to the stickerdb state |
| type | MPD sticker type |
| uri | sticker uri |
| sticker | pointer to t_sticker struct to populate |
| user_defined | get user defines stickers? |
| sds stickerdb_get_batch | ( | struct t_stickerdb_state * | stickerdb, |
| enum mympd_sticker_type | type, | ||
| const char * | uri, | ||
| const char * | name | ||
| ) |
Gets a sticker. You must manage the idle state manually.
| stickerdb | pointer to the stickerdb state |
| type | MPD sticker type |
| uri | sticker uri |
| name | sticker name |
| int64_t stickerdb_get_int64 | ( | struct t_stickerdb_state * | stickerdb, |
| enum mympd_sticker_type | type, | ||
| const char * | uri, | ||
| const char * | name | ||
| ) |
Gets an int64_t value sticker.
| stickerdb | pointer to the stickerdb state |
| type | MPD sticker type |
| uri | sticker uri |
| name | sticker name |
| int64_t stickerdb_get_int64_batch | ( | struct t_stickerdb_state * | stickerdb, |
| enum mympd_sticker_type | type, | ||
| const char * | uri, | ||
| const char * | name | ||
| ) |
Gets an int64_t value sticker. You must manage the idle state manually.
| stickerdb | pointer to the stickerdb state |
| type | MPD sticker type |
| uri | sticker uri |
| name | sticker name |
| bool stickerdb_get_names | ( | struct t_stickerdb_state * | stickerdb, |
| enum mympd_sticker_type | type, | ||
| struct t_list * | sticker_names | ||
| ) |
Gets all sticker names by type
| stickerdb | pointer to the stickerdb state |
| type | MPD sticker type |
| sticker_names | List to populate |
| bool stickerdb_idle | ( | struct t_stickerdb_state * | stickerdb | ) |
Discards waiting idle events for the stickerdb connection. This prevents the connection to timeout.
| stickerdb | pointer to the stickerdb state |
| bool stickerdb_inc | ( | struct t_stickerdb_state * | stickerdb, |
| enum mympd_sticker_type | type, | ||
| const char * | uri, | ||
| const char * | name, | ||
| unsigned | value | ||
| ) |
Increments a sticker
| stickerdb | pointer to the stickerdb state |
| type | MPD sticker type |
| uri | sticker uri |
| name | sticker name |
| value | value to increment |
| bool stickerdb_inc_play_count | ( | struct t_stickerdb_state * | stickerdb, |
| enum mympd_sticker_type | type, | ||
| const char * | uri, | ||
| time_t | timestamp | ||
| ) |
Increments the myMPD play count and sets the last played time
| stickerdb | pointer to the stickerdb state |
| type | MPD sticker type |
| uri | sticker uri |
| timestamp | timestamp to set |
| bool stickerdb_inc_set | ( | struct t_stickerdb_state * | stickerdb, |
| enum mympd_sticker_type | type, | ||
| const char * | uri, | ||
| enum mympd_sticker_names | name_inc, | ||
| enum mympd_sticker_names | name_timestamp, | ||
| time_t | timestamp | ||
| ) |
Increments a counter and sets a timestamp
| stickerdb | pointer to the stickerdb state |
| type | MPD sticker type |
| uri | sticker uri |
| name_inc | sticker name for counter |
| name_timestamp | sticker name for timestamp |
| timestamp | timestamp to set |
| bool stickerdb_inc_skip_count | ( | struct t_stickerdb_state * | stickerdb, |
| enum mympd_sticker_type | type, | ||
| const char * | uri | ||
| ) |
Increments the myMPD skip count and sets the last skipped time
| stickerdb | pointer to the stickerdb state |
| type | MPD sticker type |
| uri | sticker uri |
| bool stickerdb_remove | ( | struct t_stickerdb_state * | stickerdb, |
| enum mympd_sticker_type | type, | ||
| const char * | uri, | ||
| const char * | name | ||
| ) |
Removes a sticker
| stickerdb | pointer to the stickerdb state |
| type | MPD sticker type |
| uri | sticker uri |
| name | sticker name |
| bool stickerdb_set | ( | struct t_stickerdb_state * | stickerdb, |
| enum mympd_sticker_type | type, | ||
| const char * | uri, | ||
| const char * | name, | ||
| const char * | value | ||
| ) |
Sets a sticker
| stickerdb | pointer to the stickerdb state |
| type | MPD sticker type |
| uri | sticker uri |
| name | sticker name |
| value | sticker value |
| bool stickerdb_set_elapsed | ( | struct t_stickerdb_state * | stickerdb, |
| enum mympd_sticker_type | type, | ||
| const char * | uri, | ||
| time_t | elapsed | ||
| ) |
Sets the myMPD elapsed timestamp sticker
| stickerdb | pointer to the stickerdb state |
| type | MPD sticker type |
| uri | sticker uri |
| elapsed | timestamp |
| bool stickerdb_set_int64 | ( | struct t_stickerdb_state * | stickerdb, |
| enum mympd_sticker_type | type, | ||
| const char * | uri, | ||
| const char * | name, | ||
| int64_t | value | ||
| ) |
Sets a sticker
| stickerdb | pointer to the stickerdb state |
| type | MPD sticker type |
| uri | sticker uri |
| name | sticker name |
| value | sticker value |
| bool stickerdb_set_like | ( | struct t_stickerdb_state * | stickerdb, |
| enum mympd_sticker_type | type, | ||
| const char * | uri, | ||
| enum sticker_like | value | ||
| ) |
Sets the myMPD like sticker
| stickerdb | pointer to the stickerdb state |
| type | MPD sticker type |
| uri | sticker uri |
| value | 0 = hate, 1 = neutral, 2 = like |
| bool stickerdb_set_rating | ( | struct t_stickerdb_state * | stickerdb, |
| enum mympd_sticker_type | type, | ||
| const char * | uri, | ||
| int | value | ||
| ) |
Sets the myMPD rating sticker
| stickerdb | pointer to the stickerdb state |
| type | MPD sticker type |
| uri | sticker uri |
| value | 0 - 10 stars |