[jsonapi] Map additional metadata for artist and album
This commit is contained in:
parent
8afae4a41b
commit
382467eb9c
|
@ -151,6 +151,7 @@ static json_object *
|
||||||
artist_to_json(struct db_group_info *dbgri)
|
artist_to_json(struct db_group_info *dbgri)
|
||||||
{
|
{
|
||||||
json_object *item;
|
json_object *item;
|
||||||
|
int intval;
|
||||||
char uri[100];
|
char uri[100];
|
||||||
char artwork_url[100];
|
char artwork_url[100];
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -164,6 +165,14 @@ artist_to_json(struct db_group_info *dbgri)
|
||||||
safe_json_add_int_from_string(item, "track_count", dbgri->itemcount);
|
safe_json_add_int_from_string(item, "track_count", dbgri->itemcount);
|
||||||
safe_json_add_int_from_string(item, "length_ms", dbgri->song_length);
|
safe_json_add_int_from_string(item, "length_ms", dbgri->song_length);
|
||||||
|
|
||||||
|
ret = safe_atoi32(dbgri->media_kind, &intval);
|
||||||
|
if (ret == 0)
|
||||||
|
safe_json_add_string(item, "media_kind", db_media_kind_label(intval));
|
||||||
|
|
||||||
|
ret = safe_atoi32(dbgri->data_kind, &intval);
|
||||||
|
if (ret == 0)
|
||||||
|
safe_json_add_string(item, "data_kind", db_data_kind_label(intval));
|
||||||
|
|
||||||
ret = snprintf(uri, sizeof(uri), "%s:%s:%s", "library", "artist", dbgri->persistentid);
|
ret = snprintf(uri, sizeof(uri), "%s:%s:%s", "library", "artist", dbgri->persistentid);
|
||||||
if (ret < sizeof(uri))
|
if (ret < sizeof(uri))
|
||||||
json_object_object_add(item, "uri", json_object_new_string(uri));
|
json_object_object_add(item, "uri", json_object_new_string(uri));
|
||||||
|
@ -179,6 +188,7 @@ static json_object *
|
||||||
album_to_json(struct db_group_info *dbgri)
|
album_to_json(struct db_group_info *dbgri)
|
||||||
{
|
{
|
||||||
json_object *item;
|
json_object *item;
|
||||||
|
int intval;
|
||||||
char uri[100];
|
char uri[100];
|
||||||
char artwork_url[100];
|
char artwork_url[100];
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -193,6 +203,17 @@ album_to_json(struct db_group_info *dbgri)
|
||||||
safe_json_add_int_from_string(item, "track_count", dbgri->itemcount);
|
safe_json_add_int_from_string(item, "track_count", dbgri->itemcount);
|
||||||
safe_json_add_int_from_string(item, "length_ms", dbgri->song_length);
|
safe_json_add_int_from_string(item, "length_ms", dbgri->song_length);
|
||||||
|
|
||||||
|
ret = safe_atoi32(dbgri->media_kind, &intval);
|
||||||
|
if (ret == 0)
|
||||||
|
safe_json_add_string(item, "media_kind", db_media_kind_label(intval));
|
||||||
|
|
||||||
|
ret = safe_atoi32(dbgri->data_kind, &intval);
|
||||||
|
if (ret == 0)
|
||||||
|
safe_json_add_string(item, "data_kind", db_data_kind_label(intval));
|
||||||
|
|
||||||
|
safe_json_add_time_from_string(item, "date_released", dbgri->date_released, false);
|
||||||
|
safe_json_add_int_from_string(item, "year", dbgri->year);
|
||||||
|
|
||||||
ret = snprintf(uri, sizeof(uri), "%s:%s:%s", "library", "album", dbgri->persistentid);
|
ret = snprintf(uri, sizeof(uri), "%s:%s:%s", "library", "album", dbgri->persistentid);
|
||||||
if (ret < sizeof(uri))
|
if (ret < sizeof(uri))
|
||||||
json_object_object_add(item, "uri", json_object_new_string(uri));
|
json_object_object_add(item, "uri", json_object_new_string(uri));
|
||||||
|
|
Loading…
Reference in New Issue