///////////////////////////////////////////////////////////////////////////////
// LameXP - Audio Encoder Front-End
-// Copyright (C) 2004-2012 LoRd_MuldeR <MuldeR2@GMX.de>
+// Copyright (C) 2004-2013 LoRd_MuldeR <MuldeR2@GMX.de>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
fflush(stdout);
fflush(stderr);
fprintf(stderr, "\nGURU MEDITATION !!!\n");
- FatalAppExit(0, L"Unhandeled exception error, application will exit!");
- TerminateProcess(GetCurrentProcess(), -1);
+ lamexp_fatal_exit(L"Unhandeled exception error, application will exit!");
}
}
case -1:
//File name already exists -> skipping!
emit processStateChanged(m_jobId, tr("Skipped."), ProgressModel::JobSkipped);
- emit processStateFinished(m_jobId, outFileName, true);
+ emit processStateFinished(m_jobId, outFileName, -1);
return;
default:
//File name could not be generated
emit processStateChanged(m_jobId, tr("Not found!"), ProgressModel::JobFailed);
- emit processStateFinished(m_jobId, outFileName, false);
+ emit processStateFinished(m_jobId, outFileName, 0);
return;
}
}
else
{
+ if(QFileInfo(outFileName).exists() && (QFileInfo(outFileName).size() < 512)) QFile::remove(outFileName);
handleMessage(QString("%1\n%2\n\n%3\t%4\n%5\t%6").arg(tr("The format of this file is NOT supported:"), m_audioFile.filePath(), tr("Container Format:"), m_audioFile.formatContainerInfo(), tr("Audio Format:"), m_audioFile.formatAudioCompressInfo()));
emit processStateChanged(m_jobId, tr("Unsupported!"), ProgressModel::JobFailed);
- emit processStateFinished(m_jobId, outFileName, false);
+ emit processStateFinished(m_jobId, outFileName, 0);
return;
}
}
bSuccess = m_encoder->encode(sourceFile, m_audioFile, outFileName, &m_aborted);
}
+ //Clean-up
+ if((!bSuccess) || m_aborted)
+ {
+ QFileInfo fileInfo(outFileName);
+ if(fileInfo.exists() && (fileInfo.size() < 512))
+ {
+ QFile::remove(outFileName);
+ }
+ }
+
//Make sure output file exists
- if(bSuccess && !m_aborted)
+ if(bSuccess && (!m_aborted))
{
QFileInfo fileInfo(outFileName);
bSuccess = fileInfo.exists() && fileInfo.isFile() && (fileInfo.size() > 0);
//Report result
emit processStateChanged(m_jobId, (m_aborted ? tr("Aborted!") : (bSuccess ? tr("Done.") : tr("Failed!"))), ((bSuccess && !m_aborted) ? ProgressModel::JobComplete : ProgressModel::JobFailed));
- emit processStateFinished(m_jobId, outFileName, bSuccess);
+ emit processStateFinished(m_jobId, outFileName, (bSuccess ? 1 : 0));
qDebug("Process thread is done.");
}