myMPD
Internal API documentation
Loading...
Searching...
No Matches
webradio.h
Go to the documentation of this file.
1/*
2 SPDX-License-Identifier: GPL-3.0-or-later
3 myMPD (c) 2018-2025 Juergen Mang <mail@jcgames.de>
4 https://github.com/jcorporation/mympd
5*/
6
11#ifndef MYMPD_LIB_WEBRADIO_H
12#define MYMPD_LIB_WEBRADIO_H
13
14#include "dist/rax/rax.h"
15#include "dist/sds/sds.h"
16#include "src/lib/config_def.h"
17#include "src/lib/list.h"
18
23 WEBRADIO_WEBRADIODB,
24 WEBRADIO_FAVORITE,
25 WEBRADIO_ALL
26};
27
32 rax *db;
33 rax *idx_uris;
34 pthread_rwlock_t rwlock;
35};
36
41 WEBRADIO_TAG_UNKNOWN = -1,
42 WEBRADIO_TAG_NAME,
43 WEBRADIO_TAG_IMAGE,
44 WEBRADIO_TAG_HOMEPAGE,
45 WEBRADIO_TAG_COUNTRY,
46 WEBRADIO_TAG_REGION,
47 WEBRADIO_TAG_DESCRIPTION,
48 WEBRADIO_TAG_URIS,
49 WEBRADIO_TAG_BITRATE,
50 WEBRADIO_TAG_CODEC,
51 WEBRADIO_TAG_GENRES,
52 WEBRADIO_TAG_LANGUAGES,
53 WEBRADIO_TAG_ADDED,
54 WEBRADIO_TAG_LASTMODIFIED,
55 WEBRADIO_TAG_COUNT
56};
57
62 size_t len;
63 enum webradio_tag_type tags[WEBRADIO_TAG_COUNT];
64};
65
83
84struct t_webradio_data *webradio_by_uri(struct t_webradios *webradio_favorites, struct t_webradios *webradiodb,
85 const char *uri);
86sds webradio_get_extm3u(struct t_webradios *webradio_favorites, struct t_webradios *webradiodb, sds buffer, sds uri);
88void webradio_data_free(struct t_webradio_data *data);
89sds webradio_get_cover_uri(struct t_webradio_data *webradio, sds buffer);
91void webradio_tags_search(struct t_webradio_tags *tags);
92const char *webradio_type_name(enum webradio_type type);
93const char *webradio_get_tag(const struct t_webradio_data *webradio, enum webradio_tag_type tag_type, unsigned int idx);
94sds webradio_to_extm3u(const struct t_webradio_data *webradio, sds buffer, const char *uri);
95
96struct t_webradios *webradios_new(void);
97void webradios_clear(struct t_webradios *webradios, bool init_rax);
98void webradios_free(struct t_webradios *webradios);
99void webradios_free_void(void *webradios);
100bool webradios_get_read_lock(struct t_webradios *webradios);
101bool webradios_get_write_lock(struct t_webradios *webradios);
102bool webradios_release_lock(struct t_webradios *webradios);
103bool webradios_save_to_disk(struct t_config *config, struct t_webradios *webradios, const char *filename);
104bool webradios_read_from_disk(struct t_config *config, struct t_webradios *webradios, const char *filename, enum webradio_type type);
105
106#endif
Central myMPD configuration definitions.
struct t_webradio_data * webradio_data_new(enum webradio_type type)
Definition webradio.c:70
webradio_type
Definition webradio.h:22
bool webradios_get_write_lock(struct t_webradios *webradios)
Definition webradio.c:362
void webradios_free_void(void *webradios)
Definition webradio.c:337
const char * webradio_type_name(enum webradio_type type)
Definition webradio.c:183
struct t_webradios * webradios_new(void)
Definition webradio.c:265
sds webradio_get_cover_uri(struct t_webradio_data *webradio, sds buffer)
Definition webradio.c:114
bool webradios_get_read_lock(struct t_webradios *webradios)
Definition webradio.c:346
webradio_tag_type
Definition webradio.h:40
void webradios_clear(struct t_webradios *webradios, bool init_rax)
Definition webradio.c:284
const char * webradio_get_tag(const struct t_webradio_data *webradio, enum webradio_tag_type tag_type, unsigned int idx)
Definition webradio.c:196
enum webradio_tag_type webradio_tag_name_parse(const char *name)
Definition webradio.c:169
void webradio_tags_search(struct t_webradio_tags *tags)
Definition webradio.c:135
void webradio_data_free(struct t_webradio_data *data)
Definition webradio.c:91
sds webradio_to_extm3u(const struct t_webradio_data *webradio, sds buffer, const char *uri)
Definition webradio.c:251
struct t_webradio_data * webradio_by_uri(struct t_webradios *webradio_favorites, struct t_webradios *webradiodb, const char *uri)
Definition webradio.c:30
bool webradios_save_to_disk(struct t_config *config, struct t_webradios *webradios, const char *filename)
Definition webradio.c:396
void webradios_free(struct t_webradios *webradios)
Definition webradio.c:323
bool webradios_read_from_disk(struct t_config *config, struct t_webradios *webradios, const char *filename, enum webradio_type type)
Definition webradio.c:492
bool webradios_release_lock(struct t_webradios *webradios)
Definition webradio.c:378
sds webradio_get_extm3u(struct t_webradios *webradio_favorites, struct t_webradios *webradiodb, sds buffer, sds uri)
Definition webradio.c:57
Linked list implementation.
Definition config_def.h:22
Definition list.h:32
Definition webradio.h:69
struct t_list languages
List of languages.
Definition webradio.h:78
sds homepage
Homepage.
Definition webradio.h:72
time_t added
Added timestamp.
Definition webradio.h:80
enum webradio_type type
Type of the webradio.
Definition webradio.h:79
sds country
Country.
Definition webradio.h:73
sds name
Station name.
Definition webradio.h:70
sds description
Short description.
Definition webradio.h:75
struct t_list genres
List of genres.
Definition webradio.h:77
sds region
State or region.
Definition webradio.h:74
time_t last_modified
Last modified timestamp.
Definition webradio.h:81
struct t_list uris
List of Uris (uri, bitrate and codec)
Definition webradio.h:76
sds image
Station image.
Definition webradio.h:71
Definition webradio.h:61
size_t len
number of tags in the array
Definition webradio.h:62
enum webradio_tag_type tags[WEBRADIO_TAG_COUNT]
tags array
Definition webradio.h:63
Definition webradio.h:31
rax * db
Index by name.
Definition webradio.h:32
pthread_rwlock_t rwlock
pthreads read-write lock object
Definition webradio.h:34
rax * idx_uris
Index by uri.
Definition webradio.h:33