More relaxed search for artist images, fixes #538
This commit is contained in:
@@ -108,14 +108,30 @@ namespace lms::scanner
|
||||
releasePaths.insert(directory->getAbsolutePath());
|
||||
});
|
||||
|
||||
if (!releasePaths.empty())
|
||||
{
|
||||
// Expect layout like this:
|
||||
// ReleaseArtist/Release/Tracks'
|
||||
// /artist.jpg
|
||||
// /someOtherUserConfiguredArtistFile.jpg
|
||||
if (!releasePaths.empty())
|
||||
//
|
||||
// Or:
|
||||
// ReleaseArtist/SomeGrouping/Release/Tracks'
|
||||
// /artist.jpg
|
||||
// /someOtherUserConfiguredArtistFile.jpg
|
||||
//
|
||||
std::filesystem::path directoryToInspect{ core::pathUtils::getLongestCommonPath(std::cbegin(releasePaths), std::cend(releasePaths)) };
|
||||
while (true)
|
||||
{
|
||||
const std::filesystem::path artistPath{ releasePaths.size() == 1 ? releasePaths.begin()->parent_path() : core::pathUtils::getLongestCommonPath(std::cbegin(releasePaths), std::cend(releasePaths)) };
|
||||
image = findImageInDirectory(searchContext, artistPath);
|
||||
image = findImageInDirectory(searchContext, directoryToInspect);
|
||||
if (image)
|
||||
break;
|
||||
|
||||
std::filesystem::path parentPath{ directoryToInspect.parent_path() };
|
||||
if (parentPath == directoryToInspect)
|
||||
break;
|
||||
|
||||
directoryToInspect = parentPath;
|
||||
}
|
||||
|
||||
if (!image)
|
||||
@@ -132,6 +148,7 @@ namespace lms::scanner
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ namespace lms::scanner
|
||||
// and still belongs to a media directory
|
||||
if (!std::filesystem::exists(p) || !std::filesystem::is_regular_file(p))
|
||||
{
|
||||
LMS_LOG(DBUPDATER, INFO, "Removing '" << p.string() << "': missing");
|
||||
LMS_LOG(DBUPDATER, DEBUG, "Removing '" << p.string() << "': missing");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -128,13 +128,13 @@ namespace lms::scanner
|
||||
return core::pathUtils::isPathInRootPath(p, libraryInfo.rootDirectory, &excludeDirFileName);
|
||||
}))
|
||||
{
|
||||
LMS_LOG(DBUPDATER, INFO, "Removing '" << p.string() << "': out of media directory");
|
||||
LMS_LOG(DBUPDATER, DEBUG, "Removing '" << p.string() << "': out of media directory");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!core::pathUtils::hasFileAnyExtension(p, allowedExtensions))
|
||||
{
|
||||
LMS_LOG(DBUPDATER, INFO, "Removing '" << p.string() << "': file format no longer handled");
|
||||
LMS_LOG(DBUPDATER, DEBUG, "Removing '" << p.string() << "': file format no longer handled");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user