Added podcast support, only from subsonic API for now, ref #726
This commit is contained in:
@@ -19,8 +19,6 @@
|
||||
|
||||
#include "SubsonicId.hpp"
|
||||
|
||||
#include "core/String.hpp"
|
||||
|
||||
namespace lms::api::subsonic
|
||||
{
|
||||
std::string idToString(db::ArtistId id)
|
||||
@@ -33,6 +31,16 @@ namespace lms::api::subsonic
|
||||
return "dir-" + id.toString();
|
||||
}
|
||||
|
||||
std::string idToString(db::PodcastEpisodeId id)
|
||||
{
|
||||
return "podep-" + id.toString();
|
||||
}
|
||||
|
||||
std::string idToString(db::PodcastId id)
|
||||
{
|
||||
return "pod-" + id.toString();
|
||||
}
|
||||
|
||||
std::string idToString(db::ReleaseId id)
|
||||
{
|
||||
return "al-" + id.toString();
|
||||
@@ -92,6 +100,38 @@ namespace lms::core::stringUtils
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
template<>
|
||||
std::optional<db::PodcastEpisodeId> readAs(std::string_view str)
|
||||
{
|
||||
std::vector<std::string_view> values{ core::stringUtils::splitString(str, '-') };
|
||||
if (values.size() != 2)
|
||||
return std::nullopt;
|
||||
|
||||
if (values[0] != "podep")
|
||||
return std::nullopt;
|
||||
|
||||
if (const auto value{ core::stringUtils::readAs<db::PodcastEpisodeId::ValueType>(values[1]) })
|
||||
return db::PodcastEpisodeId{ *value };
|
||||
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
template<>
|
||||
std::optional<db::PodcastId> readAs(std::string_view str)
|
||||
{
|
||||
std::vector<std::string_view> values{ core::stringUtils::splitString(str, '-') };
|
||||
if (values.size() != 2)
|
||||
return std::nullopt;
|
||||
|
||||
if (values[0] != "pod")
|
||||
return std::nullopt;
|
||||
|
||||
if (const auto value{ core::stringUtils::readAs<db::PodcastId::ValueType>(values[1]) })
|
||||
return db::PodcastId{ *value };
|
||||
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
template<>
|
||||
std::optional<db::ReleaseId> readAs(std::string_view str)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user