From c08fa1493a4e1704ccb9e2ef6161e10af0c377ca Mon Sep 17 00:00:00 2001 From: lordmulder Date: Tue, 6 Sep 2011 18:47:13 +0200 Subject: [PATCH] Added support for a few Playlist file name prefixes. Will be chosen based on the file names in the Playlist. --- doc/Changelog.html | 1 + etc/Translation/Blank.ts | 10 +++++----- src/Config.h | 2 +- src/Dialog_Processing.cpp | 22 +++++++++++++++++----- src/Global.cpp | 4 +++- 5 files changed, 27 insertions(+), 12 deletions(-) diff --git a/doc/Changelog.html b/doc/Changelog.html index feb0442d..e817c659 100644 --- a/doc/Changelog.html +++ b/doc/Changelog.html @@ -27,6 +27,7 @@ a:visited { color: #0000EE; }
  • Updated language files (big thank-you to all contributors !!!)
  • Improved "downmix" filter by using explicit channel mappings for each number of input channels
  • Fixed Cue Sheet import for tracks with certain characters in the title +
  • Fixed a problem with the "normalization" filter that sometimes caused the resulting file to be empty
  • Workaround for malicious "anti-virus" programs that prevent innocent applications from functioning
  • Enabled "Aero Glass" theme in installer and web-update program (Vista and Windows 7 only)
  • Restored Windows 2000 support with Visual Studio 2010 builds (this is experimental!) diff --git a/etc/Translation/Blank.ts b/etc/Translation/Blank.ts index 9e943d14..d22afe89 100644 --- a/etc/Translation/Blank.ts +++ b/etc/Translation/Blank.ts @@ -2645,23 +2645,23 @@ - + Playlist creation failed - + The playlist file could not be created: - + Warning: Computer will shutdown in %1 seconds... - - + + Cancel Shutdown diff --git a/src/Config.h b/src/Config.h index 7eb8f1f6..5114c62e 100644 --- a/src/Config.h +++ b/src/Config.h @@ -30,7 +30,7 @@ #define VER_LAMEXP_MINOR_LO 3 #define VER_LAMEXP_TYPE Beta #define VER_LAMEXP_PATCH 1 -#define VER_LAMEXP_BUILD 683 +#define VER_LAMEXP_BUILD 684 /////////////////////////////////////////////////////////////////////////////// // Tools versions diff --git a/src/Dialog_Processing.cpp b/src/Dialog_Processing.cpp index 644bd80b..fdb6e872 100644 --- a/src/Dialog_Processing.cpp +++ b/src/Dialog_Processing.cpp @@ -723,8 +723,11 @@ void ProcessingDialog::writePlayList(void) } //Init local variables - const static char *invalidChars = "\\/:*?\"<>|"; QStringList list; + QRegExp regExp1("\\[\\d\\d\\][^/\\\\]+$", Qt::CaseInsensitive); + QRegExp regExp2("\\(\\d\\d\\)[^/\\\\]+$", Qt::CaseInsensitive); + QRegExp regExp3("\\d\\d[^/\\\\]+$", Qt::CaseInsensitive); + bool usePrefix[3] = {true, true, true}; bool useUtf8 = false; int counter = 1; @@ -736,10 +739,7 @@ void ProcessingDialog::writePlayList(void) } //Clean playlist name - for(int i = 0; invalidChars[i]; i++) - { - playListName = playListName.replace(invalidChars[i], ' ').simplified(); - } + playListName = lamexp_clean_filename(playListName); //Create list of audio files for(int i = 0; i < m_allJobs.count(); i++) @@ -748,6 +748,18 @@ void ProcessingDialog::writePlayList(void) list << QDir::toNativeSeparators(QDir(m_settings->outputDir()).relativeFilePath(m_playList.value(m_allJobs.at(i), "N/A"))); } + //Use prefix? + for(int i = 0; i < list.count(); i++) + { + if(regExp1.indexIn(list.at(i)) < 0) usePrefix[0] = false; + if(regExp2.indexIn(list.at(i)) < 0) usePrefix[1] = false; + if(regExp3.indexIn(list.at(i)) < 0) usePrefix[2] = false; + } + if(usePrefix[0] || usePrefix[1] || usePrefix[2]) + { + playListName.prepend(usePrefix[0] ? "[00] " : (usePrefix[1] ? "(00) " : "00 ")); + } + //Do we need an UTF-8 playlist? for(int i = 0; i < list.count(); i++) { diff --git a/src/Global.cpp b/src/Global.cpp index de198f87..2566dcc5 100644 --- a/src/Global.cpp +++ b/src/Global.cpp @@ -1553,6 +1553,7 @@ void lamexp_blink_window(QWidget *poWindow, unsigned int count, unsigned int del const QString lamexp_clean_filename(const QString &str) { QString newStr(str); + newStr.replace("\\", "-"); newStr.replace(" / ", ", "); newStr.replace("/", ","); @@ -1562,7 +1563,8 @@ const QString lamexp_clean_filename(const QString &str) newStr.replace("<", "["); newStr.replace(">", "]"); newStr.replace("|", "!"); - return newStr; + + return newStr.simplified(); } /*