Webradio functions.
More...
#include "dist/rax/rax.h"
#include "dist/sds/sds.h"
#include "src/lib/config_def.h"
#include "src/lib/list.h"
Go to the source code of this file.
|
| enum | webradio_type { WEBRADIO_WEBRADIODB
, WEBRADIO_FAVORITE
, WEBRADIO_ALL
} |
| |
| enum | webradio_tag_type {
WEBRADIO_TAG_UNKNOWN = -1
, WEBRADIO_TAG_NAME
, WEBRADIO_TAG_IMAGE
, WEBRADIO_TAG_HOMEPAGE
,
WEBRADIO_TAG_COUNTRY
, WEBRADIO_TAG_REGION
, WEBRADIO_TAG_DESCRIPTION
, WEBRADIO_TAG_URIS
,
WEBRADIO_TAG_BITRATE
, WEBRADIO_TAG_CODEC
, WEBRADIO_TAG_GENRES
, WEBRADIO_TAG_LANGUAGES
,
WEBRADIO_TAG_ADDED
, WEBRADIO_TAG_LASTMODIFIED
, WEBRADIO_TAG_COUNT
} |
| |
|
| struct t_webradio_data * | webradio_by_uri (struct t_webradios *webradio_favorites, struct t_webradios *webradiodb, const char *uri) |
| |
| sds | webradio_get_extm3u (struct t_webradios *webradio_favorites, struct t_webradios *webradiodb, sds buffer, sds uri) |
| |
| struct t_webradio_data * | webradio_data_new (enum webradio_type type) |
| |
| void | webradio_data_free (struct t_webradio_data *data) |
| |
| sds | webradio_get_cover_uri (struct t_webradio_data *webradio, sds buffer) |
| |
| enum webradio_tag_type | webradio_tag_name_parse (const char *name) |
| |
| void | webradio_tags_search (struct t_webradio_tags *tags) |
| |
| const char * | webradio_type_name (enum webradio_type type) |
| |
| const char * | webradio_get_tag (const struct t_webradio_data *webradio, enum webradio_tag_type tag_type, unsigned int idx) |
| |
| sds | webradio_to_extm3u (const struct t_webradio_data *webradio, sds buffer, const char *uri) |
| |
| struct t_webradios * | webradios_new (void) |
| |
| void | webradios_clear (struct t_webradios *webradios, bool init_rax) |
| |
| void | webradios_free (struct t_webradios *webradios) |
| |
| void | webradios_free_void (void *webradios) |
| |
| bool | webradios_get_read_lock (struct t_webradios *webradios) |
| |
| bool | webradios_get_write_lock (struct t_webradios *webradios) |
| |
| bool | webradios_release_lock (struct t_webradios *webradios) |
| |
| bool | webradios_save_to_disk (struct t_config *config, struct t_webradios *webradios, const char *filename) |
| |
| bool | webradios_read_from_disk (struct t_config *config, struct t_webradios *webradios, const char *filename, enum webradio_type type) |
| |
◆ webradio_tag_type
◆ webradio_type
◆ webradio_by_uri()
Search webradio by uri in favorites and WebradioDB
- Parameters
-
| webradio_favorites | Pointer to webradio favorites |
| webradiodb | Pointer to WebradioDB |
| uri | Uri to search for |
- Returns
- pointer to webradio data or NULL on error
◆ webradio_data_free()
Frees a webradios data struct
- Parameters
-
◆ webradio_data_new()
Creates a new webradio data struct
- Parameters
-
- Returns
- struct t_webradio_data*
◆ webradio_get_cover_uri()
| sds webradio_get_cover_uri |
( |
struct t_webradio_data * |
webradio, |
|
|
sds |
buffer |
|
) |
| |
Returns the uri for the webradio image
- Parameters
-
| webradio | Webradio struct |
| buffer | buffer to append the uri |
- Returns
- pointer to buffer
◆ webradio_get_extm3u()
| sds webradio_get_extm3u |
( |
struct t_webradios * |
webradio_favorites, |
|
|
struct t_webradios * |
webradiodb, |
|
|
sds |
buffer, |
|
|
sds |
uri |
|
) |
| |
Returns an extm3u for a webradio
- Parameters
-
| webradio_favorites | Pointer to webradio favorites |
| webradiodb | Pointer to WebradioDB |
| buffer | Buffer to append the uri |
| uri | Webradio uri |
- Returns
- Pointer to buffer
◆ webradio_get_tag()
Returns the value of a webradio tag
- Parameters
-
| webradio | Webdadio |
| tag_type | Webradio tag |
| idx | Index of tag |
- Returns
- Tag value or NULL if not exists
◆ webradio_tag_name_parse()
Parses a string to a webradio tag type
- Parameters
-
- Returns
- enum webradio_tag_type
◆ webradio_tags_search()
Sets the webradio tags for search
- Parameters
-
◆ webradio_to_extm3u()
| sds webradio_to_extm3u |
( |
const struct t_webradio_data * |
webradio, |
|
|
sds |
buffer, |
|
|
const char * |
uri |
|
) |
| |
Returns an extm3u for a webradio
- Parameters
-
| webradio | Pointer to webradio struct |
| buffer | Already allocated buffer to append the extm3u |
| uri | Optional uri. If NULL use the first uri from the webradio entry. |
- Returns
- Pointer to buffer
◆ webradio_type_name()
Returns the webradio type as string literal
- Parameters
-
- Returns
- Name of the webradio type
◆ webradios_clear()
| void webradios_clear |
( |
struct t_webradios * |
webradios, |
|
|
bool |
init_rax |
|
) |
| |
Clears the webradios struct
- Parameters
-
| webradios | struct to free |
| init_rax | re-init the rax trees? |
◆ webradios_free()
Frees the webradios struct
- Parameters
-
◆ webradios_free_void()
| void webradios_free_void |
( |
void * |
webradios | ) |
|
Frees the webradios struct
- Parameters
-
◆ webradios_get_read_lock()
| bool webradios_get_read_lock |
( |
struct t_webradios * |
webradios | ) |
|
Acquires a read lock
- Parameters
-
| webradios | pointer to webradios struct |
- Returns
- true on success, else false
◆ webradios_get_write_lock()
| bool webradios_get_write_lock |
( |
struct t_webradios * |
webradios | ) |
|
Acquires a write lock
- Parameters
-
| webradios | pointer to webradios struct |
- Returns
- true on success, else false
◆ webradios_new()
Initializes the webradios struct
- Returns
- struct t_webradios*
◆ webradios_read_from_disk()
Reads the webradios file from disk
- Parameters
-
| config | pointer to config |
| webradios | webradios struct to populate |
| filename | file to read |
| type | Webradio type |
- Returns
- true on success, else false
◆ webradios_release_lock()
| bool webradios_release_lock |
( |
struct t_webradios * |
webradios | ) |
|
Frees the lock
- Parameters
-
| webradios | pointer to webradios struct |
- Returns
- true on success, else false
◆ webradios_save_to_disk()
| bool webradios_save_to_disk |
( |
struct t_config * |
config, |
|
|
struct t_webradios * |
webradios, |
|
|
const char * |
filename |
|
) |
| |
Saves the webradios to disk
- Parameters
-
| config | pointer to config |
| webradios | webradios struct to write |
| filename | file to write |
- Returns
- true on success, else false