summaryrefslogtreecommitdiff
path: root/src/lib/spl.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2024-12-14 18:53:10 +0100
committerCarl Hetherington <cth@carlh.net>2025-02-02 21:25:06 +0100
commit5c1f0476063cce08d4362476863f80f74892d45c (patch)
treeda70d7ef8a9b17420aecce95adb9063093195949 /src/lib/spl.cc
parent9cb39b660cb851e571cb96d0b416d6744ca6d6f5 (diff)
WIP: add playlist support to the HTTP API.
Diffstat (limited to 'src/lib/spl.cc')
-rw-r--r--src/lib/spl.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/lib/spl.cc b/src/lib/spl.cc
index 3897709db..89cb1d0c5 100644
--- a/src/lib/spl.cc
+++ b/src/lib/spl.cc
@@ -85,3 +85,23 @@ SPL::insert(SPLEntry entry, optional<string> before_id)
}
}
+
+nlohmann::json
+SPL::as_json_without_content() const
+{
+ nlohmann::json json;
+ json["id"] = _id;
+ json["name"] = _name;
+ return json;
+}
+
+
+nlohmann::json
+SPL::as_json_with_content() const
+{
+ auto json = as_json_without_content();
+ for (auto i: _spl) {
+ json["content"].push_back(i.as_json());
+ }
+ return json;
+}