diff --git a/src/database-updater/DatabaseUpdater.cpp b/src/database-updater/DatabaseUpdater.cpp
index c69c273c..e59a0e03 100644
--- a/src/database-updater/DatabaseUpdater.cpp
+++ b/src/database-updater/DatabaseUpdater.cpp
@@ -285,8 +285,8 @@ Updater::processAudioFile( const boost::filesystem::path& file, Stats& stats)
{
// no change since last time we updated
// Skip only if no external covers has to be set
- if (track->getCoverType() == Database::Track::CoverType::None && externalCovers.empty()
- || track->getCoverType() == Database::Track::CoverType::ExternalFile && !externalCovers.empty())
+ if (((track->getCoverType() == Database::Track::CoverType::None) && externalCovers.empty())
+ || ((track->getCoverType() == Database::Track::CoverType::ExternalFile) && !externalCovers.empty()))
return;
}
diff --git a/src/rest-api/Resource.cpp b/src/rest-api/Resource.cpp
deleted file mode 100644
index 46f347a6..00000000
--- a/src/rest-api/Resource.cpp
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Copyright (C) 2015 Emeric Poupon
- *
- * This file is part of LMS.
- *
- * LMS is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * LMS is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with LMS. If not, see .
- */
-
-#include
-#include
-
-#include "logger/Logger.hpp"
-#include "database/DatabaseHandler.hpp"
-#include "transcode/Format.hpp"
-#include "transcode/InputMediaFile.hpp"
-#include "transcode/Parameters.hpp"
-#include "transcode/AvConvTranscoder.hpp"
-
-#include "Resource.hpp"
-
-
-namespace RestAPI {
-
-Resource::Resource(boost::filesystem::path dbPath)
-: _dbPath(dbPath)
-{
-
-}
-
-void
-Resource::handleRequest(const Wt::Http::Request& request, Wt::Http::Response& response)
-{
- static const std::size_t _bufferSize = 65536;
- LMS_LOG(MOD_REST_API, SEV_DEBUG) << "Handle request...";
-
- // see if this request is for a continuation:
- Wt::Http::ResponseContinuation *continuation = request.continuation();
-
- LMS_LOG(MOD_UI, SEV_DEBUG) << "Handling request. Continuation = " << std::boolalpha << continuation;
-
- std::shared_ptr transcoder;
- if (continuation)
- {
- transcoder = boost::any_cast >(continuation->data());
- }
- else
- {
- const Wt::Http::ParameterMap& parameters = request.getParameterMap();
-
- for (auto itParameter : parameters)
- {
- LMS_LOG(MOD_REST_API, SEV_DEBUG) << "Param name: '" << itParameter.first << "'";
-
- for (auto value : itParameter.second)
- {
- LMS_LOG(MOD_REST_API, SEV_DEBUG) << "\tvalue: '" << value << "'";
- }
- }
-
- auto itParamMediaId = parameters.find("mediaid");
- if (itParamMediaId == parameters.end())
- {
- LMS_LOG(MOD_REST_API, SEV_DEBUG) << "Cannot find parameter mediaid";
- return;
- }
-
- std::string mediaId = itParamMediaId->second.front();
- LMS_LOG(MOD_REST_API, SEV_DEBUG) << "MediaId = " << mediaId;
-
- try
- {
- Database::Handler db(_dbPath);
-
- Wt::Dbo::Transaction transaction(db.getSession());
-
- Database::Track::pointer track = Database::Track::getById(db.getSession(), std::stol(mediaId));
-
- LMS_LOG(MOD_UI, SEV_DEBUG) << "Launching transcoder";
- Transcode::InputMediaFile input(track->getPath());
- Transcode::Parameters parameters(input, Transcode::Format::get(Transcode::Format::OGA));
-
- transcoder = std::make_shared(parameters);
-
- LMS_LOG(MOD_UI, SEV_DEBUG) << "Mime type set to '" << parameters.getOutputFormat().getMimeType() << "'";
- response.setMimeType(parameters.getOutputFormat().getMimeType());
-
- }
- catch(std::exception &e)
- {
- LMS_LOG(MOD_UI, SEV_DEBUG) << "Caught exception: " << e.what();
- return;
- }
- }
-
- if (!transcoder)
- {
- LMS_LOG(MOD_UI, SEV_ERROR) << "No transcoder ?!";
- return;
- }
-
- if (!transcoder->isComplete())
- {
- std::vector data;
- data.reserve(_bufferSize);
-
- transcoder->process(data, _bufferSize);
-
- // Give the client all the output data
- response.out().write(reinterpret_cast(&data[0]), data.size());
-
- LMS_LOG(MOD_UI, SEV_DEBUG) << "Written " << data.size() << " bytes! complete = " << std::boolalpha << transcoder->isComplete() << ", produced bytes = " << transcoder->getOutputBytes();
-
- if (!response.out())
- LMS_LOG(MOD_UI, SEV_ERROR) << "Write failed!";
- }
-
- if (!transcoder->isComplete() && response.out()) {
- continuation = response.createContinuation();
- continuation->setData(transcoder);
- }
- else
- LMS_LOG(MOD_UI, SEV_DEBUG) << "No more data!";
-}
-
-} // namespace API
diff --git a/src/rest-api/Resource.hpp b/src/rest-api/Resource.hpp
deleted file mode 100644
index 39ebc99e..00000000
--- a/src/rest-api/Resource.hpp
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (C) 2015 Emeric Poupon
- *
- * This file is part of LMS.
- *
- * LMS is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * LMS is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with LMS. If not, see .
- */
-
-#ifndef API_RESOURCE_HPP
-#define API_RESOURCE_HPP
-
-#include
-
-#include
-
-namespace RestAPI {
-
-class Resource : public Wt::WResource
-{
- public:
- Resource(boost::filesystem::path dbPath);
-
- void handleRequest(const Wt::Http::Request& request,
- Wt::Http::Response& response);
-
- private:
-
- boost::filesystem::path _dbPath;
-};
-
-} // namespace API
-
-#endif
diff --git a/src/transcode/AvConvTranscoder.cpp b/src/transcode/AvConvTranscoder.cpp
index aa9cc467..655bffc6 100644
--- a/src/transcode/AvConvTranscoder.cpp
+++ b/src/transcode/AvConvTranscoder.cpp
@@ -58,7 +58,7 @@ AvConvTranscoder::init()
if (!_avConvPath.empty())
LMS_LOG(MOD_TRANSCODE, SEV_INFO) << "Using transcoder " << _avConvPath;
else
- LMS_LOG(MOD_TRANSCODE, SEV_ERROR) << "Cannot find any transcoder binary!";
+ throw std::runtime_error("Cannot find any transcoder binary!");
}
diff --git a/src/ui/audio/desktop/PlayQueue.cpp b/src/ui/audio/desktop/PlayQueue.cpp
index 567e85c5..f2c47373 100644
--- a/src/ui/audio/desktop/PlayQueue.cpp
+++ b/src/ui/audio/desktop/PlayQueue.cpp
@@ -388,7 +388,7 @@ PlayQueue::addTracks(const std::vector& trackIds)
coverUrl = LmsApplication::instance()->getCoverResource()->getUnknownTrackUrl(64);
_model->setData(dataRow, COLUMN_ID_COVER, coverUrl, Wt::DecorationRole);
- _model->setData(dataRow, COLUMN_ID_COVER, "playqueue-cover", Wt::StyleClassRole);
+ _model->setData(dataRow, COLUMN_ID_COVER, std::string("playqueue-cover"), Wt::StyleClassRole);
TrackInfo trackInfo;
trackInfo.track = Wt::WString::fromUTF8(track->getName());