[db/jsonapi] New admin value for Last-Modified in JSON API header

This adds a new timestamp value "db_modified" into the admin db table.
In addition to the existing "db_update" admin value, this value is also
updated if rating, play-/skip-count or seek changes for a
media_info_file (files db table).

This should improve the caching behavior in clients of the JSON API
(especially the player web interface) in refreshing its data if some of
this values changes.
This commit is contained in:
chme
2019-01-30 08:36:34 +01:00
committed by ejurgensen
parent 694e1874ae
commit 0ded6d63bf
4 changed files with 42 additions and 22 deletions

View File

@@ -2590,7 +2590,7 @@ jsonapi_reply_library_album_tracks(struct httpd_request *hreq)
int total;
int ret = 0;
db_update = (time_t) db_admin_getint64(DB_ADMIN_DB_UPDATE);
db_update = (time_t) db_admin_getint64(DB_ADMIN_DB_MODIFIED);
if (db_update && httpd_request_not_modified_since(hreq->req, &db_update))
return HTTP_NOTMODIFIED;
@@ -2644,7 +2644,7 @@ jsonapi_reply_library_tracks_get_byid(struct httpd_request *hreq)
json_object *reply = NULL;
int ret = 0;
db_update = (time_t) db_admin_getint64(DB_ADMIN_DB_UPDATE);
db_update = (time_t) db_admin_getint64(DB_ADMIN_DB_MODIFIED);
if (db_update && httpd_request_not_modified_since(hreq->req, &db_update))
return HTTP_NOTMODIFIED;
@@ -2836,7 +2836,7 @@ jsonapi_reply_library_playlist_tracks(struct httpd_request *hreq)
int total;
int ret = 0;
db_update = (time_t) db_admin_getint64(DB_ADMIN_DB_UPDATE);
db_update = (time_t) db_admin_getint64(DB_ADMIN_DB_MODIFIED);
if (db_update && httpd_request_not_modified_since(hreq->req, &db_update))
return HTTP_NOTMODIFIED;