Make the FileAnalyzer remember the recently analyzed files. This way the audio files won't be MediaInfo'ed twice, when adding a folder that contains audio files *and* a playlist references these audio files.

This commit is contained in:
LoRd_MuldeR 2011-09-06 00:51:00 +02:00
parent 64696fa133
commit 85cc4daac3
3 changed files with 17 additions and 3 deletions

View File

@ -30,7 +30,7 @@
#define VER_LAMEXP_MINOR_LO 3
#define VER_LAMEXP_TYPE Beta
#define VER_LAMEXP_PATCH 1
#define VER_LAMEXP_BUILD 682
#define VER_LAMEXP_BUILD 683
///////////////////////////////////////////////////////////////////////////////
// Tools versions

View File

@ -77,6 +77,7 @@ void FileAnalyzer::run()
m_filesCueSheet = 0;
m_inputFiles.sort();
m_recentlyAdded.clear();
m_abortFlag = false;
while(!m_inputFiles.isEmpty())
@ -94,7 +95,11 @@ void FileAnalyzer::run()
qWarning("Operation cancelled by user!");
return;
}
if(fileType == fileTypeSkip)
{
qWarning("File was recently added, skipping!");
continue;
}
if(fileType == fileTypeDenied)
{
m_filesDenied++;
@ -142,6 +147,7 @@ void FileAnalyzer::run()
}
m_filesAccepted++;
m_recentlyAdded.append(file.filePath());
emit fileAnalyzed(file);
}
@ -161,6 +167,12 @@ const AudioFileModel FileAnalyzer::analyzeFile(const QString &filePath, int *typ
m_currentSection = sectionOther;
m_currentCover = coverNone;
if(m_recentlyAdded.contains(filePath, Qt::CaseInsensitive))
{
*type = fileTypeSkip;
return audioFile;
}
QFile readTest(filePath);
if(!readTest.open(QIODevice::ReadOnly))
{

View File

@ -74,7 +74,8 @@ private:
{
fileTypeNormal = 0,
fileTypeCDDA = 1,
fileTypeDenied = 2
fileTypeDenied = 2,
fileTypeSkip = 3
};
const AudioFileModel analyzeFile(const QString &filePath, int *type);
@ -90,6 +91,7 @@ private:
const QString m_avs2wavBin;
QStringList m_inputFiles;
QStringList m_recentlyAdded;
section_t m_currentSection;
cover_t m_currentCover;
unsigned int m_filesAccepted;