Actually make RegExp-based file renaming work.
This commit is contained in:
parent
effb417eb5
commit
e35aff3907
@ -89,6 +89,7 @@ document.write('<a h'+'ref'+'="ma'+'ilto'+':'+e+'">'+e+'<\/'+'a'+'>');
|
||||
// -->
|
||||
</script><noscript>zityisoft at gmail dot com</noscript><br /></li>
|
||||
<li>Added optional support for the <em>libfdk-aac</em> encoder, using the <a href="https://github.com/nu774/fdkaac">fdkaac</a> front-end by nu774<br /></li>
|
||||
<li>Added enhanced file renaming options: Files can now be renamed based on <a href="http://www.regular-expressions.info/quickstart.html">regular expressions</a><br /></li>
|
||||
<li>Updated MediaInfo to v0.7.73 (2015-04-09), compiled with ICL 15.0 and MSVC 12.0<br /></li>
|
||||
<li>Updated ALAC decoder to refalac v1.47 (2015-02-15), based on reference implementation by Apple<br /></li>
|
||||
<li>Fixed potential deadlock in Cue Sheet import dialog when "Browse..." button is clicked<br /></li>
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
* Added Hungarian translation, thanks to Zityi's Translator Team <zityisoft@gmail.com>
|
||||
* Added optional support for the *libfdk-aac* encoder, using the [fdkaac](https://github.com/nu774/fdkaac) front-end by nu774
|
||||
* Added enhanced file renaming options: Files can now be renamed based on [regular expressions](http://www.regular-expressions.info/quickstart.html)
|
||||
* Updated MediaInfo to v0.7.73 (2015-04-09), compiled with ICL 15.0 and MSVC 12.0
|
||||
* Updated ALAC decoder to refalac v1.47 (2015-02-15), based on reference implementation by Apple
|
||||
* Fixed potential deadlock in Cue Sheet import dialog when "Browse..." button is clicked
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -31,7 +31,7 @@
|
||||
<context>
|
||||
<name>MainWindow</name>
|
||||
<message numerus="yes">
|
||||
<location filename="../../src/Dialog_MainWindow.cpp" line="827"/>
|
||||
<location filename="../../src/Dialog_MainWindow.cpp" line="834"/>
|
||||
<source>%n file(s) have been rejected, because read access was not granted!</source>
|
||||
<translation>
|
||||
<numerusform>%n file have been rejected, because read access was not granted!</numerusform>
|
||||
@ -39,7 +39,7 @@
|
||||
</translation>
|
||||
</message>
|
||||
<message numerus="yes">
|
||||
<location filename="../../src/Dialog_MainWindow.cpp" line="831"/>
|
||||
<location filename="../../src/Dialog_MainWindow.cpp" line="838"/>
|
||||
<source>%n file(s) have been rejected, because they are dummy CDDA files!</source>
|
||||
<translation>
|
||||
<numerusform>%n file have been rejected, because they are dummy CDDA files!</numerusform>
|
||||
@ -47,7 +47,7 @@
|
||||
</translation>
|
||||
</message>
|
||||
<message numerus="yes">
|
||||
<location filename="../../src/Dialog_MainWindow.cpp" line="835"/>
|
||||
<location filename="../../src/Dialog_MainWindow.cpp" line="842"/>
|
||||
<source>%n file(s) have been rejected, because they appear to be Cue Sheet images!</source>
|
||||
<translation>
|
||||
<numerusform>%n file have been rejected, because they appear to be Cue Sheet images!</numerusform>
|
||||
@ -55,7 +55,7 @@
|
||||
</translation>
|
||||
</message>
|
||||
<message numerus="yes">
|
||||
<location filename="../../src/Dialog_MainWindow.cpp" line="839"/>
|
||||
<location filename="../../src/Dialog_MainWindow.cpp" line="846"/>
|
||||
<source>%n file(s) have been rejected, because the file format could not be recognized!</source>
|
||||
<translation>
|
||||
<numerusform>%n file have been rejected, because the file format could not be recognized!</numerusform>
|
||||
@ -63,7 +63,7 @@
|
||||
</translation>
|
||||
</message>
|
||||
<message numerus="yes">
|
||||
<location filename="../../src/Dialog_MainWindow.cpp" line="3986"/>
|
||||
<location filename="../../src/Dialog_MainWindow.cpp" line="4083"/>
|
||||
<source>%n Instance(s)</source>
|
||||
<translation>
|
||||
<numerusform>%n Instance</numerusform>
|
||||
@ -74,7 +74,7 @@
|
||||
<context>
|
||||
<name>ProcessingDialog</name>
|
||||
<message numerus="yes">
|
||||
<location filename="../../src/Dialog_Processing.cpp" line="667"/>
|
||||
<location filename="../../src/Dialog_Processing.cpp" line="671"/>
|
||||
<source>Encoding: %n file(s) of %1 completed so far, please wait...</source>
|
||||
<translation>
|
||||
<numerusform>Encoding: %n file of %1 completed so far, please wait...</numerusform>
|
||||
@ -82,7 +82,7 @@
|
||||
</translation>
|
||||
</message>
|
||||
<message numerus="yes">
|
||||
<location filename="../../src/Dialog_Processing.cpp" line="699"/>
|
||||
<location filename="../../src/Dialog_Processing.cpp" line="703"/>
|
||||
<source>Process was aborted by the user after %n file(s)!</source>
|
||||
<translation>
|
||||
<numerusform>Process was aborted by the user after %n file!</numerusform>
|
||||
@ -90,7 +90,7 @@
|
||||
</translation>
|
||||
</message>
|
||||
<message numerus="yes">
|
||||
<location filename="../../src/Dialog_Processing.cpp" line="720"/>
|
||||
<location filename="../../src/Dialog_Processing.cpp" line="724"/>
|
||||
<source>Error: %1 of %n file(s) failed (%2). Double-click failed items for detailed information!</source>
|
||||
<translation>
|
||||
<numerusform>Error: %1 of %n file failed (%2). Double-click failed items for detailed information!</numerusform>
|
||||
@ -98,7 +98,7 @@
|
||||
</translation>
|
||||
</message>
|
||||
<message numerus="yes">
|
||||
<location filename="../../src/Dialog_Processing.cpp" line="720"/>
|
||||
<location filename="../../src/Dialog_Processing.cpp" line="724"/>
|
||||
<source>%n file(s) skipped</source>
|
||||
<translation>
|
||||
<numerusform>%n file skipped</numerusform>
|
||||
@ -106,7 +106,7 @@
|
||||
</translation>
|
||||
</message>
|
||||
<message numerus="yes">
|
||||
<location filename="../../src/Dialog_Processing.cpp" line="724"/>
|
||||
<location filename="../../src/Dialog_Processing.cpp" line="728"/>
|
||||
<source>Error: %1 of %n file(s) failed. Double-click failed items for detailed information!</source>
|
||||
<translation>
|
||||
<numerusform>Error: %1 of %n file failed. Double-click failed items for detailed information!</numerusform>
|
||||
@ -114,7 +114,7 @@
|
||||
</translation>
|
||||
</message>
|
||||
<message numerus="yes">
|
||||
<location filename="../../src/Dialog_Processing.cpp" line="738"/>
|
||||
<location filename="../../src/Dialog_Processing.cpp" line="742"/>
|
||||
<source>All files completed successfully. Skipped %n file(s).</source>
|
||||
<translation>
|
||||
<numerusform>All files completed successfully. Skipped %n file.</numerusform>
|
||||
@ -122,7 +122,7 @@
|
||||
</translation>
|
||||
</message>
|
||||
<message numerus="yes">
|
||||
<location filename="../../src/Dialog_Processing.cpp" line="1157"/>
|
||||
<location filename="../../src/Dialog_Processing.cpp" line="1161"/>
|
||||
<source>%n hour(s)</source>
|
||||
<translation>
|
||||
<numerusform>%n hour</numerusform>
|
||||
@ -130,8 +130,8 @@
|
||||
</translation>
|
||||
</message>
|
||||
<message numerus="yes">
|
||||
<location filename="../../src/Dialog_Processing.cpp" line="1158"/>
|
||||
<location filename="../../src/Dialog_Processing.cpp" line="1162"/>
|
||||
<location filename="../../src/Dialog_Processing.cpp" line="1166"/>
|
||||
<source>%n minute(s)</source>
|
||||
<translation>
|
||||
<numerusform>%n minute</numerusform>
|
||||
@ -139,8 +139,8 @@
|
||||
</translation>
|
||||
</message>
|
||||
<message numerus="yes">
|
||||
<location filename="../../src/Dialog_Processing.cpp" line="1163"/>
|
||||
<location filename="../../src/Dialog_Processing.cpp" line="1167"/>
|
||||
<location filename="../../src/Dialog_Processing.cpp" line="1171"/>
|
||||
<source>%n second(s)</source>
|
||||
<translation>
|
||||
<numerusform>%n second</numerusform>
|
||||
@ -148,7 +148,7 @@
|
||||
</translation>
|
||||
</message>
|
||||
<message numerus="yes">
|
||||
<location filename="../../src/Dialog_Processing.cpp" line="1168"/>
|
||||
<location filename="../../src/Dialog_Processing.cpp" line="1172"/>
|
||||
<source>%n millisecond(s)</source>
|
||||
<translation>
|
||||
<numerusform>%n millisecond</numerusform>
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -34,8 +34,8 @@
|
||||
#define VER_LAMEXP_MINOR_HI 1
|
||||
#define VER_LAMEXP_MINOR_LO 2
|
||||
#define VER_LAMEXP_TYPE Alpha
|
||||
#define VER_LAMEXP_PATCH 1
|
||||
#define VER_LAMEXP_BUILD 1723
|
||||
#define VER_LAMEXP_PATCH 2
|
||||
#define VER_LAMEXP_BUILD 1725
|
||||
#define VER_LAMEXP_CONFG 1700
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -487,7 +487,8 @@ MainWindow::MainWindow(MUtils::IPCChannel *const ipcChannel, FileListModel *cons
|
||||
SET_CHECKBOX_STATE(ui->checkBoxNormalizationFilterCoupled, m_settings->normalizationFilterCoupled());
|
||||
SET_CHECKBOX_STATE(ui->checkBoxAutoDetectInstances, (m_settings->maximumInstances() < 1));
|
||||
SET_CHECKBOX_STATE(ui->checkBoxUseSystemTempFolder, (!m_settings->customTempPathEnabled()));
|
||||
SET_CHECKBOX_STATE(ui->checkBoxRename_Rename, m_settings->renameOutputFilesEnabled());
|
||||
SET_CHECKBOX_STATE(ui->checkBoxRename_Rename, m_settings->renameFiles_renameEnabled());
|
||||
SET_CHECKBOX_STATE(ui->checkBoxRename_RegExp, m_settings->renameFiles_regExpEnabled());
|
||||
SET_CHECKBOX_STATE(ui->checkBoxForceStereoDownmix, m_settings->forceStereoDownmix());
|
||||
SET_CHECKBOX_STATE(ui->checkBoxOpusDisableResample, m_settings->opusDisableResample());
|
||||
|
||||
@ -495,12 +496,14 @@ MainWindow::MainWindow(MUtils::IPCChannel *const ipcChannel, FileListModel *cons
|
||||
|
||||
ui->lineEditCustomParamLAME ->setText(EncoderRegistry::loadEncoderCustomParams(m_settings, SettingsModel::MP3Encoder));
|
||||
ui->lineEditCustomParamOggEnc ->setText(EncoderRegistry::loadEncoderCustomParams(m_settings, SettingsModel::VorbisEncoder));
|
||||
ui->lineEditCustomParamNeroAAC->setText(EncoderRegistry::loadEncoderCustomParams(m_settings, SettingsModel::AACEncoder));
|
||||
ui->lineEditCustomParamNeroAAC ->setText(EncoderRegistry::loadEncoderCustomParams(m_settings, SettingsModel::AACEncoder));
|
||||
ui->lineEditCustomParamFLAC ->setText(EncoderRegistry::loadEncoderCustomParams(m_settings, SettingsModel::FLACEncoder));
|
||||
ui->lineEditCustomParamAften ->setText(EncoderRegistry::loadEncoderCustomParams(m_settings, SettingsModel::AC3Encoder));
|
||||
ui->lineEditCustomParamOpus ->setText(EncoderRegistry::loadEncoderCustomParams(m_settings, SettingsModel::OpusEncoder));
|
||||
ui->lineEditCustomTempFolder ->setText(QDir::toNativeSeparators(m_settings->customTempPath()));
|
||||
ui->lineEditRenamePattern ->setText(m_settings->renameOutputFilesPattern());
|
||||
ui->lineEditRenamePattern ->setText(m_settings->renameFiles_renamePattern());
|
||||
ui->lineEditRenameRegExp_Search ->setText(m_settings->renameFiles_regExpSearch ());
|
||||
ui->lineEditRenameRegExp_Replace->setText(m_settings->renameFiles_regExpReplace());
|
||||
|
||||
m_evenFilterCustumParamsHelp = new CustomEventFilter();
|
||||
ui->helpCustomParamLAME->installEventFilter(m_evenFilterCustumParamsHelp);
|
||||
@ -553,9 +556,13 @@ MainWindow::MainWindow(MUtils::IPCChannel *const ipcChannel, FileListModel *cons
|
||||
connect(ui->checkBoxUseSystemTempFolder, SIGNAL(clicked(bool)), this, SLOT(useCustomTempFolderChanged(bool)));
|
||||
connect(ui->buttonResetAdvancedOptions, SIGNAL(clicked()), this, SLOT(resetAdvancedOptionsButtonClicked()));
|
||||
connect(ui->checkBoxRename_Rename, SIGNAL(clicked(bool)), this, SLOT(renameOutputEnabledChanged(bool)));
|
||||
connect(ui->checkBoxRename_RegExp, SIGNAL(clicked(bool)), this, SLOT(renameOutputEnabledChanged(bool)));
|
||||
connect(ui->checkBoxRename_RegExp, SIGNAL(clicked(bool)), this, SLOT(renameRegExpEnabledChanged(bool)));
|
||||
connect(ui->lineEditRenamePattern, SIGNAL(editingFinished()), this, SLOT(renameOutputPatternChanged()));
|
||||
connect(ui->lineEditRenamePattern, SIGNAL(textChanged(QString)), this, SLOT(renameOutputPatternChanged(QString)));
|
||||
connect(ui->lineEditRenameRegExp_Search, SIGNAL(editingFinished()), this, SLOT(renameRegExpValueChanged()));
|
||||
connect(ui->lineEditRenameRegExp_Search, SIGNAL(textChanged(QString)), this, SLOT(renameRegExpSearchChanged(QString)));
|
||||
connect(ui->lineEditRenameRegExp_Replace, SIGNAL(editingFinished()), this, SLOT(renameRegExpValueChanged()));
|
||||
connect(ui->lineEditRenameRegExp_Replace, SIGNAL(textChanged(QString)), this, SLOT(renameRegExpReplaceChanged(QString)));
|
||||
connect(ui->labelShowRenameMacros, SIGNAL(linkActivated(QString)), this, SLOT(showRenameMacros(QString)));
|
||||
connect(ui->labelShowRegExpHelp, SIGNAL(linkActivated(QString)), this, SLOT(showRenameMacros(QString)));
|
||||
connect(ui->checkBoxForceStereoDownmix, SIGNAL(clicked(bool)), this, SLOT(forceStereoDownmixEnabledChanged(bool)));
|
||||
@ -1140,6 +1147,8 @@ void MainWindow::changeEvent(QEvent *e)
|
||||
updateLameAlgoQuality(ui->sliderLameAlgoQuality->value());
|
||||
updateMaximumInstances(ui->sliderMaxInstances->value());
|
||||
renameOutputPatternChanged(ui->lineEditRenamePattern->text(), true);
|
||||
renameRegExpSearchChanged (ui->lineEditRenameRegExp_Search ->text(), true);
|
||||
renameRegExpReplaceChanged(ui->lineEditRenameRegExp_Replace->text(), true);
|
||||
|
||||
//Re-install shell integration
|
||||
if(m_settings->shellIntegrationEnabled())
|
||||
@ -3887,9 +3896,9 @@ void MainWindow::renameButtonClicked(bool checked)
|
||||
/*
|
||||
* Rename output files enabled changed
|
||||
*/
|
||||
void MainWindow::renameOutputEnabledChanged(bool checked)
|
||||
void MainWindow::renameOutputEnabledChanged(const bool &checked)
|
||||
{
|
||||
m_settings->renameOutputFilesEnabled(checked);
|
||||
m_settings->renameFiles_renameEnabled(checked);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -3898,14 +3907,14 @@ void MainWindow::renameOutputEnabledChanged(bool checked)
|
||||
void MainWindow::renameOutputPatternChanged(void)
|
||||
{
|
||||
QString temp = ui->lineEditRenamePattern->text().simplified();
|
||||
ui->lineEditRenamePattern->setText(temp.isEmpty() ? m_settings->renameOutputFilesPatternDefault() : temp);
|
||||
m_settings->renameOutputFilesPattern(ui->lineEditRenamePattern->text());
|
||||
ui->lineEditRenamePattern->setText(temp.isEmpty() ? m_settings->renameFiles_renamePatternDefault() : temp);
|
||||
m_settings->renameFiles_renamePattern(ui->lineEditRenamePattern->text());
|
||||
}
|
||||
|
||||
/*
|
||||
* Rename output files patterm changed
|
||||
*/
|
||||
void MainWindow::renameOutputPatternChanged(const QString &text, bool silent)
|
||||
void MainWindow::renameOutputPatternChanged(const QString &text, const bool &silent)
|
||||
{
|
||||
QString pattern(text.simplified());
|
||||
|
||||
@ -3939,6 +3948,94 @@ void MainWindow::renameOutputPatternChanged(const QString &text, bool silent)
|
||||
ui->labelRanameExample->setText(patternClean);
|
||||
}
|
||||
|
||||
/*
|
||||
* Regular expression enabled changed
|
||||
*/
|
||||
void MainWindow::renameRegExpEnabledChanged(const bool &checked)
|
||||
{
|
||||
m_settings->renameFiles_regExpEnabled(checked);
|
||||
}
|
||||
|
||||
/*
|
||||
* Regular expression value has changed
|
||||
*/
|
||||
void MainWindow::renameRegExpValueChanged(void)
|
||||
{
|
||||
const QString search = ui->lineEditRenameRegExp_Search->text() .trimmed();
|
||||
const QString replace = ui->lineEditRenameRegExp_Replace->text().simplified();
|
||||
ui->lineEditRenameRegExp_Search ->setText(search.isEmpty() ? m_settings->renameFiles_regExpSearchDefault() : search);
|
||||
ui->lineEditRenameRegExp_Replace->setText(replace.isEmpty() ? m_settings->renameFiles_regExpReplaceDefault() : replace);
|
||||
m_settings->renameFiles_regExpSearch (ui->lineEditRenameRegExp_Search ->text());
|
||||
m_settings->renameFiles_regExpReplace(ui->lineEditRenameRegExp_Replace->text());
|
||||
}
|
||||
|
||||
/*
|
||||
* Regular expression search pattern has changed
|
||||
*/
|
||||
void MainWindow::renameRegExpSearchChanged(const QString &text, const bool &silent)
|
||||
{
|
||||
const QString pattern(text.trimmed());
|
||||
|
||||
if((!pattern.isEmpty()) && (!QRegExp(pattern.trimmed()).isValid()))
|
||||
{
|
||||
if(ui->lineEditRenameRegExp_Search->palette().color(QPalette::Text) != Qt::red)
|
||||
{
|
||||
if(!silent) MUtils::Sound::beep(MUtils::Sound::BEEP_ERR);
|
||||
SET_TEXT_COLOR(ui->lineEditRenameRegExp_Search, Qt::red);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(ui->lineEditRenameRegExp_Search->palette() != QPalette())
|
||||
{
|
||||
if(!silent) MUtils::Sound::beep(MUtils::Sound::BEEP_NFO);
|
||||
ui->lineEditRenameRegExp_Search->setPalette(QPalette());
|
||||
}
|
||||
}
|
||||
|
||||
renameRegExpReplaceChanged(ui->lineEditRenameRegExp_Replace->text(), silent);
|
||||
}
|
||||
|
||||
/*
|
||||
* Regular expression replacement string changed
|
||||
*/
|
||||
void MainWindow::renameRegExpReplaceChanged(const QString &text, const bool &silent)
|
||||
{
|
||||
QString replacement(text.simplified());
|
||||
const QString search(ui->lineEditRenameRegExp_Search->text().trimmed());
|
||||
|
||||
if(!search.isEmpty())
|
||||
{
|
||||
const QRegExp regexp(search);
|
||||
if(regexp.isValid())
|
||||
{
|
||||
const int count = regexp.captureCount();
|
||||
const QString blank;
|
||||
for(int i = 0; i < count; i++)
|
||||
{
|
||||
replacement.replace(QString("\\%0").arg(QString::number(i+1)), blank);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(replacement.compare(MUtils::clean_file_name(replacement)))
|
||||
{
|
||||
if(ui->lineEditRenameRegExp_Replace->palette().color(QPalette::Text) != Qt::red)
|
||||
{
|
||||
if(!silent) MUtils::Sound::beep(MUtils::Sound::BEEP_ERR);
|
||||
SET_TEXT_COLOR(ui->lineEditRenameRegExp_Replace, Qt::red);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(ui->lineEditRenameRegExp_Replace->palette() != QPalette())
|
||||
{
|
||||
if(!silent) MUtils::Sound::beep(MUtils::Sound::BEEP_NFO);
|
||||
ui->lineEditRenameRegExp_Replace->setPalette(QPalette());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Show list of rename macros
|
||||
*/
|
||||
@ -3946,7 +4043,7 @@ void MainWindow::showRenameMacros(const QString &text)
|
||||
{
|
||||
if(text.compare("reset", Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
ui->lineEditRenamePattern->setText(m_settings->renameOutputFilesPatternDefault());
|
||||
ui->lineEditRenamePattern->setText(m_settings->renameFiles_renamePatternDefault());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -4192,24 +4289,30 @@ void MainWindow::resetAdvancedOptionsButtonClicked(void)
|
||||
SET_CHECKBOX_STATE(ui->checkBoxAutoDetectInstances, (m_settings->maximumInstancesDefault() < 1));
|
||||
SET_CHECKBOX_STATE(ui->checkBoxUseSystemTempFolder, (!m_settings->customTempPathEnabledDefault()));
|
||||
SET_CHECKBOX_STATE(ui->checkBoxAftenFastAllocation, m_settings->aftenFastBitAllocationDefault());
|
||||
SET_CHECKBOX_STATE(ui->checkBoxRename_Rename, m_settings->renameOutputFilesEnabledDefault());
|
||||
SET_CHECKBOX_STATE(ui->checkBoxRename_Rename, m_settings->renameFiles_renameEnabledDefault());
|
||||
SET_CHECKBOX_STATE(ui->checkBoxRename_RegExp, m_settings->renameFiles_regExpEnabledDefault());
|
||||
SET_CHECKBOX_STATE(ui->checkBoxForceStereoDownmix, m_settings->forceStereoDownmixDefault());
|
||||
SET_CHECKBOX_STATE(ui->checkBoxOpusDisableResample, m_settings->opusDisableResampleDefault());
|
||||
|
||||
ui->lineEditCustomParamLAME ->setText(m_settings->customParametersLAMEDefault());
|
||||
ui->lineEditCustomParamOggEnc ->setText(m_settings->customParametersOggEncDefault());
|
||||
ui->lineEditCustomParamNeroAAC->setText(m_settings->customParametersAacEncDefault());
|
||||
ui->lineEditCustomParamNeroAAC ->setText(m_settings->customParametersAacEncDefault());
|
||||
ui->lineEditCustomParamFLAC ->setText(m_settings->customParametersFLACDefault());
|
||||
ui->lineEditCustomParamOpus ->setText(m_settings->customParametersOpusEncDefault());
|
||||
ui->lineEditCustomTempFolder ->setText(QDir::toNativeSeparators(m_settings->customTempPathDefault()));
|
||||
ui->lineEditRenamePattern ->setText(m_settings->renameOutputFilesPatternDefault());
|
||||
ui->lineEditRenamePattern ->setText(m_settings->renameFiles_renamePatternDefault());
|
||||
ui->lineEditRenameRegExp_Search ->setText(m_settings->renameFiles_regExpSearchDefault());
|
||||
ui->lineEditRenameRegExp_Replace->setText(m_settings->renameFiles_regExpReplaceDefault());
|
||||
|
||||
if(m_settings->overwriteModeDefault() == SettingsModel::Overwrite_KeepBoth) ui->radioButtonOverwriteModeKeepBoth->click();
|
||||
if(m_settings->overwriteModeDefault() == SettingsModel::Overwrite_SkipFile) ui->radioButtonOverwriteModeSkipFile->click();
|
||||
if(m_settings->overwriteModeDefault() == SettingsModel::Overwrite_Replaces) ui->radioButtonOverwriteModeReplaces->click();
|
||||
|
||||
customParamsChanged();
|
||||
ui->scrollArea->verticalScrollBar()->setValue(0);
|
||||
ui->buttonRename_Rename->click();
|
||||
customParamsChanged();
|
||||
renameOutputPatternChanged();
|
||||
renameRegExpValueChanged();
|
||||
}
|
||||
|
||||
// =========================================================
|
||||
|
@ -152,9 +152,13 @@ private slots:
|
||||
void refreshFolderContextActionTriggered(void);
|
||||
void removeFileButtonClicked(void);
|
||||
void renameButtonClicked(bool checked);
|
||||
void renameOutputEnabledChanged(bool checked);
|
||||
void renameOutputEnabledChanged(const bool &checked);
|
||||
void renameOutputPatternChanged(void);
|
||||
void renameOutputPatternChanged(const QString &text, bool silent = false);
|
||||
void renameOutputPatternChanged(const QString &text, const bool &silent = false);
|
||||
void renameRegExpEnabledChanged(const bool &checked);
|
||||
void renameRegExpValueChanged(void);
|
||||
void renameRegExpSearchChanged (const QString &text, const bool &silent = false);
|
||||
void renameRegExpReplaceChanged(const QString &text, const bool &silent = false);
|
||||
void resetAdvancedOptionsButtonClicked(void);
|
||||
void restoreCursor(void);
|
||||
void samplingRateChanged(int value);
|
||||
|
@ -616,9 +616,13 @@ void ProcessingDialog::startNextJob(void)
|
||||
{
|
||||
thread->addFilter(new NormalizeFilter(m_settings->normalizationFilterMaxVolume(), m_settings->normalizationFilterDynamic(), m_settings->normalizationFilterCoupled(), m_settings->normalizationFilterSize()));
|
||||
}
|
||||
if(m_settings->renameOutputFilesEnabled() && (!m_settings->renameOutputFilesPattern().simplified().isEmpty()))
|
||||
if(m_settings->renameFiles_renameEnabled() && (!m_settings->renameFiles_renamePattern().simplified().isEmpty()))
|
||||
{
|
||||
thread->setRenamePattern(m_settings->renameOutputFilesPattern());
|
||||
thread->setRenamePattern(m_settings->renameFiles_renamePattern());
|
||||
}
|
||||
if(m_settings->renameFiles_regExpEnabled() && (!m_settings->renameFiles_regExpSearch().trimmed().isEmpty()) && (!m_settings->renameFiles_regExpReplace().simplified().isEmpty()))
|
||||
{
|
||||
thread->setRenameRegExp(m_settings->renameFiles_regExpSearch(), m_settings->renameFiles_regExpReplace());
|
||||
}
|
||||
if(m_settings->overwriteMode() != SettingsModel::Overwrite_KeepBoth)
|
||||
{
|
||||
|
@ -274,8 +274,11 @@ LAMEXP_MAKE_ID(outputDir, "OutputDirectory/SelectedPath");
|
||||
LAMEXP_MAKE_ID(outputToSourceDir, "OutputDirectory/OutputToSourceFolder");
|
||||
LAMEXP_MAKE_ID(overwriteMode, "AdvancedOptions/OverwriteMode");
|
||||
LAMEXP_MAKE_ID(prependRelativeSourcePath, "OutputDirectory/PrependRelativeSourcePath");
|
||||
LAMEXP_MAKE_ID(renameOutputFilesEnabled, "AdvancedOptions/RenameOutputFiles/Enabled");
|
||||
LAMEXP_MAKE_ID(renameOutputFilesPattern, "AdvancedOptions/RenameOutputFiles/Pattern");
|
||||
LAMEXP_MAKE_ID(renameFiles_regExpEnabled, "AdvancedOptions/RenameOutputFiles/RegExp/Enabled");
|
||||
LAMEXP_MAKE_ID(renameFiles_regExpSearch, "AdvancedOptions/RenameOutputFiles/RegExp/SearchPattern");
|
||||
LAMEXP_MAKE_ID(renameFiles_regExpReplace, "AdvancedOptions/RenameOutputFiles/RegExp/Replacement");
|
||||
LAMEXP_MAKE_ID(renameFiles_renameEnabled, "AdvancedOptions/RenameOutputFiles/Rename/Enabled");
|
||||
LAMEXP_MAKE_ID(renameFiles_renamePattern, "AdvancedOptions/RenameOutputFiles/Rename/Pattern");
|
||||
LAMEXP_MAKE_ID(samplingRate, "AdvancedOptions/Common/Resampling");
|
||||
LAMEXP_MAKE_ID(shellIntegrationEnabled, "Flags/EnableShellIntegration");
|
||||
LAMEXP_MAKE_ID(slowStartup, "Flags/SlowStartupDetected");
|
||||
@ -652,8 +655,11 @@ LAMEXP_MAKE_OPTION_S(outputDir, defaultDirectory())
|
||||
LAMEXP_MAKE_OPTION_B(outputToSourceDir, false)
|
||||
LAMEXP_MAKE_OPTION_I(overwriteMode, Overwrite_KeepBoth)
|
||||
LAMEXP_MAKE_OPTION_B(prependRelativeSourcePath, false)
|
||||
LAMEXP_MAKE_OPTION_B(renameOutputFilesEnabled, false)
|
||||
LAMEXP_MAKE_OPTION_S(renameOutputFilesPattern, "[<TrackNo>] <Artist> - <Title>")
|
||||
LAMEXP_MAKE_OPTION_B(renameFiles_regExpEnabled, false)
|
||||
LAMEXP_MAKE_OPTION_S(renameFiles_regExpSearch, QString())
|
||||
LAMEXP_MAKE_OPTION_S(renameFiles_regExpReplace, QString())
|
||||
LAMEXP_MAKE_OPTION_B(renameFiles_renameEnabled, false)
|
||||
LAMEXP_MAKE_OPTION_S(renameFiles_renamePattern, "[<TrackNo>] <Artist> - <Title>")
|
||||
LAMEXP_MAKE_OPTION_I(samplingRate, 0)
|
||||
LAMEXP_MAKE_OPTION_B(shellIntegrationEnabled, !lamexp_version_portable())
|
||||
LAMEXP_MAKE_OPTION_B(slowStartup, false)
|
||||
|
@ -192,8 +192,11 @@ public:
|
||||
LAMEXP_MAKE_OPTION_B(outputToSourceDir)
|
||||
LAMEXP_MAKE_OPTION_I(overwriteMode)
|
||||
LAMEXP_MAKE_OPTION_B(prependRelativeSourcePath)
|
||||
LAMEXP_MAKE_OPTION_B(renameOutputFilesEnabled)
|
||||
LAMEXP_MAKE_OPTION_S(renameOutputFilesPattern)
|
||||
LAMEXP_MAKE_OPTION_B(renameFiles_regExpEnabled)
|
||||
LAMEXP_MAKE_OPTION_S(renameFiles_regExpSearch)
|
||||
LAMEXP_MAKE_OPTION_S(renameFiles_regExpReplace)
|
||||
LAMEXP_MAKE_OPTION_B(renameFiles_renameEnabled)
|
||||
LAMEXP_MAKE_OPTION_S(renameFiles_renamePattern)
|
||||
LAMEXP_MAKE_OPTION_I(samplingRate)
|
||||
LAMEXP_MAKE_OPTION_B(shellIntegrationEnabled)
|
||||
LAMEXP_MAKE_OPTION_B(slowStartup)
|
||||
|
@ -380,7 +380,7 @@ int ProcessThread::generateOutFileName(QString &outFileName)
|
||||
outFileName.clear();
|
||||
|
||||
//Make sure the source file exists
|
||||
QFileInfo sourceFile(m_audioFile.filePath());
|
||||
const QFileInfo sourceFile(m_audioFile.filePath());
|
||||
if(!(sourceFile.exists() && sourceFile.isFile()))
|
||||
{
|
||||
handleMessage(QString("%1\n%2").arg(tr("The source audio file could not be found:"), sourceFile.absoluteFilePath()));
|
||||
@ -399,7 +399,7 @@ int ProcessThread::generateOutFileName(QString &outFileName)
|
||||
readTest.close();
|
||||
}
|
||||
|
||||
QString baseName = sourceFile.completeBaseName();
|
||||
const QString baseName = sourceFile.completeBaseName();
|
||||
QDir targetDir(m_outputDirectory.isEmpty() ? sourceFile.canonicalPath() : m_outputDirectory);
|
||||
|
||||
//Prepend relative source file path?
|
||||
@ -437,7 +437,7 @@ int ProcessThread::generateOutFileName(QString &outFileName)
|
||||
}
|
||||
|
||||
//Apply rename pattern
|
||||
QString fileName = applyRenamePattern(baseName, m_audioFile.metaInfo());
|
||||
const QString fileName = MUtils::clean_file_name(applyRegularExpression(applyRenamePattern(baseName, m_audioFile.metaInfo())));
|
||||
|
||||
//Generate full output path
|
||||
outFileName = QString("%1/%2.%3").arg(targetDir.canonicalPath(), fileName, m_encoder->extension());
|
||||
@ -500,11 +500,27 @@ QString ProcessThread::applyRenamePattern(const QString &baseName, const AudioFi
|
||||
fileName.replace("<Album>", STRDEF(metaInfo.album(), tr("Unknown Album")), Qt::CaseInsensitive);
|
||||
fileName.replace("<Year>", QString().sprintf("%04d", metaInfo.year()), Qt::CaseInsensitive);
|
||||
fileName.replace("<Comment>", STRDEF(metaInfo.comment(), tr("Unknown Comment")), Qt::CaseInsensitive);
|
||||
fileName = MUtils::clean_file_name(fileName);
|
||||
|
||||
return fileName;
|
||||
}
|
||||
|
||||
QString ProcessThread::applyRegularExpression(const QString &fileName)
|
||||
{
|
||||
if(m_renameRegExp_Search.isEmpty() || m_renameRegExp_Replace.isEmpty())
|
||||
{
|
||||
return fileName;
|
||||
}
|
||||
|
||||
QRegExp regExp(m_renameRegExp_Search);
|
||||
if(!regExp.isValid())
|
||||
{
|
||||
qWarning("Invalid regular expression detected -> cannot rename!");
|
||||
return fileName;
|
||||
}
|
||||
|
||||
return (QString(fileName).replace(regExp, m_renameRegExp_Replace));
|
||||
}
|
||||
|
||||
QString ProcessThread::generateTempFileName(void)
|
||||
{
|
||||
bool bOkay = false;
|
||||
@ -680,10 +696,20 @@ void ProcessThread::addFilter(AbstractFilter *filter)
|
||||
|
||||
void ProcessThread::setRenamePattern(const QString &pattern)
|
||||
{
|
||||
QString newPattern = pattern.simplified();
|
||||
const QString newPattern = pattern.simplified();
|
||||
if(!newPattern.isEmpty()) m_renamePattern = newPattern;
|
||||
}
|
||||
|
||||
void ProcessThread::setRenameRegExp(const QString &search, const QString &replace)
|
||||
{
|
||||
const QString newSearch = search.trimmed(), newReplace = replace.simplified();
|
||||
if((!newSearch.isEmpty()) && (!newReplace.isEmpty()))
|
||||
{
|
||||
m_renameRegExp_Search = newSearch;
|
||||
m_renameRegExp_Replace = newReplace;
|
||||
}
|
||||
}
|
||||
|
||||
void ProcessThread::setOverwriteMode(const bool &bSkipExistingFile, const bool &bReplacesExisting)
|
||||
{
|
||||
if(bSkipExistingFile && bReplacesExisting)
|
||||
|
@ -47,6 +47,7 @@ public:
|
||||
|
||||
QUuid getId(void) { return m_jobId; }
|
||||
void setRenamePattern(const QString &pattern);
|
||||
void setRenameRegExp(const QString &search, const QString &replace);
|
||||
void setOverwriteMode(const bool &bSkipExistingFile, const bool &bReplacesExisting = false);
|
||||
void addFilter(AbstractFilter *filter);
|
||||
|
||||
@ -87,6 +88,7 @@ private:
|
||||
void processFile();
|
||||
int generateOutFileName(QString &outFileName);
|
||||
QString applyRenamePattern(const QString &baseName, const AudioFileModel_MetaInfo &metaInfo);
|
||||
QString applyRegularExpression(const QString &fileName);
|
||||
QString generateTempFileName(void);
|
||||
void insertDownmixFilter(void);
|
||||
void insertDownsampleFilter(void);
|
||||
@ -104,6 +106,8 @@ private:
|
||||
const bool m_prependRelativeSourcePath;
|
||||
QList<AbstractFilter*> m_filters;
|
||||
QString m_renamePattern;
|
||||
QString m_renameRegExp_Search;
|
||||
QString m_renameRegExp_Replace;
|
||||
int m_overwriteMode;
|
||||
WaveProperties *m_propDetect;
|
||||
QString m_outFileName;
|
||||
|
Loading…
Reference in New Issue
Block a user