Merge branch 'develop' for release v3.29.1

This commit is contained in:
emeric
2022-05-28 19:35:41 +02:00
11 changed files with 81 additions and 24 deletions
@@ -1,4 +1,4 @@
name: Build
name: Build (alpine)
on: [push, pull_request]
jobs:
Build:
@@ -22,11 +22,11 @@ jobs:
id: buildx
uses: docker/setup-buildx-action@v1
- name: Build
- name: Build (alpine)
uses: docker/build-push-action@v2
with:
context: ./
file: ./Dockerfile-build
file: ./Dockerfile-build-alpine
builder: ${{ steps.buildx.outputs.name }}
build-args: LMS_BUILD_TYPE=${{ matrix.BUILD_TYPE }}
push: false
+34
View File
@@ -0,0 +1,34 @@
name: Build (arch)
on: [push, pull_request]
jobs:
Build:
strategy:
matrix:
BUILD_TYPE: [Release, Debug]
runs-on: ubuntu-latest
steps:
- name: Check Out Repo
uses: actions/checkout@v2
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Build
uses: docker/build-push-action@v2
with:
context: ./
file: ./Dockerfile-build-arch
builder: ${{ steps.buildx.outputs.name }}
build-args: LMS_BUILD_TYPE=${{ matrix.BUILD_TYPE }}
push: false
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
+26
View File
@@ -0,0 +1,26 @@
FROM archlinux:latest
ARG BUILD_PACKAGES="\
clang \
cmake \
boost \
ffmpeg \
gtest \
graphicsmagick \
libconfig \
make \
pkgconfig \
taglib \
wt"
RUN pacman -Syy
RUN pacman -S --noconfirm ${BUILD_PACKAGES}
# LMS
COPY . /tmp/lms/
ARG LMS_BUILD_TYPE="Release"
RUN \
DIR=/tmp/lms/build && mkdir -p ${DIR} && cd ${DIR} && \
cmake /tmp/lms/ -DCMAKE_BUILD_TYPE=${LMS_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX=/usr && \
VERBOSE=1 make -j$(nproc) && \
make test
+2 -2
View File
@@ -1,4 +1,4 @@
FROM alpine:3.16 AS build
FROM alpine:3.14 AS build
WORKDIR /tmp/workdir
@@ -132,7 +132,7 @@ RUN \
rm -rf /tmp/fakeroot/share/Wt/resources/themes
## Release Stage
FROM alpine:3.16 AS release
FROM alpine:3.14 AS release
LABEL maintainer="Emeric Poupon <itmfr@yahoo.fr>"
ARG RUNTIME_PACKAGES=" \
@@ -67,7 +67,12 @@ std::vector<std::filesystem::path>
ScanSettings::getAudioFileExtensions() const
{
const auto extensions {StringUtils::splitString(_audioFileExtensions, " ")};
return std::vector<std::filesystem::path>(std::cbegin(extensions), std::cend(extensions));
std::vector<std::filesystem::path> res (std::cbegin(extensions), std::cend(extensions));
std::sort(std::begin(res), std::end(res));
res.erase(std::unique( std::begin(res), std::end(res)), std::end(res));
return res;
}
void
@@ -213,7 +213,7 @@ FeaturesEngine::loadFromTraining(const TrainSettings& trainSettings, const Progr
}
void
FeaturesEngine::loadFromCache(FeaturesEngineCache cache)
FeaturesEngine::loadFromCache(FeaturesEngineCache&& cache)
{
LMS_LOG(RECOMMENDATION, INFO) << "Constructing features classifier from cache...";
@@ -341,9 +341,9 @@ FeaturesEngine::load(bool forceReload, const ProgressCallback& progressCallback)
{
FeaturesEngineCache::invalidate();
}
else if (const std::optional<FeaturesEngineCache> cache {FeaturesEngineCache::read()})
else if (std::optional<FeaturesEngineCache> cache {FeaturesEngineCache::read()})
{
loadFromCache(*cache);
loadFromCache(std::move(*cache));
return;
}
@@ -63,7 +63,7 @@ class FeaturesEngine : public IEngine
ReleaseContainer getSimilarReleases(Database::ReleaseId releaseId, std::size_t maxCount) const override;
ArtistContainer getSimilarArtists(Database::ArtistId artistId, EnumSet<Database::TrackArtistLinkType> linkTypes, std::size_t maxCount) const override;
void loadFromCache(FeaturesEngineCache cache);
void loadFromCache(FeaturesEngineCache&& cache);
// Use training (may be very slow)
struct TrainSettings
@@ -69,11 +69,11 @@ getNextFirstOfMonth(Wt::WDate current)
}
bool
isFileSupported(const std::filesystem::path& file, const std::unordered_set<std::filesystem::path>& extensions)
isFileSupported(const std::filesystem::path& file, const std::vector<std::filesystem::path>& extensions)
{
const std::filesystem::path extension {StringUtils::stringToLower(file.extension().string())};
return (extensions.find(extension) != extensions.end());
return (std::find(std::cbegin(extensions), std::cend(extensions), extension) != std::cend(extensions));
}
bool
@@ -642,7 +642,7 @@ ScannerService::refreshScanSettings()
{
const auto fileExtensions {scanSettings->getAudioFileExtensions()};
_fileExtensions.clear();
std::transform(std::cbegin(fileExtensions), std::end(fileExtensions), std::inserter(_fileExtensions, std::begin(_fileExtensions)),
std::transform(std::cbegin(fileExtensions), std::end(fileExtensions), std::back_inserter(_fileExtensions),
[](const std::filesystem::path& extension) { return std::filesystem::path{ StringUtils::stringToLower(extension.string()) }; });
}
_mediaDirectory = scanSettings->getMediaDirectory();
@@ -896,7 +896,7 @@ ScannerService::scanMediaDirectory(const std::filesystem::path& mediaDirectory,
// Check if a file exists and is still in a media directory
static bool
checkFile(const std::filesystem::path& p, const std::filesystem::path& mediaDirectory, const std::unordered_set<std::filesystem::path>& extensions)
checkFile(const std::filesystem::path& p, const std::filesystem::path& mediaDirectory, const std::vector<std::filesystem::path>& extensions)
{
try
{
@@ -22,7 +22,7 @@
#include <chrono>
#include <shared_mutex>
#include <optional>
#include <unordered_set>
#include <vector>
#include <Wt/WDateTime.h>
#include <Wt/WIOService.h>
@@ -114,7 +114,7 @@ namespace Scanner
std::size_t _scanVersion {};
Wt::WTime _startTime;
Database::ScanSettings::UpdatePeriod _updatePeriod {Database::ScanSettings::UpdatePeriod::Never};
std::unordered_set<std::filesystem::path> _fileExtensions;
std::vector<std::filesystem::path> _fileExtensions;
std::filesystem::path _mediaDirectory;
Database::ScanSettings::RecommendationEngineType _recommendationServiceType;
};
-8
View File
@@ -38,11 +38,3 @@ Wt::WDateTime getLastWriteTime(const std::filesystem::path& dir);
// returns false if aborted by user
bool exploreFilesRecursive(const std::filesystem::path& directory, std::function<bool(std::error_code, const std::filesystem::path&)> cb, const std::filesystem::path& excludeDirFileName = {});
namespace std
{
template <>
struct hash<std::filesystem::path>
{
inline std::size_t operator()(const std::filesystem::path &path) const { return hash_value(path); }
};
}