Make lamexp_clean_filename() a global function.
This commit is contained in:
parent
272cef76f4
commit
93d4fb14ee
@ -30,7 +30,7 @@
|
|||||||
#define VER_LAMEXP_MINOR_LO 3
|
#define VER_LAMEXP_MINOR_LO 3
|
||||||
#define VER_LAMEXP_TYPE Alpha
|
#define VER_LAMEXP_TYPE Alpha
|
||||||
#define VER_LAMEXP_PATCH 6
|
#define VER_LAMEXP_PATCH 6
|
||||||
#define VER_LAMEXP_BUILD 612
|
#define VER_LAMEXP_BUILD 613
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// Tools versions
|
// Tools versions
|
||||||
|
@ -1535,6 +1535,39 @@ void lamexp_blink_window(QWidget *poWindow, unsigned int count, unsigned int del
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Remove forbidden characters from a filename
|
||||||
|
*/
|
||||||
|
const QString lamexp_clean_filename(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;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Remove forbidden characters from a file path
|
||||||
|
*/
|
||||||
|
const QString lamexp_clean_filepath(const QString &str)
|
||||||
|
{
|
||||||
|
QStringList parts = QString(str).replace("\\", "/").split("/");
|
||||||
|
|
||||||
|
for(int i = 0; i < parts.count(); i++)
|
||||||
|
{
|
||||||
|
parts[i] = lamexp_clean_filename(parts[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return parts.join("/");
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Finalization function (final clean-up)
|
* Finalization function (final clean-up)
|
||||||
*/
|
*/
|
||||||
|
@ -120,6 +120,8 @@ __int64 lamexp_free_diskspace(const QString &path);
|
|||||||
bool lamexp_remove_file(const QString &filename);
|
bool lamexp_remove_file(const QString &filename);
|
||||||
bool lamexp_themes_enabled(void);
|
bool lamexp_themes_enabled(void);
|
||||||
void lamexp_blink_window(QWidget *poWindow, unsigned int count = 10, unsigned int delay = 150);
|
void lamexp_blink_window(QWidget *poWindow, unsigned int count = 10, unsigned int delay = 150);
|
||||||
|
const QString lamexp_clean_filename(const QString &str);
|
||||||
|
const QString lamexp_clean_filepath(const QString &str);
|
||||||
|
|
||||||
//Debug-only functions
|
//Debug-only functions
|
||||||
SIZE_T lamexp_dbg_private_bytes(void);
|
SIZE_T lamexp_dbg_private_bytes(void);
|
||||||
|
@ -39,25 +39,6 @@
|
|||||||
#include <float.h>
|
#include <float.h>
|
||||||
#include <limits>
|
#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
|
// Constructor
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
@ -210,10 +191,10 @@ void CueSplitter::run()
|
|||||||
|
|
||||||
//Generate output file name
|
//Generate output file name
|
||||||
QString trackTitle = trackMetaInfo.fileName().isEmpty() ? QString().sprintf("Track %02d", trackNo) : trackMetaInfo.fileName();
|
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), clean(m_baseName), clean(trackTitle));
|
QString outputFile = QString("%1/[%2] %3 - %4.wav").arg(m_outputDir, QString().sprintf("%02d", trackNo), lamexp_clean_filename(m_baseName), lamexp_clean_filename(trackTitle));
|
||||||
for(int n = 2; QFileInfo(outputFile).exists(); n++)
|
for(int n = 2; QFileInfo(outputFile).exists(); n++)
|
||||||
{
|
{
|
||||||
outputFile = QString("%1/[%2] %3 - %4 (%5).wav").arg(m_outputDir, QString().sprintf("%02d", trackNo), clean(m_baseName), clean(trackTitle), QString::number(n));
|
outputFile = QString("%1/[%2] %3 - %4 (%5).wav").arg(m_outputDir, QString().sprintf("%02d", trackNo), lamexp_clean_filename(m_baseName), lamexp_clean_filename(trackTitle), QString::number(n));
|
||||||
}
|
}
|
||||||
|
|
||||||
//Call split function
|
//Call split function
|
||||||
|
Loading…
Reference in New Issue
Block a user