Made compilation work with unity builds

This commit is contained in:
emeric
2025-04-20 11:26:47 +02:00
parent a5b130305e
commit 7767ddb78f
28 changed files with 206 additions and 160 deletions
+6
View File
@@ -26,11 +26,17 @@ if (${LMS_IMAGE_BACKEND} STREQUAL "stb")
target_sources(lmsimage PRIVATE target_sources(lmsimage PRIVATE
impl/stb/Image.cpp impl/stb/Image.cpp
impl/stb/Exception.cpp
impl/stb/RawImage.cpp impl/stb/RawImage.cpp
impl/stb/StbImage.cpp impl/stb/StbImage.cpp
impl/stb/StbImageResize.cpp impl/stb/StbImageResize.cpp
impl/stb/StbImageWrite.cpp impl/stb/StbImageWrite.cpp
) )
set_property(SOURCE impl/stb/StbImage.cpp PROPERTY SKIP_UNITY_BUILD_INCLUSION ON)
set_property(SOURCE impl/stb/StbImageResize.cpp PROPERTY SKIP_UNITY_BUILD_INCLUSION ON)
set_property(SOURCE impl/stb/StbImageWrite.cpp PROPERTY SKIP_UNITY_BUILD_INCLUSION ON)
target_compile_options(lmsimage PRIVATE "-DSTB_IMAGE_RESIZE_VERSION=${STB_IMAGE_RESIZE_VERSION}") target_compile_options(lmsimage PRIVATE "-DSTB_IMAGE_RESIZE_VERSION=${STB_IMAGE_RESIZE_VERSION}")
target_include_directories(lmsimage PRIVATE ${STB_IMAGE_INCLUDE_DIR}) target_include_directories(lmsimage PRIVATE ${STB_IMAGE_INCLUDE_DIR})
+36
View File
@@ -0,0 +1,36 @@
/*
* Copyright (C) 2020 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 "Exception.hpp"
#include "StbImage.hpp"
namespace lms::image
{
StbiException::StbiException(std::string_view desc)
: Exception{ std::string{ desc } + ": " + getLastFailureReason() }
{
}
std::string StbiException::getLastFailureReason()
{
const char* failureReason{ ::stbi_failure_reason() };
return failureReason ? failureReason : "unknown reason";
}
} // namespace lms::image
+36
View File
@@ -0,0 +1,36 @@
/*
* Copyright (C) 2020 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 <string_view>
#include "image/Exception.hpp"
namespace lms::image
{
class StbiException : public Exception
{
public:
StbiException(std::string_view desc);
private:
static std::string getLastFailureReason();
};
} // namespace lms::image
+1
View File
@@ -21,6 +21,7 @@
#include <array> #include <array>
#include "Exception.hpp"
#include "StbImage.hpp" #include "StbImage.hpp"
#include "StbImageWrite.hpp" #include "StbImageWrite.hpp"
+1
View File
@@ -19,6 +19,7 @@
#include "RawImage.hpp" #include "RawImage.hpp"
#include "Exception.hpp"
#include "StbImage.hpp" #include "StbImage.hpp"
#include "StbImageResize.hpp" #include "StbImageResize.hpp"
-14
View File
@@ -19,17 +19,3 @@
#define STB_IMAGE_IMPLEMENTATION #define STB_IMAGE_IMPLEMENTATION
#include "StbImage.hpp" #include "StbImage.hpp"
namespace lms::image
{
StbiException::StbiException(std::string_view desc)
: Exception{ std::string{ desc } + ": " + getLastFailureReason() }
{
}
std::string StbiException::getLastFailureReason()
{
const char* failureReason{ ::stbi_failure_reason() };
return failureReason ? failureReason : "unknown reason";
}
} // namespace lms::image
+1 -16
View File
@@ -16,6 +16,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with LMS. If not, see <http://www.gnu.org/licenses/>. * along with LMS. If not, see <http://www.gnu.org/licenses/>.
*/ */
#pragma once #pragma once
#define STBI_ONLY_JPEG #define STBI_ONLY_JPEG
@@ -24,19 +25,3 @@
#define STBI_FAILURE_USERMSG #define STBI_FAILURE_USERMSG
#include <stb_image.h> #include <stb_image.h>
#include <string_view>
#include "image/Exception.hpp"
namespace lms::image
{
class StbiException : public Exception
{
public:
StbiException(std::string_view desc);
private:
static std::string getLastFailureReason();
};
} // namespace lms::image
+3 -3
View File
@@ -30,7 +30,7 @@ namespace lms::metadata
namespace namespace
{ {
// Mapping to internal avformat names and/or common alternative custom names // Mapping to internal avformat names and/or common alternative custom names
static const std::unordered_map<TagType, std::vector<std::string>> tagMapping{ static const std::unordered_map<TagType, std::vector<std::string>> avFormatTagMapping{
{ TagType::AcoustID, { "ACOUSTID_ID", "ACOUSTID ID" } }, { TagType::AcoustID, { "ACOUSTID_ID", "ACOUSTID ID" } },
{ TagType::Advisory, { "ITUNESADVISORY" } }, { TagType::Advisory, { "ITUNESADVISORY" } },
{ TagType::Album, { "ALBUM", "TALB", "WM/ALBUMTITLE" } }, { TagType::Album, { "ALBUM", "TALB", "WM/ALBUMTITLE" } },
@@ -171,8 +171,8 @@ namespace lms::metadata
void AvFormatTagReader::visitTagValues(TagType tag, TagValueVisitor visitor) const void AvFormatTagReader::visitTagValues(TagType tag, TagValueVisitor visitor) const
{ {
auto itTagNames{ tagMapping.find(tag) }; auto itTagNames{ avFormatTagMapping.find(tag) };
if (itTagNames == std::cend(tagMapping)) if (itTagNames == std::cend(avFormatTagMapping))
return; return;
for (const std::string& tagName : itTagNames->second) for (const std::string& tagName : itTagNames->second)
+2 -2
View File
@@ -48,7 +48,7 @@ namespace lms::metadata
{ {
namespace namespace
{ {
class ParsingFailedException : public Exception class ImageParsingFailedException : public Exception
{ {
}; };
@@ -362,7 +362,7 @@ namespace lms::metadata
if (_file.isNull()) if (_file.isNull())
{ {
LMS_LOG(METADATA, ERROR, "File " << p << ": parsing failed"); LMS_LOG(METADATA, ERROR, "File " << p << ": parsing failed");
throw ParsingFailedException{}; throw ImageParsingFailedException{};
} }
} }
+6 -6
View File
@@ -55,12 +55,12 @@ namespace lms::metadata
{ {
namespace namespace
{ {
class ParsingFailedException : public Exception class TagParsingFailedException : public Exception
{ {
}; };
// Mapping to internal taglib names and/or common alternative custom names // Mapping to internal taglib names and/or common alternative custom names
const std::unordered_map<TagType, std::vector<std::string>> tagMapping{ const std::unordered_map<TagType, std::vector<std::string>> tagLibTagMapping{
{ TagType::AcoustID, { "ACOUSTID_ID", "ACOUSTID ID" } }, { TagType::AcoustID, { "ACOUSTID_ID", "ACOUSTID ID" } },
{ TagType::Advisory, { "ITUNESADVISORY" } }, { TagType::Advisory, { "ITUNESADVISORY" } },
{ TagType::Album, { "ALBUM" } }, { TagType::Album, { "ALBUM" } },
@@ -228,13 +228,13 @@ namespace lms::metadata
if (_file.isNull()) if (_file.isNull())
{ {
LMS_LOG(METADATA, ERROR, "File " << p << ": parsing failed"); LMS_LOG(METADATA, ERROR, "File " << p << ": parsing failed");
throw ParsingFailedException{}; throw TagParsingFailedException{};
} }
if (!_file.audioProperties()) if (!_file.audioProperties())
{ {
LMS_LOG(METADATA, ERROR, "File " << p << ": no audio properties"); LMS_LOG(METADATA, ERROR, "File " << p << ": no audio properties");
throw ParsingFailedException{}; throw TagParsingFailedException{};
} }
computeAudioProperties(); computeAudioProperties();
@@ -465,8 +465,8 @@ namespace lms::metadata
void TagLibTagReader::visitTagValues(TagType tag, TagValueVisitor visitor) const void TagLibTagReader::visitTagValues(TagType tag, TagValueVisitor visitor) const
{ {
auto itTagNames{ tagMapping.find(tag) }; auto itTagNames{ tagLibTagMapping.find(tag) };
if (itTagNames == std::cend(tagMapping)) if (itTagNames == std::cend(tagLibTagMapping))
return; return;
for (const std::string& tagName : itTagNames->second) for (const std::string& tagName : itTagNames->second)
@@ -51,7 +51,7 @@ namespace lms::scanner
}; };
using ArtistImageAssociationContainer = std::deque<ArtistImageAssociation>; using ArtistImageAssociationContainer = std::deque<ArtistImageAssociation>;
struct SearchImageContext struct SearchArtistImageContext
{ {
db::Session& session; db::Session& session;
db::ArtistId lastRetrievedArtistId; db::ArtistId lastRetrievedArtistId;
@@ -59,7 +59,7 @@ namespace lms::scanner
std::span<const std::string> artistFileNames; std::span<const std::string> artistFileNames;
}; };
db::Image::pointer findImageInDirectory(SearchImageContext& searchContext, const std::filesystem::path& directoryPath, std::span<const std::string> fileStemsToSearch) db::Image::pointer findImageInDirectory(SearchArtistImageContext& searchContext, const std::filesystem::path& directoryPath, std::span<const std::string> fileStemsToSearch)
{ {
db::Image::pointer image; db::Image::pointer image;
@@ -85,7 +85,7 @@ namespace lms::scanner
return image; return image;
} }
db::Image::pointer getImageFromMbid(SearchImageContext& searchContext, const core::UUID& mbid) db::Image::pointer getImageFromMbid(SearchArtistImageContext& searchContext, const core::UUID& mbid)
{ {
db::Image::pointer image; db::Image::pointer image;
@@ -98,7 +98,7 @@ namespace lms::scanner
return image; return image;
} }
db::Image::pointer searchImageInArtistInfoDirectory(SearchImageContext& searchContext, db::ArtistId artistId) db::Image::pointer searchImageInArtistInfoDirectory(SearchArtistImageContext& searchContext, db::ArtistId artistId)
{ {
db::Image::pointer image; db::Image::pointer image;
@@ -116,7 +116,7 @@ namespace lms::scanner
return image; return image;
} }
db::Image::pointer searchImageInDirectories(SearchImageContext& searchContext, db::ArtistId artistId) db::Image::pointer searchImageInDirectories(SearchArtistImageContext& searchContext, db::ArtistId artistId)
{ {
db::Image::pointer image; db::Image::pointer image;
@@ -169,7 +169,7 @@ namespace lms::scanner
return image; return image;
} }
db::Image::pointer computeBestArtistImage(SearchImageContext& searchContext, const db::Artist::pointer& artist) db::Image::pointer computeBestArtistImage(SearchArtistImageContext& searchContext, const db::Artist::pointer& artist)
{ {
db::Image::pointer image; db::Image::pointer image;
@@ -185,7 +185,7 @@ namespace lms::scanner
return image; return image;
} }
bool fetchNextArtistImagesToUpdate(SearchImageContext& searchContext, ArtistImageAssociationContainer& artistImageAssociations) bool fetchNextArtistImagesToUpdate(SearchArtistImageContext& searchContext, ArtistImageAssociationContainer& artistImageAssociations)
{ {
const db::ArtistId artistId{ searchContext.lastRetrievedArtistId }; const db::ArtistId artistId{ searchContext.lastRetrievedArtistId };
@@ -271,7 +271,7 @@ namespace lms::scanner
context.currentStepStats.totalElems = db::Artist::getCount(session); context.currentStepStats.totalElems = db::Artist::getCount(session);
} }
SearchImageContext searchContext{ SearchArtistImageContext searchContext{
.session = session, .session = session,
.lastRetrievedArtistId = {}, .lastRetrievedArtistId = {},
.artistFileNames = _artistFileNames, .artistFileNames = _artistFileNames,
@@ -32,9 +32,6 @@ namespace lms::scanner
{ {
namespace namespace
{ {
constexpr std::size_t readBatchSize{ 100 };
constexpr std::size_t writeBatchSize{ 20 };
struct TrackLyricsAssociation struct TrackLyricsAssociation
{ {
db::TrackLyricsId trackLyricsId; db::TrackLyricsId trackLyricsId;
@@ -83,6 +80,8 @@ namespace lms::scanner
bool fetchNextTrackLyricsToUpdate(SearchTrackLyricsContext& searchContext, TrackLyricsAssociationContainer& trackLyricsAssociations) bool fetchNextTrackLyricsToUpdate(SearchTrackLyricsContext& searchContext, TrackLyricsAssociationContainer& trackLyricsAssociations)
{ {
constexpr std::size_t readBatchSize{ 100 };
const db::TrackLyricsId trackLyricsId{ searchContext.lastRetrievedTrackLyricsId }; const db::TrackLyricsId trackLyricsId{ searchContext.lastRetrievedTrackLyricsId };
{ {
@@ -125,6 +124,8 @@ namespace lms::scanner
void updateTrackLyrics(db::Session& session, TrackLyricsAssociationContainer& lyricsAssociations) void updateTrackLyrics(db::Session& session, TrackLyricsAssociationContainer& lyricsAssociations)
{ {
constexpr std::size_t writeBatchSize{ 20 };
while (!lyricsAssociations.empty()) while (!lyricsAssociations.empty())
{ {
auto transaction{ session.createWriteTransaction() }; auto transaction{ session.createWriteTransaction() };
@@ -37,9 +37,6 @@ namespace lms::scanner
{ {
namespace namespace
{ {
constexpr std::size_t readBatchSize{ 20 };
constexpr std::size_t writeBatchSize{ 5 };
struct TrackInfo struct TrackInfo
{ {
db::TrackId trackId; db::TrackId trackId;
@@ -118,6 +115,8 @@ namespace lms::scanner
const db::PlayListFileId playListFileIdId{ searchContext.lastRetrievedPlayListFileId }; const db::PlayListFileId playListFileIdId{ searchContext.lastRetrievedPlayListFileId };
{ {
constexpr std::size_t readBatchSize{ 20 };
auto transaction{ searchContext.session.createReadTransaction() }; auto transaction{ searchContext.session.createReadTransaction() };
db::PlayListFile::find(searchContext.session, searchContext.lastRetrievedPlayListFileId, readBatchSize, [&](const db::PlayListFile::pointer& playListFile) { db::PlayListFile::find(searchContext.session, searchContext.lastRetrievedPlayListFileId, readBatchSize, [&](const db::PlayListFile::pointer& playListFile) {
@@ -199,6 +198,8 @@ namespace lms::scanner
void updatePlayListFiles(db::Session& session, PlayListFileAssociationContainer& playListFileAssociations) void updatePlayListFiles(db::Session& session, PlayListFileAssociationContainer& playListFileAssociations)
{ {
constexpr std::size_t writeBatchSize{ 5 };
while (!playListFileAssociations.empty()) while (!playListFileAssociations.empty())
{ {
auto transaction{ session.createWriteTransaction() }; auto transaction{ session.createWriteTransaction() };
@@ -38,9 +38,6 @@ namespace lms::scanner
{ {
namespace namespace
{ {
constexpr std::size_t readBatchSize{ 100 };
constexpr std::size_t writeBatchSize{ 20 };
struct ReleaseImageAssociation struct ReleaseImageAssociation
{ {
db::ReleaseId releaseId; db::ReleaseId releaseId;
@@ -48,7 +45,7 @@ namespace lms::scanner
}; };
using ReleaseImageAssociationContainer = std::deque<ReleaseImageAssociation>; using ReleaseImageAssociationContainer = std::deque<ReleaseImageAssociation>;
struct SearchImageContext struct SearchReleaseImageContext
{ {
db::Session& session; db::Session& session;
db::ReleaseId lastRetrievedReleaseId; db::ReleaseId lastRetrievedReleaseId;
@@ -56,7 +53,7 @@ namespace lms::scanner
const std::vector<std::string>& releaseFileNames; const std::vector<std::string>& releaseFileNames;
}; };
db::Image::pointer findImageInDirectory(SearchImageContext& searchContext, const std::filesystem::path& directoryPath) db::Image::pointer findImageInDirectory(SearchReleaseImageContext& searchContext, const std::filesystem::path& directoryPath)
{ {
db::Image::pointer image; db::Image::pointer image;
@@ -82,7 +79,7 @@ namespace lms::scanner
return image; return image;
} }
db::Image::pointer computeBestReleaseImage(SearchImageContext& searchContext, const db::Release::pointer& release) db::Image::pointer computeBestReleaseImage(SearchReleaseImageContext& searchContext, const db::Release::pointer& release)
{ {
db::Image::pointer image; db::Image::pointer image;
@@ -130,11 +127,13 @@ namespace lms::scanner
return image; return image;
} }
bool fetchNextReleaseImagesToUpdate(SearchImageContext& searchContext, ReleaseImageAssociationContainer& releaseImageAssociations) bool fetchNextReleaseImagesToUpdate(SearchReleaseImageContext& searchContext, ReleaseImageAssociationContainer& releaseImageAssociations)
{ {
const db::ReleaseId releaseId{ searchContext.lastRetrievedReleaseId }; const db::ReleaseId releaseId{ searchContext.lastRetrievedReleaseId };
{ {
constexpr std::size_t readBatchSize{ 100 };
auto transaction{ searchContext.session.createReadTransaction() }; auto transaction{ searchContext.session.createReadTransaction() };
db::Release::find(searchContext.session, searchContext.lastRetrievedReleaseId, readBatchSize, [&](const db::Release::pointer& release) { db::Release::find(searchContext.session, searchContext.lastRetrievedReleaseId, readBatchSize, [&](const db::Release::pointer& release) {
@@ -166,6 +165,8 @@ namespace lms::scanner
void updateReleaseImages(db::Session& session, ReleaseImageAssociationContainer& imageAssociations) void updateReleaseImages(db::Session& session, ReleaseImageAssociationContainer& imageAssociations)
{ {
constexpr std::size_t writeBatchSize{ 20 };
while (!imageAssociations.empty()) while (!imageAssociations.empty())
{ {
auto transaction{ session.createWriteTransaction() }; auto transaction{ session.createWriteTransaction() };
@@ -216,7 +217,7 @@ namespace lms::scanner
context.currentStepStats.totalElems = db::Release::getCount(session); context.currentStepStats.totalElems = db::Release::getCount(session);
} }
SearchImageContext searchContext{ SearchReleaseImageContext searchContext{
.session = session, .session = session,
.lastRetrievedReleaseId = {}, .lastRetrievedReleaseId = {},
.releaseFileNames = _releaseFileNames, .releaseFileNames = _releaseFileNames,
@@ -62,7 +62,7 @@ namespace lms::api::subsonic
return res; return res;
} }
ReleaseId getReleaseFromDirectory(Session& session, DirectoryId directory) ReleaseId getReleaseIdFromDirectory(Session& session, DirectoryId directory)
{ {
auto transaction{ session.createReadTransaction() }; auto transaction{ session.createReadTransaction() };
@@ -117,7 +117,7 @@ namespace lms::api::subsonic
for (const DirectoryId id : params.directoryIds) for (const DirectoryId id : params.directoryIds)
{ {
if (const ReleaseId releaseId{ getReleaseFromDirectory(context.dbSession, id) }; releaseId.isValid()) if (const ReleaseId releaseId{ getReleaseIdFromDirectory(context.dbSession, id) }; releaseId.isValid())
core::Service<feedback::IFeedbackService>::get()->star(context.user->getId(), releaseId); core::Service<feedback::IFeedbackService>::get()->star(context.user->getId(), releaseId);
} }
@@ -139,7 +139,7 @@ namespace lms::api::subsonic
for (const DirectoryId id : params.directoryIds) for (const DirectoryId id : params.directoryIds)
{ {
if (const ReleaseId releaseId{ getReleaseFromDirectory(context.dbSession, id) }; releaseId.isValid()) if (const ReleaseId releaseId{ getReleaseIdFromDirectory(context.dbSession, id) }; releaseId.isValid())
core::Service<feedback::IFeedbackService>::get()->unstar(context.user->getId(), releaseId); core::Service<feedback::IFeedbackService>::get()->unstar(context.user->getId(), releaseId);
} }
@@ -163,7 +163,7 @@ namespace lms::api::subsonic
core::Service<feedback::IFeedbackService>::get()->setRating(context.user->getId(), *artistId, params.rating); core::Service<feedback::IFeedbackService>::get()->setRating(context.user->getId(), *artistId, params.rating);
else if (const DirectoryId * directoryId{ std::get_if<DirectoryId>(&params.id) }) else if (const DirectoryId * directoryId{ std::get_if<DirectoryId>(&params.id) })
{ {
if (const ReleaseId releaseId{ getReleaseFromDirectory(context.dbSession, *directoryId) }; releaseId.isValid()) if (const ReleaseId releaseId{ getReleaseIdFromDirectory(context.dbSession, *directoryId) }; releaseId.isValid())
core::Service<feedback::IFeedbackService>::get()->setRating(context.user->getId(), releaseId, params.rating); core::Service<feedback::IFeedbackService>::get()->setRating(context.user->getId(), releaseId, params.rating);
} }
else if (const ReleaseId * releaseId{ std::get_if<ReleaseId>(&params.id) }) else if (const ReleaseId * releaseId{ std::get_if<ReleaseId>(&params.id) })
+6 -6
View File
@@ -45,16 +45,16 @@ namespace lms::ui
} }
} // namespace } // namespace
class ReportResource : public Wt::WResource class ScannerReportResource : public Wt::WResource
{ {
public: public:
ReportResource() = default; ScannerReportResource() = default;
~ReportResource() override ~ScannerReportResource() override
{ {
beingDeleted(); beingDeleted();
} }
ReportResource(const ReportResource&) = delete; ScannerReportResource(const ScannerReportResource&) = delete;
ReportResource& operator=(const ReportResource&) = delete; ScannerReportResource& operator=(const ScannerReportResource&) = delete;
void setScanStats(const scanner::ScanStats& stats) void setScanStats(const scanner::ScanStats& stats)
{ {
@@ -160,7 +160,7 @@ namespace lms::ui
{ {
_reportBtn = bindNew<Wt::WPushButton>("report-btn", Wt::WString::tr("Lms.Admin.ScannerController.get-report")); _reportBtn = bindNew<Wt::WPushButton>("report-btn", Wt::WString::tr("Lms.Admin.ScannerController.get-report"));
auto reportResource{ std::make_shared<ReportResource>() }; auto reportResource{ std::make_shared<ScannerReportResource>() };
reportResource->setTakesUpdateLock(true); reportResource->setTakesUpdateLock(true);
_reportResource = reportResource.get(); _reportResource = reportResource.get();
+1 -1
View File
@@ -42,6 +42,6 @@ namespace lms::ui
Wt::WLineEdit* _lastScanStatus; Wt::WLineEdit* _lastScanStatus;
Wt::WLineEdit* _status; Wt::WLineEdit* _status;
Wt::WLineEdit* _stepStatus; Wt::WLineEdit* _stepStatus;
class ReportResource* _reportResource; class ScannerReportResource* _reportResource;
}; };
} // namespace lms::ui } // namespace lms::ui
+6 -4
View File
@@ -34,18 +34,20 @@ namespace lms::ui
{ {
namespace namespace
{ {
class ReportResource : public Wt::WResource class TracingReportResource : public Wt::WResource
{ {
public: public:
ReportResource(core::tracing::ITraceLogger& traceLogger) TracingReportResource(core::tracing::ITraceLogger& traceLogger)
: _traceLogger{ traceLogger } : _traceLogger{ traceLogger }
{ {
} }
~ReportResource() ~TracingReportResource()
{ {
beingDeleted(); beingDeleted();
} }
TracingReportResource(const TracingReportResource&) = delete;
TracingReportResource& operator=(const TracingReportResource&) = delete;
void handleRequest(const Wt::Http::Request&, Wt::Http::Response& response) void handleRequest(const Wt::Http::Request&, Wt::Http::Response& response)
{ {
@@ -80,7 +82,7 @@ namespace lms::ui
if (auto traceLogger{ core::Service<core::tracing::ITraceLogger>::get() }) if (auto traceLogger{ core::Service<core::tracing::ITraceLogger>::get() })
{ {
Wt::WLink link{ std::make_shared<ReportResource>(*traceLogger) }; Wt::WLink link{ std::make_shared<TracingReportResource>(*traceLogger) };
link.setTarget(Wt::LinkTarget::NewWindow); link.setTarget(Wt::LinkTarget::NewWindow);
dumpBtn->setLink(link); dumpBtn->setLink(link);
} }
+7 -9
View File
@@ -36,8 +36,6 @@
namespace lms::ui namespace lms::ui
{ {
using namespace db;
Artists::Artists(Filters& filters) Artists::Artists(Filters& filters)
: Template{ Wt::WString::tr("Lms.Explore.Artists.template") } : Template{ Wt::WString::tr("Lms.Explore.Artists.template") }
, _artistCollector{ filters, _defaultSortMode, _maxCount } , _artistCollector{ filters, _defaultSortMode, _maxCount }
@@ -63,12 +61,12 @@ namespace lms::ui
} }
{ {
const std::optional<TrackArtistLinkType> linkType{ state::readValue<TrackArtistLinkType>("artists_link_type") }; const std::optional<db::TrackArtistLinkType> linkType{ state::readValue<db::TrackArtistLinkType>("artists_link_type") };
_artistCollector.setArtistLinkType(linkType); _artistCollector.setArtistLinkType(linkType);
TrackArtistLinkTypeSelector* linkTypeSelector{ bindNew<TrackArtistLinkTypeSelector>("link-type", linkType) }; TrackArtistLinkTypeSelector* linkTypeSelector{ bindNew<TrackArtistLinkTypeSelector>("link-type", linkType) };
linkTypeSelector->itemSelected.connect([this](std::optional<TrackArtistLinkType> newLinkType) { linkTypeSelector->itemSelected.connect([this](std::optional<db::TrackArtistLinkType> newLinkType) {
state::writeValue<TrackArtistLinkType>("artists_link_type", newLinkType); state::writeValue<db::TrackArtistLinkType>("artists_link_type", newLinkType);
refreshView(newLinkType); refreshView(newLinkType);
}); });
} }
@@ -97,7 +95,7 @@ namespace lms::ui
refreshView(); refreshView();
} }
void Artists::refreshView(std::optional<TrackArtistLinkType> linkType) void Artists::refreshView(std::optional<db::TrackArtistLinkType> linkType)
{ {
_artistCollector.setArtistLinkType(linkType); _artistCollector.setArtistLinkType(linkType);
refreshView(); refreshView();
@@ -111,14 +109,14 @@ namespace lms::ui
void Artists::addSome() void Artists::addSome()
{ {
const auto artistIds{ _artistCollector.get(Range{ static_cast<std::size_t>(_container->getCount()), _batchSize }) }; const auto artistIds{ _artistCollector.get(db::Range{ static_cast<std::size_t>(_container->getCount()), _batchSize }) };
{ {
auto transaction{ LmsApp->getDbSession().createReadTransaction() }; auto transaction{ LmsApp->getDbSession().createReadTransaction() };
for (const ArtistId artistId : artistIds.results) for (const db::ArtistId artistId : artistIds.results)
{ {
if (const auto artist{ Artist::find(LmsApp->getDbSession(), artistId) }) if (const auto artist{ db::Artist::find(LmsApp->getDbSession(), artistId) })
_container->add(ArtistListHelpers::createEntry(artist)); _container->add(ArtistListHelpers::createEntry(artist));
} }
} }
-1
View File
@@ -38,6 +38,5 @@ namespace lms::ui
private: private:
PlayQueueController _playQueueController; PlayQueueController _playQueueController;
SearchView* _search{};
}; };
} // namespace lms::ui } // namespace lms::ui
+17 -19
View File
@@ -31,16 +31,14 @@
namespace lms::ui namespace lms::ui
{ {
using namespace db; db::RangeResults<db::ReleaseId> ReleaseCollector::get(std::optional<db::Range> requestedRange)
RangeResults<ReleaseId> ReleaseCollector::get(std::optional<db::Range> requestedRange)
{ {
feedback::IFeedbackService& feedbackService{ *core::Service<feedback::IFeedbackService>::get() }; feedback::IFeedbackService& feedbackService{ *core::Service<feedback::IFeedbackService>::get() };
scrobbling::IScrobblingService& scrobblingService{ *core::Service<scrobbling::IScrobblingService>::get() }; scrobbling::IScrobblingService& scrobblingService{ *core::Service<scrobbling::IScrobblingService>::get() };
const Range range{ getActualRange(requestedRange) }; const db::Range range{ getActualRange(requestedRange) };
RangeResults<ReleaseId> releases; db::RangeResults<db::ReleaseId> releases;
switch (getMode()) switch (getMode())
{ {
@@ -85,45 +83,45 @@ namespace lms::ui
case Mode::RecentlyAdded: case Mode::RecentlyAdded:
{ {
Release::FindParameters params; db::Release::FindParameters params;
params.setFilters(getDbFilters()); params.setFilters(getDbFilters());
params.setKeywords(getSearchKeywords()); params.setKeywords(getSearchKeywords());
params.setSortMethod(ReleaseSortMethod::AddedDesc); params.setSortMethod(db::ReleaseSortMethod::AddedDesc);
params.setRange(range); params.setRange(range);
{ {
auto transaction{ LmsApp->getDbSession().createReadTransaction() }; auto transaction{ LmsApp->getDbSession().createReadTransaction() };
releases = Release::findIds(LmsApp->getDbSession(), params); releases = db::Release::findIds(LmsApp->getDbSession(), params);
} }
break; break;
} }
case Mode::RecentlyModified: case Mode::RecentlyModified:
{ {
Release::FindParameters params; db::Release::FindParameters params;
params.setFilters(getDbFilters()); params.setFilters(getDbFilters());
params.setKeywords(getSearchKeywords()); params.setKeywords(getSearchKeywords());
params.setSortMethod(ReleaseSortMethod::LastWrittenDesc); params.setSortMethod(db::ReleaseSortMethod::LastWrittenDesc);
params.setRange(range); params.setRange(range);
{ {
auto transaction{ LmsApp->getDbSession().createReadTransaction() }; auto transaction{ LmsApp->getDbSession().createReadTransaction() };
releases = Release::findIds(LmsApp->getDbSession(), params); releases = db::Release::findIds(LmsApp->getDbSession(), params);
} }
break; break;
} }
case Mode::All: case Mode::All:
{ {
Release::FindParameters params; db::Release::FindParameters params;
params.setFilters(getDbFilters()); params.setFilters(getDbFilters());
params.setSortMethod(ReleaseSortMethod::SortName); params.setSortMethod(db::ReleaseSortMethod::SortName);
params.setKeywords(getSearchKeywords()); params.setKeywords(getSearchKeywords());
params.setRange(range); params.setRange(range);
{ {
auto transaction{ LmsApp->getDbSession().createReadTransaction() }; auto transaction{ LmsApp->getDbSession().createReadTransaction() };
releases = Release::findIds(LmsApp->getDbSession(), params); releases = db::Release::findIds(LmsApp->getDbSession(), params);
} }
break; break;
} }
@@ -135,21 +133,21 @@ namespace lms::ui
return releases; return releases;
} }
RangeResults<ReleaseId> ReleaseCollector::getRandomReleases(Range range) db::RangeResults<db::ReleaseId> ReleaseCollector::getRandomReleases(Range range)
{ {
assert(getMode() == Mode::Random); assert(getMode() == Mode::Random);
if (!_randomReleases) if (!_randomReleases)
{ {
Release::FindParameters params; db::Release::FindParameters params;
params.setFilters(getDbFilters()); params.setFilters(getDbFilters());
params.setKeywords(getSearchKeywords()); params.setKeywords(getSearchKeywords());
params.setSortMethod(ReleaseSortMethod::Random); params.setSortMethod(db::ReleaseSortMethod::Random);
params.setRange(Range{ 0, getMaxCount() }); params.setRange(db::Range{ 0, getMaxCount() });
{ {
auto transaction{ LmsApp->getDbSession().createReadTransaction() }; auto transaction{ LmsApp->getDbSession().createReadTransaction() };
_randomReleases = Release::findIds(LmsApp->getDbSession(), params); _randomReleases = db::Release::findIds(LmsApp->getDbSession(), params);
} }
} }
+20 -22
View File
@@ -47,26 +47,24 @@
namespace lms::ui::TrackListHelpers namespace lms::ui::TrackListHelpers
{ {
using namespace db; std::map<Wt::WString, std::set<db::ArtistId>> getArtistsByRole(db::TrackId trackId, core::EnumSet<db::TrackArtistLinkType> artistLinkTypes)
std::map<Wt::WString, std::set<ArtistId>> getArtistsByRole(db::TrackId trackId, core::EnumSet<db::TrackArtistLinkType> artistLinkTypes)
{ {
std::map<Wt::WString, std::set<ArtistId>> artistMap; std::map<Wt::WString, std::set<db::ArtistId>> artistMap;
auto addArtists = [&](TrackArtistLinkType linkType, const char* type) { auto addArtists = [&](db::TrackArtistLinkType linkType, const char* type) {
if (!artistLinkTypes.contains(linkType)) if (!artistLinkTypes.contains(linkType))
return; return;
Artist::FindParameters params; db::Artist::FindParameters params;
params.setTrack(trackId); params.setTrack(trackId);
params.setLinkType(linkType); params.setLinkType(linkType);
const auto artistIds{ Artist::findIds(LmsApp->getDbSession(), params) }; const auto artistIds{ db::Artist::findIds(LmsApp->getDbSession(), params) };
if (artistIds.results.empty()) if (artistIds.results.empty())
return; return;
Wt::WString typeStr{ Wt::WString::trn(type, artistIds.results.size()) }; Wt::WString typeStr{ Wt::WString::trn(type, artistIds.results.size()) };
for (ArtistId artistId : artistIds.results) for (db::ArtistId artistId : artistIds.results)
artistMap[typeStr].insert(artistId); artistMap[typeStr].insert(artistId);
}; };
@@ -74,21 +72,21 @@ namespace lms::ui::TrackListHelpers
if (!artistLinkTypes.contains(db::TrackArtistLinkType::Performer)) if (!artistLinkTypes.contains(db::TrackArtistLinkType::Performer))
return; return;
TrackArtistLink::FindParameters params; db::TrackArtistLink::FindParameters params;
params.setTrack(trackId); params.setTrack(trackId);
params.setLinkType(TrackArtistLinkType::Performer); params.setLinkType(db::TrackArtistLinkType::Performer);
TrackArtistLink::find(LmsApp->getDbSession(), params, [&](const TrackArtistLink::pointer& link) { db::TrackArtistLink::find(LmsApp->getDbSession(), params, [&](const db::TrackArtistLink::pointer& link) {
artistMap[std::string{ link->getSubType() }].insert(link->getArtist()->getId()); artistMap[std::string{ link->getSubType() }].insert(link->getArtist()->getId());
}); });
}; };
addArtists(TrackArtistLinkType::Composer, "Lms.Explore.Artists.linktype-composer"); addArtists(db::TrackArtistLinkType::Composer, "Lms.Explore.Artists.linktype-composer");
addArtists(TrackArtistLinkType::Conductor, "Lms.Explore.Artists.linktype-conductor"); addArtists(db::TrackArtistLinkType::Conductor, "Lms.Explore.Artists.linktype-conductor");
addArtists(TrackArtistLinkType::Lyricist, "Lms.Explore.Artists.linktype-lyricist"); addArtists(db::TrackArtistLinkType::Lyricist, "Lms.Explore.Artists.linktype-lyricist");
addArtists(TrackArtistLinkType::Mixer, "Lms.Explore.Artists.linktype-mixer"); addArtists(db::TrackArtistLinkType::Mixer, "Lms.Explore.Artists.linktype-mixer");
addArtists(TrackArtistLinkType::Remixer, "Lms.Explore.Artists.linktype-remixer"); addArtists(db::TrackArtistLinkType::Remixer, "Lms.Explore.Artists.linktype-remixer");
addArtists(TrackArtistLinkType::Producer, "Lms.Explore.Artists.linktype-producer"); addArtists(db::TrackArtistLinkType::Producer, "Lms.Explore.Artists.linktype-producer");
addPerformerArtists(); addPerformerArtists();
if (auto itRolelessPerformers{ artistMap.find("") }; itRolelessPerformers != std::cend(artistMap)) if (auto itRolelessPerformers{ artistMap.find("") }; itRolelessPerformers != std::cend(artistMap))
@@ -105,7 +103,7 @@ namespace lms::ui::TrackListHelpers
{ {
auto transaction{ LmsApp->getDbSession().createReadTransaction() }; auto transaction{ LmsApp->getDbSession().createReadTransaction() };
const db::Track::pointer track{ Track::find(LmsApp->getDbSession(), trackId) }; const db::Track::pointer track{ db::Track::find(LmsApp->getDbSession(), trackId) };
if (!track) if (!track)
return; return;
@@ -113,7 +111,7 @@ namespace lms::ui::TrackListHelpers
Wt::WWidget* trackInfoPtr{ trackInfo.get() }; Wt::WWidget* trackInfoPtr{ trackInfo.get() };
trackInfo->addFunction("tr", &Wt::WTemplate::Functions::tr); trackInfo->addFunction("tr", &Wt::WTemplate::Functions::tr);
std::map<Wt::WString, std::set<ArtistId>> artistMap{ getArtistsByRole(trackId) }; std::map<Wt::WString, std::set<db::ArtistId>> artistMap{ getArtistsByRole(trackId) };
if (!artistMap.empty()) if (!artistMap.empty())
{ {
trackInfo->setCondition("if-has-artist", true); trackInfo->setCondition("if-has-artist", true);
@@ -219,10 +217,10 @@ namespace lms::ui::TrackListHelpers
entry->bindString("name", Wt::WString::fromUTF8(track->getName()), Wt::TextFormat::Plain); entry->bindString("name", Wt::WString::fromUTF8(track->getName()), Wt::TextFormat::Plain);
const Release::pointer release{ track->getRelease() }; const db::Release::pointer release{ track->getRelease() };
const TrackId trackId{ track->getId() }; const db::TrackId trackId{ track->getId() };
const auto artists{ track->getArtistIds({ TrackArtistLinkType::Artist }) }; const auto artists{ track->getArtistIds({ db::TrackArtistLinkType::Artist }) };
if (!artists.empty()) if (!artists.empty())
{ {
entry->setCondition("if-has-artists", true); entry->setCondition("if-has-artists", true);
+11 -13
View File
@@ -35,8 +35,6 @@
namespace lms::ui namespace lms::ui
{ {
using namespace db;
TrackLists::TrackLists(Filters& filters) TrackLists::TrackLists(Filters& filters)
: Template{ Wt::WString::tr("Lms.Explore.TrackLists.template") } : Template{ Wt::WString::tr("Lms.Explore.TrackLists.template") }
, _filters{ filters } , _filters{ filters }
@@ -111,17 +109,17 @@ namespace lms::ui
void TrackLists::addSome() void TrackLists::addSome()
{ {
const Range range{ static_cast<std::size_t>(_container->getCount()), _batchSize }; const db::Range range{ static_cast<std::size_t>(_container->getCount()), _batchSize };
Session& session{ LmsApp->getDbSession() }; db::Session& session{ LmsApp->getDbSession() };
auto transaction{ session.createReadTransaction() }; auto transaction{ session.createReadTransaction() };
TrackList::FindParameters params; db::TrackList::FindParameters params;
if (!_searchText.empty()) if (!_searchText.empty())
params.setKeywords(core::stringUtils::splitString(_searchText, ' ')); params.setKeywords(core::stringUtils::splitString(_searchText, ' '));
params.setFilters(_filters.getDbFilters()); params.setFilters(_filters.getDbFilters());
params.setType(TrackListType::PlayList); params.setType(db::TrackListType::PlayList);
params.setRange(range); params.setRange(range);
switch (_type) switch (_type)
@@ -139,26 +137,26 @@ namespace lms::ui
switch (_sortMode) switch (_sortMode)
{ {
case SortMode::All: case SortMode::All:
params.setSortMethod(TrackListSortMethod::Name); params.setSortMethod(db::TrackListSortMethod::Name);
break; break;
case SortMode::RecentlyModified: case SortMode::RecentlyModified:
params.setSortMethod(TrackListSortMethod::LastModifiedDesc); params.setSortMethod(db::TrackListSortMethod::LastModifiedDesc);
break; break;
} }
const auto trackListIds{ TrackList::find(session, params) }; const auto trackListIds{ db::TrackList::find(session, params) };
for (const TrackListId trackListId : trackListIds.results) for (const db::TrackListId trackListId : trackListIds.results)
{ {
if (const TrackList::pointer trackList{ TrackList::find(LmsApp->getDbSession(), trackListId) }) if (const db::TrackList::pointer trackList{ db::TrackList::find(LmsApp->getDbSession(), trackListId) })
addTracklist(trackList); addTracklist(trackList);
} }
_container->setHasMore(trackListIds.moreResults); _container->setHasMore(trackListIds.moreResults);
} }
void TrackLists::addTracklist(const ObjectPtr<TrackList>& trackList) void TrackLists::addTracklist(const db::ObjectPtr<db::TrackList>& trackList)
{ {
const TrackListId trackListId{ trackList->getId() }; const db::TrackListId trackListId{ trackList->getId() };
WTemplate* entry{ _container->addNew<Template>(Wt::WString::tr("Lms.Explore.TrackLists.template.entry")) }; WTemplate* entry{ _container->addNew<Template>(Wt::WString::tr("Lms.Explore.TrackLists.template.entry")) };
entry->bindWidget("name", utils::createTrackListAnchor(trackList)); entry->bindWidget("name", utils::createTrackListAnchor(trackList));
-1
View File
@@ -71,7 +71,6 @@ namespace lms::ui
Type _type{ _defaultType }; Type _type{ _defaultType };
std::string _searchText; std::string _searchText;
Filters& _filters; Filters& _filters;
Wt::WWidget* _currentActiveItem{};
InfiniteScrollingContainer* _container{}; InfiniteScrollingContainer* _container{};
std::unordered_map<db::TrackListId, Wt::WWidget*> _trackListWidgets; std::unordered_map<db::TrackListId, Wt::WWidget*> _trackListWidgets;
}; };
+2 -2
View File
@@ -37,7 +37,7 @@
#include "LmsApplication.hpp" #include "LmsApplication.hpp"
#define LOG(severity, message) LMS_LOG(UI, severity, "Image resource: " << message) #define ARTWORK_RESOURCE_LOG(severity, message) LMS_LOG(UI, severity, "Image resource: " << message)
namespace lms::ui namespace lms::ui
{ {
@@ -190,7 +190,7 @@ namespace lms::ui
const auto size{ sizeStr ? core::stringUtils::readAs<std::size_t>(*sizeStr) : std::nullopt }; const auto size{ sizeStr ? core::stringUtils::readAs<std::size_t>(*sizeStr) : std::nullopt };
if (size && *size > maxSize) if (size && *size > maxSize)
{ {
LOG(DEBUG, "invalid size provided!"); ARTWORK_RESOURCE_LOG(DEBUG, "invalid size provided!");
return; return;
} }
+4 -4
View File
@@ -32,7 +32,7 @@
namespace lms::ui namespace lms::ui
{ {
#define LOG(severity, message) LMS_LOG(UI, severity, "Audio file resource: " << message) #define AUDIO_RESOURCE_LOG(severity, message) LMS_LOG(UI, severity, "Audio file resource: " << message)
namespace namespace
{ {
@@ -43,7 +43,7 @@ namespace lms::ui
const db::Track::pointer track{ db::Track::find(LmsApp->getDbSession(), trackId) }; const db::Track::pointer track{ db::Track::find(LmsApp->getDbSession(), trackId) };
if (!track) if (!track)
{ {
LOG(ERROR, "Missing track"); AUDIO_RESOURCE_LOG(ERROR, "Missing track");
return std::nullopt; return std::nullopt;
} }
@@ -55,14 +55,14 @@ namespace lms::ui
const std::string* trackIdParameter{ request.getParameter("trackid") }; const std::string* trackIdParameter{ request.getParameter("trackid") };
if (!trackIdParameter) if (!trackIdParameter)
{ {
LOG(ERROR, "Missing trackid URL parameter!"); AUDIO_RESOURCE_LOG(ERROR, "Missing trackid URL parameter!");
return std::nullopt; return std::nullopt;
} }
const std::optional<db::TrackId> trackId{ core::stringUtils::readAs<db::TrackId::ValueType>(*trackIdParameter) }; const std::optional<db::TrackId> trackId{ core::stringUtils::readAs<db::TrackId::ValueType>(*trackIdParameter) };
if (!trackId) if (!trackId)
{ {
LOG(ERROR, "Bad trackid URL parameter!"); AUDIO_RESOURCE_LOG(ERROR, "Bad trackid URL parameter!");
return std::nullopt; return std::nullopt;
} }
@@ -34,7 +34,7 @@
#include "LmsApplication.hpp" #include "LmsApplication.hpp"
#define LOG(severity, message) LMS_LOG(UI, severity, "Audio transcode resource: " << message) #define TRANSCODE_LOG(severity, message) LMS_LOG(UI, severity, "Audio transcode resource: " << message)
namespace lms::core::stringUtils namespace lms::core::stringUtils
{ {
@@ -62,7 +62,7 @@ namespace lms::core::stringUtils
return format; return format;
} }
LOG(ERROR, "Cannot determine audio format from value '" << str << "'"); TRANSCODE_LOG(ERROR, "Cannot determine audio format from value '" << str << "'");
return std::nullopt; return std::nullopt;
} }
@@ -88,7 +88,7 @@ namespace lms::ui
return av::transcoding::OutputFormat::WEBM_VORBIS; return av::transcoding::OutputFormat::WEBM_VORBIS;
} }
LOG(ERROR, "Cannot convert from audio format to AV format"); TRANSCODE_LOG(ERROR, "Cannot convert from audio format to AV format");
return std::nullopt; return std::nullopt;
} }
@@ -99,13 +99,13 @@ namespace lms::ui
auto paramStr{ request.getParameter(parameterName) }; auto paramStr{ request.getParameter(parameterName) };
if (!paramStr) if (!paramStr)
{ {
LOG(DEBUG, "Missing parameter '" << parameterName << "'"); TRANSCODE_LOG(DEBUG, "Missing parameter '" << parameterName << "'");
return std::nullopt; return std::nullopt;
} }
auto res{ core::stringUtils::readAs<T>(*paramStr) }; auto res{ core::stringUtils::readAs<T>(*paramStr) };
if (!res) if (!res)
LOG(ERROR, "Cannot parse parameter '" << parameterName << "' from value '" << *paramStr << "'"); TRANSCODE_LOG(ERROR, "Cannot parse parameter '" << parameterName << "' from value '" << *paramStr << "'");
return res; return res;
} }
@@ -130,7 +130,7 @@ namespace lms::ui
if (!db::isAudioBitrateAllowed(*bitrate)) if (!db::isAudioBitrateAllowed(*bitrate))
{ {
LOG(ERROR, "Bitrate '" << *bitrate << "' is not allowed"); TRANSCODE_LOG(ERROR, "Bitrate '" << *bitrate << "' is not allowed");
return std::nullopt; return std::nullopt;
} }
@@ -148,7 +148,7 @@ namespace lms::ui
const db::Track::pointer track{ db::Track::find(LmsApp->getDbSession(), *trackId) }; const db::Track::pointer track{ db::Track::find(LmsApp->getDbSession(), *trackId) };
if (!track) if (!track)
{ {
LOG(ERROR, "Missing track"); TRANSCODE_LOG(ERROR, "Missing track");
return std::nullopt; return std::nullopt;
} }
@@ -201,7 +201,7 @@ namespace lms::ui
} }
catch (const av::Exception& e) catch (const av::Exception& e)
{ {
LOG(ERROR, "Caught Av exception: " << e.what()); TRANSCODE_LOG(ERROR, "Caught Av exception: " << e.what());
} }
} }
+3 -3
View File
@@ -31,7 +31,7 @@
#include "LmsApplication.hpp" #include "LmsApplication.hpp"
#define LOG(severity, message) LMS_LOG(UI, severity, "Download resource: " << message) #define DL_RESOURCE_LOG(severity, message) LMS_LOG(UI, severity, "Download resource: " << message)
namespace lms::ui namespace lms::ui
{ {
@@ -71,7 +71,7 @@ namespace lms::ui
} }
catch (zip::Exception& exception) catch (zip::Exception& exception)
{ {
LOG(ERROR, "Zipper exception: " << exception.what()); DL_RESOURCE_LOG(ERROR, "Zipper exception: " << exception.what());
} }
} }
@@ -220,7 +220,7 @@ namespace lms::ui
const db::Track::pointer track{ db::Track::find(LmsApp->getDbSession(), _trackId) }; const db::Track::pointer track{ db::Track::find(LmsApp->getDbSession(), _trackId) };
if (!track) if (!track)
{ {
LOG(DEBUG, "Cannot find track"); DL_RESOURCE_LOG(DEBUG, "Cannot find track");
return {}; return {};
} }