Skip to content

Commit

Permalink
Create proper .m3u8 playlist with UTF-8 BOM, if the file names contai…
Browse files Browse the repository at this point in the history
…n Unicode characters. Otherwise create a simple .m3u playlist with Latin-1 encoding.
  • Loading branch information
lordmulder committed Jun 2, 2011
1 parent d452e92 commit e076c5b
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 17 deletions.
4 changes: 3 additions & 1 deletion doc/Changelog.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,17 @@ <h3>LameXP - Version History</h3><br>
<li>Added Cue Sheet import wizard, which allows splitting and importing tracks from Cue Sheet images
<li>Added ATSC A/52 (AC-3) encoding support, based on Aften encoder v0.0.8+ (Git Master)
<li>Added Avisynth input (audio only!) using 'avs2wav' tool, partly based on code by Jory Stone
<li>Added one new translation: Korean
<li>Added a method to use custom tools instead of the "built-in" ones (see <a href="FAQ.html#3d6684e9" target="_blank">FAQ doc</a> for details)
<li>Added an option to copy all meta information of a single file over to the "meta information" tab
<li>Added one new translation: Korean
<li>Updated Qt runtime libraries to v4.7.3
<li>Updated LAME encoder to v3.99.1.0 (2011-04-15), compiled with ICL 12.0.3 and MSVC 10.0 (<a href="http://lame.cvs.sourceforge.net/viewvc/lame/lame/doc/html/history.html?revision=1.127" target="_blank">details</a>)
<li>Updated Vorbis encoder to v2.87 using aoTuV Beta-6.03 (2011-05-04), compiled with ICL 11.1 and MSVC 9.0
<li>Updated mpg123 decoder to v1.13.3 (2011-04-21), compiled with GCC 4.6.0
<li>Updated MediaInfo to v0.7.45 Beta (2011-05-02), compiled with ICL 12.0.3 and MSVC 10.0
<li>Updated language files (big thank-you to all contributors !!!)
<li>Fixed placement of the Dropbox when the Taskbar is located on the top or on the left side
<li>Improved playlist generation: Generate M3U (Latin-1) or M3U8 (UTF-8) playlist file as required
<li>Miscellaneous bugfixes
</ul><br>

Expand Down
26 changes: 22 additions & 4 deletions doc/FAQ.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ <h3>LameXP - Frequently Asked Questions (FAQ)</h3><br>
<li><a href="#f35cfa24">How can I translate LameXP to my language or improve an existing translation?</a>
<li><a href="#8dba381f">Where can I download the latest version of LameXP?</a>
<li><a href="#9c2e273d">Where can I submit bug reports or feature requests?</a>
<li><a href="#e5694e3e">What programming language is LameXP written in?</a><br>
<li><a href="#982cf1c0">Where can I find the LameXP source code?</a>
<li><a href="#a0c1e92b">What are the prerequisites to build LameXP from the sources?</a></ul>

Expand Down Expand Up @@ -589,6 +590,14 @@ <h3>LameXP - Frequently Asked Questions (FAQ)</h3><br>
Please do NOT send me E-Mail unless you really have to! I receive a LOT of E-Mail and your mail can get lost!<br><br>
<br><br>

<a name="e5694e3e"></a><b>What programming language is LameXP written in?</b><br>
<br>
While LameXP v3.xx and all earlier versions were written in Delphi/Pascal, starting with version 4.xx the<br>
software has been re-written in the C++ programming language. LameXP v4.xx is based on the Qt cross-platform<br>
application framework and offers full Unicode support. For the time being LameXP is Windows-only.<br><br>

<br><br>

<a name="982cf1c0"></a><b>Where can I find the LameXP source code?</b><br>
<br>
LameXP is developed using the <a href="http://en.wikipedia.org/wiki/Git_(software)" target="_blank">Git</a> revision control system. The LameXP Git repository is mirrored at:<br><ul>
Expand All @@ -601,9 +610,10 @@ <h3>LameXP - Frequently Asked Questions (FAQ)</h3><br>
<a name="a0c1e92b"></a><b>What are the prerequisites to build LameXP from the sources?</b><br>
<br>
LameXP is currently being developed using the following build environment:<br><ul>
<li>Visual Studio 2010 with Service Pack 1, running on Windows 7 with Service Pack 1
<li>Desktop Qt v4.7.3 (MSVC 2008), included in Qt SDK v1.1
<li>Windows Platform SDK v7.1 (Windows SDK for Windows 7 and .NET Framework 4)</ul>
<li><a href="http://www.microsoft.com/visualstudio/en-us" target="_blank">Visual Studio 2010</a> with Service Pack 1, running on Windows 7 with Service Pack 1
<li>Desktop Qt v4.7.3 (MSVC 2008), included in <a href="http://qt.nokia.com/products/qt-sdk" target="_blank">Qt SDK v1.1</a>
<li><a href="http://www.microsoft.com/downloads/en/details.aspx?FamilyID=35AEDA01-421D-4BA5-B44B-543DC8C33A20" target="_blank">Windows Platform SDK v7.1</a> (Windows SDK for Windows 7 and .NET Framework 4)
<li>The minimum supported Windows version is Windows XP with Service Pack 2</ul>
<br>
Also note the following hints:<br><ul>
<li>Run "qtenv2.bat" before launching Visual Studio in order to set up the Qt environment
Expand All @@ -612,6 +622,14 @@ <h3>LameXP - Frequently Asked Questions (FAQ)</h3><br>
<li>The Windows Platform SDK v6.0A should work as well, but there may be a few limitations
<li>Support for the GNU Toolchain (GCC/MinGW + Make) is planned for a future version</ul>
<br>
In order to use the LameXP deployment scripts you need the following tools:<br><ul>
<li><a href="http://www.7-zip.org/" target="_blank">7-Zip</a> - file archiver with a high compression ratio
<li><a href="http://www.scratchpaper.com/" target="_blank">NSIS</a> - Nullsoft Scriptable Install System (Unicode Version)
<li><a href="ftp://ftp.gnupg.org/gcrypt/binary/" target="_blank">GnuPG</a> - the GNU Privacy Guard v1.4.x
<li><a href="http://upx.sourceforge.net/" target="_blank">UPX</a> - the Ultimate Packer for eXecutables
<li><a href="http://www.matcode.com/mpress.htm" target="_blank">MPRESS</a> - high-performance executable packer for PE32/PE32+<div style="height:7px"></div>
<li>Copy 'buildenv.template.txt' to 'buildenv.txt' and edit the paths as needed!</ul>
<br>
Instructions to build Qt as 'static' libraries:<br><ul>
<li>Make sure Visual Studio 2010 and Strawberry Perl for Windows are installed
<li>Install the Qt SDK v1.1 and choose to install the Qt 4.7.3 Sources
Expand All @@ -622,7 +640,7 @@ <h3>LameXP - Frequently Asked Questions (FAQ)</h3><br>
<li>Finally run 'configure.exe -release -static -ltcg &lt;more options&gt;' and wait for completion
<li>You can now open and build the solution files (e.g. 'src\corelib\QtCore.sln' in Visual Studio
<li>Make sure you select the "Release" configuration for your builds
<li>It is also recommended to change "C/C++ &gt; Code Generation &gt; Runtime Library" to "/MT"
<li>It is also recommended to change "C/C++ &rArr; Code Generation &rArr; Runtime Library" to "/MT"
<li>Libraries you need to build for LameXP include the following:<ul>
<li>lib\qtmain.lib
<li>lib\QtCore.lib
Expand Down
2 changes: 1 addition & 1 deletion src/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#define VER_LAMEXP_MINOR_LO 2
#define VER_LAMEXP_TYPE Beta
#define VER_LAMEXP_PATCH 6
#define VER_LAMEXP_BUILD 558
#define VER_LAMEXP_BUILD 560

///////////////////////////////////////////////////////////////////////////////
// Tools versions
Expand Down
51 changes: 40 additions & 11 deletions src/Dialog_Processing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -681,32 +681,61 @@ void ProcessingDialog::writePlayList(void)
return;
}

//Init local variables
const static char *invalidChars = "\\/:*?\"<>|";
QStringList list;
bool useUtf8 = false;
int counter = 1;

//Generate playlist name
QString playListName = (m_metaInfo->fileAlbum().isEmpty() ? "Playlist" : m_metaInfo->fileAlbum());
if(!m_metaInfo->fileArtist().isEmpty())
{
playListName = QString("%1 - %2").arg(m_metaInfo->fileArtist(), playListName);
}

const static char *invalidChars = "\\/:*?\"<>|";
//Clean playlist name
for(int i = 0; invalidChars[i]; i++)
{
playListName.replace(invalidChars[i], ' ');
playListName = playListName.simplified();
playListName = playListName.replace(invalidChars[i], ' ').simplified();
}

QString playListFile = QString("%1/%2.m3u").arg(m_settings->outputDir(), playListName);

int counter = 1;
//Create list of audio files
for(int i = 0; i < m_allJobs.count(); i++)
{
if(!m_succeededJobs.contains(m_allJobs.at(i))) continue;
list << QDir::toNativeSeparators(QDir(m_settings->outputDir()).relativeFilePath(m_playList.value(m_allJobs.at(i), "N/A")));
}

//Do we need an UTF-8 playlist?
for(int i = 0; i < list.count(); i++)
{
if(wcscmp(QWCHAR(QString::fromLatin1(list.at(i).toLatin1().constData())), QWCHAR(list.at(i))))
{
useUtf8 = true;
break;
}
}

//Generate playlist output file
QString playListFile = QString("%1/%2.%3").arg(m_settings->outputDir(), playListName, (useUtf8 ? "m3u8" : "m3u"));
while(QFileInfo(playListFile).exists())
{
playListFile = QString("%1/%2 (%3).m3u").arg(m_settings->outputDir(), playListName, QString::number(++counter));
playListFile = QString("%1/%2 (%3).%4").arg(m_settings->outputDir(), playListName, QString::number(++counter), (useUtf8 ? "m3u8" : "m3u"));
}

//Now write playlist to output file
QFile playList(playListFile);
if(playList.open(QIODevice::WriteOnly))
{
if(useUtf8)
{
playList.write("\xef\xbb\xbf");
}
playList.write("#EXTM3U\r\n");
for(int i = 0; i < m_allJobs.count(); i++)
while(!list.isEmpty())
{

if(!m_succeededJobs.contains(m_allJobs.at(i))) continue;
playList.write(QDir::toNativeSeparators(QDir(m_settings->outputDir()).relativeFilePath(m_playList.value(m_allJobs.at(i), "N/A"))).toUtf8().constData());
playList.write(useUtf8 ? list.takeFirst().toUtf8().constData() : list.takeFirst().toLatin1().constData());
playList.write("\r\n");
}
playList.close();
Expand Down

0 comments on commit e076c5b

Please sign in to comment.