Make Avisynth analyzer check the exit code of avs2wav.
This commit is contained in:
parent
eece27de06
commit
b0a6432b88
@ -30,7 +30,7 @@
|
||||
#define VER_LAMEXP_MINOR_LO 2
|
||||
#define VER_LAMEXP_TYPE Beta
|
||||
#define VER_LAMEXP_PATCH 3
|
||||
#define VER_LAMEXP_BUILD 544
|
||||
#define VER_LAMEXP_BUILD 545
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Tools versions
|
||||
|
@ -122,7 +122,7 @@ void FileAnalyzer::run()
|
||||
}
|
||||
else if(!QFileInfo(currentFile).suffix().compare("avs", Qt::CaseInsensitive))
|
||||
{
|
||||
qWarning("Added an potential Avisynth script file!");
|
||||
qDebug("Found a potential Avisynth script, investigating...");
|
||||
if(analyzeAvisynthFile(currentFile, file))
|
||||
{
|
||||
m_filesAccepted++;
|
||||
@ -561,8 +561,6 @@ void FileAnalyzer::retrieveCover(AudioFileModel &audioFile, const QString &fileP
|
||||
|
||||
bool FileAnalyzer::analyzeAvisynthFile(const QString &filePath, AudioFileModel &info)
|
||||
{
|
||||
bool bAudioInfoReceived = false;
|
||||
|
||||
QProcess process;
|
||||
process.setProcessChannelMode(QProcess::MergedChannels);
|
||||
process.setReadChannel(QProcess::StandardOutput);
|
||||
@ -577,6 +575,8 @@ bool FileAnalyzer::analyzeAvisynthFile(const QString &filePath, AudioFileModel &
|
||||
return false;
|
||||
}
|
||||
|
||||
bool bInfoHeaderFound = false;
|
||||
|
||||
while(process.state() != QProcess::NotRunning)
|
||||
{
|
||||
if(m_abortFlag)
|
||||
@ -610,7 +610,7 @@ bool FileAnalyzer::analyzeAvisynthFile(const QString &filePath, AudioFileModel &
|
||||
QString key = line.left(index).trimmed();
|
||||
QString val = line.mid(index+1).trimmed();
|
||||
|
||||
if(!key.isEmpty() && !val.isEmpty())
|
||||
if(bInfoHeaderFound && !key.isEmpty() && !val.isEmpty())
|
||||
{
|
||||
if(key.compare("TotalSeconds", Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
@ -644,7 +644,7 @@ bool FileAnalyzer::analyzeAvisynthFile(const QString &filePath, AudioFileModel &
|
||||
{
|
||||
info.setFormatAudioType("Avisynth");
|
||||
info.setFormatContainerType("Avisynth");
|
||||
bAudioInfoReceived = true;
|
||||
bInfoHeaderFound = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -658,10 +658,24 @@ bool FileAnalyzer::analyzeAvisynthFile(const QString &filePath, AudioFileModel &
|
||||
process.waitForFinished(-1);
|
||||
}
|
||||
|
||||
return bAudioInfoReceived;
|
||||
//Check exit code
|
||||
switch(process.exitCode())
|
||||
{
|
||||
case 0:
|
||||
qDebug("Avisynth script was analyzed successfully.");
|
||||
return true;
|
||||
break;
|
||||
case -5:
|
||||
qWarning("It appears that Avisynth is not installed on the system!");
|
||||
return false;
|
||||
break;
|
||||
default:
|
||||
qWarning("Failed to open the Avisynth script, bad AVS file?");
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Public Functions
|
||||
////////////////////////////////////////////////////////////
|
||||
|
Loading…
x
Reference in New Issue
Block a user