<translation type="unfinished"></translation>
</message>
<message>
- <source>An unknown error has occured!</source>
+ <source>Failed to load the Cue Sheet file:</source>
<translation type="unfinished"></translation>
</message>
<message>
- <source>Failed to load the Cue Sheet file:</source>
+ <source>The specified file could not be found!</source>
<translation type="unfinished"></translation>
</message>
<message>
<translation type="unfinished"></translation>
</message>
<message>
- <source>The specified file could not be found!</source>
+ <source>An unknown error has occured!</source>
<translation type="unfinished"></translation>
</message>
<message>
<translation type="unfinished"></translation>
</message>
<message>
+ <source>Error: The selected output directory could not be created!</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
<source>Error: The selected output directory is not writable!</source>
<translation type="unfinished"></translation>
</message>
<source>Splitting file(s), please wait...</source>
<translation type="unfinished"></translation>
</message>
+ <message>
+ <source>An unexpected error has occured while splitting the Cue Sheet!</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Imported %1 track(s) from the Cue Sheet and skipped %2 track(s).</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Cue Sheet Completed</source>
+ <translation type="unfinished"></translation>
+ </message>
</context>
<context>
<name>CueSheetImport</name>
<translation type="unfinished"></translation>
</message>
<message>
- <source> Output Directory </source>
+ <source>Existing Source File</source>
<translation type="unfinished"></translation>
</message>
<message>
- <source>Browse...</source>
+ <source>Missing Source File (Tracks will be skipped!)</source>
<translation type="unfinished"></translation>
</message>
<message>
- <source>Discard</source>
+ <source> Output Directory </source>
<translation type="unfinished"></translation>
</message>
<message>
- <source>Existing Source File</source>
+ <source>Browse...</source>
<translation type="unfinished"></translation>
</message>
<message>
- <source>Missing Source File (Tracks will be skipped!)</source>
+ <source>Discard</source>
<translation type="unfinished"></translation>
</message>
</context>
<translation type="unfinished"></translation>
</message>
<message>
+ <source>Duration</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
<source>File %1</source>
<translation type="unfinished"></translation>
</message>
<source>Unknown Title</source>
<translation type="unfinished"></translation>
</message>
- <message>
- <source>Duration</source>
- <translation type="unfinished"></translation>
- </message>
</context>
<context>
<name>DecoderRegistry</name>
<translation type="unfinished"></translation>
</message>
<message>
+ <source>Import Cue Sheet</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
<source>Adding file(s), please wait...</source>
<translation type="unfinished"></translation>
</message>
<translation type="unfinished"></translation>
</message>
<message>
+ <source>Open Cue Sheet</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Cue Sheet File</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
<source>Beta Updates</source>
<translation type="unfinished"></translation>
</message>
<source>The LameXP shell integration has been re-enabled.</source>
<translation type="unfinished"></translation>
</message>
- <message>
- <source>Import Cue Sheet</source>
- <translation type="unfinished"></translation>
- </message>
- <message>
- <source>Open Cue Sheet</source>
- <translation type="unfinished"></translation>
- </message>
- <message>
- <source>Cue Sheet File</source>
- <translation type="unfinished"></translation>
- </message>
</context>
<context>
<name>MetaInfo</name>
<name>CueImportDialog</name>
<message>
<source>Import Cue Sheet</source>
- <translation type="unfinished"></translation>
+ <translation>Cuehseet Assistent</translation>
</message>
<message>
<source>The following Cue Sheet will be split and imported into LameXP.</source>
- <translation type="unfinished"></translation>
+ <translation>Das folgende Cuesheet wird aufgeteilt und in LameXP importiert.</translation>
</message>
<message>
<source>Loading Cue Sheet file, please be patient...</source>
- <translation type="unfinished"></translation>
+ <translation>Cuesheet Datei wird geladen, bitte warten...</translation>
</message>
<message>
<source>An unknown error has occured!</source>
- <translation type="unfinished"></translation>
+ <translation>Ein unbekannter Fehler ist aufgetreten!</translation>
</message>
<message>
<source>Failed to load the Cue Sheet file:</source>
- <translation type="unfinished"></translation>
+ <translation>Fehler beim Laden der Cuesheet Datei:</translation>
</message>
<message>
<source>Cue Sheet Error</source>
- <translation type="unfinished"></translation>
+ <translation>Cuesheet Fehler</translation>
</message>
<message>
<source>The specified file could not be found!</source>
- <translation type="unfinished"></translation>
+ <translation>Die angegebene Datei konnte nicht gefunden werden!</translation>
</message>
<message>
<source>The file could not be opened for reading. Make sure you have the required rights!</source>
- <translation type="unfinished"></translation>
+ <translation>Datei kann nicht geöffnet werden. Stellen Sie sicher, dass Sie über die notwendigen Rechte verfügen!</translation>
</message>
<message>
<source>The provided file does not look like a valid Cue Sheet disc image file!</source>
- <translation type="unfinished"></translation>
+ <translation>Die angegebene Datei scheint keine gültige Cuesheet Datei zu sein!</translation>
</message>
<message>
<source>Could not find any supported audio track in the Cue Sheet image!</source>
- <translation type="unfinished"></translation>
+ <translation>Es konnte kein unterstützter Audio-Track im Cuesheet gefunden werden!</translation>
</message>
<message>
<source>Note that LameXP can not handle "binary" Cue Sheet images.</source>
- <translation type="unfinished"></translation>
+ <translation>Beachten Sie, dass LameXP keine "binären" Cuesheets unterstützt.</translation>
</message>
<message>
<source>The selected Cue Sheet file contains inconsistent information. Take care!</source>
- <translation type="unfinished"></translation>
+ <translation>Das Cuesheet enthält inkonsistente Informationen. Bitte geben Sie Acht!</translation>
</message>
<message>
<source>Choose Output Directory</source>
- <translation type="unfinished"></translation>
+ <translation>Ausgabe-Verzeichnis auswählen</translation>
</message>
<message>
<source>LameXP</source>
- <translation type="unfinished">LameXP</translation>
+ <translation>LameXP</translation>
</message>
<message>
<source>Error: The selected output directory is not writable!</source>
- <translation type="unfinished"></translation>
+ <translation>Fehler: Im Ausgabe-Verzeichnis kann nicht geschrieben werden!</translation>
</message>
<message>
<source>Low Diskspace Warning</source>
- <translation type="unfinished">Warnung: Wenig freier Festplattenspeicher</translation>
+ <translation>Warnung: Wenig freier Festplattenspeicher</translation>
</message>
<message>
<source>There are less than %1 GB of free diskspace available in the selected output directory.</source>
- <translation type="unfinished"></translation>
+ <translation>Es sind weniger als %1 GB freier Speicherplatz im Ausgabe-Verzeichnis verfügbar.</translation>
</message>
<message>
<source>It is highly recommend to free up more diskspace before proceeding with the import!</source>
- <translation type="unfinished"></translation>
+ <translation>Es wird dringend empfohlen, vor dem Fortfahren mehr Speicherplatz freizugeben!</translation>
</message>
<message>
<source>Analyzing file(s), please wait...</source>
- <translation type="unfinished"></translation>
+ <translation>Analysiere Dateien, bitte warten...</translation>
</message>
<message>
<source>Splitting file(s), please wait...</source>
- <translation type="unfinished"></translation>
+ <translation>Dateien werden aufgeteilt, bitte warten...</translation>
+ </message>
+ <message>
+ <source>Error: The selected output directory could not be created!</source>
+ <translation>Fehler: Das Ausgabe-Verzeichnis konnte nicht erstellt werden!</translation>
+ </message>
+ <message>
+ <source>An unexpected error has occured while splitting the Cue Sheet!</source>
+ <translation>Beim Aufteilen des Cuesheets is ein unerwarteter Fehler aufgetreten!</translation>
+ </message>
+ <message>
+ <source>Imported %1 track(s) from the Cue Sheet and skipped %2 track(s).</source>
+ <translation>%1 Datei(ein) wurden aus dem Cuesheet importiert und %2 Datei(en) übersprungen.</translation>
+ </message>
+ <message>
+ <source>Cue Sheet Completed</source>
+ <translation>Cuesheet Abgeschlossen</translation>
</message>
</context>
<context>
<name>CueSheetImport</name>
<message>
<source>Import Cue Sheet</source>
- <translation type="unfinished"></translation>
+ <translation>Cuesheet Importieren</translation>
</message>
<message>
<source> Output Directory </source>
- <translation type="unfinished"></translation>
+ <translation> Ausgabe-Verzeichnis </translation>
</message>
<message>
<source>Browse...</source>
- <translation type="unfinished">Durchsuchen...</translation>
+ <translation>Durchsuchen...</translation>
</message>
<message>
<source>Discard</source>
- <translation type="unfinished">Schließen</translation>
+ <translation>Schließen</translation>
</message>
<message>
<source>Existing Source File</source>
- <translation type="unfinished"></translation>
+ <translation>Existierende Quelldatei</translation>
</message>
<message>
<source>Missing Source File (Tracks will be skipped!)</source>
- <translation type="unfinished"></translation>
+ <translation>Fehlende Quelldatei (Tracks werden übersprungen!)</translation>
</message>
</context>
<context>
<name>CueSheetModel</name>
<message>
<source>No.</source>
- <translation type="unfinished"></translation>
+ <translation>Nr.</translation>
</message>
<message>
<source>File / Track</source>
- <translation type="unfinished"></translation>
+ <translation>Datei / Track</translation>
</message>
<message>
<source>Index</source>
- <translation type="unfinished"></translation>
+ <translation>Index</translation>
</message>
<message>
<source>File %1</source>
- <translation type="unfinished"></translation>
+ <translation>Datei %1</translation>
</message>
<message>
<source>Track %1</source>
- <translation type="unfinished"></translation>
+ <translation>Titel %1</translation>
</message>
<message>
<source>Unknown Artist</source>
- <translation type="unfinished"></translation>
+ <translation>Unbekannter Künstler</translation>
</message>
<message>
<source>Unknown Title</source>
- <translation type="unfinished"></translation>
+ <translation>Unbekannter Titel</translation>
</message>
<message>
<source>Duration</source>
- <translation type="unfinished">Dauer</translation>
+ <translation>Dauer</translation>
</message>
</context>
<context>
</message>
<message>
<source>Import Cue Sheet</source>
- <translation type="unfinished"></translation>
+ <translation>Cuesheet importieren</translation>
</message>
<message>
<source>Open Cue Sheet</source>
- <translation type="unfinished"></translation>
+ <translation>Cuesheet öffnen</translation>
</message>
<message>
<source>Cue Sheet File</source>
- <translation type="unfinished"></translation>
+ <translation>Cuesheet Datei</translation>
</message>
</context>
<context>
<source>Splitting file(s), please wait...</source>
<translation type="unfinished"></translation>
</message>
+ <message>
+ <source>Error: The selected output directory could not be created!</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>An unexpected error has occured while splitting the Cue Sheet!</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Imported %1 track(s) from the Cue Sheet and skipped %2 track(s).</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Cue Sheet Completed</source>
+ <translation type="unfinished"></translation>
+ </message>
</context>
<context>
<name>CueSheetImport</name>
<source>Splitting file(s), please wait...</source>
<translation type="unfinished"></translation>
</message>
+ <message>
+ <source>Error: The selected output directory could not be created!</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>An unexpected error has occured while splitting the Cue Sheet!</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Imported %1 track(s) from the Cue Sheet and skipped %2 track(s).</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Cue Sheet Completed</source>
+ <translation type="unfinished"></translation>
+ </message>
</context>
<context>
<name>CueSheetImport</name>
<source>Splitting file(s), please wait...</source>
<translation type="unfinished"></translation>
</message>
+ <message>
+ <source>Error: The selected output directory could not be created!</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>An unexpected error has occured while splitting the Cue Sheet!</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Imported %1 track(s) from the Cue Sheet and skipped %2 track(s).</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Cue Sheet Completed</source>
+ <translation type="unfinished"></translation>
+ </message>
</context>
<context>
<name>CueSheetImport</name>
<source>Splitting file(s), please wait...</source>
<translation type="unfinished"></translation>
</message>
+ <message>
+ <source>Error: The selected output directory could not be created!</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>An unexpected error has occured while splitting the Cue Sheet!</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Imported %1 track(s) from the Cue Sheet and skipped %2 track(s).</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Cue Sheet Completed</source>
+ <translation type="unfinished"></translation>
+ </message>
</context>
<context>
<name>CueSheetImport</name>
<source>Splitting file(s), please wait...</source>
<translation type="unfinished"></translation>
</message>
+ <message>
+ <source>Error: The selected output directory could not be created!</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>An unexpected error has occured while splitting the Cue Sheet!</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Imported %1 track(s) from the Cue Sheet and skipped %2 track(s).</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Cue Sheet Completed</source>
+ <translation type="unfinished"></translation>
+ </message>
</context>
<context>
<name>CueSheetImport</name>
<source>Splitting file(s), please wait...</source>
<translation type="unfinished"></translation>
</message>
+ <message>
+ <source>Error: The selected output directory could not be created!</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>An unexpected error has occured while splitting the Cue Sheet!</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Imported %1 track(s) from the Cue Sheet and skipped %2 track(s).</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Cue Sheet Completed</source>
+ <translation type="unfinished"></translation>
+ </message>
</context>
<context>
<name>CueSheetImport</name>
+..\..\gui\CueSheetImport.ui
..\..\gui\DropBox.ui
..\..\gui\LogViewDialog.ui
..\..\gui\MainWindow.ui
..\..\src\Decoder_WavPack.cpp
..\..\src\Decoder_WMA.cpp
..\..\src\Dialog_About.cpp
+..\..\src\Dialog_CueImport.cpp
..\..\src\Dialog_DropBox.cpp
..\..\src\Dialog_LogView.cpp
..\..\src\Dialog_MainWindow.cpp
..\..\src\Main.cpp
..\..\src\Model_Artwork.cpp
..\..\src\Model_AudioFile.cpp
+..\..\src\Model_CueSheet.cpp
..\..\src\Model_FileList.cpp
..\..\src\Model_FileSystem.cpp
..\..\src\Model_MetaInfo.cpp
..\..\src\PlaylistImporter.cpp
..\..\src\Registry_Decoder.cpp
..\..\src\ShellIntegration.cpp
+..\..\src\Thread_CueSplitter.cpp
..\..\src\Thread_DiskObserver.cpp
..\..\src\Thread_FileAnalyzer.cpp
..\..\src\Thread_Initialization.cpp
..\..\src\Decoder_WavPack.h
..\..\src\Decoder_WMA.h
..\..\src\Dialog_About.h
+..\..\src\Dialog_CueImport.h
..\..\src\Dialog_DropBox.h
..\..\src\Dialog_LogView.h
..\..\src\Dialog_MainWindow.h
..\..\src\LockedFile.h
..\..\src\Model_Artwork.h
..\..\src\Model_AudioFile.h
+..\..\src\Model_CueSheet.h
..\..\src\Model_FileList.h
..\..\src\Model_FileSystem.h
..\..\src\Model_MetaInfo.h
..\..\src\Resource.h
..\..\src\ShellIntegration.h
..\..\src\Targetver.h
+..\..\src\Thread_CueSplitter.h
..\..\src\Thread_DiskObserver.h
..\..\src\Thread_FileAnalyzer.h
..\..\src\Thread_Initialization.h
#define VER_LAMEXP_MINOR_LO 2
#define VER_LAMEXP_TYPE Alpha
#define VER_LAMEXP_PATCH 15
-#define VER_LAMEXP_BUILD 520
+#define VER_LAMEXP_BUILD 523
///////////////////////////////////////////////////////////////////////////////
// Tools versions
progress->show(tr("Loading Cue Sheet file, please be patient..."));
QFileInfo cueFileInfo(m_cueFileName);
- QDir outputDir(cueFileInfo.canonicalPath());
- m_outputDir = outputDir.canonicalPath();
-
- setWindowTitle(QString("%1: %2").arg(windowTitle().split(":", QString::SkipEmptyParts).first().trimmed(), cueFileInfo.fileName()));
-
- if(!cueFileInfo.exists() || !cueFileInfo.isFile() || m_outputDir.isEmpty())
+ if(!cueFileInfo.exists() || !cueFileInfo.isFile())
{
QString text = QString("<nobr>%1</nobr><br><nobr>%2</nobr><br><br><nobr>%3</nobr>").arg(tr("Failed to load the Cue Sheet file:"), QDir::toNativeSeparators(m_cueFileName), tr("The specified file could not be found!")).replace("-", "−");
QMessageBox::warning(progress, tr("Cue Sheet Error"), text);
return CueSheetModel::ErrorIOFailure;
}
- outputDir.mkdir(cueFileInfo.completeBaseName());
- if(outputDir.cd(cueFileInfo.completeBaseName()))
- {
- m_outputDir = outputDir.canonicalPath();
- }
+ m_outputDir = QString("%1/%2").arg(cueFileInfo.canonicalPath(), cueFileInfo.completeBaseName());
+ setWindowTitle(QString("%1: %2").arg(windowTitle().split(":", QString::SkipEmptyParts).first().trimmed(), cueFileInfo.fileName()));
int iResult = m_model->loadCueSheet(m_cueFileName, QApplication::instance());
if(iResult != CueSheetModel::ErrorSuccess)
static const __int64 minimumFreeDiskspaceMultiplier = 2i64;
static const char *writeTestBuffer = "LAMEXP_WRITE_TEST";
+ QDir outputDir(m_outputDir);
+ outputDir.mkpath(".");
+ if(!(outputDir.exists() && outputDir.isReadable()))
+ {
+ QMessageBox::warning(this, tr("LameXP"), QString("<nobr>%2</nobr>").arg(tr("Error: The selected output directory could not be created!")));
+ return;
+ }
+
QFile writeTest(QString("%1/~%2.txt").arg(m_outputDir, lamexp_rand_str()));
if(!(writeTest.open(QIODevice::ReadWrite) && (writeTest.write(writeTestBuffer) == strlen(writeTestBuffer))))
{
{
m_fileInfo.clear();
- WorkingBanner *progress = new WorkingBanner(dynamic_cast<QWidget*>(parent()));
+ WorkingBanner *progress = new WorkingBanner(this);
FileAnalyzer *analyzer = new FileAnalyzer(files);
connect(analyzer, SIGNAL(fileSelected(QString)), progress, SLOT(setText(QString)), Qt::QueuedConnection);
void CueImportDialog::splitFiles(void)
{
+ int nTracksSkipped = 0;
+
WorkingBanner *progress = new WorkingBanner(this);
CueSplitter *splitter = new CueSplitter(m_outputDir, QFileInfo(m_cueFileName).completeBaseName().replace(".", " ").left(42).trimmed(), m_fileInfo);
-
+ splitter->setAlbumInfo(m_model->getAlbumPerformer(), m_model->getAlbumTitle());
+
connect(splitter, SIGNAL(fileSelected(QString)), progress, SLOT(setText(QString)), Qt::QueuedConnection);
connect(splitter, SIGNAL(fileSplit(AudioFileModel)), m_fileList, SLOT(addFile(AudioFileModel)), Qt::QueuedConnection);
-
+
int nFiles = m_model->getFileCount();
for(int i = 0; i < nFiles; i++)
{
AudioFileModel metaInfo(QString().sprintf("cue://File%02d/Track%02d", i, j));
metaInfo.setFileName(m_model->getTrackTitle(i, j));
metaInfo.setFileArtist(m_model->getTrackPerformer(i, j));
+ metaInfo.setFilePosition(trackNo);
try
{
catch(char *err)
{
qWarning("Failed to add track #%02d: %s", trackNo, err);
+ nTracksSkipped++;
}
}
}
progress->show(tr("Splitting file(s), please wait..."), splitter);
progress->close();
+ if(!splitter->getSuccess())
+ {
+ QMessageBox::warning(this, tr("Cue Sheet Error"), tr("An unexpected error has occured while splitting the Cue Sheet!"));
+ }
+ else
+ {
+ QString text = tr("Imported %1 track(s) from the Cue Sheet and skipped %2 track(s).").arg(QString::number(splitter->getTracksSuccess()), QString::number(splitter->getTracksSkipped() + nTracksSkipped));
+ QMessageBox::information(this, tr("Cue Sheet Completed"), text);
+ }
+
LAMEXP_DELETE(splitter);
LAMEXP_DELETE(progress);
}
////////////////////////////////////////////////////////////
CueSheetModel::CueSheetModel()
+:
+ m_fileIcon(":/icons/music.png"),
+ m_trackIcon(":/icons/control_play_blue.png")
{
int trackNo = 0;
return QDir::toNativeSeparators(trackPtr->parent()->fileName());
}
}
+ else if(role == Qt::DecorationRole)
+ {
+ if(index.column() == 0)
+ {
+ CueSheetItem *item = reinterpret_cast<CueSheetItem*>(index.internalPointer());
+
+ if(dynamic_cast<CueSheetFile*>(item))
+ {
+ return m_fileIcon;
+ }
+ else if(dynamic_cast<CueSheetTrack*>(item))
+ {
+ return m_trackIcon;
+ }
+ }
+ }
else if(role == Qt::FontRole)
{
QFont font("Monospace");
CueSheetFile *currentFile = NULL;
CueSheetTrack *currentTrack = NULL;
- QString albumTitle;
- QString albumPerformer;
+ m_albumTitle.clear();
+ m_albumPerformer.clear();
//Loop over the Cue Sheet until all lines were processed
for(int lines = 0; lines < INT_MAX; lines++)
{
if(currentTrack->isValid())
{
- currentTrack->setTitle(albumTitle, true);
- currentTrack->setPerformer(albumPerformer, true);
currentFile->addTrack(currentTrack);
currentTrack = NULL;
}
{
if(currentTrack->isValid())
{
- currentTrack->setTitle(albumTitle, true);
- currentTrack->setPerformer(albumPerformer, true);
currentFile->addTrack(currentTrack);
currentTrack = NULL;
}
{
if(bPreamble)
{
- albumTitle = rxTitle.cap(1);
+ m_albumTitle = rxTitle.cap(1).simplified();
}
else if(currentFile && currentTrack)
{
{
if(bPreamble)
{
- albumPerformer = rxPerformer.cap(1);
+ m_albumPerformer = rxPerformer.cap(1).simplified();
}
else if(currentFile && currentTrack)
{
{
if(currentTrack->isValid())
{
- currentTrack->setTitle(albumTitle, true);
- currentTrack->setPerformer(albumPerformer, true);
currentFile->addTrack(currentTrack);
currentTrack = NULL;
}
}
else
{
- int temp = static_cast<int>(index * 100.0);
+ int temp = static_cast<int>(floor(0.5 + (index * 100.0)));
int msec = temp % 100;
int secs = temp / 100;
void getTrackIndex(int fileIndex, int trackIndex, double *startIndex, double *duration);
QString getTrackPerformer(int fileIndex, int trackIndex);
QString getTrackTitle(int fileIndex, int trackIndex);
+ QString getAlbumPerformer(void) { return m_albumPerformer; }
+ QString getAlbumTitle(void) { return m_albumTitle; }
//Cue Sheet functions
int loadCueSheet(const QString &cueFile, QCoreApplication *application = NULL);
int parseCueFile(QFile &cueFile, const QDir &baseDir, QCoreApplication *application);
double parseTimeIndex(const QString &index);
QString indexToString(const double index) const;
+
QList<CueSheetFile*> m_files;
+ QString m_albumTitle;
+ QString m_albumPerformer;
+
+ const QIcon m_fileIcon;
+ const QIcon m_trackIcon;
};
qFatal("Invalid path to SoX binary. Tool not initialized properly.");
}
+ m_albumPerformer.clear();
+ m_albumTitle.clear();
+
qDebug("\n[CueSplitter::CueSplitter]");
int nInputFiles = inputFiles.count();
void CueSplitter::run()
{
m_bSuccess = false;
+ m_nTracksSuccess = 0;
+ m_nTracksSkipped = 0;
m_abortFlag = false;
int nTracks = min(min(min(m_trackFile.count(), m_trackNo.count()), min(m_trackOffset.count(), m_trackLength.count())), m_trackMetaInfo.count());
}
}
+void CueSplitter::setAlbumInfo(const QString &performer, const QString &title)
+{
+ if(!performer.isEmpty()) m_albumPerformer = performer;
+ if(!title.isEmpty()) m_albumTitle = title;
+}
+
////////////////////////////////////////////////////////////
// Privtae Functions
////////////////////////////////////////////////////////////
qDebug("Length: %f", length);
qDebug("Artist: <%s>", metaInfo.fileArtist().toUtf8().constData());
qDebug("Title: <%s>", metaInfo.fileName().toUtf8().constData());
-
- QRegExp regExp("In:(\\d+)(\\.\\d+)*%");
+
QString baseName = QFileInfo(output).fileName();
if(!m_inputFiles.contains(file))
{
qWarning("Unknown input file, skipping!");
+ m_nTracksSkipped++;
return;
}
if(inputFileInfo.formatContainerType().compare("Wave", Qt::CaseInsensitive) || inputFileInfo.formatAudioType().compare("PCM", Qt::CaseInsensitive))
{
qWarning("Sorry, only Wave/PCM files are supported at this time!");
+ m_nTracksSkipped++;
return;
}
+ AudioFileModel outFileInfo(metaInfo);
+ outFileInfo.setFilePath(output);
+ outFileInfo.setFormatContainerType(inputFileInfo.formatContainerType());
+ outFileInfo.setFormatAudioType(inputFileInfo.formatAudioType());
+
+ if(length != std::numeric_limits<double>::infinity())
+ {
+ outFileInfo.setFileDuration(static_cast<unsigned int>(abs(length)));
+ }
+ if(!m_albumTitle.isEmpty())
+ {
+ outFileInfo.setFileAlbum(m_albumTitle);
+ }
+ if(!m_albumPerformer.isEmpty() && outFileInfo.fileArtist().isEmpty())
+ {
+ outFileInfo.setFileArtist(m_albumPerformer);
+ }
+
QStringList args;
args << "-S" << "-V3";
args << "--guard" << "--temp" << ".";
args << QDir::toNativeSeparators(file);
args << QDir::toNativeSeparators(output);
- args << "trim";
- args << indexToString(offset);
- if((length != std::numeric_limits<double>::quiet_NaN()) && (length != std::numeric_limits<double>::infinity()))
+ if(offset != 0.0 || length != std::numeric_limits<double>::infinity())
{
- args << indexToString(length);
+ args << "trim";
+ args << indexToString(offset);
+
+ if((length != std::numeric_limits<double>::quiet_NaN()) && (length != std::numeric_limits<double>::infinity()))
+ {
+ args << indexToString(length);
+ }
}
+ QRegExp rxProgress("In:(\\d+)(\\.\\d+)*%", Qt::CaseInsensitive);
+ QRegExp rxChannels("Channels\\s*:\\s*(\\d+)", Qt::CaseInsensitive);
+ QRegExp rxSamplerate("Sample Rate\\s*:\\s*(\\d+)", Qt::CaseInsensitive);
+ QRegExp rxPrecision("Precision\\s*:\\s*(\\d+)-bit", Qt::CaseInsensitive);
+ QRegExp rxDuration("Duration\\s*:\\s*(\\d\\d):(\\d\\d):(\\d\\d).(\\d\\d)", Qt::CaseInsensitive);
+
QProcess process;
process.setProcessChannelMode(QProcess::MergedChannels);
process.setReadChannel(QProcess::StandardOutput);
qWarning("Error message: \"%s\"\n", process.errorString().toLatin1().constData());
process.kill();
process.waitForFinished(-1);
+ m_nTracksSkipped++;
return;
}
{
QByteArray line = process.readLine();
QString text = QString::fromUtf8(line.constData()).simplified();
- if(regExp.lastIndexIn(text) >= 0)
+ if(rxProgress.lastIndexIn(text) >= 0)
{
bool ok = false;
- int progress = regExp.cap(1).toInt(&ok);
+ int progress = rxProgress.cap(1).toInt(&ok);
if(ok)
{
emit fileSelected(QString("%1 [%2%]").arg(baseName, QString::number(progress)));
}
}
+ else if(rxChannels.lastIndexIn(text) >= 0)
+ {
+ bool ok = false;
+ unsigned int channels = rxChannels.cap(1).toUInt(&ok);
+ if(ok) outFileInfo.setFormatAudioChannels(channels);
+ }
+ else if(rxSamplerate.lastIndexIn(text) >= 0)
+ {
+ bool ok = false;
+ unsigned int samplerate = rxSamplerate.cap(1).toUInt(&ok);
+ if(ok) outFileInfo.setFormatAudioSamplerate(samplerate);
+ }
+ else if(rxPrecision.lastIndexIn(text) >= 0)
+ {
+ bool ok = false;
+ unsigned int precision = rxPrecision.cap(1).toUInt(&ok);
+ if(ok) outFileInfo.setFormatAudioBitdepth(precision);
+ }
+ else if(rxDuration.lastIndexIn(text) >= 0)
+ {
+ bool ok1 = false, ok2 = false, ok3 = false;
+ unsigned int hh = rxDuration.cap(1).toUInt(&ok1);
+ unsigned int mm = rxDuration.cap(2).toUInt(&ok2);
+ unsigned int ss = rxDuration.cap(3).toUInt(&ok3);
+ if(ok1 && ok2 && ok3)
+ {
+ unsigned intputLen = (hh * 3600) + (mm * 60) + ss;
+ if(length == std::numeric_limits<double>::infinity())
+ {
+ qDebug("Duration updated from SoX info!");
+ outFileInfo.setFileDuration(max(0, intputLen - static_cast<unsigned int>(floor(offset + 0.5))));
+ }
+ else
+ {
+ unsigned int trackEnd = static_cast<unsigned int>(floor(offset + 0.5)) + static_cast<unsigned int>(floor(length + 0.5));
+ if(trackEnd > intputLen) qWarning("Track is out of bounds: End of track exceeds input file duration!");
+ }
+ }
+ }
}
}
+ process.waitForFinished();
if(process.state() != QProcess::NotRunning)
{
process.kill();
if(process.exitStatus() != QProcess::NormalExit || QFileInfo(output).size() == 0)
{
- qWarning("Splitting has failed!");
+ qWarning("Splitting has failed !!!");
+ m_nTracksSkipped++;
return;
}
- AudioFileModel outFileInfo(metaInfo);
- outFileInfo.setFilePath(output);
- outFileInfo.setFormatContainerType(inputFileInfo.formatContainerType());
- outFileInfo.setFormatAudioType(inputFileInfo.formatAudioType());
- outFileInfo.setFileDuration(static_cast<unsigned int>(abs(length)));
emit fileSplit(outFileInfo);
+ m_nTracksSuccess++;
}
QString CueSplitter::indexToString(const double index) const
return QString();
}
- int temp = static_cast<int>(index * 1000.0);
+ int temp = static_cast<int>(floor(0.5 + (index * 1000.0)));
int msec = temp % 1000;
int secs = temp / 1000;
CueSplitter(const QString &outputDir, const QString &baseName, const QList<AudioFileModel> &inputFiles);
void run();
bool getSuccess(void) { return !isRunning() && m_bSuccess; }
+ unsigned int getTracksSuccess(void) { return m_nTracksSuccess; }
+ unsigned int getTracksSkipped(void) { return m_nTracksSkipped; }
void addTrack(const int trackNo, const QString &file, const double offset, const double length, const AudioFileModel &metaInfo);
+ void setAlbumInfo(const QString &performer, const QString &title);
signals:
void fileSelected(const QString &fileName);
const QString m_soxBin;
const QString m_outputDir;
const QString m_baseName;
+ unsigned int m_nTracksSuccess;
+ unsigned int m_nTracksSkipped;
bool m_bSuccess;
volatile bool m_abortFlag;
+ QString m_albumTitle;
+ QString m_albumPerformer;
QMap<QString,AudioFileModel> m_inputFiles;
QList<QString> m_trackFile;
QList<int> m_trackNo;