Subsonic API: fixed missing mimetype for raw files

This commit is contained in:
emeric
2023-11-07 23:51:04 +01:00
parent 4bc5aee986
commit 504dfa86a9
8 changed files with 163 additions and 100 deletions
+1
View File
@@ -1,6 +1,7 @@
add_library(lmsav SHARED
impl/AudioFile.cpp
impl/RawResourceHandlerCreator.cpp
impl/Transcoder.cpp
impl/TranscodeResourceHandler.cpp
impl/Types.cpp
@@ -0,0 +1,38 @@
/*
* Copyright (C) 2023 Emeric Poupon
*
* This file is part of LMS.
*
* LMS is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* LMS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with LMS. If not, see <http://www.gnu.org/licenses/>.
*/
#include "av/RawResourceHandlerCreator.hpp"
#include "av/IAudioFile.hpp"
#include "utils/FileResourceHandlerCreator.hpp"
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);
}
}
@@ -0,0 +1,30 @@
/*
* Copyright (C) 2023 Emeric Poupon
*
* This file is part of LMS.
*
* LMS is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* LMS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with LMS. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <filesystem>
#include <memory>
#include "utils/IResourceHandler.hpp"
namespace Av
{
std::unique_ptr<IResourceHandler> createRawResourceHandler(const std::filesystem::path& path);
}