Subsonic API: added contentType and transcodedContentType fields, fixes #363

This commit is contained in:
emeric
2023-11-11 22:54:27 +01:00
parent 1d21ba41b7
commit ebc59dd70c
5 changed files with 43 additions and 38 deletions
@@ -26,13 +26,7 @@ namespace Av
{
std::unique_ptr<IResourceHandler> createRawResourceHandler(const std::filesystem::path& path)
{
std::string mimeType;
const auto guessedAudioFormat{ Av::guessAudioFileFormat(path) };
if (guessedAudioFormat)
mimeType = guessedAudioFormat->mimeType;
else
mimeType = "application/octet-stream";
return createFileResourceHandler(path, mimeType);
std::string_view mimeType{ Av::getMimeType(path.extension()) };
return createFileResourceHandler(path, mimeType.empty() ? "application/octet-stream" : mimeType);
}
}