diff --git a/src/db.c b/src/db.c index e890fac2..8fbedf84 100644 --- a/src/db.c +++ b/src/db.c @@ -2344,7 +2344,7 @@ db_build_query_count_items(struct query_params *qp, struct query_clause *qc) qp->results = 1; - query = sqlite3_mprintf("SELECT COUNT(*), SUM(song_length), COUNT(DISTINCT songartistid), COUNT(DISTINCT songalbumid) FROM files f %s;", qc->where); + query = sqlite3_mprintf("SELECT COUNT(*), SUM(song_length), COUNT(DISTINCT songartistid), COUNT(DISTINCT songalbumid), SUM(file_size) FROM files f %s;", qc->where); if (!query) DPRINTF(E_LOG, L_DB, "Out of memory for query string\n"); @@ -2699,6 +2699,7 @@ db_query_fetch_count(struct filecount_info *fci, struct query_params *qp) fci->length = sqlite3_column_int64(qp->stmt, 1); fci->artist_count = sqlite3_column_int(qp->stmt, 2); fci->album_count = sqlite3_column_int(qp->stmt, 3); + fci->file_size = sqlite3_column_int64(qp->stmt, 4); return 0; } diff --git a/src/db.h b/src/db.h index 61701a85..75fb3941 100644 --- a/src/db.h +++ b/src/db.h @@ -474,6 +474,7 @@ struct filecount_info { uint64_t length; uint32_t artist_count; uint32_t album_count; + uint64_t file_size; }; /* Directory ids must be in sync with the ids in Q_DIR* in db_init.c */ diff --git a/src/httpd_jsonapi.c b/src/httpd_jsonapi.c index ded5e95a..f2050ac7 100644 --- a/src/httpd_jsonapi.c +++ b/src/httpd_jsonapi.c @@ -1205,6 +1205,7 @@ jsonapi_reply_library(struct httpd_request *hreq) json_object_object_add(jreply, "db_playtime", json_object_new_int64((fci.length / 1000))); json_object_object_add(jreply, "artists", json_object_new_int(fci.artist_count)); json_object_object_add(jreply, "albums", json_object_new_int(fci.album_count)); + json_object_object_add(jreply, "file_size", json_object_new_int64(fci.file_size)); } else { @@ -4163,6 +4164,7 @@ jsonapi_reply_library_count(struct httpd_request *hreq) json_object_object_add(jreply, "artists", json_object_new_int(fci.artist_count)); json_object_object_add(jreply, "albums", json_object_new_int(fci.album_count)); json_object_object_add(jreply, "db_playtime", json_object_new_int64((fci.length / 1000))); + json_object_object_add(jreply, "file_size", json_object_new_int64((fci.file_size))); } else {