diff --git a/doc/Changelog.html b/doc/Changelog.html
index 29e1a2a5..e7fd7d59 100644
--- a/doc/Changelog.html
+++ b/doc/Changelog.html
@@ -17,6 +17,7 @@ a:visited { color: #0000EE; }
LameXP - Version History
Changes between v4.02 and v4.03:
+Added an option to rename the output files (based on an user-defined pattern)
Added "built-in" WMA decoder (see this thread for details) and removed all remnants of "old" decoder
Updated Qt runtime libraries to v4.8.0 Beta-1 (2011-07-19), compiled with MSVC 10.0
Updated MediaInfo to v0.7.47 (2011-07-27), compiled with MSVC 10.0
diff --git a/etc/Translation/Blank.ts b/etc/Translation/Blank.ts
index 8b0ff585..8f6fc7b3 100644
--- a/etc/Translation/Blank.ts
+++ b/etc/Translation/Blank.ts
@@ -1553,6 +1553,54 @@
LameXP is already running, please use the running instance!
+
+ Rename Output Files
+
+
+
+ [<TrackNo>] <Artist> - <Title>
+
+
+
+ Rename Output Files
+
+
+
+ <a href="#">Show List of Macros</a>
+
+
+
+ Original file name without extension
+
+
+
+ Track number with leading zero
+
+
+
+ Track title
+
+
+
+ Artist name
+
+
+
+ Album name
+
+
+
+ Year with (at least) four digits
+
+
+
+ Comment
+
+
+
+ Rename Macros
+
+
MetaInfo
diff --git a/etc/Translation/LameXP_DE.ts b/etc/Translation/LameXP_DE.ts
index 34408097..56d66c16 100644
--- a/etc/Translation/LameXP_DE.ts
+++ b/etc/Translation/LameXP_DE.ts
@@ -1554,6 +1554,54 @@
The slow startup notifications have been re-enabled.
Die langsamer Programmstart Meldungen wurden wieder aktiviert.
+
+ Rename Output Files
+
+
+
+ [<TrackNo>] <Artist> - <Title>
+
+
+
+ Rename Output Files
+
+
+
+ <a href="#">Show List of Macros</a>
+
+
+
+ Original file name without extension
+
+
+
+ Track number with leading zero
+
+
+
+ Track title
+
+
+
+ Artist name
+
+
+
+ Album name
+
+
+
+ Year with (at least) four digits
+
+
+
+ Comment
+ Kommentar
+
+
+ Rename Macros
+
+
MetaInfo
diff --git a/etc/Translation/LameXP_ES.ts b/etc/Translation/LameXP_ES.ts
index 644b0185..838886a6 100644
--- a/etc/Translation/LameXP_ES.ts
+++ b/etc/Translation/LameXP_ES.ts
@@ -1553,6 +1553,54 @@
The slow startup notifications have been re-enabled.
+
+ Rename Output Files
+
+
+
+ [<TrackNo>] <Artist> - <Title>
+
+
+
+ Rename Output Files
+
+
+
+ <a href="#">Show List of Macros</a>
+
+
+
+ Original file name without extension
+
+
+
+ Track number with leading zero
+
+
+
+ Track title
+
+
+
+ Artist name
+
+
+
+ Album name
+
+
+
+ Year with (at least) four digits
+
+
+
+ Comment
+ Comentarios
+
+
+ Rename Macros
+
+
MetaInfo
diff --git a/etc/Translation/LameXP_FR.ts b/etc/Translation/LameXP_FR.ts
index 7ec49351..83686d17 100644
--- a/etc/Translation/LameXP_FR.ts
+++ b/etc/Translation/LameXP_FR.ts
@@ -1563,6 +1563,54 @@ Ouvrir le dossier récursivement...
The slow startup notifications have been re-enabled.
+
+ Rename Output Files
+
+
+
+ [<TrackNo>] <Artist> - <Title>
+
+
+
+ Rename Output Files
+
+
+
+ <a href="#">Show List of Macros</a>
+
+
+
+ Original file name without extension
+
+
+
+ Track number with leading zero
+
+
+
+ Track title
+
+
+
+ Artist name
+
+
+
+ Album name
+
+
+
+ Year with (at least) four digits
+
+
+
+ Comment
+ Commentaire
+
+
+ Rename Macros
+
+
MetaInfo
diff --git a/etc/Translation/LameXP_IT.ts b/etc/Translation/LameXP_IT.ts
index 0d80abe7..9fa88408 100644
--- a/etc/Translation/LameXP_IT.ts
+++ b/etc/Translation/LameXP_IT.ts
@@ -1554,6 +1554,54 @@
The slow startup notifications have been re-enabled.
+
+ Rename Output Files
+
+
+
+ [<TrackNo>] <Artist> - <Title>
+
+
+
+ Rename Output Files
+
+
+
+ <a href="#">Show List of Macros</a>
+
+
+
+ Original file name without extension
+
+
+
+ Track number with leading zero
+
+
+
+ Track title
+
+
+
+ Artist name
+
+
+
+ Album name
+
+
+
+ Year with (at least) four digits
+
+
+
+ Comment
+ Commento
+
+
+ Rename Macros
+
+
MetaInfo
diff --git a/etc/Translation/LameXP_KR.ts b/etc/Translation/LameXP_KR.ts
index e016849a..1f66b4f9 100644
--- a/etc/Translation/LameXP_KR.ts
+++ b/etc/Translation/LameXP_KR.ts
@@ -1553,6 +1553,54 @@
The slow startup notifications have been re-enabled.
+
+ Rename Output Files
+
+
+
+ [<TrackNo>] <Artist> - <Title>
+
+
+
+ Rename Output Files
+
+
+
+ <a href="#">Show List of Macros</a>
+
+
+
+ Original file name without extension
+
+
+
+ Track number with leading zero
+
+
+
+ Track title
+
+
+
+ Artist name
+
+
+
+ Album name
+
+
+
+ Year with (at least) four digits
+
+
+
+ Comment
+ 설명
+
+
+ Rename Macros
+
+
MetaInfo
diff --git a/etc/Translation/LameXP_RU.ts b/etc/Translation/LameXP_RU.ts
index d6482ca5..d6dc9c2b 100644
--- a/etc/Translation/LameXP_RU.ts
+++ b/etc/Translation/LameXP_RU.ts
@@ -1559,6 +1559,54 @@
The slow startup notifications have been re-enabled.
+
+ Rename Output Files
+
+
+
+ [<TrackNo>] <Artist> - <Title>
+
+
+
+ Rename Output Files
+
+
+
+ <a href="#">Show List of Macros</a>
+
+
+
+ Original file name without extension
+
+
+
+ Track number with leading zero
+
+
+
+ Track title
+
+
+
+ Artist name
+
+
+
+ Album name
+
+
+
+ Year with (at least) four digits
+
+
+
+ Comment
+ Комментарий
+
+
+ Rename Macros
+
+
MetaInfo
diff --git a/etc/Translation/LameXP_UK.ts b/etc/Translation/LameXP_UK.ts
index 677087d0..e4eba651 100644
--- a/etc/Translation/LameXP_UK.ts
+++ b/etc/Translation/LameXP_UK.ts
@@ -1554,6 +1554,54 @@
The slow startup notifications have been re-enabled.
Нагадування про уповільнений запуск були дозволені.
+
+ Rename Output Files
+
+
+
+ [<TrackNo>] <Artist> - <Title>
+
+
+
+ Rename Output Files
+
+
+
+ <a href="#">Show List of Macros</a>
+
+
+
+ Original file name without extension
+
+
+
+ Track number with leading zero
+
+
+
+ Track title
+
+
+
+ Artist name
+
+
+
+ Album name
+
+
+
+ Year with (at least) four digits
+
+
+
+ Comment
+ Коментар
+
+
+ Rename Macros
+
+
MetaInfo
diff --git a/gui/MainWindow.ui b/gui/MainWindow.ui
index cbcaebda..d4b589ad 100644
--- a/gui/MainWindow.ui
+++ b/gui/MainWindow.ui
@@ -1067,8 +1067,8 @@
0
0
- 602
- 1241
+ 604
+ 1365
@@ -2028,7 +2028,7 @@
- -
+
-
@@ -2237,7 +2237,7 @@
- -
+
-
@@ -2401,7 +2401,7 @@
- -
+
-
@@ -2783,6 +2783,146 @@
+ -
+
+
+
+ 50
+ false
+
+
+
+ Rename Output Files
+
+
+ -
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QSizePolicy::Fixed
+
+
+
+ 10
+ 20
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QSizePolicy::Fixed
+
+
+
+ 10
+ 20
+
+
+
+
+ -
+
+
+ false
+
+
+
+ Lucida Console
+
+
+
+ [<TrackNo>] <Artist> - <Title>
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+ QSizePolicy::Fixed
+
+
+
+ 20
+ 8
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+ QSizePolicy::Fixed
+
+
+
+ 20
+ 8
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Rename Output Files
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+ QSizePolicy::Fixed
+
+
+
+ 20
+ 3
+
+
+
+
+ -
+
+
+ PointingHandCursor
+
+
+ <a href="#">Show List of Macros</a>
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+
+
+
+
+
+
-
@@ -3469,6 +3609,9 @@
+
+
+
@@ -3967,5 +4110,21 @@
+
+ checkBoxRenameOutput
+ toggled(bool)
+ lineEditRenamePattern
+ setEnabled(bool)
+
+
+ 323
+ 206
+
+
+ 323
+ 172
+
+
+
diff --git a/res/localization/LameXP_DE.qm b/res/localization/LameXP_DE.qm
index 8a70a79d..46bff731 100644
Binary files a/res/localization/LameXP_DE.qm and b/res/localization/LameXP_DE.qm differ
diff --git a/res/localization/LameXP_ES.qm b/res/localization/LameXP_ES.qm
index 8f7b710b..e7e2cb15 100644
Binary files a/res/localization/LameXP_ES.qm and b/res/localization/LameXP_ES.qm differ
diff --git a/res/localization/LameXP_FR.qm b/res/localization/LameXP_FR.qm
index cfebfe63..bbae5b11 100644
Binary files a/res/localization/LameXP_FR.qm and b/res/localization/LameXP_FR.qm differ
diff --git a/res/localization/LameXP_IT.qm b/res/localization/LameXP_IT.qm
index dd88aaa6..126469b0 100644
Binary files a/res/localization/LameXP_IT.qm and b/res/localization/LameXP_IT.qm differ
diff --git a/res/localization/LameXP_KR.qm b/res/localization/LameXP_KR.qm
index f32a6344..a81d461f 100644
Binary files a/res/localization/LameXP_KR.qm and b/res/localization/LameXP_KR.qm differ
diff --git a/res/localization/LameXP_RU.qm b/res/localization/LameXP_RU.qm
index 299a8fb9..e240f890 100644
Binary files a/res/localization/LameXP_RU.qm and b/res/localization/LameXP_RU.qm differ
diff --git a/res/localization/LameXP_UK.qm b/res/localization/LameXP_UK.qm
index eba73b57..0138b2b4 100644
Binary files a/res/localization/LameXP_UK.qm and b/res/localization/LameXP_UK.qm differ
diff --git a/src/Config.h b/src/Config.h
index 6a7db31b..a4951c30 100644
--- a/src/Config.h
+++ b/src/Config.h
@@ -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 6
-#define VER_LAMEXP_BUILD 613
+#define VER_LAMEXP_PATCH 7
+#define VER_LAMEXP_BUILD 616
///////////////////////////////////////////////////////////////////////////////
// Tools versions
diff --git a/src/Dialog_MainWindow.cpp b/src/Dialog_MainWindow.cpp
index 4d5f33c3..1ad719e5 100644
--- a/src/Dialog_MainWindow.cpp
+++ b/src/Dialog_MainWindow.cpp
@@ -70,7 +70,7 @@
//Helper macros
#define ABORT_IF_BUSY if(m_banner->isVisible() || m_delayedFileTimer->isActive()) { MessageBeep(MB_ICONEXCLAMATION); return; }
-#define SET_TEXT_COLOR(WIDGET,COLOR) { QPalette _palette = WIDGET->palette(); _palette.setColor(QPalette::WindowText, COLOR); WIDGET->setPalette(_palette); }
+#define SET_TEXT_COLOR(WIDGET,COLOR) { QPalette _palette = WIDGET->palette(); _palette.setColor(QPalette::WindowText, (COLOR)); _palette.setColor(QPalette::Text, (COLOR)); WIDGET->setPalette(_palette); }
#define SET_FONT_BOLD(WIDGET,BOLD) { QFont _font = WIDGET->font(); _font.setBold(BOLD); WIDGET->setFont(_font); }
#define LINK(URL) QString("%2 ").arg(URL).arg(URL)
#define TEMP_HIDE_DROPBOX(CMD) { bool __dropBoxVisible = m_dropBox->isVisible(); if(__dropBoxVisible) m_dropBox->hide(); CMD; if(__dropBoxVisible) m_dropBox->show(); }
@@ -236,6 +236,8 @@ MainWindow::MainWindow(FileListModel *fileListModel, AudioFileModel *metaInfo, S
lineEditCustomParamFLAC->setText(m_settings->customParametersFLAC());
lineEditCustomParamAften->setText(m_settings->customParametersAften());
lineEditCustomTempFolder->setText(QDir::toNativeSeparators(m_settings->customTempPath()));
+ while(checkBoxRenameOutput->isChecked() != m_settings->renameOutputFilesEnabled()) checkBoxRenameOutput->click();
+ lineEditRenamePattern->setText(m_settings->renameOutputFilesPattern());
connect(sliderLameAlgoQuality, SIGNAL(valueChanged(int)), this, SLOT(updateLameAlgoQuality(int)));
connect(checkBoxBitrateManagement, SIGNAL(clicked(bool)), this, SLOT(bitrateManagementEnabledChanged(bool)));
connect(spinBoxBitrateManagementMin, SIGNAL(valueChanged(int)), this, SLOT(bitrateManagementMinChanged(int)));
@@ -264,6 +266,10 @@ MainWindow::MainWindow(FileListModel *fileListModel, AudioFileModel *metaInfo, S
connect(lineEditCustomTempFolder, SIGNAL(textChanged(QString)), this, SLOT(customTempFolderChanged(QString)));
connect(checkBoxUseSystemTempFolder, SIGNAL(clicked(bool)), this, SLOT(useCustomTempFolderChanged(bool)));
connect(buttonResetAdvancedOptions, SIGNAL(clicked()), this, SLOT(resetAdvancedOptionsButtonClicked()));
+ connect(checkBoxRenameOutput, SIGNAL(clicked(bool)), this, SLOT(renameOutputEnabledChanged(bool)));
+ connect(lineEditRenamePattern, SIGNAL(editingFinished()), this, SLOT(renameOutputPatternChanged()));
+ connect(lineEditRenamePattern, SIGNAL(textChanged(QString)), this, SLOT(renameOutputPatternChanged(QString)));
+ connect(labelShowRenameMacros, SIGNAL(linkActivated(QString)), this, SLOT(showRenameMacros()));
updateLameAlgoQuality(sliderLameAlgoQuality->value());
updateMaximumInstances(sliderMaxInstances->value());
toneAdjustTrebleChanged(spinBoxToneAdjustTreble->value());
@@ -2711,6 +2717,77 @@ void MainWindow::customParamsChanged(void)
m_settings->customParametersAften(lineEditCustomParamAften->text());
}
+
+/*
+ * Rename output files enabled changed
+ */
+void MainWindow::renameOutputEnabledChanged(bool checked)
+{
+ m_settings->renameOutputFilesEnabled(checked);
+}
+
+/*
+ * Rename output files patterm changed
+ */
+void MainWindow::renameOutputPatternChanged(void)
+{
+ lineEditRenamePattern->setText(lineEditRenamePattern->text().simplified());
+ m_settings->renameOutputFilesPattern(lineEditRenamePattern->text());
+}
+
+/*
+ * Rename output files patterm changed
+ */
+void MainWindow::renameOutputPatternChanged(const QString &text)
+{
+ QString pattern(text);
+
+ pattern.remove("", Qt::CaseInsensitive);
+ pattern.remove("", Qt::CaseInsensitive);
+ pattern.remove("", Qt::CaseInsensitive);
+ pattern.remove("", Qt::CaseInsensitive);
+ pattern.remove("", Qt::CaseInsensitive);
+ pattern.remove("", Qt::CaseInsensitive);
+ pattern.remove("", Qt::CaseInsensitive);
+
+ if(pattern.compare(lamexp_clean_filename(pattern)))
+ {
+ if(lineEditRenamePattern->palette().color(QPalette::Text) != Qt::red)
+ {
+ MessageBeep(MB_ICONERROR);
+ SET_TEXT_COLOR(lineEditRenamePattern, Qt::red);
+ }
+ }
+ else
+ {
+ if(lineEditRenamePattern->palette().color(QPalette::Text) != Qt::black)
+ {
+ MessageBeep(MB_ICONINFORMATION);
+ SET_TEXT_COLOR(lineEditRenamePattern, Qt::black);
+ }
+ }
+}
+
+/*
+ * Show list of rename macros
+ */
+void MainWindow::showRenameMacros(void)
+{
+ const QString format = QString("<%1> %2 ");
+
+ QString text = QString("");
+ text += QString(format).arg("BaseName", tr("Original file name without extension"));
+ text += QString(format).arg("TrackNo", tr("Track number with leading zero"));
+ text += QString(format).arg("Title", tr("Track title"));
+ text += QString(format).arg("Artist", tr("Artist name"));
+ text += QString(format).arg("Album", tr("Album name"));
+ text += QString(format).arg("Year", tr("Year with (at least) four digits"));
+ text += QString(format).arg("Comment", tr("Comment"));
+ text += "
";
+
+ QMessageBox::information(this, tr("Rename Macros"), text, tr("Discard"));
+}
+
/*
* Maximum number of instances changed
*/
@@ -2789,11 +2866,13 @@ void MainWindow::resetAdvancedOptionsButtonClicked(void)
while(checkBoxAutoDetectInstances->isChecked() != (m_settings->maximumInstancesDefault() < 1)) checkBoxAutoDetectInstances->click();
while(checkBoxUseSystemTempFolder->isChecked() == m_settings->customTempPathEnabledDefault()) checkBoxUseSystemTempFolder->click();
while(checkBoxAftenFastAllocation->isChecked() != m_settings->aftenFastBitAllocationDefault()) checkBoxAftenFastAllocation->click();
+ while(checkBoxRenameOutput->isChecked() != m_settings->renameOutputFilesEnabledDefault()) checkBoxRenameOutput->click();
lineEditCustomParamLAME->setText(m_settings->customParametersLAMEDefault());
lineEditCustomParamOggEnc->setText(m_settings->customParametersOggEncDefault());
lineEditCustomParamNeroAAC->setText(m_settings->customParametersNeroAACDefault());
lineEditCustomParamFLAC->setText(m_settings->customParametersFLACDefault());
lineEditCustomTempFolder->setText(QDir::toNativeSeparators(m_settings->customTempPathDefault()));
+ lineEditRenamePattern->setText(m_settings->renameOutputFilesPatternDefault());
customParamsChanged();
scrollArea->verticalScrollBar()->setValue(0);
}
diff --git a/src/Dialog_MainWindow.h b/src/Dialog_MainWindow.h
index 5a5c6cc8..282d13c5 100644
--- a/src/Dialog_MainWindow.h
+++ b/src/Dialog_MainWindow.h
@@ -103,6 +103,9 @@ private slots:
void prependRelativePathChanged(void);
void previewContextActionTriggered(void);
void removeFileButtonClicked(void);
+ void renameOutputEnabledChanged(bool checked);
+ void renameOutputPatternChanged(void);
+ void renameOutputPatternChanged(const QString &text);
void resetAdvancedOptionsButtonClicked(void);
void restoreCursor(void);
void samplingRateChanged(int value);
@@ -110,6 +113,7 @@ private slots:
void showDetailsButtonClicked(void);
void showDropBoxWidgetActionTriggered(bool checked);
void showFolderContextActionTriggered(void);
+ void showRenameMacros(void);
void sourceFilesContextMenu(const QPoint &pos);
void sourceModelChanged(void);
void styleActionActivated(QAction *action);
diff --git a/src/Dialog_Processing.cpp b/src/Dialog_Processing.cpp
index e3ec0da9..cf6f144c 100644
--- a/src/Dialog_Processing.cpp
+++ b/src/Dialog_Processing.cpp
@@ -660,6 +660,10 @@ void ProcessingDialog::startNextJob(void)
{
thread->addFilter(new NormalizeFilter(m_settings->normalizationFilterMaxVolume()));
}
+ if(m_settings->renameOutputFilesEnabled())
+ {
+ thread->setRenamePattern(m_settings->renameOutputFilesPattern());
+ }
m_threadList.append(thread);
m_allJobs.append(thread->getId());
diff --git a/src/Global.cpp b/src/Global.cpp
index 5b71f543..dfa76597 100644
--- a/src/Global.cpp
+++ b/src/Global.cpp
@@ -1540,17 +1540,17 @@ void lamexp_blink_window(QWidget *poWindow, unsigned int count, unsigned int del
*/
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;
+ QString newStr(str);
+ newStr.replace("\\", "-");
+ newStr.replace(" / ", ", ");
+ newStr.replace("/", ",");
+ newStr.replace(":", "-");
+ newStr.replace("*", "x");
+ newStr.replace("?", "");
+ newStr.replace("<", "[");
+ newStr.replace(">", "]");
+ newStr.replace("|", "!");
+ return newStr;
}
/*
diff --git a/src/Model_Settings.cpp b/src/Model_Settings.cpp
index 9f8bf4e1..7cd8ef6f 100644
--- a/src/Model_Settings.cpp
+++ b/src/Model_Settings.cpp
@@ -107,6 +107,8 @@ LAMEXP_MAKE_ID(customParametersOggEnc, "AdvancedOptions/CustomParameters/OggEnc"
LAMEXP_MAKE_ID(customParametersNeroAAC, "AdvancedOptions/CustomParameters/NeroAAC");
LAMEXP_MAKE_ID(customParametersAften, "AdvancedOptions/CustomParameters/Aften");
LAMEXP_MAKE_ID(customParametersFLAC, "AdvancedOptions/CustomParameters/FLAC");
+LAMEXP_MAKE_ID(renameOutputFilesEnabled, "AdvancedOptions/RenameOutputFiles/Enabled");
+LAMEXP_MAKE_ID(renameOutputFilesPattern, "AdvancedOptions/RenameOutputFiles/Pattern");
LAMEXP_MAKE_ID(metaInfoPosition, "MetaInformation/PlaylistPosition");
LAMEXP_MAKE_ID(maximumInstances, "AdvancedOptions/Threading/MaximumInstances");
LAMEXP_MAKE_ID(customTempPath, "AdvancedOptions/TempDirectory/CustomPath");
@@ -296,6 +298,8 @@ LAMEXP_MAKE_OPTION_S(customParametersOggEnc, QString());
LAMEXP_MAKE_OPTION_S(customParametersNeroAAC, QString());
LAMEXP_MAKE_OPTION_S(customParametersAften, QString());
LAMEXP_MAKE_OPTION_S(customParametersFLAC, QString());
+LAMEXP_MAKE_OPTION_B(renameOutputFilesEnabled, false);
+LAMEXP_MAKE_OPTION_S(renameOutputFilesPattern, "[] - ");
LAMEXP_MAKE_OPTION_U(metaInfoPosition, UINT_MAX);
LAMEXP_MAKE_OPTION_U(maximumInstances, 0);
LAMEXP_MAKE_OPTION_S(customTempPath, QDesktopServices::storageLocation(QDesktopServices::TempLocation));
diff --git a/src/Model_Settings.h b/src/Model_Settings.h
index 04a5c5dd..d8ffc0d2 100644
--- a/src/Model_Settings.h
+++ b/src/Model_Settings.h
@@ -117,6 +117,8 @@ public:
LAMEXP_MAKE_OPTION_S(customParametersNeroAAC);
LAMEXP_MAKE_OPTION_S(customParametersAften);
LAMEXP_MAKE_OPTION_S(customParametersFLAC);
+ LAMEXP_MAKE_OPTION_B(renameOutputFilesEnabled);
+ LAMEXP_MAKE_OPTION_S(renameOutputFilesPattern);
LAMEXP_MAKE_OPTION_U(metaInfoPosition);
LAMEXP_MAKE_OPTION_U(maximumInstances);
LAMEXP_MAKE_OPTION_S(customTempPath);
diff --git a/src/Thread_Process.cpp b/src/Thread_Process.cpp
index b692961d..ebf3662d 100644
--- a/src/Thread_Process.cpp
+++ b/src/Thread_Process.cpp
@@ -59,6 +59,7 @@ ProcessThread::ProcessThread(const AudioFileModel &audioFile, const QString &out
m_encoder(encoder),
m_jobId(QUuid::createUuid()),
m_prependRelativeSourcePath(prependRelativeSourcePath),
+ m_renamePattern(""),
m_aborted(false)
{
if(m_mutex_genFileName)
@@ -304,10 +305,20 @@ QString ProcessThread::generateOutFileName(void)
writeTest.remove();
}
- QString outFileName = QString("%1/%2.%3").arg(targetDir.canonicalPath(), baseName, m_encoder->extension());
+ QString fileName = m_renamePattern;
+ fileName.replace("", baseName, Qt::CaseInsensitive);
+ fileName.replace("", QString().sprintf("%02d", m_audioFile.filePosition()), Qt::CaseInsensitive);
+ fileName.replace("", m_audioFile.fileName() , Qt::CaseInsensitive);
+ fileName.replace("", m_audioFile.fileArtist(), Qt::CaseInsensitive);
+ fileName.replace("", m_audioFile.fileAlbum(), Qt::CaseInsensitive);
+ fileName.replace("", QString().sprintf("%04d", m_audioFile.fileYear()), Qt::CaseInsensitive);
+ fileName.replace("", m_audioFile.fileComment(), Qt::CaseInsensitive);
+ fileName = lamexp_clean_filename(fileName).simplified();
+
+ QString outFileName = QString("%1/%2.%3").arg(targetDir.canonicalPath(), fileName, m_encoder->extension());
while(QFileInfo(outFileName).exists())
{
- outFileName = QString("%1/%2 (%3).%4").arg(targetDir.canonicalPath(), baseName, QString::number(++n), m_encoder->extension());
+ outFileName = QString("%1/%2 (%3).%4").arg(targetDir.canonicalPath(), fileName, QString::number(++n), m_encoder->extension());
}
QFile placeholder(outFileName);
@@ -388,6 +399,11 @@ void ProcessThread::addFilter(AbstractFilter *filter)
m_filters.append(filter);
}
+void ProcessThread::setRenamePattern(const QString &pattern)
+{
+ m_renamePattern = pattern.simplified();
+}
+
////////////////////////////////////////////////////////////
// EVENTS
////////////////////////////////////////////////////////////
diff --git a/src/Thread_Process.h b/src/Thread_Process.h
index f9f5eb7b..c94c1e1f 100644
--- a/src/Thread_Process.h
+++ b/src/Thread_Process.h
@@ -43,6 +43,7 @@ public:
void abort() { m_aborted = true; }
QUuid getId() { return m_jobId; }
+ void setRenamePattern(const QString &pattern);
void addFilter(AbstractFilter *filter);
private slots:
@@ -79,6 +80,7 @@ private:
QStringList m_tempFiles;
const bool m_prependRelativeSourcePath;
QList m_filters;
+ QString m_renamePattern;
static QMutex *m_mutex_genFileName;
};