Removed obsolete func
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
|
||||
#include "SendQueue.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <latch>
|
||||
|
||||
#include <boost/asio/bind_executor.hpp>
|
||||
@@ -308,7 +309,7 @@ namespace lms::core::http
|
||||
|
||||
void SendQueue::throttle(std::chrono::seconds requestedDuration)
|
||||
{
|
||||
const std::chrono::seconds duration{ clamp(requestedDuration, _minRetryWaitDuration, _maxRetryWaitDuration) };
|
||||
const std::chrono::seconds duration{ std::clamp(requestedDuration, _minRetryWaitDuration, _maxRetryWaitDuration) };
|
||||
LOG(DEBUG, "Throttling for " << duration.count() << " seconds");
|
||||
|
||||
_throttleTimer.expires_after(duration);
|
||||
|
||||
@@ -24,19 +24,16 @@
|
||||
|
||||
namespace lms::core::utils
|
||||
{
|
||||
template<class T, class Compare = std::less<>>
|
||||
constexpr T clamp(T v, T lo, T hi, Compare comp = {})
|
||||
{
|
||||
assert(!comp(hi, lo));
|
||||
return comp(v, lo) ? lo : comp(hi, v) ? hi :
|
||||
v;
|
||||
}
|
||||
|
||||
template<typename Container, typename T>
|
||||
void
|
||||
push_back_if_not_present(Container& container, const T& val)
|
||||
void push_back_if_not_present(Container& container, const T& val)
|
||||
{
|
||||
if (std::find(std::cbegin(container), std::cend(container), val) == std::cend(container))
|
||||
container.push_back(val);
|
||||
}
|
||||
|
||||
template<class... Ts>
|
||||
struct overloads : Ts...
|
||||
{
|
||||
using Ts::operator()...;
|
||||
};
|
||||
} // namespace lms::core::utils
|
||||
@@ -19,9 +19,10 @@
|
||||
|
||||
#include "ArtworkService.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "core/IConfig.hpp"
|
||||
#include "core/ILogger.hpp"
|
||||
#include "core/Utils.hpp"
|
||||
#include "database/IDb.hpp"
|
||||
#include "database/Session.hpp"
|
||||
#include "database/objects/Artist.hpp"
|
||||
@@ -243,7 +244,7 @@ namespace lms::artwork
|
||||
|
||||
void ArtworkService::setJpegQuality(unsigned quality)
|
||||
{
|
||||
_jpegQuality = core::utils::clamp<unsigned>(quality, 1, 100);
|
||||
_jpegQuality = std::clamp<unsigned>(quality, 1, 100);
|
||||
|
||||
LMS_LOG(COVER, INFO, "JPEG export quality = " << _jpegQuality);
|
||||
}
|
||||
|
||||
@@ -19,13 +19,13 @@
|
||||
|
||||
#include "MediaRetrieval.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <chrono>
|
||||
|
||||
#include "core/FileResourceHandlerCreator.hpp"
|
||||
#include "core/ILogger.hpp"
|
||||
#include "core/IResourceHandler.hpp"
|
||||
#include "core/String.hpp"
|
||||
#include "core/Utils.hpp"
|
||||
|
||||
#include "av/Exception.hpp"
|
||||
#include "av/IAudioFile.hpp"
|
||||
@@ -385,7 +385,7 @@ namespace lms::api::subsonic
|
||||
|
||||
std::optional<std::size_t> size{ getParameterAs<std::size_t>(context.parameters, "size") };
|
||||
if (size)
|
||||
*size = core::utils::clamp(*size, std::size_t{ 32 }, std::size_t{ 2048 });
|
||||
*size = std::clamp(*size, std::size_t{ 32 }, std::size_t{ 2048 });
|
||||
|
||||
std::shared_ptr<image::IEncodedImage> image{ core::Service<artwork::IArtworkService>::get()->getImage(coverArtId.id, size) };
|
||||
if (!image)
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
|
||||
#include "MediaPlayer.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include <Wt/Json/Object.h>
|
||||
#include <Wt/Json/Parser.h>
|
||||
#include <Wt/Json/Serializer.h>
|
||||
@@ -27,7 +29,6 @@
|
||||
|
||||
#include "core/ILogger.hpp"
|
||||
#include "core/String.hpp"
|
||||
#include "core/Utils.hpp"
|
||||
#include "database/Session.hpp"
|
||||
#include "database/Types.hpp"
|
||||
#include "database/objects/Artist.hpp"
|
||||
@@ -142,7 +143,7 @@ namespace lms::ui
|
||||
if (!value)
|
||||
return std::nullopt;
|
||||
|
||||
return core::utils::clamp(*value, (double)MediaPlayer::Settings::ReplayGain::minPreAmpGain, (double)MediaPlayer::Settings::ReplayGain::maxPreAmpGain);
|
||||
return std::clamp(*value, (double)MediaPlayer::Settings::ReplayGain::minPreAmpGain, (double)MediaPlayer::Settings::ReplayGain::maxPreAmpGain);
|
||||
}
|
||||
|
||||
MediaPlayer::Settings settingsfromJSString(const std::string& strSettings)
|
||||
|
||||
Reference in New Issue
Block a user