Minot cleanup
This commit is contained in:
@@ -65,7 +65,7 @@ namespace lms::audio::ffmpeg
|
||||
return planar ? AV_SAMPLE_FMT_DBLP : AV_SAMPLE_FMT_DBL;
|
||||
}
|
||||
|
||||
throw Exception("Unsupported PcmSampleType");
|
||||
throw Exception{ "Unsupported PcmSampleType" };
|
||||
}
|
||||
|
||||
SwrContextPtr createResampler(const PcmParameters& params, const AVChannelLayout& inLayout, AVSampleFormat inFmt, int inSampleRate)
|
||||
@@ -104,7 +104,7 @@ namespace lms::audio::ffmpeg
|
||||
: _parameters{ parameters }
|
||||
{
|
||||
if (_parameters.channelCount > AV_NUM_DATA_POINTERS)
|
||||
throw Exception("Channel count exceeds maximum supported channels");
|
||||
throw Exception{ "Channel count exceeds maximum supported channels" };
|
||||
|
||||
utils::init();
|
||||
|
||||
@@ -179,7 +179,7 @@ namespace lms::audio::ffmpeg
|
||||
{
|
||||
int error{ ::avcodec_open2(_decoderContext.get(), decoder, nullptr) };
|
||||
if (error < 0)
|
||||
throw FFmpegException("Cannot open decoder", error);
|
||||
throw FFmpegException{ "Cannot open decoder", error };
|
||||
}
|
||||
|
||||
_decodedFrame = AVFramePtr{ av_frame_alloc() };
|
||||
|
||||
@@ -89,13 +89,13 @@ namespace lms::audio::pulseaudio
|
||||
{
|
||||
const int error{ ::pa_context_connect(_context.get(), nullptr, PA_CONTEXT_NOFLAGS, nullptr) };
|
||||
if (error < 0)
|
||||
throw PaException("pa_context_connect failed", error);
|
||||
throw PaException{ "pa_context_connect failed", error };
|
||||
}
|
||||
|
||||
{
|
||||
const int error{ ::pa_threaded_mainloop_start(_mainLoop.get()) };
|
||||
if (error < 0)
|
||||
throw PaException("pa_threaded_mainloop_start failed", error);
|
||||
throw PaException{ "pa_threaded_mainloop_start failed", error };
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -226,7 +226,7 @@ namespace lms::audio::pulseaudio
|
||||
{
|
||||
pa_operation* op{ ::pa_stream_flush(_stream.get(), nullptr, nullptr) };
|
||||
if (!op)
|
||||
throw PaException("pa_stream_flush failed", pa_context_errno(_context));
|
||||
throw PaException{ "pa_stream_flush failed", pa_context_errno(_context) };
|
||||
|
||||
::pa_operation_unref(op);
|
||||
}
|
||||
@@ -249,7 +249,7 @@ namespace lms::audio::pulseaudio
|
||||
|
||||
pa_operation* op{ ::pa_stream_cork(_stream.get(), 1, nullptr, nullptr) };
|
||||
if (!op)
|
||||
throw PaException("pa_stream_cork (pause) failed", pa_context_errno(_context));
|
||||
throw PaException{ "pa_stream_cork (pause) failed", pa_context_errno(_context) };
|
||||
|
||||
::pa_operation_unref(op);
|
||||
}
|
||||
@@ -263,14 +263,14 @@ namespace lms::audio::pulseaudio
|
||||
{
|
||||
pa_operation* op{ ::pa_stream_cork(_stream.get(), 0, nullptr, nullptr) };
|
||||
if (!op)
|
||||
throw PaException("pa_stream_cork (resume) failed", pa_context_errno(_context));
|
||||
throw PaException{ "pa_stream_cork (resume) failed", pa_context_errno(_context) };
|
||||
::pa_operation_unref(op);
|
||||
}
|
||||
|
||||
{
|
||||
pa_operation* op{ ::pa_stream_trigger(_stream.get(), NULL, NULL) };
|
||||
if (!op)
|
||||
throw PaException("pa_stream_trigger failed", pa_context_errno(_context));
|
||||
throw PaException{ "pa_stream_trigger failed", pa_context_errno(_context) };
|
||||
::pa_operation_unref(op);
|
||||
}
|
||||
}
|
||||
@@ -301,7 +301,7 @@ namespace lms::audio::pulseaudio
|
||||
nullptr,
|
||||
nullptr) };
|
||||
if (!op)
|
||||
throw PaException("pa_context_set_sink_input_volume failed", pa_context_errno(_context));
|
||||
throw PaException{ "pa_context_set_sink_input_volume failed", pa_context_errno(_context) };
|
||||
|
||||
::pa_operation_unref(op);
|
||||
|
||||
@@ -425,7 +425,7 @@ namespace lms::audio::pulseaudio
|
||||
|
||||
::pa_operation* op{ ::pa_stream_drain(_stream.get(), [](pa_stream*, int success, void* userdata) { static_cast<AudioOutputStream*>(userdata)->onDrainComplete(success); }, this) };
|
||||
if (!op)
|
||||
throw PaException("pa_stream_drain failed", pa_context_errno(_context));
|
||||
throw PaException{ "pa_stream_drain failed", pa_context_errno(_context) };
|
||||
|
||||
::pa_operation_unref(op);
|
||||
}
|
||||
|
||||
@@ -248,7 +248,7 @@ namespace lms::db
|
||||
}
|
||||
else if (checkType != "none")
|
||||
{
|
||||
throw Exception("Invalid 'db-integrity-check' value: '" + checkType + "'. Expected 'quick', 'full' or 'none'.");
|
||||
throw Exception{ "Invalid 'db-integrity-check' value: '" + checkType + "'. Expected 'quick', 'full' or 'none'." };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -360,7 +360,7 @@ namespace lms::db
|
||||
}) };
|
||||
|
||||
if (!foreignKeyConstraintsPassed)
|
||||
throw Exception("Foreign key constraints check failed! Please restore from a backup or recreate the database.");
|
||||
throw Exception{ "Foreign key constraints check failed! Please restore from a backup or recreate the database." };
|
||||
|
||||
LMS_LOG(DB, INFO, "Foreign key constraints check passed!");
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ namespace lms::db
|
||||
WhereClause clusterClause;
|
||||
for (const ClusterId clusterId : params.filters.clusters)
|
||||
{
|
||||
clusterClause.Or(WhereClause("t_c.cluster_id = ?"));
|
||||
clusterClause.Or(WhereClause{ "t_c.cluster_id = ?" });
|
||||
query.bind(clusterId);
|
||||
}
|
||||
|
||||
@@ -442,11 +442,11 @@ AND NOT EXISTS (
|
||||
std::ostringstream oss;
|
||||
oss << "SELECT c FROM cluster c INNER JOIN track t ON c.id = t_c.cluster_id INNER JOIN track_cluster t_c ON t_c.track_id = t.id INNER JOIN cluster_type c_type ON c.cluster_type_id = c_type.id INNER JOIN artist a ON t_a_l.artist_id = a.id INNER JOIN track_artist_link t_a_l ON t_a_l.track_id = t.id";
|
||||
|
||||
where.And(WhereClause("a.id = ?")).bind(getId().toString());
|
||||
where.And(WhereClause{ "a.id = ?" }).bind(getId().toString());
|
||||
{
|
||||
WhereClause clusterClause;
|
||||
for (const ClusterTypeId clusterTypeId : clusterTypeIds)
|
||||
clusterClause.Or(WhereClause("c_type.id = ?")).bind(clusterTypeId.toString());
|
||||
clusterClause.Or(WhereClause{ "c_type.id = ?" }).bind(clusterTypeId.toString());
|
||||
|
||||
where.And(clusterClause);
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ namespace lms::db
|
||||
WhereClause clusterClause;
|
||||
for (const db::ClusterId id : params.filters.clusters)
|
||||
{
|
||||
clusterClause.Or(WhereClause("t_c.cluster_id = ?"));
|
||||
clusterClause.Or(WhereClause{ "t_c.cluster_id = ?" });
|
||||
query.bind(id);
|
||||
}
|
||||
|
||||
@@ -229,7 +229,7 @@ namespace lms::db
|
||||
WhereClause clusterClause;
|
||||
for (const ClusterId id : params.filters.clusters)
|
||||
{
|
||||
clusterClause.Or(WhereClause("c.id = ?"));
|
||||
clusterClause.Or(WhereClause{ "c.id = ?" });
|
||||
query.bind(id);
|
||||
}
|
||||
|
||||
@@ -313,7 +313,7 @@ namespace lms::db
|
||||
WhereClause clusterClause;
|
||||
for (const ClusterId id : params.filters.clusters)
|
||||
{
|
||||
clusterClause.Or(WhereClause("c.id = ?")).bind(id.toString());
|
||||
clusterClause.Or(WhereClause{ "c.id = ?" }).bind(id.toString());
|
||||
query.bind(id);
|
||||
}
|
||||
|
||||
|
||||
@@ -236,7 +236,7 @@ namespace lms::db
|
||||
WhereClause clusterClause;
|
||||
for (const ClusterId clusterId : params.filters.clusters)
|
||||
{
|
||||
clusterClause.Or(WhereClause("t_c.cluster_id = ?"));
|
||||
clusterClause.Or(WhereClause{ "t_c.cluster_id = ?" });
|
||||
query.bind(clusterId);
|
||||
}
|
||||
|
||||
@@ -1003,11 +1003,11 @@ namespace lms::db
|
||||
|
||||
oss << "SELECT c from cluster c INNER JOIN track_cluster t_c ON t_c.cluster_id = c.id INNER JOIN track t ON t.id = t_c.track_id ";
|
||||
|
||||
where.And(WhereClause("t.release_id = ?")).bind(getId().toString());
|
||||
where.And(WhereClause{ "t.release_id = ?" }).bind(getId().toString());
|
||||
{
|
||||
WhereClause clusterClause;
|
||||
for (const ClusterTypeId clusterTypeId : clusterTypeIds)
|
||||
clusterClause.Or(WhereClause("c.cluster_type_id = ?")).bind(clusterTypeId.toString());
|
||||
clusterClause.Or(WhereClause{ "c.cluster_type_id = ?" }).bind(clusterTypeId.toString());
|
||||
where.And(clusterClause);
|
||||
}
|
||||
oss << " " << where.get();
|
||||
|
||||
@@ -105,7 +105,7 @@ namespace lms::db
|
||||
WhereClause clusterClause;
|
||||
for (const ClusterId clusterId : params.filters.clusters)
|
||||
{
|
||||
clusterClause.Or(WhereClause("t_c.cluster_id = ?"));
|
||||
clusterClause.Or(WhereClause{ "t_c.cluster_id = ?" });
|
||||
query.bind(clusterId);
|
||||
}
|
||||
|
||||
@@ -897,11 +897,11 @@ namespace lms::db
|
||||
|
||||
oss << "SELECT c from cluster c INNER JOIN track t ON c.id = t_c.cluster_id INNER JOIN track_cluster t_c ON t_c.track_id = t.id INNER JOIN cluster_type c_type ON c.cluster_type_id = c_type.id";
|
||||
|
||||
where.And(WhereClause("t.id = ?")).bind(getId().toString());
|
||||
where.And(WhereClause{ "t.id = ?" }).bind(getId().toString());
|
||||
{
|
||||
WhereClause clusterClause;
|
||||
for (ClusterTypeId clusterTypeId : clusterTypeIds)
|
||||
clusterClause.Or(WhereClause("c_type.id = ?")).bind(clusterTypeId.toString());
|
||||
clusterClause.Or(WhereClause{ "c_type.id = ?" }).bind(clusterTypeId.toString());
|
||||
where.And(clusterClause);
|
||||
}
|
||||
oss << " " << where.get();
|
||||
|
||||
@@ -115,7 +115,7 @@ namespace lms::db
|
||||
WhereClause clusterClause;
|
||||
for (const ClusterId clusterId : params.filters.clusters)
|
||||
{
|
||||
clusterClause.Or(WhereClause("c.id = ?"));
|
||||
clusterClause.Or(WhereClause{ "c.id = ?" });
|
||||
query.bind(clusterId);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -138,7 +138,7 @@ namespace lms::ui
|
||||
return Wt::WFormModel::validateField(field);
|
||||
}
|
||||
|
||||
setValidation(field, Wt::WValidator::Result(error.empty() ? Wt::ValidationState::Valid : Wt::ValidationState::Invalid, error));
|
||||
setValidation(field, Wt::WValidator::Result{ error.empty() ? Wt::ValidationState::Valid : Wt::ValidationState::Invalid, error });
|
||||
|
||||
return (validation(field).state() == Wt::ValidationState::Valid);
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ namespace lms::ui
|
||||
std::error_code ec;
|
||||
|
||||
if (p.is_relative())
|
||||
return Wt::WValidator::Result(Wt::ValidationState::Invalid, Wt::WString::tr("Lms.Admin.MediaLibrary.path-must-be-absolute"));
|
||||
return Wt::WValidator::Result{ Wt::ValidationState::Invalid, Wt::WString::tr("Lms.Admin.MediaLibrary.path-must-be-absolute") };
|
||||
|
||||
// TODO check and translate access rights issues
|
||||
bool res{ std::filesystem::is_directory(p, ec) };
|
||||
|
||||
Reference in New Issue
Block a user