1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-06 14:16:32 +02:00

Be able to do a dry-run scan

This commit is contained in:
Uwe L. Korn
2014-09-21 11:36:30 +01:00
parent f6c2a40cca
commit 6e22032aa5
2 changed files with 27 additions and 2 deletions

View File

@@ -137,6 +137,7 @@ MusicScanner::MusicScanner( MusicScanner::ScanMode scanMode, const QStringList&
, m_scanMode( scanMode ) , m_scanMode( scanMode )
, m_paths( paths ) , m_paths( paths )
, m_showProgress( true ) , m_showProgress( true )
, m_updateIndex( true )
, m_cmdQueue( 0 ) , m_cmdQueue( 0 )
, m_batchsize( bs ) , m_batchsize( bs )
, m_dirListerThreadController( 0 ) , m_dirListerThreadController( 0 )
@@ -173,6 +174,20 @@ MusicScanner::showingProgress()
} }
void
MusicScanner::updateIndex( bool _updateIndex )
{
m_updateIndex = _updateIndex;
}
bool
MusicScanner::updatingIndex()
{
return m_updateIndex;
}
void void
MusicScanner::startScan() MusicScanner::startScan()
{ {
@@ -264,8 +279,11 @@ MusicScanner::postOps()
if ( m_filesToDelete.length() || m_scannedfiles.length() ) if ( m_filesToDelete.length() || m_scannedfiles.length() )
{ {
SourceList::instance()->getLocal()->updateIndexWhenSynced(); if ( m_updateIndex )
commitBatch( m_scannedfiles, m_filesToDelete ); {
SourceList::instance()->getLocal()->updateIndexWhenSynced();
commitBatch( m_scannedfiles, m_filesToDelete );
}
m_scannedfiles.clear(); m_scannedfiles.clear();
m_filesToDelete.clear(); m_filesToDelete.clear();
} }

View File

@@ -110,6 +110,12 @@ public:
void showProgress( bool _showProgress ); void showProgress( bool _showProgress );
bool showingProgress(); bool showingProgress();
/**
* Specify if the search index should be updated or if we only want a dry run.
*/
void updateIndex( bool _updateIndex );
bool updatingIndex();
signals: signals:
//void fileScanned( QVariantMap ); //void fileScanned( QVariantMap );
void finished(); void finished();
@@ -137,6 +143,7 @@ private:
unsigned int m_scanned; unsigned int m_scanned;
unsigned int m_skipped; unsigned int m_skipped;
bool m_showProgress; bool m_showProgress;
bool m_updateIndex;
QList<QString> m_skippedFiles; QList<QString> m_skippedFiles;
QMap<QString, QMap< unsigned int, unsigned int > > m_filemtimes; QMap<QString, QMap< unsigned int, unsigned int > > m_filemtimes;