summaryrefslogtreecommitdiff
path: root/src/lib/http_server.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2025-11-20 08:45:01 +0100
committerCarl Hetherington <cth@carlh.net>2026-02-03 21:37:04 +0100
commitdceca36f949b1cc109c268a10422bf3a7f12cebe (patch)
tree3bc5abb9081c91c79bfb05701ed804ede5fb6ba9 /src/lib/http_server.cc
parenta50b83841c9aa0c1770cd0cf47b27a8530512367 (diff)
Add playlists GET endpoint.
Diffstat (limited to 'src/lib/http_server.cc')
-rw-r--r--src/lib/http_server.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/lib/http_server.cc b/src/lib/http_server.cc
index 1ddf9dd7f..f1c1a3e19 100644
--- a/src/lib/http_server.cc
+++ b/src/lib/http_server.cc
@@ -23,6 +23,8 @@
#include "dcpomatic_log.h"
#include "dcpomatic_socket.h"
#include "http_server.h"
+#include "show_playlist.h"
+#include "show_playlist_list.h"
#include "util.h"
#include "variant.h"
#include <nlohmann/json.hpp>
@@ -110,6 +112,15 @@ HTTPServer::get(string const& url)
auto response = Response(200, json.dump());
response.set_type(Response::Type::JSON);
return response;
+ } else if (url == "/api/v1/playlists") {
+ ShowPlaylistList list;
+ nlohmann::json json;
+ for (auto spl: list.show_playlists()) {
+ json.push_back(spl.second.as_json());
+ }
+ auto response = Response(200, json.dump());
+ response.set_type(Response::Type::JSON);
+ return response;
} else {
LOG_HTTP("404 {}", url);
return Response::ERROR_404;