[jsonapi] Expose "use_libspotify" config

This commit is contained in:
chme 2021-07-04 14:40:08 +02:00
parent 6583157596
commit 1e4728f6b1

View File

@ -807,6 +807,9 @@ jsonapi_reply_config(struct httpd_request *hreq)
json_object_object_add(jreply, "allow_modifying_stored_playlists", json_object_new_boolean(allow_modifying_stored_playlists)); json_object_object_add(jreply, "allow_modifying_stored_playlists", json_object_new_boolean(allow_modifying_stored_playlists));
safe_json_add_string(jreply, "default_playlist_directory", default_playlist_directory); safe_json_add_string(jreply, "default_playlist_directory", default_playlist_directory);
// Wether libspotify should be used instead of librespot
json_object_object_add(jreply, "use_libspotify", json_object_new_boolean(cfg_getbool(cfg_getsec(cfg, "spotify"), "use_libspotify")));
CHECK_ERRNO(L_WEB, evbuffer_add_printf(hreq->reply, "%s", json_object_to_json_string(jreply))); CHECK_ERRNO(L_WEB, evbuffer_add_printf(hreq->reply, "%s", json_object_to_json_string(jreply)));
jparse_free(jreply); jparse_free(jreply);
@ -1226,8 +1229,8 @@ jsonapi_reply_spotify(struct httpd_request *hreq)
free(oauth_uri); free(oauth_uri);
spotify_status_get(&sp_status); spotify_status_get(&sp_status);
json_object_object_add(jreply, "libspotify_installed", json_object_new_boolean(sp_status.installed)); json_object_object_add(jreply, "spotify_installed", json_object_new_boolean(sp_status.installed));
json_object_object_add(jreply, "libspotify_logged_in", json_object_new_boolean(sp_status.logged_in)); json_object_object_add(jreply, "spotify_logged_in", json_object_new_boolean(sp_status.logged_in));
safe_json_add_string(jreply, "libspotify_user", sp_status.username); safe_json_add_string(jreply, "libspotify_user", sp_status.username);
spotifywebapi_status_info_get(&webapi_info); spotifywebapi_status_info_get(&webapi_info);