OSDN Git Service

Make the FileAnalyzer remember the recently analyzed files. This way the audio files...
authorlordmulder <mulder2@gmx.de>
Mon, 5 Sep 2011 22:51:00 +0000 (00:51 +0200)
committerlordmulder <mulder2@gmx.de>
Mon, 5 Sep 2011 22:51:00 +0000 (00:51 +0200)
src/Config.h
src/Thread_FileAnalyzer.cpp
src/Thread_FileAnalyzer.h

index c32e980..7eb8f1f 100644 (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
index 21c7aed..440cdf7 100644 (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))
        {
index 4c4ee66..d41f753 100644 (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;