Use the built-in tagging capability of Monkey's Audio encoder (available since v5.43) + drop the 'tag.exe' tool.
This commit is contained in:
parent
2e3954adb0
commit
a979a3a5d4
@ -680,11 +680,6 @@ copy /Y "$(SolutionDir)\..\Prerequisites\Qt4\$(PlatformToolset)\Shared\plugins\i
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_Static|Win32'">false</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="tmp\LameXP\QRC_Tools.tag.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_Static|Win32'">false</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="tmp\LameXP\QRC_Tools.tta.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
@ -1970,21 +1965,6 @@ copy /Y "$(SolutionDir)\..\Prerequisites\Qt4\$(PlatformToolset)\Shared\plugins\i
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_Static|Win32'">false</ExcludedFromBuild>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="res\Tools.tag.qrc">
|
||||
<FileType>Document</FileType>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\rcc.exe" -o "$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp" -no-compress -name "%(Filename)" "%(FullPath)"</Command>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">RCC "$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp"</Message>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp;%(Outputs)</Outputs>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release_Static|Win32'">"$(QTDIR)\bin\rcc.exe" -o "$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp" -no-compress -name "%(Filename)" "%(FullPath)"</Command>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Release_Static|Win32'">RCC "$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp"</Message>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release_Static|Win32'">$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp;%(Outputs)</Outputs>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\rcc.exe" -o "$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp" -no-compress -name "%(Filename)" "%(FullPath)"</Command>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">RCC "$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp"</Message>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp;%(Outputs)</Outputs>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_Static|Win32'">false</ExcludedFromBuild>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="res\Tools.tta.qrc">
|
||||
<FileType>Document</FileType>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\rcc.exe" -o "$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp" -no-compress -name "%(Filename)" "%(FullPath)"</Command>
|
||||
|
@ -493,9 +493,6 @@
|
||||
<ClCompile Include="tmp\LameXP\QRC_Tools.speexdec.cpp">
|
||||
<Filter>Generated Files\QRC</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="tmp\LameXP\QRC_Tools.tag.cpp">
|
||||
<Filter>Generated Files\QRC</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="tmp\LameXP\QRC_Tools.tta.cpp">
|
||||
<Filter>Generated Files\QRC</Filter>
|
||||
</ClCompile>
|
||||
@ -998,9 +995,6 @@
|
||||
<CustomBuild Include="res\Tools.speexdec.qrc">
|
||||
<Filter>Resources</Filter>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="res\Tools.tag.qrc">
|
||||
<Filter>Resources</Filter>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="res\Tools.tta.qrc">
|
||||
<Filter>Resources</Filter>
|
||||
</CustomBuild>
|
||||
|
@ -1,2 +0,0 @@
|
||||
<!DOCTYPE RCC>
|
||||
<RCC version="1.0"><qresource><file>tools/tag.exe</file></qresource></RCC>
|
@ -267,7 +267,6 @@
|
||||
<file>tools/sox.i686.exe</file>
|
||||
<file>tools/sox.sse2.exe</file>
|
||||
<file>tools/speexdec.exe</file>
|
||||
<file>tools/tag.exe</file>
|
||||
<file>tools/tta.exe</file>
|
||||
<file>tools/valdec.exe</file>
|
||||
<file>tools/vorbiscomment.exe</file>
|
||||
|
@ -35,7 +35,7 @@
|
||||
#define VER_LAMEXP_MINOR_LO 9
|
||||
#define VER_LAMEXP_TYPE RC
|
||||
#define VER_LAMEXP_PATCH 3
|
||||
#define VER_LAMEXP_BUILD 2297
|
||||
#define VER_LAMEXP_BUILD 2299
|
||||
#define VER_LAMEXP_CONFG 2188
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -130,5 +130,6 @@ QString AbstractEncoder::cleanTag(const QString &text)
|
||||
QString result(text);
|
||||
result.replace(QChar('"'), "'");
|
||||
result.replace(QChar('\\'), "/");
|
||||
result.replace(QChar('|'), "/");
|
||||
return result;
|
||||
}
|
||||
|
@ -28,6 +28,13 @@
|
||||
#include <QProcess>
|
||||
#include <QDir>
|
||||
|
||||
#define APPEND_TAG(NAME, VALUE) do \
|
||||
{ \
|
||||
if (!buffer.isEmpty()) buffer += L1C('|'); \
|
||||
buffer += QString("%1=%2").arg((NAME), (VALUE)); \
|
||||
} \
|
||||
while(0)
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Encoder Info
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@ -123,12 +130,11 @@ static const g_macEncoderInfo;
|
||||
|
||||
MACEncoder::MACEncoder(void)
|
||||
:
|
||||
m_binary_enc(lamexp_tools_lookup(L1S("mac.exe"))),
|
||||
m_binary_tag(lamexp_tools_lookup(L1S("tag.exe")))
|
||||
m_binary(lamexp_tools_lookup(L1S("mac.exe")))
|
||||
{
|
||||
if(m_binary_enc.isEmpty() || m_binary_tag.isEmpty())
|
||||
if (m_binary.isEmpty())
|
||||
{
|
||||
MUTILS_THROW("Error initializing MAC encoder. Tool 'mac.exe' or 'tag.exe' is not registred!");
|
||||
MUTILS_THROW("Error initializing MAC encoder. Tool 'mac.exe' is not registred!");
|
||||
}
|
||||
}
|
||||
|
||||
@ -156,7 +162,16 @@ bool MACEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaInfo
|
||||
break;
|
||||
}
|
||||
|
||||
if(!startProcess(process, m_binary_enc, args))
|
||||
if (!metaInfo.empty(true))
|
||||
{
|
||||
const QString apeTagsData = createApeTags(metaInfo);
|
||||
if (!apeTagsData.isEmpty())
|
||||
{
|
||||
args << "-t" << apeTagsData;
|
||||
}
|
||||
}
|
||||
|
||||
if(!startProcess(process, m_binary, args))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -182,37 +197,7 @@ bool MACEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaInfo
|
||||
return false;
|
||||
});
|
||||
|
||||
if(result != RESULT_SUCCESS)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if(metaInfo.empty(true))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
emit messageLogged(L1S("\n-------------------------------\n"));
|
||||
|
||||
args.clear();
|
||||
args << L1S("APE2") << QDir::toNativeSeparators(outputFile);
|
||||
|
||||
if(!metaInfo.title().isEmpty()) args << QString("Title=%1").arg(cleanTag(metaInfo.title()));
|
||||
if(!metaInfo.artist().isEmpty()) args << QString("Artist=%1").arg(cleanTag(metaInfo.artist()));
|
||||
if(!metaInfo.album().isEmpty()) args << QString("Album=%1").arg(cleanTag(metaInfo.album()));
|
||||
if(!metaInfo.genre().isEmpty()) args << QString("Genre=%1").arg(cleanTag(metaInfo.genre()));
|
||||
if(!metaInfo.comment().isEmpty()) args << QString("Comment=%1").arg(cleanTag(metaInfo.comment()));
|
||||
if(metaInfo.year()) args << QString("Year=%1").arg(QString::number(metaInfo.year()));
|
||||
if(metaInfo.position()) args << QString("Track=%1").arg(QString::number(metaInfo.position()));
|
||||
|
||||
//if(!metaInfo.cover().isEmpty()) args << QString("-add-cover:%1:%2").arg("front", metaInfo.cover());
|
||||
|
||||
if(!startProcess(process, m_binary_tag, args))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return (awaitProcess(process, abortFlag) == RESULT_SUCCESS);
|
||||
return (result == RESULT_SUCCESS);
|
||||
}
|
||||
|
||||
bool MACEncoder::isFormatSupported(const QString &containerType, const QString &containerProfile, const QString &formatType, const QString &formatProfile, const QString &formatVersion)
|
||||
@ -232,3 +217,18 @@ const AbstractEncoderInfo *MACEncoder::getEncoderInfo(void)
|
||||
{
|
||||
return &g_macEncoderInfo;
|
||||
}
|
||||
|
||||
QString MACEncoder::createApeTags(const AudioFileModel_MetaInfo &metaInfo)
|
||||
{
|
||||
QString buffer;
|
||||
|
||||
if (!metaInfo.title().isEmpty()) APPEND_TAG(L1S("Title"), cleanTag(metaInfo.title()));
|
||||
if (!metaInfo.artist().isEmpty()) APPEND_TAG(L1S("Artist"), cleanTag(metaInfo.artist()));
|
||||
if (!metaInfo.album().isEmpty()) APPEND_TAG(L1S("Album"), cleanTag(metaInfo.album()));
|
||||
if (!metaInfo.genre().isEmpty()) APPEND_TAG(L1S("Genre"), cleanTag(metaInfo.genre()));
|
||||
if (!metaInfo.comment().isEmpty()) APPEND_TAG(L1S("Comment"), cleanTag(metaInfo.comment()));
|
||||
if (metaInfo.year()) APPEND_TAG(L1S("Year"), QString::number(metaInfo.year()));
|
||||
if (metaInfo.position()) APPEND_TAG(L1S("Track"), QString::number(metaInfo.position()));
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
@ -42,6 +42,7 @@ public:
|
||||
static const AbstractEncoderInfo *getEncoderInfo(void);
|
||||
|
||||
private:
|
||||
const QString m_binary_enc;
|
||||
const QString m_binary_tag;
|
||||
const QString m_binary;
|
||||
|
||||
QString createApeTags(const AudioFileModel_MetaInfo &metaInfo);
|
||||
};
|
||||
|
@ -88,4 +88,5 @@ const QString lamexp_version2string(const QString &pattern, unsigned int version
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define L1S(STR) (QLatin1String((STR)))
|
||||
#define L1C(CHR) (QLatin1Char((CHR)))
|
||||
#define NOBREAK(STR) (QString("<div style='white-space:pre'>%1</div>").arg((STR)))
|
||||
|
@ -115,7 +115,6 @@ g_lamexp_tools[] =
|
||||
{"16a71940aa5e9b393e83cdfb2a4dda4291ea01858f8ba338510013f25f4d7c53b9b5cffb86404ea49ef28e6795182fd5", CPU_TYPE_ALL_SSE, "sox.sse2.exe", 1442, "" },
|
||||
{"25585ca9e2e025d82d93341a9db8527eb0b4ce451dade607f9784a79ed30e050ced0824835d5467aa0bf0c6b8fe08612", CPU_TYPE_ALL_AVX, "sox.avx.exe", 1442, "" },
|
||||
{"5a4261e1b41a59d1a5bc92e1d2766422a67454d77e06ea29af392811b7b4704e0f3e494ab9cb6375ce9e39257867c5ed", CPU_TYPE_ALL_ALL, "speexdec.exe", 12, ""},
|
||||
{"75d4c18dbb74e2dbf7342698428248d45cc4070d5f95da8831ef755e63dcd7ff9c3a760f289e8ef8b5c06b82548edbd8", CPU_TYPE_ALL_ALL, "tag.exe", 100, ""},
|
||||
{"a83628880da0b7519ec368a74a92da5a5099d8d46aa0583131f92d7321f47c9e16a1841b2a3fb8ffcca7205ef4b1bb0a", CPU_TYPE_ALL_ALL, "tta.exe", 21, ""},
|
||||
{"9e1ade2137ea5cee0ad4657971c314a372df3068594fbe4f77d45b9eb65fa7c69e55027b0df81b6fe072a220e9a8ba8a", CPU_TYPE_ALL_ALL, "valdec.exe", 100, "a"},
|
||||
{"572b9448bf4a338ecb9727951fdfcc5a219cc69896695cc96b9f6b083690e339910e41558968264a38992e45f2be152c", CPU_TYPE_ALL_ALL, "wma2wav.exe", 20111001, ""},
|
||||
|
Loading…
Reference in New Issue
Block a user