1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-06-04 15:04:59 +02: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 adfe9804a2
commit 21d38f8538
2 changed files with 12 additions and 11 deletions

View File

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

View File

@ -55,6 +55,8 @@ void
MusicScannerThreadController::run() MusicScannerThreadController::run()
{ {
m_musicScanner = QPointer< MusicScanner >( new MusicScanner( m_mode, m_paths, m_bs ) ); 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( finished() ), parent(), SLOT( scannerFinished() ), Qt::QueuedConnection );
connect( m_musicScanner.data(), SIGNAL( progress( unsigned int ) ), parent(), SIGNAL( progress( unsigned int ) ), 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 ); QMetaObject::invokeMethod( m_musicScanner.data(), "startScan", Qt::QueuedConnection );
@ -196,7 +198,7 @@ ScanManager::runNormalScan( bool manualFull )
{ {
if ( m_queuedScanType != MusicScanner::Full ) if ( m_queuedScanType != MusicScanner::Full )
m_queuedScanType = manualFull ? MusicScanner::Full : MusicScanner::Normal; 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; return;
} }
@ -243,7 +245,7 @@ ScanManager::runFileScan( const QStringList& paths, bool updateGUI )
{ {
if ( m_queuedScanType == MusicScanner::None ) if ( m_queuedScanType == MusicScanner::None )
m_queuedScanType = MusicScanner::File; 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; return;
} }