Fixed file name generation in Cue Sheet splitter: If the title of a track contains characters that are not allowed in a file name, we have to replace them.

This commit is contained in:
LoRd_MuldeR 2011-07-02 16:40:15 +02:00
parent 87a3166f8b
commit c0f13b2624
3 changed files with 28 additions and 4 deletions

View File

@ -16,6 +16,11 @@ a:visited { color: #0000EE; }
<body>
<h3>LameXP - Version History</h3><br>
<a name="4.02"></a>Changes between v4.02 and v4.03:<br><ul>
<li>Fixed Cue Sheet import for tracks with certain characters in the title
<li>Workaround for malicious "anti-virus" programs that prevent innocent applications from functioning
</ul><br>
<a name="4.02"></a>Changes between v4.01 and v4.02:<br><ul>
<li>Upgraded build environment to Microsoft Visual Studio 2010
<li>Dropping support for Windows 2000 and Windows XP RTM. Windows XP needs (at least) Service-Pack 2 now!

View File

@ -29,8 +29,8 @@
#define VER_LAMEXP_MINOR_HI 0
#define VER_LAMEXP_MINOR_LO 3
#define VER_LAMEXP_TYPE Alpha
#define VER_LAMEXP_PATCH 1
#define VER_LAMEXP_BUILD 589
#define VER_LAMEXP_PATCH 2
#define VER_LAMEXP_BUILD 592
///////////////////////////////////////////////////////////////////////////////
// Tools versions

View File

@ -39,6 +39,25 @@
#include <float.h>
#include <limits>
////////////////////////////////////////////////////////////
// Helper function
////////////////////////////////////////////////////////////
static QString clean(const QString &str)
{
QString fixedStr(str);
fixedStr.replace("\\", "-");
fixedStr.replace(" / ", ", ");
fixedStr.replace("/", ",");
fixedStr.replace(":", "-");
fixedStr.replace("*", "x");
fixedStr.replace("?", "");
fixedStr.replace("<", "[");
fixedStr.replace(">", "]");
fixedStr.replace("|", "!");
return fixedStr;
}
////////////////////////////////////////////////////////////
// Constructor
////////////////////////////////////////////////////////////
@ -191,10 +210,10 @@ void CueSplitter::run()
//Generate output file name
QString trackTitle = trackMetaInfo.fileName().isEmpty() ? QString().sprintf("Track %02d", trackNo) : trackMetaInfo.fileName();
QString outputFile = QString("%1/[%2] %3 - %4.wav").arg(m_outputDir, QString().sprintf("%02d", trackNo), m_baseName, trackTitle);
QString outputFile = QString("%1/[%2] %3 - %4.wav").arg(m_outputDir, QString().sprintf("%02d", trackNo), clean(m_baseName), clean(trackTitle));
for(int n = 2; QFileInfo(outputFile).exists(); n++)
{
outputFile = QString("%1/[%2] %3 - %4 (%5).wav").arg(m_outputDir, QString().sprintf("%02d", trackNo), m_baseName, trackTitle, QString::number(n));
outputFile = QString("%1/[%2] %3 - %4 (%5).wav").arg(m_outputDir, QString().sprintf("%02d", trackNo), clean(m_baseName), clean(trackTitle), QString::number(n));
}
//Call split function