1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-20 07:49:42 +01:00

Make MusicScanner run in verbose mode when Tomahawk is run with --verbose.

This commit is contained in:
Christian Muehlhaeuser 2015-04-11 08:10:53 +02:00
parent 701cf0f1d3
commit 57dac31d2a
2 changed files with 12 additions and 11 deletions

View File

@ -60,10 +60,10 @@ DirLister::scanDir( QDir dir, int depth )
return;
}
tDebug( LOGVERBOSE ) << "DirLister::scanDir scanning:" << dir.canonicalPath();
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "scanning:" << dir.canonicalPath();
if ( !dir.exists() || m_processedDirs.contains( dir.canonicalPath() ) )
{
tDebug( LOGVERBOSE ) << "Dir no longer exists or already scanned, ignoring";
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Dir no longer exists or already scanned, ignoring";
m_opcount--;
if ( m_opcount == 0 )
@ -191,7 +191,7 @@ MusicScanner::verbose()
void
MusicScanner::startScan()
{
tDebug( LOGVERBOSE ) << "Loading mtimes...";
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Loading mtimes...";
m_scanned = m_skipped = m_cmdQueue = 0;
m_skippedFiles.clear();
@ -222,7 +222,7 @@ MusicScanner::setFileMtimes( const QMap< QString, QMap< unsigned int, unsigned i
void
MusicScanner::scan()
{
tDebug( LOGVERBOSE ) << "Num saved file mtimes from last scan:" << m_filemtimes.size();
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Num saved file mtimes from last scan:" << m_filemtimes.size();
connect( this, SIGNAL( batchReady( QVariantList, QVariantList ) ),
SLOT( commitBatch( QVariantList, QVariantList ) ), Qt::DirectConnection );
@ -269,10 +269,10 @@ MusicScanner::postOps()
}
}
tDebug( LOGINFO ) << "Scanning complete, saving to database. ( deleted" << m_filesToDelete.count() << "- scanned" << m_scanned << "- skipped" << m_skipped << ")";
tDebug( LOGEXTRA ) << "Skipped the following files (no tags / no valid audio):";
tDebug( LOGINFO ) << Q_FUNC_INFO << "Scanning complete, saving to database. ( deleted" << m_filesToDelete.count() << "- scanned" << m_scanned << "- skipped" << m_skipped << ")";
tDebug( LOGEXTRA ) << Q_FUNC_INFO << "Skipped the following files (no tags / no valid audio):";
foreach ( const QString& s, m_skippedFiles )
tDebug( LOGEXTRA ) << s;
tDebug( LOGEXTRA ) << Q_FUNC_INFO << s;
if ( !m_filesToDelete.isEmpty() || !m_scannedfiles.isEmpty() )
{
@ -370,7 +370,6 @@ MusicScanner::scanFile( const QFileInfo& fi )
m_filemtimes.remove( "file://" + fi.canonicalFilePath() );
}
//tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Scanning file:" << fi.canonicalFilePath();
QVariant m = readFile( fi );
if ( m.toMap().isEmpty() )
return;
@ -458,7 +457,7 @@ MusicScanner::readFile( const QFileInfo& fi )
emit progress( m_scanned );
if ( m_scanned % 100 == 0 || m_verbose )
tDebug( LOGINFO ) << "Scanning file:" << m_scanned << fi.canonicalFilePath();
tDebug( LOGINFO ) << Q_FUNC_INFO << "Scanning file:" << m_scanned << fi.canonicalFilePath();
if ( m.toMap().isEmpty() )
{

View File

@ -55,6 +55,8 @@ void
MusicScannerThreadController::run()
{
m_musicScanner = QPointer< MusicScanner >( new MusicScanner( m_mode, m_paths, m_bs ) );
m_musicScanner->setVerbose( qApp->arguments().contains( "--verbose" ) );
connect( m_musicScanner.data(), SIGNAL( finished() ), parent(), SLOT( scannerFinished() ), Qt::QueuedConnection );
connect( m_musicScanner.data(), SIGNAL( progress( unsigned int ) ), parent(), SIGNAL( progress( unsigned int ) ), Qt::QueuedConnection );
QMetaObject::invokeMethod( m_musicScanner.data(), "startScan", Qt::QueuedConnection );
@ -196,7 +198,7 @@ ScanManager::runNormalScan( bool manualFull )
{
if ( m_queuedScanType != MusicScanner::Full )
m_queuedScanType = manualFull ? MusicScanner::Full : MusicScanner::Normal;
tDebug( LOGVERBOSE ) << "Could not run dir scan, old scan still running";
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Could not run dir scan, old scan still running";
return;
}
@ -243,7 +245,7 @@ ScanManager::runFileScan( const QStringList& paths, bool updateGUI )
{
if ( m_queuedScanType == MusicScanner::None )
m_queuedScanType = MusicScanner::File;
tDebug( LOGVERBOSE ) << "Could not run file scan, old scan still running";
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Could not run file scan, old scan still running";
return;
}