Merge pull request #752 from whatdoineed2do/db-queue-quality

db queue to incl media quality info
This commit is contained in:
Christian Meffert
2019-07-09 20:19:10 +02:00
committed by GitHub
11 changed files with 104 additions and 4 deletions

View File

@@ -231,6 +231,11 @@ track_to_json(struct db_media_file_info *dbmfi)
safe_json_add_time_from_string(item, "date_released", dbmfi->date_released, false);
safe_json_add_int_from_string(item, "seek_ms", dbmfi->seek);
safe_json_add_string(item, "type", dbmfi->type);
safe_json_add_int_from_string(item, "samplerate", dbmfi->samplerate);
safe_json_add_int_from_string(item, "bitrate", dbmfi->bitrate);
safe_json_add_int_from_string(item, "channels", dbmfi->channels);
ret = safe_atoi32(dbmfi->media_kind, &intval);
if (ret == 0)
safe_json_add_string(item, "media_kind", db_media_kind_label(intval));
@@ -1664,6 +1669,8 @@ queue_item_to_json(struct db_queue_item *queue_item, char shuffle)
json_object *item;
char uri[100];
char artwork_url[100];
char chbuf[6];
const char *ch;
int ret;
item = json_object_new_object();
@@ -1721,6 +1728,19 @@ queue_item_to_json(struct db_queue_item *queue_item, char shuffle)
json_object_object_add(item, "artwork_url", json_object_new_string(artwork_url));
}
safe_json_add_string(item, "type", queue_item->type);
json_object_object_add(item, "bitrate", json_object_new_int(queue_item->bitrate));
json_object_object_add(item, "samplerate", json_object_new_int(queue_item->samplerate));
switch (queue_item->channels)
{
case 1: ch = "mono"; break;
case 2: ch = "stereo"; break;
default:
snprintf(chbuf, sizeof(chbuf), "%d ch", queue_item->channels);
ch = chbuf;
}
safe_json_add_string(item, "channels", ch);
return item;
}