From: lordmulder Date: Sat, 19 Mar 2011 14:35:17 +0000 (+0100) Subject: Detect the .cda files that can be found in the root of the "dummy" file systems that... X-Git-Tag: Release_401~34 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=cf45f0391feef4f83b8c84f0ad2f7f9e0d06ae00;p=lamexp%2FLameXP.git Detect the .cda files that can be found in the root of the "dummy" file systems that Windows emulates for Audio-CD's. If such files are encountered, we tell the user gently to rip the audio tracks with EAC. --- diff --git a/etc/Translation/Blank.ts b/etc/Translation/Blank.ts index 401a901e..06528364 100644 --- a/etc/Translation/Blank.ts +++ b/etc/Translation/Blank.ts @@ -774,6 +774,22 @@ + CDA Files + + + + %1 file(s) have been rejected, because they are dummy CDDA files! + + + + Sorry, LameXP cannot extract audio tracks from an Audio−CD at present. + + + + We recommend using %1 for that purpose. + + + Files Rejected diff --git a/etc/Translation/LameXP_DE.ts b/etc/Translation/LameXP_DE.ts index 92dc3324..24f2646e 100644 --- a/etc/Translation/LameXP_DE.ts +++ b/etc/Translation/LameXP_DE.ts @@ -1194,6 +1194,22 @@ Cannot write to the selected directory. Please choose another directory! In das ausgewählte Verzeichnis kann nicht geschrieben werden. Bitte ein anderes Verzeichnis auswählen! + + CDA Files + CDA Dateien + + + %1 file(s) have been rejected, because they are dummy CDDA files! + %1 Datei(en) wurden abgewiesen, weil es sich um CDDA Platzhalter−Dateien handelt! + + + Sorry, LameXP cannot extract audio tracks from an Audio−CD at present. + LameXP ist derzeit leider nicht dazu in der Lage, Audio Tracks von einer Audio−CD zu extrahieren. + + + We recommend using %1 for that purpose. + Es wird empfohlen %1 für diesen Zweck zu verwenden. + MetaInfo diff --git a/etc/Translation/LameXP_ES.ts b/etc/Translation/LameXP_ES.ts index 8967be72..1b7fcc0b 100644 --- a/etc/Translation/LameXP_ES.ts +++ b/etc/Translation/LameXP_ES.ts @@ -1193,6 +1193,22 @@ Cannot write to the selected directory. Please choose another directory! + + CDA Files + + + + %1 file(s) have been rejected, because they are dummy CDDA files! + + + + We recommend using %1 for that purpose. + + + + Sorry, LameXP cannot extract audio tracks from an Audio−CD at present. + + MetaInfo diff --git a/etc/Translation/LameXP_FR.ts b/etc/Translation/LameXP_FR.ts index 88a205f2..7f33cec1 100644 --- a/etc/Translation/LameXP_FR.ts +++ b/etc/Translation/LameXP_FR.ts @@ -1202,6 +1202,22 @@ Sélection automatique (par défaut) Cannot write to the selected directory. Please choose another directory! + + CDA Files + + + + %1 file(s) have been rejected, because they are dummy CDDA files! + + + + We recommend using %1 for that purpose. + + + + Sorry, LameXP cannot extract audio tracks from an Audio−CD at present. + + MetaInfo diff --git a/etc/Translation/LameXP_IT.ts b/etc/Translation/LameXP_IT.ts index 37ab152b..14dcd6b9 100644 --- a/etc/Translation/LameXP_IT.ts +++ b/etc/Translation/LameXP_IT.ts @@ -1194,6 +1194,22 @@ Cannot write to the selected directory. Please choose another directory! + + CDA Files + + + + %1 file(s) have been rejected, because they are dummy CDDA files! + + + + We recommend using %1 for that purpose. + + + + Sorry, LameXP cannot extract audio tracks from an Audio−CD at present. + + MetaInfo diff --git a/etc/Translation/LameXP_RU.ts b/etc/Translation/LameXP_RU.ts index 13df0478..ad1df0ae 100644 --- a/etc/Translation/LameXP_RU.ts +++ b/etc/Translation/LameXP_RU.ts @@ -1196,6 +1196,22 @@ Cannot write to the selected directory. Please choose another directory! + + CDA Files + + + + %1 file(s) have been rejected, because they are dummy CDDA files! + + + + We recommend using %1 for that purpose. + + + + Sorry, LameXP cannot extract audio tracks from an Audio−CD at present. + + MetaInfo diff --git a/etc/Translation/LameXP_UK.ts b/etc/Translation/LameXP_UK.ts index 113fd944..97c19ebb 100644 --- a/etc/Translation/LameXP_UK.ts +++ b/etc/Translation/LameXP_UK.ts @@ -1193,6 +1193,22 @@ Cannot write to the selected directory. Please choose another directory! + + CDA Files + + + + %1 file(s) have been rejected, because they are dummy CDDA files! + + + + We recommend using %1 for that purpose. + + + + Sorry, LameXP cannot extract audio tracks from an Audio−CD at present. + + MetaInfo diff --git a/res/localization/LameXP_DE.qm b/res/localization/LameXP_DE.qm index 97b6dec2..07940042 100644 Binary files a/res/localization/LameXP_DE.qm and b/res/localization/LameXP_DE.qm differ diff --git a/src/Config.h b/src/Config.h index ad93ad63..055edc1b 100644 --- a/src/Config.h +++ b/src/Config.h @@ -25,7 +25,7 @@ #define VER_LAMEXP_MAJOR 4 #define VER_LAMEXP_MINOR_HI 0 #define VER_LAMEXP_MINOR_LO 1 -#define VER_LAMEXP_BUILD 373 +#define VER_LAMEXP_BUILD 375 #define VER_LAMEXP_SUFFIX Beta-9 /* diff --git a/src/Dialog_MainWindow.cpp b/src/Dialog_MainWindow.cpp index 4f563203..eb632a82 100644 --- a/src/Dialog_MainWindow.cpp +++ b/src/Dialog_MainWindow.cpp @@ -436,6 +436,10 @@ void MainWindow::addFiles(const QStringList &files) { QMessageBox::warning(this, tr("Access Denied"), QString("%1
%2
").arg(tr("%1 file(s) have been rejected, because read access was not granted!").arg(analyzer->filesDenied()), tr("This usually means the file is locked by another process."))); } + if(analyzer->filesDummyCDDA()) + { + QMessageBox::warning(this, tr("CDA Files"), QString("%1

%2
%3
").arg(tr("%1 file(s) have been rejected, because they are dummy CDDA files!").arg(analyzer->filesDummyCDDA()), tr("Sorry, LameXP cannot extract audio tracks from an Audio−CD at present."), tr("We recommend using %1 for that purpose.").arg("Exact Audio Copy"))); + } if(analyzer->filesRejected()) { QMessageBox::warning(this, tr("Files Rejected"), QString("%1
%2
").arg(tr("%1 file(s) have been rejected, because the file format could not be recognized!").arg(analyzer->filesRejected()), tr("This usually means the file is damaged or the file format is not supported."))); diff --git a/src/Thread_FileAnalyzer.cpp b/src/Thread_FileAnalyzer.cpp index cb9dc90c..0a0eb069 100644 --- a/src/Thread_FileAnalyzer.cpp +++ b/src/Thread_FileAnalyzer.cpp @@ -55,6 +55,7 @@ FileAnalyzer::FileAnalyzer(const QStringList &inputFiles) m_filesAccepted = 0; m_filesRejected = 0; m_filesDenied = 0; + m_filesDummyCDDA = 0; } //////////////////////////////////////////////////////////// @@ -68,6 +69,7 @@ void FileAnalyzer::run() m_filesAccepted = 0; m_filesRejected = 0; m_filesDenied = 0; + m_filesDummyCDDA = 0; m_inputFiles.sort(); @@ -113,10 +115,15 @@ const AudioFileModel FileAnalyzer::analyzeFile(const QString &filePath) m_filesDenied++; return audioFile; } - else + + if(checkFile_CDDA(readTest)) { - readTest.close(); + qWarning("Dummy CDDA file detected, skipping!"); + m_filesDummyCDDA ++; + return audioFile; } + + readTest.close(); QProcess process; process.setProcessChannelMode(QProcess::MergedChannels); @@ -359,6 +366,18 @@ unsigned int FileAnalyzer::parseDuration(const QString &str) return 0; } +bool FileAnalyzer::checkFile_CDDA(QFile &file) +{ + file.reset(); + QByteArray data = file.read(128); + + int i = data.indexOf("RIFF"); + int j = data.indexOf("CDDA"); + int k = data.indexOf("fmt "); + + return ((i >= 0) && (j >= 0) && (k >= 0) && (k > j) && (j > i)); +} + //////////////////////////////////////////////////////////// // Public Functions //////////////////////////////////////////////////////////// @@ -370,7 +389,7 @@ unsigned int FileAnalyzer::filesAccepted(void) unsigned int FileAnalyzer::filesRejected(void) { - return m_filesRejected - m_filesDenied; + return max(m_filesRejected - (m_filesDenied + m_filesDummyCDDA), 0); } unsigned int FileAnalyzer::filesDenied(void) @@ -378,6 +397,11 @@ unsigned int FileAnalyzer::filesDenied(void) return m_filesDenied; } +unsigned int FileAnalyzer::filesDummyCDDA(void) +{ + return m_filesDummyCDDA; +} + //////////////////////////////////////////////////////////// // EVENTS //////////////////////////////////////////////////////////// diff --git a/src/Thread_FileAnalyzer.h b/src/Thread_FileAnalyzer.h index 08f57653..13496732 100644 --- a/src/Thread_FileAnalyzer.h +++ b/src/Thread_FileAnalyzer.h @@ -46,6 +46,7 @@ public: unsigned int filesAccepted(void); unsigned int filesRejected(void); unsigned int filesDenied(void); + unsigned int filesDummyCDDA(void); signals: void fileSelected(const QString &fileName); @@ -64,6 +65,7 @@ private: void updateSection(const QString §ion); unsigned int parseYear(const QString &str); unsigned int parseDuration(const QString &str); + bool checkFile_CDDA(QFile &file); QStringList m_inputFiles; const QString m_mediaInfoBin_x86; @@ -72,5 +74,6 @@ private: unsigned int m_filesAccepted; unsigned int m_filesRejected; unsigned int m_filesDenied; + unsigned int m_filesDummyCDDA; bool m_bSuccess; };