summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2025-11-20 08:45:01 +0100
committerCarl Hetherington <cth@carlh.net>2026-02-16 01:20:38 +0100
commit793691fc25b9ecf97e6837475f6761723639fcb5 (patch)
tree1421d17895b56690abdbfc3aedc4eca85809166f
parent6d49cab943297b052990b70c5b0f12274cfa69e2 (diff)
Add playlists GET endpoint.
-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;