Updated clang format, and restored dsd file handling that was actually broken
This commit is contained in:
@@ -204,11 +204,11 @@ namespace lms::av
|
||||
std::optional<std::size_t> AudioFile::getBestStreamIndex() const
|
||||
{
|
||||
int res = ::av_find_best_stream(_context,
|
||||
AVMEDIA_TYPE_AUDIO,
|
||||
-1, // Auto
|
||||
-1, // Auto
|
||||
NULL,
|
||||
0);
|
||||
AVMEDIA_TYPE_AUDIO,
|
||||
-1, // Auto
|
||||
-1, // Auto
|
||||
NULL,
|
||||
0);
|
||||
|
||||
if (res < 0)
|
||||
return std::nullopt;
|
||||
|
||||
@@ -202,24 +202,24 @@ namespace lms::core
|
||||
LMS_LOG(CHILDPROCESS, DEBUG, "Async read, bufferSize = " << bufferSize);
|
||||
|
||||
boost::asio::async_read(_childStdout, boost::asio::buffer(data, bufferSize),
|
||||
[this, callback{ std::move(callback) }](const boost::system::error_code& error, std::size_t bytesTransferred) {
|
||||
LMS_LOG(CHILDPROCESS, DEBUG, "Async read cb - ec = '" << error.message() << "' (" << error.value() << "), bytesTransferred = " << bytesTransferred);
|
||||
[this, callback{ std::move(callback) }](const boost::system::error_code& error, std::size_t bytesTransferred) {
|
||||
LMS_LOG(CHILDPROCESS, DEBUG, "Async read cb - ec = '" << error.message() << "' (" << error.value() << "), bytesTransferred = " << bytesTransferred);
|
||||
|
||||
ReadResult readResult{ ReadResult::Success };
|
||||
if (error)
|
||||
{
|
||||
if (error != boost::asio::error::eof)
|
||||
{
|
||||
// forbidden to read any captured param here as the ChildProcess instance may already have been killed
|
||||
return;
|
||||
}
|
||||
ReadResult readResult{ ReadResult::Success };
|
||||
if (error)
|
||||
{
|
||||
if (error != boost::asio::error::eof)
|
||||
{
|
||||
// forbidden to read any captured param here as the ChildProcess instance may already have been killed
|
||||
return;
|
||||
}
|
||||
|
||||
readResult = ReadResult::EndOfFile;
|
||||
_finished = true;
|
||||
}
|
||||
readResult = ReadResult::EndOfFile;
|
||||
_finished = true;
|
||||
}
|
||||
|
||||
callback(readResult, bytesTransferred);
|
||||
});
|
||||
callback(readResult, bytesTransferred);
|
||||
});
|
||||
}
|
||||
|
||||
std::size_t ChildProcess::readSome(std::byte* data, std::size_t bufferSize)
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace lms::core
|
||||
|
||||
private:
|
||||
Wt::Http::ResponseContinuation* processRequest(const Wt::Http::Request& request, Wt::Http::Response& response) override;
|
||||
void abort() override{};
|
||||
void abort() override {};
|
||||
|
||||
static constexpr std::size_t _chunkSize{ 262'144 };
|
||||
|
||||
|
||||
@@ -78,9 +78,9 @@ namespace lms::core::tracing
|
||||
setMetadata("cpu_count", std::to_string(std::thread::hardware_concurrency()));
|
||||
setMetadata("build_type",
|
||||
#ifndef NDEBUG
|
||||
"debug"
|
||||
"debug"
|
||||
#else
|
||||
"release"
|
||||
"release"
|
||||
#endif
|
||||
);
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace lms::core::http
|
||||
std::visit([&](const auto& parameters) {
|
||||
res = &static_cast<const ClientRequestParameters&>(parameters);
|
||||
},
|
||||
_parameters);
|
||||
_parameters);
|
||||
|
||||
return *res;
|
||||
}
|
||||
|
||||
@@ -344,7 +344,7 @@ CREATE TABLE IF NOT EXISTS "track_backup" (
|
||||
SELECT 1, 0, s_s.media_directory, "Main"
|
||||
FROM scan_settings s_s
|
||||
WHERE id = ?)",
|
||||
scanSettingsId);
|
||||
scanSettingsId);
|
||||
|
||||
// Remove the outdated column in scan_settings
|
||||
utils::executeCommand(*session.getDboSession(), "ALTER TABLE scan_settings DROP media_directory");
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace lms::db
|
||||
class SelectStatement
|
||||
{
|
||||
public:
|
||||
SelectStatement(){};
|
||||
SelectStatement() {};
|
||||
SelectStatement(const std::string& item);
|
||||
|
||||
SelectStatement& And(const std::string& item);
|
||||
|
||||
@@ -74,13 +74,13 @@ namespace lms::image::STB
|
||||
|
||||
#if STB_IMAGE_RESIZE_VERSION == 1
|
||||
if (::stbir_resize_uint8_srgb(reinterpret_cast<const unsigned char*>(_data.get()), _width, _height, 0,
|
||||
reinterpret_cast<unsigned char*>(resizedData.get()), width, height, 0,
|
||||
3, STBIR_ALPHA_CHANNEL_NONE, 0)
|
||||
reinterpret_cast<unsigned char*>(resizedData.get()), width, height, 0,
|
||||
3, STBIR_ALPHA_CHANNEL_NONE, 0)
|
||||
== 0)
|
||||
#elif STB_IMAGE_RESIZE_VERSION == 2
|
||||
if (::stbir_resize_uint8_srgb(reinterpret_cast<const unsigned char*>(_data.get()), _width, _height, 0,
|
||||
reinterpret_cast<unsigned char*>(resizedData.get()), width, height, 0,
|
||||
STBIR_RGB)
|
||||
reinterpret_cast<unsigned char*>(resizedData.get()), width, height, 0,
|
||||
STBIR_RGB)
|
||||
== 0)
|
||||
#else
|
||||
#error "Unhandled STB image resize version"!
|
||||
|
||||
@@ -75,43 +75,43 @@ namespace lms::metadata::benchmarks
|
||||
params.artistTagDelimiters = { "/", ";" };
|
||||
// The list itself is not important, the idea is to have some volume
|
||||
params.artistsToNotSplit = { "AC/DC",
|
||||
"+/-",
|
||||
R"(A/N【eɪ-ɛn)",
|
||||
"Akron/Family",
|
||||
"AM/FM",
|
||||
"Ashes/Dust",
|
||||
"B/B/S/",
|
||||
"BLCK/MRKT/RGNS",
|
||||
"Body/Gate/Head",
|
||||
"Body/Head",
|
||||
"Born/Dead",
|
||||
"Burger/Ink",
|
||||
"case/lang/veirs",
|
||||
"Chicago / London Underground",
|
||||
"Dakota/Dakota",
|
||||
"Dark/Light",
|
||||
"Decades/Failures",
|
||||
"The Denison/Kimball Trio",
|
||||
"D-W/L-SS",
|
||||
"F/i",
|
||||
"Friend / Enemy",
|
||||
"GZA/Genius",
|
||||
"I/O",
|
||||
"I/O3",
|
||||
"In/Humanity",
|
||||
"Love/Lust",
|
||||
"Mirror/Dash",
|
||||
"Model/Actress",
|
||||
"N/N",
|
||||
"Neither/Neither World",
|
||||
"P1/E",
|
||||
"Sick/Tired",
|
||||
"t/e/u/",
|
||||
"tide/edit",
|
||||
"V/Vm",
|
||||
"White/Lichens",
|
||||
"White/Light",
|
||||
"Yamantaka // Sonic Titan" };
|
||||
"+/-",
|
||||
R"(A/N【eɪ-ɛn)",
|
||||
"Akron/Family",
|
||||
"AM/FM",
|
||||
"Ashes/Dust",
|
||||
"B/B/S/",
|
||||
"BLCK/MRKT/RGNS",
|
||||
"Body/Gate/Head",
|
||||
"Body/Head",
|
||||
"Born/Dead",
|
||||
"Burger/Ink",
|
||||
"case/lang/veirs",
|
||||
"Chicago / London Underground",
|
||||
"Dakota/Dakota",
|
||||
"Dark/Light",
|
||||
"Decades/Failures",
|
||||
"The Denison/Kimball Trio",
|
||||
"D-W/L-SS",
|
||||
"F/i",
|
||||
"Friend / Enemy",
|
||||
"GZA/Genius",
|
||||
"I/O",
|
||||
"I/O3",
|
||||
"In/Humanity",
|
||||
"Love/Lust",
|
||||
"Mirror/Dash",
|
||||
"Model/Actress",
|
||||
"N/N",
|
||||
"Neither/Neither World",
|
||||
"P1/E",
|
||||
"Sick/Tired",
|
||||
"t/e/u/",
|
||||
"tide/edit",
|
||||
"V/Vm",
|
||||
"White/Lichens",
|
||||
"White/Light",
|
||||
"Yamantaka // Sonic Titan" };
|
||||
|
||||
const TestAudioFileParser parser{ params };
|
||||
for (auto _ : state)
|
||||
|
||||
@@ -196,10 +196,10 @@ namespace lms::metadata
|
||||
}
|
||||
|
||||
std::vector<Artist> getArtists(const ITagReader& tagReader,
|
||||
std::initializer_list<TagType> artistTagNames,
|
||||
std::initializer_list<TagType> artistSortTagNames,
|
||||
std::initializer_list<TagType> artistMBIDTagNames,
|
||||
const AudioFileParserParameters& params)
|
||||
std::initializer_list<TagType> artistTagNames,
|
||||
std::initializer_list<TagType> artistSortTagNames,
|
||||
std::initializer_list<TagType> artistMBIDTagNames,
|
||||
const AudioFileParserParameters& params)
|
||||
{
|
||||
std::vector<std::string> artistNames{ getTagValuesFirstMatchAs<std::string>(tagReader, artistTagNames, params.artistTagDelimiters, ¶ms.artistsToNotSplit) };
|
||||
if (artistNames.empty())
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
#include <taglib/taglib.h>
|
||||
|
||||
#if (TAGLIB_MAJOR_VERSION > 2)
|
||||
#if (TAGLIB_MAJOR_VERSION >= 2)
|
||||
#define TAGLIB_HAS_DSF 1
|
||||
#endif
|
||||
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
#include <taglib/wavfile.h>
|
||||
#include <taglib/wavpackfile.h>
|
||||
#if TAGLIB_HAS_DSF
|
||||
#include <taglib/dsdifffile.h>
|
||||
#include <taglib/dsffile.h>
|
||||
#endif
|
||||
|
||||
@@ -452,6 +453,8 @@ namespace lms::metadata::taglib
|
||||
#if TAGLIB_HAS_DSF
|
||||
else if (const auto* dsfProperties{ dynamic_cast<const TagLib::DSF::Properties*>(properties) })
|
||||
_audioProperties.bitsPerSample = dsfProperties->bitsPerSample();
|
||||
else if (const auto* dsfProperties{ dynamic_cast<const TagLib::DSDIFF::Properties*>(properties) })
|
||||
_audioProperties.bitsPerSample = dsfProperties->bitsPerSample();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
#include <taglib/wavfile.h>
|
||||
#include <taglib/wavpackfile.h>
|
||||
#if TAGLIB_HAS_DSF
|
||||
#include <taglib/dsdifffile.h>
|
||||
#include <taglib/dsffile.h>
|
||||
#endif
|
||||
|
||||
@@ -50,14 +51,13 @@ namespace lms::metadata::taglib::utils
|
||||
{
|
||||
std::span<const std::filesystem::path> getSupportedExtensions()
|
||||
{
|
||||
static const std::vector<std::filesystem::path> supportedExtensions
|
||||
{
|
||||
static const std::vector<std::filesystem::path> supportedExtensions{
|
||||
".mp3", ".mp2", ".aac", ".ogg", ".oga", ".flac", ".spx", ".opus",
|
||||
".mpc", ".wv", ".ape", ".tta", ".m4a", ".m4r", ".m4b", ".m4p",
|
||||
".3g2", ".m4v", ".wma", ".asf", ".aif", ".aiff", ".afc", ".aifc",
|
||||
".wav",
|
||||
".mpc", ".wv", ".ape", ".tta", ".m4a", ".m4r", ".m4b", ".m4p",
|
||||
".3g2", ".m4v", ".wma", ".asf", ".aif", ".aiff", ".afc", ".aifc",
|
||||
".wav",
|
||||
#if TAGLIB_HAS_DSF
|
||||
".dsf", ".dff", ".dsdiff"
|
||||
".dsf", ".dff", ".dsdiff"
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -201,9 +201,9 @@ namespace lms::metadata::taglib::utils
|
||||
else if (TagLib::RIFF::WAV::File::isSupported(stream))
|
||||
file = std::make_unique<TagLib::RIFF::WAV::File>(stream, readAudioProperties, audioPropertiesStyle);
|
||||
#if TAGLIB_HAS_DSF
|
||||
else if (DSF::File::isSupported(stream))
|
||||
else if (TagLib::DSF::File::isSupported(stream))
|
||||
file = std::make_unique<TagLib::DSF::File>(stream, readAudioProperties, audioPropertiesStyle);
|
||||
else if (DSDIFF::File::isSupported(stream))
|
||||
else if (TagLib::DSDIFF::File::isSupported(stream))
|
||||
file = std::make_unique<TagLib::DSDIFF::File>(stream, readAudioProperties, audioPropertiesStyle);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -161,9 +161,9 @@ namespace lms::metadata::tests
|
||||
{ TagType::TotalDiscs, { "3" } },
|
||||
}) };
|
||||
testTags->setExtraUserTags({ { "MY_AWESOME_TAG_A", { "MyTagValue1ForTagA", "MyTagValue2ForTagA" } },
|
||||
{ "MY_AWESOME_TAG_B", { "MyTagValue1ForTagB", "MyTagValue2ForTagB" } } });
|
||||
{ "MY_AWESOME_TAG_B", { "MyTagValue1ForTagB", "MyTagValue2ForTagB" } } });
|
||||
testTags->setPerformersTags({ { "RoleA", { "MyPerformer1ForRoleA", "MyPerformer2ForRoleA" } },
|
||||
{ "RoleB", { "MyPerformer1ForRoleB", "MyPerformer2ForRoleB" } } });
|
||||
{ "RoleB", { "MyPerformer1ForRoleB", "MyPerformer2ForRoleB" } } });
|
||||
testTags->setLyricsTags({ { "eng", "[00:00.00]First line\n[00:01.00]Second line" } });
|
||||
|
||||
return testTags;
|
||||
|
||||
@@ -47,8 +47,8 @@ namespace lms::artwork
|
||||
}
|
||||
|
||||
ArtworkService::ArtworkService(db::IDb& db,
|
||||
const std::filesystem::path& defaultReleaseCoverSvgPath,
|
||||
const std::filesystem::path& defaultArtistImageSvgPath)
|
||||
const std::filesystem::path& defaultReleaseCoverSvgPath,
|
||||
const std::filesystem::path& defaultArtistImageSvgPath)
|
||||
: _db{ db }
|
||||
, _audioFileParser{ metadata::createAudioFileParser(metadata::AudioFileParserParameters{}) }
|
||||
, _cache{ core::Service<core::IConfig>::get()->getULong("cover-max-cache-size", 30) * 1000 * 1000 }
|
||||
|
||||
@@ -48,8 +48,8 @@ namespace lms::auth
|
||||
virtual bool checkUserPassword(std::string_view loginName, std::string_view password) = 0;
|
||||
|
||||
CheckResult checkUserPassword(const boost::asio::ip::address& clientAddress,
|
||||
std::string_view loginName,
|
||||
std::string_view password) override;
|
||||
std::string_view loginName,
|
||||
std::string_view password) override;
|
||||
|
||||
std::shared_mutex _mutex;
|
||||
LoginThrottler _loginThrottler;
|
||||
|
||||
@@ -53,8 +53,8 @@ namespace lms::auth
|
||||
db::UserId userId{};
|
||||
};
|
||||
virtual CheckResult checkUserPassword(const boost::asio::ip::address& clientAddress,
|
||||
std::string_view loginName,
|
||||
std::string_view password)
|
||||
std::string_view loginName,
|
||||
std::string_view password)
|
||||
= 0;
|
||||
|
||||
virtual bool canSetPasswords() const = 0;
|
||||
|
||||
@@ -382,7 +382,7 @@ namespace lms::recommendation
|
||||
FeatureNames res;
|
||||
|
||||
std::transform(std::cbegin(featureDefinitions), std::cend(featureDefinitions),
|
||||
std::inserter(res, std::begin(res)), [](auto itFeature) { return itFeature.first; });
|
||||
std::inserter(res, std::begin(res)), [](auto itFeature) { return itFeature.first; });
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -101,10 +101,10 @@ namespace lms::recommendation
|
||||
|
||||
std::unordered_set<FeatureName> featureNames;
|
||||
std::transform(std::cbegin(trainSettings.featureSettingsMap), std::cend(trainSettings.featureSettingsMap), std::inserter(featureNames, std::begin(featureNames)),
|
||||
[](const auto& itFeatureSetting) { return itFeatureSetting.first; });
|
||||
[](const auto& itFeatureSetting) { return itFeatureSetting.first; });
|
||||
|
||||
const std::size_t nbDimensions{ std::accumulate(std::cbegin(featureNames), std::cend(featureNames), std::size_t{ 0 },
|
||||
[](std::size_t sum, const FeatureName& featureName) { return sum + getFeatureDef(featureName).nbDimensions; }) };
|
||||
[](std::size_t sum, const FeatureName& featureName) { return sum + getFeatureDef(featureName).nbDimensions; }) };
|
||||
|
||||
LMS_LOG(RECOMMENDATION, DEBUG, "Features dimension = " << nbDimensions);
|
||||
|
||||
@@ -184,8 +184,8 @@ namespace lms::recommendation
|
||||
|
||||
LMS_LOG(RECOMMENDATION, DEBUG, "Training network...");
|
||||
network.train(samples, trainSettings.iterationCount,
|
||||
progressCallback ? somProgressCallback : som::Network::ProgressCallback{},
|
||||
[this] { return _loadCancelled; });
|
||||
progressCallback ? somProgressCallback : som::Network::ProgressCallback{},
|
||||
[this] { return _loadCancelled; });
|
||||
LMS_LOG(RECOMMENDATION, DEBUG, "Training network DONE");
|
||||
|
||||
LMS_LOG(RECOMMENDATION, DEBUG, "Classifying tracks...");
|
||||
@@ -242,10 +242,10 @@ namespace lms::recommendation
|
||||
auto transaction{ session.createReadTransaction() };
|
||||
|
||||
similarTrackIds.erase(std::remove_if(std::begin(similarTrackIds), std::end(similarTrackIds),
|
||||
[&](TrackId trackId) {
|
||||
return !Track::exists(session, trackId);
|
||||
}),
|
||||
std::end(similarTrackIds));
|
||||
[&](TrackId trackId) {
|
||||
return !Track::exists(session, trackId);
|
||||
}),
|
||||
std::end(similarTrackIds));
|
||||
}
|
||||
|
||||
return similarTrackIds;
|
||||
@@ -263,10 +263,10 @@ namespace lms::recommendation
|
||||
auto transaction{ session.createReadTransaction() };
|
||||
|
||||
similarReleaseIds.erase(std::remove_if(std::begin(similarReleaseIds), std::end(similarReleaseIds),
|
||||
[&](ReleaseId releaseId) {
|
||||
return !Release::exists(session, releaseId);
|
||||
}),
|
||||
std::end(similarReleaseIds));
|
||||
[&](ReleaseId releaseId) {
|
||||
return !Release::exists(session, releaseId);
|
||||
}),
|
||||
std::end(similarReleaseIds));
|
||||
}
|
||||
|
||||
return similarReleaseIds;
|
||||
@@ -302,10 +302,10 @@ namespace lms::recommendation
|
||||
auto transaction{ session.createReadTransaction() };
|
||||
|
||||
res.erase(std::remove_if(std::begin(res), std::end(res),
|
||||
[&](ArtistId artistId) {
|
||||
return !Artist::exists(session, artistId);
|
||||
}),
|
||||
std::end(res));
|
||||
[&](ArtistId artistId) {
|
||||
return !Artist::exists(session, artistId);
|
||||
}),
|
||||
std::end(res));
|
||||
}
|
||||
|
||||
while (res.size() > maxCount)
|
||||
|
||||
@@ -101,9 +101,9 @@ namespace lms::recommendation
|
||||
|
||||
template<typename IdType>
|
||||
std::vector<IdType> getSimilarObjects(const std::vector<IdType>& ids,
|
||||
const ObjectMatrix<IdType>& objectMatrix,
|
||||
const ObjectPositions<IdType>& objectPositions,
|
||||
std::size_t maxCount) const;
|
||||
const ObjectMatrix<IdType>& objectMatrix,
|
||||
const ObjectPositions<IdType>& objectPositions,
|
||||
std::size_t maxCount) const;
|
||||
|
||||
db::IDb& _db;
|
||||
bool _loadCancelled{};
|
||||
@@ -157,9 +157,9 @@ namespace lms::recommendation
|
||||
|
||||
template<typename IdType>
|
||||
std::vector<IdType> FeaturesEngine::getSimilarObjects(const std::vector<IdType>& ids,
|
||||
const ObjectMatrix<IdType>& objectMatrix,
|
||||
const ObjectPositions<IdType>& objectPositions,
|
||||
std::size_t maxCount) const
|
||||
const ObjectMatrix<IdType>& objectMatrix,
|
||||
const ObjectPositions<IdType>& objectPositions,
|
||||
std::size_t maxCount) const
|
||||
{
|
||||
std::vector<IdType> res;
|
||||
|
||||
@@ -173,10 +173,10 @@ namespace lms::recommendation
|
||||
|
||||
// Remove objects that are already in input or already reported
|
||||
closestObjectIds.erase(std::remove_if(std::begin(closestObjectIds), std::end(closestObjectIds),
|
||||
[&](IdType id) {
|
||||
return std::find(std::cbegin(ids), std::cend(ids), id) != std::cend(ids);
|
||||
}),
|
||||
std::end(closestObjectIds));
|
||||
[&](IdType id) {
|
||||
return std::find(std::cbegin(ids), std::cend(ids), id) != std::cend(ids);
|
||||
}),
|
||||
std::end(closestObjectIds));
|
||||
|
||||
for (IdType id : closestObjectIds)
|
||||
{
|
||||
|
||||
@@ -35,8 +35,8 @@ namespace lms::recommendation::PlaylistGeneratorConstraint
|
||||
ArtistContainer intersection;
|
||||
|
||||
std::set_intersection(std::cbegin(artists1), std::cend(artists1),
|
||||
std::cbegin(artists2), std::cend(artists2),
|
||||
std::back_inserter(intersection));
|
||||
std::cbegin(artists2), std::cend(artists2),
|
||||
std::back_inserter(intersection));
|
||||
|
||||
return intersection.size();
|
||||
}
|
||||
|
||||
@@ -591,9 +591,9 @@ namespace lms::scanner
|
||||
// Skip if duplicate files no longer in media root: as it will be removed later, we will end up with no file
|
||||
auto& mediaLibraries{ getScannerSettings().mediaLibraries };
|
||||
if (std::none_of(std::cbegin(mediaLibraries), std::cend(mediaLibraries),
|
||||
[&](const MediaLibraryInfo& libraryInfo) {
|
||||
return core::pathUtils::isPathInRootPath(getFilePath(), libraryInfo.rootDirectory, &excludeDirFileName);
|
||||
}))
|
||||
[&](const MediaLibraryInfo& libraryInfo) {
|
||||
return core::pathUtils::isPathInRootPath(getFilePath(), libraryInfo.rootDirectory, &excludeDirFileName);
|
||||
}))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -246,10 +246,10 @@ namespace lms::scanner
|
||||
std::vector<std::string> res;
|
||||
|
||||
core::Service<core::IConfig>::get()->visitStrings("artist-image-file-names",
|
||||
[&res](std::string_view fileName) {
|
||||
res.emplace_back(fileName);
|
||||
},
|
||||
{ "artist" });
|
||||
[&res](std::string_view fileName) {
|
||||
res.emplace_back(fileName);
|
||||
},
|
||||
{ "artist" });
|
||||
|
||||
return res;
|
||||
}
|
||||
@@ -259,10 +259,10 @@ namespace lms::scanner
|
||||
std::vector<std::string> res;
|
||||
|
||||
core::Service<core::IConfig>::get()->visitStrings("artist-info-image-file-names",
|
||||
[&res](std::string_view fileName) {
|
||||
res.emplace_back(fileName);
|
||||
},
|
||||
{ "thumb", "folder", "fanart" });
|
||||
[&res](std::string_view fileName) {
|
||||
res.emplace_back(fileName);
|
||||
},
|
||||
{ "thumb", "folder", "fanart" });
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -175,10 +175,10 @@ namespace lms::scanner
|
||||
std::vector<std::string> res;
|
||||
|
||||
core::Service<core::IConfig>::get()->visitStrings("medium-image-file-names",
|
||||
[&res](std::string_view fileName) {
|
||||
res.emplace_back(fileName);
|
||||
},
|
||||
{ "discsubtitle" });
|
||||
[&res](std::string_view fileName) {
|
||||
res.emplace_back(fileName);
|
||||
},
|
||||
{ "discsubtitle" });
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -204,10 +204,10 @@ namespace lms::scanner
|
||||
std::vector<std::string> res;
|
||||
|
||||
core::Service<core::IConfig>::get()->visitStrings("cover-preferred-file-names",
|
||||
[&res](std::string_view fileName) {
|
||||
res.emplace_back(fileName);
|
||||
},
|
||||
{ "cover", "front", "folder", "default" });
|
||||
[&res](std::string_view fileName) {
|
||||
res.emplace_back(fileName);
|
||||
},
|
||||
{ "cover", "front", "folder", "default" });
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -101,9 +101,9 @@ namespace lms::scanner
|
||||
}
|
||||
|
||||
if (std::none_of(std::cbegin(_settings.mediaLibraries), std::cend(_settings.mediaLibraries),
|
||||
[&](const MediaLibraryInfo& libraryInfo) {
|
||||
return core::pathUtils::isPathInRootPath(p, libraryInfo.rootDirectory, &excludeDirFileName);
|
||||
}))
|
||||
[&](const MediaLibraryInfo& libraryInfo) {
|
||||
return core::pathUtils::isPathInRootPath(p, libraryInfo.rootDirectory, &excludeDirFileName);
|
||||
}))
|
||||
{
|
||||
LMS_LOG(DBUPDATER, DEBUG, "Removing " << p << ": out of media directory");
|
||||
return false;
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace lms::transcoding
|
||||
|
||||
private:
|
||||
Wt::Http::ResponseContinuation* processRequest(const Wt::Http::Request& request, Wt::Http::Response& response) override;
|
||||
void abort() override{};
|
||||
void abort() override {};
|
||||
|
||||
static constexpr std::size_t _chunkSize{ 262'144 };
|
||||
std::optional<std::size_t> _estimatedContentLength;
|
||||
|
||||
@@ -36,9 +36,9 @@ namespace lms::som
|
||||
const T mean{ std::accumulate(vec.begin(), vec.end(), T{}) / size };
|
||||
|
||||
return std::accumulate(vec.begin(), vec.end(), T{},
|
||||
[mean, size](T accumulator, const T& val) {
|
||||
return accumulator + ((val - mean) * (val - mean) / (size - 1));
|
||||
});
|
||||
[mean, size](T accumulator, const T& val) {
|
||||
return accumulator + ((val - mean) * (val - mean) / (size - 1));
|
||||
});
|
||||
}
|
||||
|
||||
DataNormalizer::DataNormalizer(std::size_t inputDimCount)
|
||||
|
||||
@@ -212,9 +212,9 @@ namespace lms::som
|
||||
for (const Position& neighbourPosition : neighboursPosition)
|
||||
{
|
||||
auto min = std::min_element(refVectorsPosition.begin(), refVectorsPosition.end(),
|
||||
[this, neighbourPosition](const auto& a, const auto& b) {
|
||||
return (this->getRefVectorsDistance(a, neighbourPosition) < this->getRefVectorsDistance(b, neighbourPosition));
|
||||
});
|
||||
[this, neighbourPosition](const auto& a, const auto& b) {
|
||||
return (this->getRefVectorsDistance(a, neighbourPosition) < this->getRefVectorsDistance(b, neighbourPosition));
|
||||
});
|
||||
|
||||
InputVector::Distance distance{ getRefVectorsDistance(neighbourPosition, *min) };
|
||||
if (distance > maxDistance)
|
||||
@@ -227,9 +227,9 @@ namespace lms::som
|
||||
return std::nullopt;
|
||||
|
||||
auto min{ std::min_element(std::cbegin(neighboursInfo), std::cend(neighboursInfo),
|
||||
[&](const auto& a, const auto& b) {
|
||||
return a.distance < b.distance;
|
||||
}) };
|
||||
[&](const auto& a, const auto& b) {
|
||||
return a.distance < b.distance;
|
||||
}) };
|
||||
|
||||
return min->position;
|
||||
}
|
||||
|
||||
@@ -65,10 +65,10 @@ namespace lms::api::subsonic
|
||||
std::unordered_map<std::string, ProtocolVersion> res;
|
||||
|
||||
core::Service<core::IConfig>::get()->visitStrings("api-subsonic-old-server-protocol-clients",
|
||||
[&](std::string_view client) {
|
||||
res.emplace(std::string{ client }, ProtocolVersion{ .major = 1, .minor = 12, .patch = 0 });
|
||||
},
|
||||
{ "DSub" });
|
||||
[&](std::string_view client) {
|
||||
res.emplace(std::string{ client }, ProtocolVersion{ .major = 1, .minor = 12, .patch = 0 });
|
||||
},
|
||||
{ "DSub" });
|
||||
|
||||
return res;
|
||||
}
|
||||
@@ -78,10 +78,10 @@ namespace lms::api::subsonic
|
||||
std::unordered_set<std::string> res;
|
||||
|
||||
core::Service<core::IConfig>::get()->visitStrings("api-open-subsonic-disabled-clients",
|
||||
[&](std::string_view client) {
|
||||
res.emplace(std::string{ client });
|
||||
},
|
||||
{ "DSub" });
|
||||
[&](std::string_view client) {
|
||||
res.emplace(std::string{ client });
|
||||
},
|
||||
{ "DSub" });
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -176,7 +176,7 @@ namespace lms::api::subsonic
|
||||
[&](bool value) { os << (value ? "true" : "false"); },
|
||||
[&](float value) { os << value; },
|
||||
[&](long long value) { os << value; } },
|
||||
value);
|
||||
value);
|
||||
}
|
||||
|
||||
void Response::XmlSerializer::serializeEscapedString(std::ostream& os, std::string_view str)
|
||||
|
||||
@@ -128,8 +128,8 @@ namespace lms::api::subsonic
|
||||
|
||||
const auto artistTracks{ Track::findIds(context.dbSession, params) };
|
||||
tracks.insert(std::end(tracks),
|
||||
std::begin(artistTracks.results),
|
||||
std::end(artistTracks.results));
|
||||
std::begin(artistTracks.results),
|
||||
std::end(artistTracks.results));
|
||||
}
|
||||
|
||||
return tracks;
|
||||
@@ -159,8 +159,8 @@ namespace lms::api::subsonic
|
||||
|
||||
const auto releaseTracks{ Track::findIds(context.dbSession, params) };
|
||||
tracks.insert(std::end(tracks),
|
||||
std::begin(releaseTracks.results),
|
||||
std::end(releaseTracks.results));
|
||||
std::begin(releaseTracks.results),
|
||||
std::end(releaseTracks.results));
|
||||
}
|
||||
|
||||
return tracks;
|
||||
|
||||
@@ -48,9 +48,9 @@ namespace lms::api::subsonic
|
||||
names.resize(artists.size());
|
||||
|
||||
std::transform(std::cbegin(artists), std::cend(artists), std::begin(names),
|
||||
[](const Artist::pointer& artist) {
|
||||
return artist->getName();
|
||||
});
|
||||
[](const Artist::pointer& artist) {
|
||||
return artist->getName();
|
||||
});
|
||||
|
||||
return core::stringUtils::joinStrings(names, ", ");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user