Updated Logger to use enum class
This commit is contained in:
+7
-7
@@ -53,7 +53,7 @@ void AvInit()
|
|||||||
/* register all the codecs */
|
/* register all the codecs */
|
||||||
avcodec_register_all();
|
avcodec_register_all();
|
||||||
av_register_all();
|
av_register_all();
|
||||||
LMS_LOG(MOD_AV, SEV_INFO) << "avcodec version = " << avcodec_version();
|
LMS_LOG(AV, INFO) << "avcodec version = " << avcodec_version();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -79,7 +79,7 @@ MediaFile::open(void)
|
|||||||
int error = avformat_open_input(&_context, _p.string().c_str(), nullptr, nullptr);
|
int error = avformat_open_input(&_context, _p.string().c_str(), nullptr, nullptr);
|
||||||
if (error < 0)
|
if (error < 0)
|
||||||
{
|
{
|
||||||
LMS_LOG(MOD_AV, SEV_ERROR) << "Cannot open '" << _p.string() << "', avformat_open_input returned " << averror_to_string(error);
|
LMS_LOG(AV, ERROR) << "Cannot open '" << _p.string() << "', avformat_open_input returned " << averror_to_string(error);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,7 +95,7 @@ MediaFile::scan(void)
|
|||||||
int error = avformat_find_stream_info(_context, nullptr);
|
int error = avformat_find_stream_info(_context, nullptr);
|
||||||
if (error < 0)
|
if (error < 0)
|
||||||
{
|
{
|
||||||
LMS_LOG(MOD_AV, SEV_ERROR) << "Cannot find stream information: '" << averror_to_string(error);
|
LMS_LOG(AV, ERROR) << "Cannot find stream information: '" << averror_to_string(error);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -171,7 +171,7 @@ MediaFile::getStreams(Stream::Type type) const
|
|||||||
|
|
||||||
if (avstream->codec == nullptr)
|
if (avstream->codec == nullptr)
|
||||||
{
|
{
|
||||||
LMS_LOG(MOD_AV, SEV_ERROR) << "Skipping stream " << i << " since no codec is set";
|
LMS_LOG(AV, ERROR) << "Skipping stream " << i << " since no codec is set";
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -226,7 +226,7 @@ MediaFile::getBestStreamId(Stream::Type type) const
|
|||||||
0);
|
0);
|
||||||
if (res < 0)
|
if (res < 0)
|
||||||
{
|
{
|
||||||
LMS_LOG(MOD_AV, SEV_ERROR) << "Cannot find best stream for type " << streamType_to_string(type);
|
LMS_LOG(AV, ERROR) << "Cannot find best stream for type " << streamType_to_string(type);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -273,7 +273,7 @@ MediaFile::getAttachedPictures(std::size_t nbMaxPictures) const
|
|||||||
|
|
||||||
if (avstream->codec == nullptr)
|
if (avstream->codec == nullptr)
|
||||||
{
|
{
|
||||||
LMS_LOG(MOD_AV, SEV_ERROR) << "Skipping stream " << i << " since no codec is set";
|
LMS_LOG(AV, ERROR) << "Skipping stream " << i << " since no codec is set";
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -287,7 +287,7 @@ MediaFile::getAttachedPictures(std::size_t nbMaxPictures) const
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
picture.mimeType = "application/octet-stream";
|
picture.mimeType = "application/octet-stream";
|
||||||
LMS_LOG(MOD_AV, SEV_ERROR) << "CODEC ID " << avstream->codec->codec_id << " not handled in mime type conversion";
|
LMS_LOG(AV, ERROR) << "CODEC ID " << avstream->codec->codec_id << " not handled in mime type conversion";
|
||||||
}
|
}
|
||||||
|
|
||||||
AVPacket pkt = avstream->attached_pic;
|
AVPacket pkt = avstream->attached_pic;
|
||||||
|
|||||||
+11
-11
@@ -66,7 +66,7 @@ Transcoder::init()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!_avConvPath.empty())
|
if (!_avConvPath.empty())
|
||||||
LMS_LOG(MOD_TRANSCODE, SEV_INFO) << "Using transcoder " << _avConvPath;
|
LMS_LOG(TRANSCODE, INFO) << "Using transcoder " << _avConvPath;
|
||||||
else
|
else
|
||||||
throw std::runtime_error("Cannot find any transcoder binary!");
|
throw std::runtime_error("Cannot find any transcoder binary!");
|
||||||
}
|
}
|
||||||
@@ -94,7 +94,7 @@ Transcoder::start()
|
|||||||
else if (!boost::filesystem::is_regular( _filePath) )
|
else if (!boost::filesystem::is_regular( _filePath) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
LMS_LOG(MOD_TRANSCODE, SEV_INFO) << "Transcoding file '" << _filePath << "'";
|
LMS_LOG(TRANSCODE, INFO) << "Transcoding file '" << _filePath << "'";
|
||||||
|
|
||||||
// Launch a process to handle the conversion
|
// Launch a process to handle the conversion
|
||||||
boost::iostreams::file_descriptor_sink sink(_outputPipe.sink, boost::iostreams::close_handle);
|
boost::iostreams::file_descriptor_sink sink(_outputPipe.sink, boost::iostreams::close_handle);
|
||||||
@@ -157,7 +157,7 @@ Transcoder::start()
|
|||||||
}
|
}
|
||||||
oss << " -"; // output to stdout
|
oss << " -"; // output to stdout
|
||||||
|
|
||||||
LMS_LOG(MOD_TRANSCODE, SEV_DEBUG) << "Executing '" << oss.str() << "'";
|
LMS_LOG(TRANSCODE, DEBUG) << "Executing '" << oss.str() << "'";
|
||||||
|
|
||||||
// make sure only one thread is executing this part of code
|
// make sure only one thread is executing this part of code
|
||||||
// See boost process FAQ
|
// See boost process FAQ
|
||||||
@@ -191,7 +191,7 @@ Transcoder::process(std::vector<unsigned char>& output, std::size_t maxSize)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!_in || _in.fail() || _in.eof()) {
|
if (!_in || _in.fail() || _in.eof()) {
|
||||||
LMS_LOG(MOD_TRANSCODE, SEV_DEBUG) << "Transcode complete!";
|
LMS_LOG(TRANSCODE, DEBUG) << "Transcode complete!";
|
||||||
|
|
||||||
waitChild();
|
waitChild();
|
||||||
_isComplete = true;
|
_isComplete = true;
|
||||||
@@ -201,7 +201,7 @@ Transcoder::process(std::vector<unsigned char>& output, std::size_t maxSize)
|
|||||||
|
|
||||||
Transcoder::~Transcoder()
|
Transcoder::~Transcoder()
|
||||||
{
|
{
|
||||||
LMS_LOG(MOD_TRANSCODE, SEV_DEBUG) << "~Transcoder called!";
|
LMS_LOG(TRANSCODE, DEBUG) << "~Transcoder called!";
|
||||||
|
|
||||||
if (_in.eof())
|
if (_in.eof())
|
||||||
waitChild();
|
waitChild();
|
||||||
@@ -216,12 +216,12 @@ Transcoder::waitChild()
|
|||||||
{
|
{
|
||||||
boost::system::error_code ec;
|
boost::system::error_code ec;
|
||||||
|
|
||||||
LMS_LOG(MOD_TRANSCODE, SEV_DEBUG) << "Waiting for child...";
|
LMS_LOG(TRANSCODE, DEBUG) << "Waiting for child...";
|
||||||
boost::process::wait_for_exit(*_child, ec);
|
boost::process::wait_for_exit(*_child, ec);
|
||||||
LMS_LOG(MOD_TRANSCODE, SEV_DEBUG) << "Waiting for child: OK";
|
LMS_LOG(TRANSCODE, DEBUG) << "Waiting for child: OK";
|
||||||
|
|
||||||
if (ec)
|
if (ec)
|
||||||
LMS_LOG(MOD_TRANSCODE, SEV_ERROR) << "Transcoder::waitChild: error: " << ec.message();
|
LMS_LOG(TRANSCODE, ERROR) << "Transcoder::waitChild: error: " << ec.message();
|
||||||
|
|
||||||
_child.reset();
|
_child.reset();
|
||||||
}
|
}
|
||||||
@@ -234,13 +234,13 @@ Transcoder::killChild()
|
|||||||
{
|
{
|
||||||
boost::system::error_code ec;
|
boost::system::error_code ec;
|
||||||
|
|
||||||
LMS_LOG(MOD_TRANSCODE, SEV_DEBUG) << "Killing child! pid = " << _child->pid;
|
LMS_LOG(TRANSCODE, DEBUG) << "Killing child! pid = " << _child->pid;
|
||||||
boost::process::terminate(*_child, ec);
|
boost::process::terminate(*_child, ec);
|
||||||
LMS_LOG(MOD_TRANSCODE, SEV_DEBUG) << "Killing child DONE";
|
LMS_LOG(TRANSCODE, DEBUG) << "Killing child DONE";
|
||||||
|
|
||||||
// If an error occured, force kill the child
|
// If an error occured, force kill the child
|
||||||
if (ec)
|
if (ec)
|
||||||
LMS_LOG(MOD_TRANSCODE, SEV_ERROR) << "Transcoder::killChild: error: " << ec.message();
|
LMS_LOG(TRANSCODE, ERROR) << "Transcoder::killChild: error: " << ec.message();
|
||||||
|
|
||||||
_child.reset();
|
_child.reset();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ CoverArt::scale(std::size_t size)
|
|||||||
}
|
}
|
||||||
catch(std::exception& e)
|
catch(std::exception& e)
|
||||||
{
|
{
|
||||||
LMS_LOG(MOD_COVER, SEV_ERROR) << "Caught exception: " << e.what();
|
LMS_LOG(COVER, ERROR) << "Caught exception: " << e.what();
|
||||||
}
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ Grabber::getCoverPaths(const boost::filesystem::path& directoryPath, std::size_t
|
|||||||
|
|
||||||
if (boost::filesystem::file_size(path) > _maxFileSize)
|
if (boost::filesystem::file_size(path) > _maxFileSize)
|
||||||
{
|
{
|
||||||
LMS_LOG(MOD_COVER, SEV_INFO) << "Cover file '" << path << " is too big (" << boost::filesystem::file_size(path) << "), limit is " << _maxFileSize;
|
LMS_LOG(COVER, INFO) << "Cover file '" << path << " is too big (" << boost::filesystem::file_size(path) << "), limit is " << _maxFileSize;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ void computeCrc(const boost::filesystem::path& p, std::vector<unsigned char>& cr
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LMS_LOG(MOD_DBUPDATER, SEV_ERROR) << "Failed to open file '" << p << "'";
|
LMS_LOG(DBUPDATER, ERROR) << "Failed to open file '" << p << "'";
|
||||||
throw std::runtime_error("Failed to open file '" + p.string() + "'" );
|
throw std::runtime_error("Failed to open file '" + p.string() + "'" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ Updater::processNextJob(void)
|
|||||||
MediaDirectorySettings::pointer settings = MediaDirectorySettings::get(_db.getSession());
|
MediaDirectorySettings::pointer settings = MediaDirectorySettings::get(_db.getSession());
|
||||||
|
|
||||||
if (settings->getManualScanRequested()) {
|
if (settings->getManualScanRequested()) {
|
||||||
LMS_LOG(MOD_DBUPDATER, SEV_NOTICE) << "Manual scan requested!";
|
LMS_LOG(DBUPDATER, INFO) << "Manual scan requested!";
|
||||||
scheduleScan( boost::posix_time::seconds(0) );
|
scheduleScan( boost::posix_time::seconds(0) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -197,7 +197,7 @@ Updater::processNextJob(void)
|
|||||||
void
|
void
|
||||||
Updater::scheduleScan( boost::posix_time::time_duration duration)
|
Updater::scheduleScan( boost::posix_time::time_duration duration)
|
||||||
{
|
{
|
||||||
LMS_LOG(MOD_DBUPDATER, SEV_NOTICE) << "Scheduling next scan in " << duration;
|
LMS_LOG(DBUPDATER, INFO) << "Scheduling next scan in " << duration;
|
||||||
_scheduleTimer.expires_from_now(duration);
|
_scheduleTimer.expires_from_now(duration);
|
||||||
_scheduleTimer.async_wait( boost::bind( &Updater::process, this, boost::asio::placeholders::error) );
|
_scheduleTimer.async_wait( boost::bind( &Updater::process, this, boost::asio::placeholders::error) );
|
||||||
}
|
}
|
||||||
@@ -205,7 +205,7 @@ Updater::scheduleScan( boost::posix_time::time_duration duration)
|
|||||||
void
|
void
|
||||||
Updater::scheduleScan( boost::posix_time::ptime time)
|
Updater::scheduleScan( boost::posix_time::ptime time)
|
||||||
{
|
{
|
||||||
LMS_LOG(MOD_DBUPDATER, SEV_NOTICE) << "Scheduling next scan at " << time;
|
LMS_LOG(DBUPDATER, INFO) << "Scheduling next scan at " << time;
|
||||||
_scheduleTimer.expires_at(time);
|
_scheduleTimer.expires_at(time);
|
||||||
_scheduleTimer.async_wait( boost::bind( &Updater::process, this, boost::asio::placeholders::error) );
|
_scheduleTimer.async_wait( boost::bind( &Updater::process, this, boost::asio::placeholders::error) );
|
||||||
}
|
}
|
||||||
@@ -230,12 +230,12 @@ Updater::process(boost::system::error_code err)
|
|||||||
|
|
||||||
for (RootDirectory rootDirectory : rootDirectories)
|
for (RootDirectory rootDirectory : rootDirectories)
|
||||||
{
|
{
|
||||||
LMS_LOG(MOD_DBUPDATER, SEV_INFO) << "Processing root directory '" << rootDirectory.path << "'...";
|
LMS_LOG(DBUPDATER, INFO) << "Processing root directory '" << rootDirectory.path << "'...";
|
||||||
processRootDirectory(rootDirectory, stats);
|
processRootDirectory(rootDirectory, stats);
|
||||||
LMS_LOG(MOD_DBUPDATER, SEV_INFO) << "Processing root directory '" << rootDirectory.path << "' DONE";
|
LMS_LOG(DBUPDATER, INFO) << "Processing root directory '" << rootDirectory.path << "' DONE";
|
||||||
}
|
}
|
||||||
|
|
||||||
LMS_LOG(MOD_DBUPDATER, SEV_INFO) << "Scan complete. Changes = " << stats.nbChanges() << ", Errors = " << stats.nbScanErrors;
|
LMS_LOG(DBUPDATER, INFO) << "Scan complete. Changes = " << stats.nbChanges() << ", Errors = " << stats.nbScanErrors;
|
||||||
|
|
||||||
// Update database stats
|
// Update database stats
|
||||||
boost::posix_time::ptime now = boost::posix_time::second_clock::local_time();
|
boost::posix_time::ptime now = boost::posix_time::second_clock::local_time();
|
||||||
@@ -396,7 +396,7 @@ Updater::processAudioFile( const boost::filesystem::path& file, Stats& stats)
|
|||||||
if (items.find(MetaData::Type::AudioStreams) == items.end()
|
if (items.find(MetaData::Type::AudioStreams) == items.end()
|
||||||
|| boost::any_cast<std::vector<MetaData::AudioStream> >(items[MetaData::Type::AudioStreams]).empty())
|
|| boost::any_cast<std::vector<MetaData::AudioStream> >(items[MetaData::Type::AudioStreams]).empty())
|
||||||
{
|
{
|
||||||
LMS_LOG(MOD_DBUPDATER, SEV_DEBUG) << "Skipped '" << file << "' (no audio stream found)";
|
LMS_LOG(DBUPDATER, DEBUG) << "Skipped '" << file << "' (no audio stream found)";
|
||||||
|
|
||||||
// If Track exists here, delete it!
|
// If Track exists here, delete it!
|
||||||
if (track) {
|
if (track) {
|
||||||
@@ -408,7 +408,7 @@ Updater::processAudioFile( const boost::filesystem::path& file, Stats& stats)
|
|||||||
if (items.find(MetaData::Type::Duration) == items.end()
|
if (items.find(MetaData::Type::Duration) == items.end()
|
||||||
|| boost::any_cast<boost::posix_time::time_duration>(items[MetaData::Type::Duration]).total_seconds() <= 0)
|
|| boost::any_cast<boost::posix_time::time_duration>(items[MetaData::Type::Duration]).total_seconds() <= 0)
|
||||||
{
|
{
|
||||||
LMS_LOG(MOD_DBUPDATER, SEV_DEBUG) << "Skipped '" << file << "' (no duration or duration <= 0)";
|
LMS_LOG(DBUPDATER, DEBUG) << "Skipped '" << file << "' (no duration or duration <= 0)";
|
||||||
|
|
||||||
// If Track exists here, delete it!
|
// If Track exists here, delete it!
|
||||||
if (track) {
|
if (track) {
|
||||||
@@ -481,12 +481,12 @@ Updater::processAudioFile( const boost::filesystem::path& file, Stats& stats)
|
|||||||
{
|
{
|
||||||
// Create a new song
|
// Create a new song
|
||||||
track = Track::create(_db.getSession(), file);
|
track = Track::create(_db.getSession(), file);
|
||||||
LMS_LOG(MOD_DBUPDATER, SEV_INFO) << "Adding '" << file << "'";
|
LMS_LOG(DBUPDATER, INFO) << "Adding '" << file << "'";
|
||||||
stats.nbAdded++;
|
stats.nbAdded++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LMS_LOG(MOD_DBUPDATER, SEV_INFO) << "Updating '" << file << "'";
|
LMS_LOG(DBUPDATER, INFO) << "Updating '" << file << "'";
|
||||||
stats.nbModified++;
|
stats.nbModified++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -547,7 +547,7 @@ Updater::processAudioFile( const boost::filesystem::path& file, Stats& stats)
|
|||||||
}
|
}
|
||||||
catch( std::exception& e )
|
catch( std::exception& e )
|
||||||
{
|
{
|
||||||
LMS_LOG(MOD_DBUPDATER, SEV_ERROR) << "Exception while parsing audio file : '" << file << "': '" << e.what() << "' => skipping!";
|
LMS_LOG(DBUPDATER, ERROR) << "Exception while parsing audio file : '" << file << "': '" << e.what() << "' => skipping!";
|
||||||
stats.nbRemoved++;
|
stats.nbRemoved++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -602,7 +602,7 @@ Updater::checkFile(const boost::filesystem::path& p, const std::vector<boost::fi
|
|||||||
if (!boost::filesystem::exists( p )
|
if (!boost::filesystem::exists( p )
|
||||||
|| !boost::filesystem::is_regular( p ) )
|
|| !boost::filesystem::is_regular( p ) )
|
||||||
{
|
{
|
||||||
LMS_LOG(MOD_DBUPDATER, SEV_INFO) << "Missing file '" << p << "'";
|
LMS_LOG(DBUPDATER, INFO) << "Missing file '" << p << "'";
|
||||||
status = false;
|
status = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -619,12 +619,12 @@ Updater::checkFile(const boost::filesystem::path& p, const std::vector<boost::fi
|
|||||||
|
|
||||||
if (!foundRoot)
|
if (!foundRoot)
|
||||||
{
|
{
|
||||||
LMS_LOG(MOD_DBUPDATER, SEV_INFO) << "Out of root file '" << p << "'";
|
LMS_LOG(DBUPDATER, INFO) << "Out of root file '" << p << "'";
|
||||||
status = false;
|
status = false;
|
||||||
}
|
}
|
||||||
else if (!isFileSupported(p, extensions))
|
else if (!isFileSupported(p, extensions))
|
||||||
{
|
{
|
||||||
LMS_LOG(MOD_DBUPDATER, SEV_INFO) << "File format no longer supported for '" << p << "'";
|
LMS_LOG(DBUPDATER, INFO) << "File format no longer supported for '" << p << "'";
|
||||||
status = false;
|
status = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -634,7 +634,7 @@ Updater::checkFile(const boost::filesystem::path& p, const std::vector<boost::fi
|
|||||||
}
|
}
|
||||||
catch (boost::filesystem::filesystem_error& e)
|
catch (boost::filesystem::filesystem_error& e)
|
||||||
{
|
{
|
||||||
LMS_LOG(MOD_DBUPDATER, SEV_ERROR) << "Caught exception while checking file '" << p << "': " << e.what();
|
LMS_LOG(DBUPDATER, ERROR) << "Caught exception while checking file '" << p << "': " << e.what();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -644,12 +644,12 @@ void
|
|||||||
Updater::checkAudioFiles( Stats& stats )
|
Updater::checkAudioFiles( Stats& stats )
|
||||||
{
|
{
|
||||||
|
|
||||||
LMS_LOG(MOD_DBUPDATER, SEV_INFO) << "Checking audio files...";
|
LMS_LOG(DBUPDATER, INFO) << "Checking audio files...";
|
||||||
Wt::Dbo::Transaction transaction(_db.getSession());
|
Wt::Dbo::Transaction transaction(_db.getSession());
|
||||||
|
|
||||||
std::vector<boost::filesystem::path> rootDirs = getRootDirectoriesByType(_db.getSession(), Database::MediaDirectory::Audio);
|
std::vector<boost::filesystem::path> rootDirs = getRootDirectoriesByType(_db.getSession(), Database::MediaDirectory::Audio);
|
||||||
|
|
||||||
LMS_LOG(MOD_DBUPDATER, SEV_DEBUG) << "Checking tracks...";
|
LMS_LOG(DBUPDATER, DEBUG) << "Checking tracks...";
|
||||||
auto tracks = Track::getAll(_db.getSession());
|
auto tracks = Track::getAll(_db.getSession());
|
||||||
for (auto track : tracks)
|
for (auto track : tracks)
|
||||||
{
|
{
|
||||||
@@ -661,45 +661,45 @@ Updater::checkAudioFiles( Stats& stats )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Now process orphan Genre (no track)
|
// Now process orphan Genre (no track)
|
||||||
LMS_LOG(MOD_DBUPDATER, SEV_DEBUG) << "Checking Genres...";
|
LMS_LOG(DBUPDATER, DEBUG) << "Checking Genres...";
|
||||||
auto genres = Genre::getAll(_db.getSession());
|
auto genres = Genre::getAll(_db.getSession());
|
||||||
for (auto genre : genres)
|
for (auto genre : genres)
|
||||||
{
|
{
|
||||||
if (genre->getTracks().size() == 0)
|
if (genre->getTracks().size() == 0)
|
||||||
{
|
{
|
||||||
LMS_LOG(MOD_DBUPDATER, SEV_DEBUG) << "Removing orphan genre '" << genre->getName() << "'";
|
LMS_LOG(DBUPDATER, DEBUG) << "Removing orphan genre '" << genre->getName() << "'";
|
||||||
genre.remove();
|
genre.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LMS_LOG(MOD_DBUPDATER, SEV_DEBUG) << "Checking artists...";
|
LMS_LOG(DBUPDATER, DEBUG) << "Checking artists...";
|
||||||
auto artists = Artist::getAllOrphans(_db.getSession());
|
auto artists = Artist::getAllOrphans(_db.getSession());
|
||||||
for (auto artist : artists)
|
for (auto artist : artists)
|
||||||
{
|
{
|
||||||
LMS_LOG(MOD_DBUPDATER, SEV_DEBUG) << "Removing orphan artist '" << artist->getName() << "'";
|
LMS_LOG(DBUPDATER, DEBUG) << "Removing orphan artist '" << artist->getName() << "'";
|
||||||
artist.remove();
|
artist.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
LMS_LOG(MOD_DBUPDATER, SEV_DEBUG) << "Checking releases...";
|
LMS_LOG(DBUPDATER, DEBUG) << "Checking releases...";
|
||||||
auto releases = Release::getAllOrphans(_db.getSession());
|
auto releases = Release::getAllOrphans(_db.getSession());
|
||||||
for (auto release : releases)
|
for (auto release : releases)
|
||||||
{
|
{
|
||||||
LMS_LOG(MOD_DBUPDATER, SEV_DEBUG) << "Removing orphan release '" << release->getName() << "'";
|
LMS_LOG(DBUPDATER, DEBUG) << "Removing orphan release '" << release->getName() << "'";
|
||||||
release.remove();
|
release.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
LMS_LOG(MOD_DBUPDATER, SEV_INFO) << "Check audio files done!";
|
LMS_LOG(DBUPDATER, INFO) << "Check audio files done!";
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Updater::checkVideoFiles( Stats& stats )
|
Updater::checkVideoFiles( Stats& stats )
|
||||||
{
|
{
|
||||||
LMS_LOG(MOD_DBUPDATER, SEV_DEBUG) << "Checking video files...";
|
LMS_LOG(DBUPDATER, DEBUG) << "Checking video files...";
|
||||||
Wt::Dbo::Transaction transaction(_db.getSession());
|
Wt::Dbo::Transaction transaction(_db.getSession());
|
||||||
|
|
||||||
std::vector<boost::filesystem::path> rootDirs = getRootDirectoriesByType(_db.getSession(), Database::MediaDirectory::Video);
|
std::vector<boost::filesystem::path> rootDirs = getRootDirectoriesByType(_db.getSession(), Database::MediaDirectory::Video);
|
||||||
|
|
||||||
LMS_LOG(MOD_DBUPDATER, SEV_DEBUG) << "Checking videos...";
|
LMS_LOG(DBUPDATER, DEBUG) << "Checking videos...";
|
||||||
typedef Wt::Dbo::collection< Wt::Dbo::ptr<Video> > Videos;
|
typedef Wt::Dbo::collection< Wt::Dbo::ptr<Video> > Videos;
|
||||||
Videos videos = Video::getAll(_db.getSession());
|
Videos videos = Video::getAll(_db.getSession());
|
||||||
|
|
||||||
@@ -714,7 +714,7 @@ Updater::checkVideoFiles( Stats& stats )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LMS_LOG(MOD_DBUPDATER, SEV_DEBUG) << "Check video files done!";
|
LMS_LOG(DBUPDATER, DEBUG) << "Check video files done!";
|
||||||
}
|
}
|
||||||
void
|
void
|
||||||
Updater::processVideoFile( const boost::filesystem::path& file, Stats& stats)
|
Updater::processVideoFile( const boost::filesystem::path& file, Stats& stats)
|
||||||
@@ -740,7 +740,7 @@ Updater::processVideoFile( const boost::filesystem::path& file, Stats& stats)
|
|||||||
if (items.find(MetaData::Type::VideoStreams) == items.end()
|
if (items.find(MetaData::Type::VideoStreams) == items.end()
|
||||||
|| boost::any_cast<std::vector<MetaData::VideoStream> >(items[MetaData::Type::VideoStreams]).empty())
|
|| boost::any_cast<std::vector<MetaData::VideoStream> >(items[MetaData::Type::VideoStreams]).empty())
|
||||||
{
|
{
|
||||||
LMS_LOG(MOD_DBUPDATER, SEV_ERROR) << "Skipped '" << file << "' (no video stream found)";
|
LMS_LOG(DBUPDATER, ERROR) << "Skipped '" << file << "' (no video stream found)";
|
||||||
|
|
||||||
// If the video exists here, delete it!
|
// If the video exists here, delete it!
|
||||||
if (video) {
|
if (video) {
|
||||||
@@ -752,7 +752,7 @@ Updater::processVideoFile( const boost::filesystem::path& file, Stats& stats)
|
|||||||
if (items.find(MetaData::Type::Duration) == items.end()
|
if (items.find(MetaData::Type::Duration) == items.end()
|
||||||
|| boost::any_cast<boost::posix_time::time_duration>(items[MetaData::Type::Duration]).total_seconds() == 0)
|
|| boost::any_cast<boost::posix_time::time_duration>(items[MetaData::Type::Duration]).total_seconds() == 0)
|
||||||
{
|
{
|
||||||
LMS_LOG(MOD_DBUPDATER, SEV_ERROR) << "Skipped '" << file << "' (no duration or duration 0)";
|
LMS_LOG(DBUPDATER, ERROR) << "Skipped '" << file << "' (no duration or duration 0)";
|
||||||
|
|
||||||
// If Track exists here, delete it!
|
// If Track exists here, delete it!
|
||||||
if (video) {
|
if (video) {
|
||||||
@@ -768,12 +768,12 @@ Updater::processVideoFile( const boost::filesystem::path& file, Stats& stats)
|
|||||||
if (!video)
|
if (!video)
|
||||||
{
|
{
|
||||||
video = Video::create(_db.getSession(), file);
|
video = Video::create(_db.getSession(), file);
|
||||||
LMS_LOG(MOD_DBUPDATER, SEV_DEBUG) << "Adding '" << file << "'";
|
LMS_LOG(DBUPDATER, DEBUG) << "Adding '" << file << "'";
|
||||||
stats.nbAdded++;
|
stats.nbAdded++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LMS_LOG(MOD_DBUPDATER, SEV_DEBUG) << "Updating '" << file << "'";
|
LMS_LOG(DBUPDATER, DEBUG) << "Updating '" << file << "'";
|
||||||
stats.nbModified++;
|
stats.nbModified++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -787,7 +787,7 @@ Updater::processVideoFile( const boost::filesystem::path& file, Stats& stats)
|
|||||||
}
|
}
|
||||||
catch( std::exception& e )
|
catch( std::exception& e )
|
||||||
{
|
{
|
||||||
LMS_LOG(MOD_DBUPDATER, SEV_ERROR) << "Exception while parsing video file : '" << file << "': '" << e.what() << "' => skipping!";
|
LMS_LOG(DBUPDATER, ERROR) << "Exception while parsing video file : '" << file << "': '" << e.what() << "' => skipping!";
|
||||||
stats.nbScanErrors++;
|
stats.nbScanErrors++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ Handler::Handler(Wt::Dbo::SqlConnectionPool& connectionPool)
|
|||||||
_session.execute("CREATE INDEX track_name_idx ON track(name)");
|
_session.execute("CREATE INDEX track_name_idx ON track(name)");
|
||||||
}
|
}
|
||||||
catch(std::exception& e) {
|
catch(std::exception& e) {
|
||||||
LMS_LOG(MOD_DB, SEV_ERROR) << "Cannot create tables: " << e.what();
|
LMS_LOG(DB, ERROR) << "Cannot create tables: " << e.what();
|
||||||
}
|
}
|
||||||
|
|
||||||
_users = new UserDatabase(_session);
|
_users = new UserDatabase(_session);
|
||||||
@@ -136,7 +136,7 @@ Handler::getUser(const Wt::Auth::User& authUser)
|
|||||||
{
|
{
|
||||||
|
|
||||||
if (!authUser.isValid()) {
|
if (!authUser.isValid()) {
|
||||||
LMS_LOG(MOD_DB, SEV_ERROR) << "Handler::getUser: invalid authUser";
|
LMS_LOG(DB, ERROR) << "Handler::getUser: invalid authUser";
|
||||||
return User::pointer();
|
return User::pointer();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -155,7 +155,7 @@ Handler::getUser(const Wt::Auth::User& authUser)
|
|||||||
Wt::Dbo::SqlConnectionPool*
|
Wt::Dbo::SqlConnectionPool*
|
||||||
Handler::createConnectionPool(boost::filesystem::path p)
|
Handler::createConnectionPool(boost::filesystem::path p)
|
||||||
{
|
{
|
||||||
LMS_LOG(MOD_DB, SEV_INFO) << "Creating connection pool on file " << p;
|
LMS_LOG(DB, INFO) << "Creating connection pool on file " << p;
|
||||||
|
|
||||||
Wt::Dbo::backend::Sqlite3 *connection = new Wt::Dbo::backend::Sqlite3(p.string());
|
Wt::Dbo::backend::Sqlite3 *connection = new Wt::Dbo::backend::Sqlite3(p.string());
|
||||||
|
|
||||||
|
|||||||
+15
-16
@@ -23,16 +23,16 @@ std::string getModuleName(Module mod)
|
|||||||
{
|
{
|
||||||
switch (mod)
|
switch (mod)
|
||||||
{
|
{
|
||||||
case MOD_AV: return "AV";
|
case Module::AV: return "AV";
|
||||||
case MOD_COVER: return "COVER";
|
case Module::COVER: return "COVER";
|
||||||
case MOD_DB: return "DB";
|
case Module::DB: return "DB";
|
||||||
case MOD_DBUPDATER: return "DB UPDATER";
|
case Module::DBUPDATER: return "DB UPDATER";
|
||||||
case MOD_MAIN: return "MAIN";
|
case Module::MAIN: return "MAIN";
|
||||||
case MOD_METADATA: return "METADATA";
|
case Module::METADATA: return "METADATA";
|
||||||
case MOD_REMOTE: return "REMOTE";
|
case Module::REMOTE: return "REMOTE";
|
||||||
case MOD_SERVICE: return "SERVICE";
|
case Module::SERVICE: return "SERVICE";
|
||||||
case MOD_TRANSCODE: return "TRANSCODE";
|
case Module::TRANSCODE: return "TRANSCODE";
|
||||||
case MOD_UI: return "UI";
|
case Module::UI: return "UI";
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
@@ -41,12 +41,11 @@ std::string getSeverityName(Severity sev)
|
|||||||
{
|
{
|
||||||
switch (sev)
|
switch (sev)
|
||||||
{
|
{
|
||||||
case SEV_CRIT: return "fatal";
|
case Severity::FATAL: return "fatal";
|
||||||
case SEV_ERROR: return "error";
|
case Severity::ERROR: return "error";
|
||||||
case SEV_WARNING: return "warning";
|
case Severity::WARNING: return "warning";
|
||||||
case SEV_NOTICE:
|
case Severity::INFO: return "info";
|
||||||
case SEV_INFO: return "info";
|
case Severity::DEBUG: return "debug";
|
||||||
case SEV_DEBUG: return "debug";
|
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|||||||
+18
-19
@@ -27,33 +27,32 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
|
||||||
enum Severity
|
enum class Severity
|
||||||
{
|
{
|
||||||
SEV_CRIT = 2,
|
FATAL,
|
||||||
SEV_ERROR = 3,
|
ERROR,
|
||||||
SEV_WARNING = 4,
|
WARNING,
|
||||||
SEV_NOTICE = 5,
|
INFO,
|
||||||
SEV_INFO = 6,
|
DEBUG,
|
||||||
SEV_DEBUG = 7,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum Module
|
enum class Module
|
||||||
{
|
{
|
||||||
MOD_AV,
|
AV,
|
||||||
MOD_COVER,
|
COVER,
|
||||||
MOD_DB,
|
DB,
|
||||||
MOD_DBUPDATER,
|
DBUPDATER,
|
||||||
MOD_MAIN,
|
MAIN,
|
||||||
MOD_METADATA,
|
METADATA,
|
||||||
MOD_REMOTE,
|
REMOTE,
|
||||||
MOD_SERVICE,
|
SERVICE,
|
||||||
MOD_TRANSCODE,
|
TRANSCODE,
|
||||||
MOD_UI,
|
UI,
|
||||||
};
|
};
|
||||||
|
|
||||||
std::string getModuleName(Module mod);
|
std::string getModuleName(Module mod);
|
||||||
std::string getSeverityName(Severity sev);
|
std::string getSeverityName(Severity sev);
|
||||||
|
|
||||||
#define LMS_LOG(module, level) Wt::log(getSeverityName(level)) << Wt::WLogger::sep << "[" << getModuleName(module) << "]" << Wt::WLogger::sep
|
#define LMS_LOG(module, level) Wt::log(getSeverityName(Severity::level)) << Wt::WLogger::sep << "[" << getModuleName(Module::module) << "]" << Wt::WLogger::sep
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+8
-8
@@ -68,35 +68,35 @@ int main(int argc, char* argv[])
|
|||||||
// bind entry point
|
// bind entry point
|
||||||
server.addEntryPoint(Wt::Application, boost::bind(UserInterface::LmsApplication::create, _1, boost::ref(*connectionPool)));
|
server.addEntryPoint(Wt::Application, boost::bind(UserInterface::LmsApplication::create, _1, boost::ref(*connectionPool)));
|
||||||
|
|
||||||
LMS_LOG(MOD_MAIN, SEV_NOTICE) << "Now running...";
|
|
||||||
|
|
||||||
// Starting the main server
|
// Starting the main server
|
||||||
LMS_LOG(MOD_MAIN, SEV_INFO) << "Starting server...";
|
LMS_LOG(MAIN, INFO) << "Starting server...";
|
||||||
server.start();
|
server.start();
|
||||||
|
|
||||||
// Start underlying services
|
// Start underlying services
|
||||||
LMS_LOG(MOD_MAIN, SEV_INFO) << "Starting services...";
|
LMS_LOG(MAIN, INFO) << "Starting services...";
|
||||||
serviceManager.start();
|
serviceManager.start();
|
||||||
|
|
||||||
|
LMS_LOG(MAIN, INFO) << "Now running...";
|
||||||
|
|
||||||
// Waiting for shutdown command
|
// Waiting for shutdown command
|
||||||
Wt::WServer::waitForShutdown(argv[0]);
|
Wt::WServer::waitForShutdown(argv[0]);
|
||||||
|
|
||||||
LMS_LOG(MOD_MAIN, SEV_INFO) << "Stopping services...";
|
LMS_LOG(MAIN, INFO) << "Stopping services...";
|
||||||
serviceManager.stop();
|
serviceManager.stop();
|
||||||
serviceManager.clear();
|
serviceManager.clear();
|
||||||
|
|
||||||
LMS_LOG(MOD_MAIN, SEV_INFO) << "Stopping server...";
|
LMS_LOG(MAIN, INFO) << "Stopping server...";
|
||||||
server.stop();
|
server.stop();
|
||||||
|
|
||||||
res = EXIT_SUCCESS;
|
res = EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
catch( Wt::WServer::Exception& e)
|
catch( Wt::WServer::Exception& e)
|
||||||
{
|
{
|
||||||
LMS_LOG(MOD_MAIN, SEV_CRIT) << "Caught a WServer::Exception: " << e.what();
|
LMS_LOG(MAIN, FATAL) << "Caught a WServer::Exception: " << e.what();
|
||||||
}
|
}
|
||||||
catch( std::exception& e)
|
catch( std::exception& e)
|
||||||
{
|
{
|
||||||
LMS_LOG(MOD_MAIN, SEV_CRIT) << "Caught std::exception: " << e.what();
|
LMS_LOG(MAIN, FATAL) << "Caught std::exception: " << e.what();
|
||||||
}
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ LmsApplication::handleAuthEvent(void)
|
|||||||
{
|
{
|
||||||
if (DbHandler().getLogin().loggedIn())
|
if (DbHandler().getLogin().loggedIn())
|
||||||
{
|
{
|
||||||
LMS_LOG(MOD_UI, SEV_NOTICE) << "User '" << CurrentAuthUser().identity(Wt::Auth::Identity::LoginName) << "' logged in from '" << Wt::WApplication::instance()->environment().clientAddress() << "', user agent = " << Wt::WApplication::instance()->environment().agent() << ", session = " << Wt::WApplication::instance()->sessionId();
|
LMS_LOG(UI, INFO) << "User '" << CurrentAuthUser().identity(Wt::Auth::Identity::LoginName) << "' logged in from '" << Wt::WApplication::instance()->environment().clientAddress() << "', user agent = " << Wt::WApplication::instance()->environment().agent() << ", session = " << Wt::WApplication::instance()->sessionId();
|
||||||
|
|
||||||
this->root()->setOverflow(Wt::WContainerWidget::OverflowHidden);
|
this->root()->setOverflow(Wt::WContainerWidget::OverflowHidden);
|
||||||
setConfirmCloseMessage("Closing LMS. Are you sure?");
|
setConfirmCloseMessage("Closing LMS. Are you sure?");
|
||||||
@@ -243,7 +243,7 @@ LmsApplication::handleAuthEvent(void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LMS_LOG(MOD_UI, SEV_NOTICE) << "User logged out, session = " << Wt::WApplication::instance()->sessionId();
|
LMS_LOG(UI, INFO) << "User logged out, session = " << Wt::WApplication::instance()->sessionId();
|
||||||
|
|
||||||
quit("");
|
quit("");
|
||||||
redirect("/");
|
redirect("/");
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ AudioMediaPlayer::AudioMediaPlayer(Wt::WContainerWidget *parent)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LMS_LOG(MOD_UI, SEV_INFO) << "Audio player using encoding " << _encoding;
|
LMS_LOG(UI, INFO) << "Audio player using encoding " << _encoding;
|
||||||
|
|
||||||
// Current Media info
|
// Current Media info
|
||||||
Wt::WHBoxLayout *currentMediaLayout = new Wt::WHBoxLayout();
|
Wt::WHBoxLayout *currentMediaLayout = new Wt::WHBoxLayout();
|
||||||
@@ -219,7 +219,7 @@ AudioMediaPlayer::load(Database::Track::id_type trackId)
|
|||||||
if (!mediaFile.open())
|
if (!mediaFile.open())
|
||||||
{
|
{
|
||||||
// No longer exist ? TODO next?
|
// No longer exist ? TODO next?
|
||||||
LMS_LOG(MOD_UI, SEV_INFO) << "Cannot open file '" << path << "'";
|
LMS_LOG(UI, INFO) << "Cannot open file '" << path << "'";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -215,7 +215,7 @@ _playQueue(nullptr)
|
|||||||
_mediaPlayer->loop().connect(boost::bind(&PlayQueue::setLoop,_playQueue, _1));
|
_mediaPlayer->loop().connect(boost::bind(&PlayQueue::setLoop,_playQueue, _1));
|
||||||
|
|
||||||
_playQueue->tracksUpdated().connect(std::bind([=] () {
|
_playQueue->tracksUpdated().connect(std::bind([=] () {
|
||||||
LMS_LOG(MOD_UI, SEV_INFO) << "Playqueue updated!";
|
LMS_LOG(UI, INFO) << "Playqueue updated!";
|
||||||
|
|
||||||
playlistSaveFromPlayqueue(CurrentQueuePlaylistName);
|
playlistSaveFromPlayqueue(CurrentQueuePlaylistName);
|
||||||
}));
|
}));
|
||||||
@@ -308,14 +308,14 @@ Audio::playlistShowSaveDialog(std::string playlistName)
|
|||||||
void
|
void
|
||||||
Audio::playlistSaveFromPlayqueue(std::string playlistName)
|
Audio::playlistSaveFromPlayqueue(std::string playlistName)
|
||||||
{
|
{
|
||||||
LMS_LOG(MOD_UI, SEV_INFO) << "Saving playqueue to playlist '" << playlistName << "'";
|
LMS_LOG(UI, INFO) << "Saving playqueue to playlist '" << playlistName << "'";
|
||||||
|
|
||||||
Wt::Dbo::Transaction transaction(DboSession());
|
Wt::Dbo::Transaction transaction(DboSession());
|
||||||
|
|
||||||
Playlist::pointer playlist = Playlist::get(DboSession(), playlistName, CurrentUser());
|
Playlist::pointer playlist = Playlist::get(DboSession(), playlistName, CurrentUser());
|
||||||
if (playlist)
|
if (playlist)
|
||||||
{
|
{
|
||||||
LMS_LOG(MOD_UI, SEV_INFO) << "Erasing playlist '" << playlistName << "'";
|
LMS_LOG(UI, INFO) << "Erasing playlist '" << playlistName << "'";
|
||||||
playlist.remove();
|
playlist.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -333,13 +333,13 @@ Audio::playlistSaveFromPlayqueue(std::string playlistName)
|
|||||||
PlaylistEntry::create(DboSession(), track, playlist, pos++);
|
PlaylistEntry::create(DboSession(), track, playlist, pos++);
|
||||||
}
|
}
|
||||||
|
|
||||||
LMS_LOG(MOD_UI, SEV_INFO) << "Saving playqueue to playlist '" << playlistName << "' done. Contains " << pos << " entries";
|
LMS_LOG(UI, INFO) << "Saving playqueue to playlist '" << playlistName << "' done. Contains " << pos << " entries";
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Audio::playlistLoadToPlayqueue(std::string playlistName)
|
Audio::playlistLoadToPlayqueue(std::string playlistName)
|
||||||
{
|
{
|
||||||
LMS_LOG(MOD_UI, SEV_DEBUG) << "Loading playlist '" << playlistName << "' to playqueue";
|
LMS_LOG(UI, DEBUG) << "Loading playlist '" << playlistName << "' to playqueue";
|
||||||
|
|
||||||
std::vector<Track::id_type> entries;
|
std::vector<Track::id_type> entries;
|
||||||
|
|
||||||
@@ -356,7 +356,7 @@ Audio::playlistLoadToPlayqueue(std::string playlistName)
|
|||||||
_playQueue->clear();
|
_playQueue->clear();
|
||||||
_playQueue->addTracks(entries);
|
_playQueue->addTracks(entries);
|
||||||
|
|
||||||
LMS_LOG(MOD_UI, SEV_DEBUG) << "Loading playlist '" << playlistName << "' to playqueue done. " << entries.size() << " entries";
|
LMS_LOG(UI, DEBUG) << "Loading playlist '" << playlistName << "' to playqueue done. " << entries.size() << " entries";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -395,7 +395,7 @@ Audio::playlistRefreshMenus()
|
|||||||
Wt::Dbo::Transaction transaction(DboSession());
|
Wt::Dbo::Transaction transaction(DboSession());
|
||||||
|
|
||||||
// Clear playlists in each menu
|
// Clear playlists in each menu
|
||||||
LMS_LOG(MOD_UI, SEV_DEBUG) << "Save item count: " << _popupMenuSave->count();
|
LMS_LOG(UI, DEBUG) << "Save item count: " << _popupMenuSave->count();
|
||||||
|
|
||||||
WPopupMenuClear(_popupMenuDelete);
|
WPopupMenuClear(_popupMenuDelete);
|
||||||
WPopupMenuClear(_popupMenuLoad);
|
WPopupMenuClear(_popupMenuLoad);
|
||||||
@@ -457,7 +457,7 @@ Audio::playSelectedTracks(PlayQueueAddType addType)
|
|||||||
{
|
{
|
||||||
std::vector<Track::id_type> trackIds;
|
std::vector<Track::id_type> trackIds;
|
||||||
|
|
||||||
LMS_LOG(MOD_UI, SEV_DEBUG) << "Playing selected tracks... nb selected = " << _trackView->getNbSelectedTracks() << ", add type = " << (addType == PlayQueueAddAllTracks ? "AddAll" : "AddSelected");
|
LMS_LOG(UI, DEBUG) << "Playing selected tracks... nb selected = " << _trackView->getNbSelectedTracks() << ", add type = " << (addType == PlayQueueAddAllTracks ? "AddAll" : "AddSelected");
|
||||||
|
|
||||||
_playQueue->clear();
|
_playQueue->clear();
|
||||||
|
|
||||||
@@ -472,7 +472,7 @@ Audio::playSelectedTracks(PlayQueueAddType addType)
|
|||||||
break;
|
break;
|
||||||
case PlayQueueAddSelectedTracks:
|
case PlayQueueAddSelectedTracks:
|
||||||
|
|
||||||
LMS_LOG(MOD_UI, SEV_DEBUG) << "Adding selected tracks...";
|
LMS_LOG(UI, DEBUG) << "Adding selected tracks...";
|
||||||
|
|
||||||
// If nothing selected, get all the track and play everything
|
// If nothing selected, get all the track and play everything
|
||||||
if (_trackView->getNbSelectedTracks() == 0)
|
if (_trackView->getNbSelectedTracks() == 0)
|
||||||
|
|||||||
@@ -371,7 +371,7 @@ PlayQueue::addTracks(const std::vector<Database::Track::id_type>& trackIds)
|
|||||||
{
|
{
|
||||||
using namespace Database;
|
using namespace Database;
|
||||||
|
|
||||||
LMS_LOG(MOD_UI, SEV_DEBUG) << "Adding " << trackIds.size() << " tracks to play queue";
|
LMS_LOG(UI, DEBUG) << "Adding " << trackIds.size() << " tracks to play queue";
|
||||||
|
|
||||||
// Add tracks to model
|
// Add tracks to model
|
||||||
for (Track::id_type trackId : trackIds)
|
for (Track::id_type trackId : trackIds)
|
||||||
@@ -465,7 +465,7 @@ PlayQueue::playPrevious(void)
|
|||||||
void
|
void
|
||||||
PlayQueue::readTrack(int rowPos)
|
PlayQueue::readTrack(int rowPos)
|
||||||
{
|
{
|
||||||
LMS_LOG(MOD_UI, SEV_DEBUG) << "Reading track at pos " << rowPos << ", row count = " << _model->rowCount();
|
LMS_LOG(UI, DEBUG) << "Reading track at pos " << rowPos << ", row count = " << _model->rowCount();
|
||||||
|
|
||||||
if (rowPos < _model->rowCount())
|
if (rowPos < _model->rowCount())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ TrackView::refresh(SearchFilter& filter)
|
|||||||
void
|
void
|
||||||
TrackView::getSelectedTracks(std::vector<Track::id_type>& track_ids)
|
TrackView::getSelectedTracks(std::vector<Track::id_type>& track_ids)
|
||||||
{
|
{
|
||||||
LMS_LOG(MOD_UI, SEV_DEBUG) << "Getting selected tracks...";
|
LMS_LOG(UI, DEBUG) << "Getting selected tracks...";
|
||||||
|
|
||||||
Wt::WModelIndexSet indexSet = this->selectedIndexes();
|
Wt::WModelIndexSet indexSet = this->selectedIndexes();
|
||||||
|
|
||||||
@@ -164,7 +164,7 @@ TrackView::getSelectedTracks(std::vector<Track::id_type>& track_ids)
|
|||||||
track_ids.push_back(id);
|
track_ids.push_back(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
LMS_LOG(MOD_UI, SEV_DEBUG) << "Getting all selected tracks: " << track_ids.size();
|
LMS_LOG(UI, DEBUG) << "Getting all selected tracks: " << track_ids.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::size_t
|
std::size_t
|
||||||
@@ -192,7 +192,7 @@ TrackView::getFirstSelectedTrackPosition(void)
|
|||||||
void
|
void
|
||||||
TrackView::getTracks(std::vector<Track::id_type>& trackIds)
|
TrackView::getTracks(std::vector<Track::id_type>& trackIds)
|
||||||
{
|
{
|
||||||
LMS_LOG(MOD_UI, SEV_DEBUG) << "Getting all tracks...";
|
LMS_LOG(UI, DEBUG) << "Getting all tracks...";
|
||||||
|
|
||||||
Wt::Dbo::Transaction transaction(DboSession());
|
Wt::Dbo::Transaction transaction(DboSession());
|
||||||
Wt::Dbo::collection<Track::UIQueryResult> results = _queryModel.query();
|
Wt::Dbo::collection<Track::UIQueryResult> results = _queryModel.query();
|
||||||
@@ -203,7 +203,7 @@ TrackView::getTracks(std::vector<Track::id_type>& trackIds)
|
|||||||
trackIds.push_back(id);
|
trackIds.push_back(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
LMS_LOG(MOD_UI, SEV_DEBUG) << "Getting all tracks done! " << trackIds.size() << " tracks!";
|
LMS_LOG(UI, DEBUG) << "Getting all tracks done! " << trackIds.size() << " tracks!";
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Desktop
|
} // namespace Desktop
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ Audio::Audio(Wt::WContainerWidget *parent)
|
|||||||
|
|
||||||
trackSearch->trackPlay().connect(std::bind([=] (Track::id_type id)
|
trackSearch->trackPlay().connect(std::bind([=] (Track::id_type id)
|
||||||
{
|
{
|
||||||
LMS_LOG(MOD_UI, SEV_DEBUG) << "Playing track id " << id;
|
LMS_LOG(UI, DEBUG) << "Playing track id " << id;
|
||||||
// TODO reduce transaction scope here
|
// TODO reduce transaction scope here
|
||||||
Wt::Dbo::Transaction transaction(DboSession());
|
Wt::Dbo::Transaction transaction(DboSession());
|
||||||
|
|
||||||
|
|||||||
@@ -32,12 +32,12 @@ AvConvTranscodeStreamResource::AvConvTranscodeStreamResource(boost::filesystem::
|
|||||||
_filePath(p),
|
_filePath(p),
|
||||||
_parameters( parameters )
|
_parameters( parameters )
|
||||||
{
|
{
|
||||||
LMS_LOG(MOD_UI, SEV_DEBUG) << "CONSTRUCTING RESOURCE";
|
LMS_LOG(UI, DEBUG) << "CONSTRUCTING RESOURCE";
|
||||||
}
|
}
|
||||||
|
|
||||||
AvConvTranscodeStreamResource::~AvConvTranscodeStreamResource()
|
AvConvTranscodeStreamResource::~AvConvTranscodeStreamResource()
|
||||||
{
|
{
|
||||||
LMS_LOG(MOD_UI, SEV_DEBUG) << "DESTRUCTING RESOURCE";
|
LMS_LOG(UI, DEBUG) << "DESTRUCTING RESOURCE";
|
||||||
beingDeleted();
|
beingDeleted();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -48,7 +48,7 @@ AvConvTranscodeStreamResource::handleRequest(const Wt::Http::Request& request,
|
|||||||
// see if this request is for a continuation:
|
// see if this request is for a continuation:
|
||||||
Wt::Http::ResponseContinuation *continuation = request.continuation();
|
Wt::Http::ResponseContinuation *continuation = request.continuation();
|
||||||
|
|
||||||
LMS_LOG(MOD_UI, SEV_DEBUG) << "Handling new request. Continuation = " << continuation;
|
LMS_LOG(UI, DEBUG) << "Handling new request. Continuation = " << continuation;
|
||||||
|
|
||||||
std::shared_ptr<Av::Transcoder> transcoder;
|
std::shared_ptr<Av::Transcoder> transcoder;
|
||||||
if (continuation)
|
if (continuation)
|
||||||
@@ -56,15 +56,15 @@ AvConvTranscodeStreamResource::handleRequest(const Wt::Http::Request& request,
|
|||||||
|
|
||||||
if (!transcoder)
|
if (!transcoder)
|
||||||
{
|
{
|
||||||
LMS_LOG(MOD_UI, SEV_DEBUG) << "Launching transcoder";
|
LMS_LOG(UI, DEBUG) << "Launching transcoder";
|
||||||
transcoder = std::make_shared<Av::Transcoder>( _filePath, _parameters);
|
transcoder = std::make_shared<Av::Transcoder>( _filePath, _parameters);
|
||||||
|
|
||||||
LMS_LOG(MOD_UI, SEV_DEBUG) << "Mime type set to '" << Av::encoding_to_mimetype(_parameters.getEncoding());
|
LMS_LOG(UI, DEBUG) << "Mime type set to '" << Av::encoding_to_mimetype(_parameters.getEncoding());
|
||||||
response.setMimeType( Av::encoding_to_mimetype(_parameters.getEncoding()) );
|
response.setMimeType( Av::encoding_to_mimetype(_parameters.getEncoding()) );
|
||||||
|
|
||||||
if (!transcoder->start())
|
if (!transcoder->start())
|
||||||
{
|
{
|
||||||
LMS_LOG(MOD_UI, SEV_ERROR) << "Cannot start transcoder";
|
LMS_LOG(UI, ERROR) << "Cannot start transcoder";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -79,10 +79,10 @@ AvConvTranscodeStreamResource::handleRequest(const Wt::Http::Request& request,
|
|||||||
// Give the client all the output data
|
// Give the client all the output data
|
||||||
response.out().write(reinterpret_cast<char*>(&data[0]), data.size());
|
response.out().write(reinterpret_cast<char*>(&data[0]), data.size());
|
||||||
|
|
||||||
LMS_LOG(MOD_UI, SEV_DEBUG) << "Written " << data.size() << " bytes! complete = " << std::boolalpha << transcoder->isComplete();
|
LMS_LOG(UI, DEBUG) << "Written " << data.size() << " bytes! complete = " << std::boolalpha << transcoder->isComplete();
|
||||||
|
|
||||||
if (!response.out())
|
if (!response.out())
|
||||||
LMS_LOG(MOD_UI, SEV_ERROR) << "Write failed!";
|
LMS_LOG(UI, ERROR) << "Write failed!";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!transcoder->isComplete() && response.out()) {
|
if (!transcoder->isComplete() && response.out()) {
|
||||||
@@ -90,7 +90,7 @@ AvConvTranscodeStreamResource::handleRequest(const Wt::Http::Request& request,
|
|||||||
continuation->setData(transcoder);
|
continuation->setData(transcoder);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
LMS_LOG(MOD_UI, SEV_DEBUG) << "No more data!";
|
LMS_LOG(UI, DEBUG) << "No more data!";
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace UserInterface
|
} // namespace UserInterface
|
||||||
|
|||||||
@@ -175,7 +175,7 @@ CoverResource::handleRequest(const Wt::Http::Request& request, Wt::Http::Respons
|
|||||||
}
|
}
|
||||||
catch (std::invalid_argument& e)
|
catch (std::invalid_argument& e)
|
||||||
{
|
{
|
||||||
LMS_LOG(MOD_UI, SEV_ERROR) << "Invalid argument: " << e.what();
|
LMS_LOG(UI, ERROR) << "Invalid argument: " << e.what();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ Settings::Settings(Wt::WContainerWidget* parent)
|
|||||||
void
|
void
|
||||||
Settings::handleDatabaseDirectoriesChanged()
|
Settings::handleDatabaseDirectoriesChanged()
|
||||||
{
|
{
|
||||||
LMS_LOG(MOD_UI, SEV_NOTICE) << "Media directories have changed: requesting imediate scan";
|
LMS_LOG(UI, INFO) << "Media directories have changed: requesting imediate scan";
|
||||||
// On directory add or delete, request an immediate scan
|
// On directory add or delete, request an immediate scan
|
||||||
{
|
{
|
||||||
Wt::Dbo::Transaction transaction(DboSession());
|
Wt::Dbo::Transaction transaction(DboSession());
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ class AccountFormModel : public Wt::WFormModel
|
|||||||
}
|
}
|
||||||
catch(Wt::Dbo::Exception& exception)
|
catch(Wt::Dbo::Exception& exception)
|
||||||
{
|
{
|
||||||
LMS_LOG(MOD_UI, SEV_ERROR) << "Dbo exception: " << exception.what();
|
LMS_LOG(UI, ERROR) << "Dbo exception: " << exception.what();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ class AudioFormModel : public Wt::WFormModel
|
|||||||
}
|
}
|
||||||
catch(Wt::Dbo::Exception& exception)
|
catch(Wt::Dbo::Exception& exception)
|
||||||
{
|
{
|
||||||
LMS_LOG(MOD_UI, SEV_ERROR) << "Dbo exception: " << exception.what();
|
LMS_LOG(UI, ERROR) << "Dbo exception: " << exception.what();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ class DatabaseFormModel : public Wt::WFormModel
|
|||||||
}
|
}
|
||||||
catch(Wt::Dbo::Exception& exception)
|
catch(Wt::Dbo::Exception& exception)
|
||||||
{
|
{
|
||||||
LMS_LOG(MOD_UI, SEV_ERROR) << "Dbo exception: " << exception.what();
|
LMS_LOG(UI, ERROR) << "Dbo exception: " << exception.what();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ class FirstConnectionFormModel : public Wt::WFormModel
|
|||||||
// If it's the case, just do nothing
|
// If it's the case, just do nothing
|
||||||
if (!Database::User::getAll(DboSession()).empty())
|
if (!Database::User::getAll(DboSession()).empty())
|
||||||
{
|
{
|
||||||
LMS_LOG(MOD_UI, SEV_ERROR) << "Admin user already created";
|
LMS_LOG(UI, ERROR) << "Admin user already created";
|
||||||
error = Wt::WString("Admin user already created!");
|
error = Wt::WString("Admin user already created!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -86,7 +86,7 @@ class FirstConnectionFormModel : public Wt::WFormModel
|
|||||||
}
|
}
|
||||||
catch(Wt::Dbo::Exception& exception)
|
catch(Wt::Dbo::Exception& exception)
|
||||||
{
|
{
|
||||||
LMS_LOG(MOD_UI, SEV_ERROR) << "Dbo exception: " << exception.what();
|
LMS_LOG(UI, ERROR) << "Dbo exception: " << exception.what();
|
||||||
error = Wt::WString(exception.what());
|
error = Wt::WString(exception.what());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ class MediaDirectoryFormModel : public Wt::WFormModel
|
|||||||
}
|
}
|
||||||
catch(Wt::Dbo::Exception& exception)
|
catch(Wt::Dbo::Exception& exception)
|
||||||
{
|
{
|
||||||
LMS_LOG(MOD_UI, SEV_ERROR) << "Dbo exception: " << exception.what();
|
LMS_LOG(UI, ERROR) << "Dbo exception: " << exception.what();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -168,12 +168,12 @@ class UserFormModel : public Wt::WFormModel
|
|||||||
|
|
||||||
// user may have been deleted by someone else
|
// user may have been deleted by someone else
|
||||||
if (!authUser.isValid()) {
|
if (!authUser.isValid()) {
|
||||||
LMS_LOG(MOD_UI, SEV_ERROR) << "user identity does not exist!";
|
LMS_LOG(UI, ERROR) << "user identity does not exist!";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if(!user)
|
else if(!user)
|
||||||
{
|
{
|
||||||
LMS_LOG(MOD_UI, SEV_ERROR) << "User not found!";
|
LMS_LOG(UI, ERROR) << "User not found!";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -206,7 +206,7 @@ class UserFormModel : public Wt::WFormModel
|
|||||||
}
|
}
|
||||||
catch(Wt::Dbo::Exception& exception)
|
catch(Wt::Dbo::Exception& exception)
|
||||||
{
|
{
|
||||||
LMS_LOG(MOD_UI, SEV_ERROR) << "Dbo exception: " << exception.what();
|
LMS_LOG(UI, ERROR) << "Dbo exception: " << exception.what();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -96,12 +96,12 @@ Users::refresh(void)
|
|||||||
}
|
}
|
||||||
catch(Wt::Dbo::Exception& e)
|
catch(Wt::Dbo::Exception& e)
|
||||||
{
|
{
|
||||||
LMS_LOG(MOD_UI, SEV_ERROR) << "Caught exception when getting userId=" << userId << ": " << e.code();
|
LMS_LOG(UI, ERROR) << "Caught exception when getting userId=" << userId << ": " << e.code();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!authUser.isValid()) {
|
if (!authUser.isValid()) {
|
||||||
LMS_LOG(MOD_UI, SEV_ERROR) << "Users::refresh: skipping invalid userId = " << userId;
|
LMS_LOG(UI, ERROR) << "Users::refresh: skipping invalid userId = " << userId;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user