Extracted browsing entry points

This commit is contained in:
emeric
2023-10-02 00:04:58 +02:00
parent 247975d304
commit 4fbacd691d
10 changed files with 593 additions and 506 deletions
+4 -8
View File
@@ -31,6 +31,7 @@
#include "utils/String.hpp"
#include "responses/Artist.hpp"
#include "SubsonicId.hpp"
#include "Utils.hpp"
namespace API::Subsonic
{
@@ -54,11 +55,6 @@ namespace API::Subsonic
return "";
}
std::string makeNameFilesystemCompatible(std::string_view name)
{
return StringUtils::replaceInString(name, "/", "_");
}
std::string getTrackPath(const Track::pointer& track)
{
std::string path;
@@ -75,9 +71,9 @@ namespace API::Subsonic
if (artists.size() > 1)
path = "Various Artists/";
else if (artists.size() == 1)
path = makeNameFilesystemCompatible(artists.front()->getName()) + "/";
path = Utils::makeNameFilesystemCompatible(artists.front()->getName()) + "/";
path += makeNameFilesystemCompatible(track->getRelease()->getName()) + "/";
path += Utils::makeNameFilesystemCompatible(track->getRelease()->getName()) + "/";
}
if (track->getDiscNumber())
@@ -85,7 +81,7 @@ namespace API::Subsonic
if (track->getTrackNumber())
path += std::to_string(*track->getTrackNumber()) + "-";
path += makeNameFilesystemCompatible(track->getName());
path += Utils::makeNameFilesystemCompatible(track->getName());
if (track->getPath().has_extension())
path += track->getPath().extension();