Added an option to rename the output files (based on an user-defined pattern). More macros might be added at a later time.

This commit is contained in:
LoRd_MuldeR 2011-08-04 23:26:38 +02:00
parent 93d4fb14ee
commit 7e1f790e9b
26 changed files with 676 additions and 21 deletions

View File

@ -17,6 +17,7 @@ a:visited { color: #0000EE; }
<h3>LameXP - Version History</h3><br>
<a name="4.02"></a>Changes between v4.02 and v4.03:<br><ul>
<li>Added an option to rename the output files (based on an user-defined pattern)
<li>Added "built-in" WMA decoder (see <a href="http://forum.doom9.org/showthread.php?t=140273">this</a> thread for details) and removed all remnants of "old" decoder
<li>Updated Qt runtime libraries to v4.8.0 Beta-1 (2011-07-19), compiled with MSVC 10.0
<li>Updated MediaInfo to v0.7.47 (2011-07-27), compiled with MSVC 10.0

View File

@ -1553,6 +1553,54 @@
<source>LameXP is already running, please use the running instance!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source> Rename Output Files </source>
<translation type="unfinished"></translation>
</message>
<message>
<source>[&lt;TrackNo&gt;] &lt;Artist&gt; - &lt;Title&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Rename Output Files</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&lt;a href=&quot;#&quot;&gt;Show List of Macros&lt;/a&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Original file name without extension</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Track number with leading zero</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Track title</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Artist name</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Album name</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Year with (at least) four digits</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Comment</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Rename Macros</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MetaInfo</name>

View File

@ -1554,6 +1554,54 @@
<source>The slow startup notifications have been re-enabled.</source>
<translation>Die langsamer Programmstart Meldungen wurden wieder aktiviert.</translation>
</message>
<message>
<source> Rename Output Files </source>
<translation type="unfinished"></translation>
</message>
<message>
<source>[&lt;TrackNo&gt;] &lt;Artist&gt; - &lt;Title&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Rename Output Files</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&lt;a href=&quot;#&quot;&gt;Show List of Macros&lt;/a&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Original file name without extension</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Track number with leading zero</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Track title</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Artist name</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Album name</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Year with (at least) four digits</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Comment</source>
<translation type="unfinished">Kommentar</translation>
</message>
<message>
<source>Rename Macros</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MetaInfo</name>

View File

@ -1553,6 +1553,54 @@
<source>The slow startup notifications have been re-enabled.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source> Rename Output Files </source>
<translation type="unfinished"></translation>
</message>
<message>
<source>[&lt;TrackNo&gt;] &lt;Artist&gt; - &lt;Title&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Rename Output Files</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&lt;a href=&quot;#&quot;&gt;Show List of Macros&lt;/a&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Original file name without extension</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Track number with leading zero</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Track title</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Artist name</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Album name</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Year with (at least) four digits</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Comment</source>
<translation type="unfinished">Comentarios</translation>
</message>
<message>
<source>Rename Macros</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MetaInfo</name>

View File

@ -1563,6 +1563,54 @@ Ouvrir le dossier récursivement...</translation>
<source>The slow startup notifications have been re-enabled.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source> Rename Output Files </source>
<translation type="unfinished"></translation>
</message>
<message>
<source>[&lt;TrackNo&gt;] &lt;Artist&gt; - &lt;Title&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Rename Output Files</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&lt;a href=&quot;#&quot;&gt;Show List of Macros&lt;/a&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Original file name without extension</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Track number with leading zero</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Track title</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Artist name</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Album name</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Year with (at least) four digits</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Comment</source>
<translation type="unfinished">Commentaire</translation>
</message>
<message>
<source>Rename Macros</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MetaInfo</name>

View File

@ -1554,6 +1554,54 @@
<source>The slow startup notifications have been re-enabled.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source> Rename Output Files </source>
<translation type="unfinished"></translation>
</message>
<message>
<source>[&lt;TrackNo&gt;] &lt;Artist&gt; - &lt;Title&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Rename Output Files</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&lt;a href=&quot;#&quot;&gt;Show List of Macros&lt;/a&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Original file name without extension</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Track number with leading zero</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Track title</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Artist name</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Album name</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Year with (at least) four digits</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Comment</source>
<translation type="unfinished">Commento</translation>
</message>
<message>
<source>Rename Macros</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MetaInfo</name>

View File

@ -1553,6 +1553,54 @@
<source>The slow startup notifications have been re-enabled.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source> Rename Output Files </source>
<translation type="unfinished"></translation>
</message>
<message>
<source>[&lt;TrackNo&gt;] &lt;Artist&gt; - &lt;Title&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Rename Output Files</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&lt;a href=&quot;#&quot;&gt;Show List of Macros&lt;/a&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Original file name without extension</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Track number with leading zero</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Track title</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Artist name</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Album name</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Year with (at least) four digits</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Comment</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Rename Macros</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MetaInfo</name>

View File

@ -1559,6 +1559,54 @@
<source>The slow startup notifications have been re-enabled.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source> Rename Output Files </source>
<translation type="unfinished"></translation>
</message>
<message>
<source>[&lt;TrackNo&gt;] &lt;Artist&gt; - &lt;Title&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Rename Output Files</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&lt;a href=&quot;#&quot;&gt;Show List of Macros&lt;/a&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Original file name without extension</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Track number with leading zero</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Track title</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Artist name</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Album name</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Year with (at least) four digits</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Comment</source>
<translation type="unfinished">Комментарий</translation>
</message>
<message>
<source>Rename Macros</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MetaInfo</name>

View File

@ -1554,6 +1554,54 @@
<source>The slow startup notifications have been re-enabled.</source>
<translation>Нагадування про уповільнений запуск були дозволені.</translation>
</message>
<message>
<source> Rename Output Files </source>
<translation type="unfinished"></translation>
</message>
<message>
<source>[&lt;TrackNo&gt;] &lt;Artist&gt; - &lt;Title&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Rename Output Files</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&lt;a href=&quot;#&quot;&gt;Show List of Macros&lt;/a&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Original file name without extension</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Track number with leading zero</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Track title</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Artist name</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Album name</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Year with (at least) four digits</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Comment</source>
<translation type="unfinished">Коментар</translation>
</message>
<message>
<source>Rename Macros</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MetaInfo</name>

View File

@ -1067,8 +1067,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>602</width>
<height>1241</height>
<width>604</width>
<height>1365</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_22">
@ -2028,7 +2028,7 @@
</layout>
</widget>
</item>
<item row="7" column="0">
<item row="8" column="0">
<widget class="QGroupBox" name="groupBox_11">
<property name="font">
<font>
@ -2237,7 +2237,7 @@
</layout>
</widget>
</item>
<item row="8" column="0">
<item row="9" column="0">
<widget class="QGroupBox" name="groupBox_12">
<property name="font">
<font>
@ -2401,7 +2401,7 @@
</layout>
</widget>
</item>
<item row="9" column="0">
<item row="10" column="0">
<widget class="QGroupBox" name="groupBox_13">
<property name="font">
<font>
@ -2783,6 +2783,146 @@
</layout>
</widget>
</item>
<item row="7" column="0">
<widget class="QGroupBox" name="groupBox_15">
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="title">
<string> Rename Output Files </string>
</property>
<layout class="QGridLayout" name="gridLayout_38">
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout_37">
<item row="1" column="0" rowspan="3">
<spacer name="horizontalSpacer_43">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="3" rowspan="3">
<spacer name="horizontalSpacer_44">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="1" colspan="2">
<widget class="QLineEdit" name="lineEditRenamePattern">
<property name="enabled">
<bool>false</bool>
</property>
<property name="font">
<font>
<family>Lucida Console</family>
</font>
</property>
<property name="text">
<string>[&lt;TrackNo&gt;] &lt;Artist&gt; - &lt;Title&gt;</string>
</property>
</widget>
</item>
<item row="0" column="1" colspan="2">
<spacer name="verticalSpacer_26">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>8</height>
</size>
</property>
</spacer>
</item>
<item row="4" column="1" colspan="2">
<spacer name="verticalSpacer_27">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>8</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="1">
<widget class="QCheckBox" name="checkBoxRenameOutput">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Rename Output Files</string>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<spacer name="verticalSpacer_28">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>3</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="2">
<widget class="QLabel" name="labelShowRenameMacros">
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="text">
<string>&lt;a href=&quot;#&quot;&gt;Show List of Macros&lt;/a&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</item>
<item row="6" column="0">
@ -3469,6 +3609,9 @@
<include location="../res/Icons.qrc"/>
<include location="../res/Icons.qrc"/>
<include location="../res/Icons.qrc"/>
<include location="../res/Icons.qrc"/>
<include location="../res/Icons.qrc"/>
<include location="../res/Icons.qrc"/>
</resources>
<connections>
<connection>
@ -3967,5 +4110,21 @@
</hint>
</hints>
</connection>
<connection>
<sender>checkBoxRenameOutput</sender>
<signal>toggled(bool)</signal>
<receiver>lineEditRenamePattern</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>323</x>
<y>206</y>
</hint>
<hint type="destinationlabel">
<x>323</x>
<y>172</y>
</hint>
</hints>
</connection>
</connections>
</ui>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

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 6
#define VER_LAMEXP_BUILD 613
#define VER_LAMEXP_PATCH 7
#define VER_LAMEXP_BUILD 616
///////////////////////////////////////////////////////////////////////////////
// Tools versions

View File

@ -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("<a href=\"%1\">%2</a>").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("<BaseName>", Qt::CaseInsensitive);
pattern.remove("<TrackNo>", Qt::CaseInsensitive);
pattern.remove("<Title>", Qt::CaseInsensitive);
pattern.remove("<Artist>", Qt::CaseInsensitive);
pattern.remove("<Album>", Qt::CaseInsensitive);
pattern.remove("<Year>", Qt::CaseInsensitive);
pattern.remove("<Comment>", 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("<tr><td><tt>&lt;%1&gt;</tt></td><td>&nbsp;&nbsp;</td><td>%2</td></tr>");
QString text = QString("<table>");
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 += "</table><br>";
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);
}

View File

@ -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);

View File

@ -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());

View File

@ -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;
}
/*

View File

@ -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, "[<TrackNo>] <Artist> - <Title>");
LAMEXP_MAKE_OPTION_U(metaInfoPosition, UINT_MAX);
LAMEXP_MAKE_OPTION_U(maximumInstances, 0);
LAMEXP_MAKE_OPTION_S(customTempPath, QDesktopServices::storageLocation(QDesktopServices::TempLocation));

View File

@ -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);

View File

@ -59,6 +59,7 @@ ProcessThread::ProcessThread(const AudioFileModel &audioFile, const QString &out
m_encoder(encoder),
m_jobId(QUuid::createUuid()),
m_prependRelativeSourcePath(prependRelativeSourcePath),
m_renamePattern("<BaseName>"),
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>", baseName, Qt::CaseInsensitive);
fileName.replace("<TrackNo>", QString().sprintf("%02d", m_audioFile.filePosition()), Qt::CaseInsensitive);
fileName.replace("<Title>", m_audioFile.fileName() , Qt::CaseInsensitive);
fileName.replace("<Artist>", m_audioFile.fileArtist(), Qt::CaseInsensitive);
fileName.replace("<Album>", m_audioFile.fileAlbum(), Qt::CaseInsensitive);
fileName.replace("<Year>", QString().sprintf("%04d", m_audioFile.fileYear()), Qt::CaseInsensitive);
fileName.replace("<Comment>", 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
////////////////////////////////////////////////////////////

View File

@ -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<AbstractFilter*> m_filters;
QString m_renamePattern;
static QMutex *m_mutex_genFileName;
};