mirror of
https://github.com/owntone/owntone-server.git
synced 2025-10-29 07:45:04 -04:00
[jsonapi] Add chapters array to GET /api/library/tracks/x response
This commit is contained in:
parent
8821b53cdb
commit
66cd5e668b
@ -100,6 +100,14 @@ safe_json_add_string(json_object *obj, const char *key, const char *value)
|
||||
json_object_object_add(obj, key, json_object_new_string(value));
|
||||
}
|
||||
|
||||
static inline void
|
||||
safe_json_add_raw(json_object *obj, const char *key, const char *raw)
|
||||
{
|
||||
json_object *value = json_tokener_parse(raw);
|
||||
if (value)
|
||||
json_object_object_add(obj, key, value);
|
||||
}
|
||||
|
||||
static inline void
|
||||
safe_json_add_string_from_int64(json_object *obj, const char *key, int64_t value)
|
||||
{
|
||||
@ -348,6 +356,7 @@ track_to_json(struct db_media_file_info *dbmfi)
|
||||
json_object_object_add(item, "artwork_url", json_object_new_string(artwork_url));
|
||||
|
||||
safe_json_add_string(item, "lyrics", dbmfi->lyrics);
|
||||
safe_json_add_raw(item, "chapters", dbmfi->chapters);
|
||||
return item;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user