Added a scan step to scan artist images, ref #435
This commit is contained in:
@@ -76,6 +76,22 @@ namespace lms::core::stringUtils
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
template<>
|
||||
std::optional<db::ImageId> readAs(std::string_view str)
|
||||
{
|
||||
std::vector<std::string_view> values{ core::stringUtils::splitString(str, '-') };
|
||||
if (values.size() != 2)
|
||||
return std::nullopt;
|
||||
|
||||
if (values[0] != "im")
|
||||
return std::nullopt;
|
||||
|
||||
if (const auto value{ core::stringUtils::readAs<db::ImageId::ValueType>(values[1]) })
|
||||
return db::ImageId{ *value };
|
||||
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
template<>
|
||||
std::optional<db::MediaLibraryId> readAs(std::string_view str)
|
||||
{
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
#include "core/String.hpp"
|
||||
#include "database/ArtistId.hpp"
|
||||
#include "database/ImageId.hpp"
|
||||
#include "database/MediaLibraryId.hpp"
|
||||
#include "database/ReleaseId.hpp"
|
||||
#include "database/TrackId.hpp"
|
||||
@@ -33,6 +34,7 @@ namespace lms::api::subsonic
|
||||
};
|
||||
|
||||
std::string idToString(db::ArtistId id);
|
||||
std::string idToString(db::ImageId id);
|
||||
std::string idToString(db::MediaLibraryId id);
|
||||
std::string idToString(db::ReleaseId id);
|
||||
std::string idToString(db::TrackId id);
|
||||
@@ -49,6 +51,9 @@ namespace lms::core::stringUtils
|
||||
template<>
|
||||
std::optional<db::ArtistId> readAs(std::string_view str);
|
||||
|
||||
template<>
|
||||
std::optional<db::ImageId> readAs(std::string_view str);
|
||||
|
||||
template<>
|
||||
std::optional<db::MediaLibraryId> readAs(std::string_view str);
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace lms::api::subsonic::Scan
|
||||
{
|
||||
std::size_t count{};
|
||||
|
||||
if (scanStatus.currentScanStepStats && scanStatus.currentScanStepStats->currentStep == ScanStep::ScanFiles)
|
||||
if (scanStatus.currentScanStepStats && scanStatus.currentScanStepStats->currentStep == ScanStep::ScanAudioFiles)
|
||||
count = scanStatus.currentScanStepStats->processedElems;
|
||||
|
||||
statusResponse.setAttribute("count", count);
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "core/Service.hpp"
|
||||
#include "core/String.hpp"
|
||||
#include "database/Artist.hpp"
|
||||
#include "database/Image.hpp"
|
||||
#include "database/Release.hpp"
|
||||
#include "database/TrackArtistLink.hpp"
|
||||
#include "database/User.hpp"
|
||||
@@ -92,7 +93,8 @@ namespace lms::api::subsonic
|
||||
|
||||
artistNode.setAttribute("id", idToString(artist->getId()));
|
||||
artistNode.setAttribute("name", artist->getName());
|
||||
artistNode.setAttribute("coverArt", idToString(artist->getId()));
|
||||
if (const db::Image::pointer artistImage{ artist->getImage() })
|
||||
artistNode.setAttribute("coverArt", idToString(artist->getId()));
|
||||
|
||||
if (id3)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user