Skip to content

Commit

Permalink
parserm3u: fallback implemented for both paths.
Browse files Browse the repository at this point in the history
  • Loading branch information
fatihemreyildiz committed May 14, 2022
1 parent 93a786f commit 1d21ca2
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/library/parserm3u.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,7 @@ bool ParserM3u::writeM3UFile(const QString &file_str, const QList<QString> &item
QString fileContents(QStringLiteral("#EXTM3U\n"));
for (const QString& item : items) {
fileContents += QStringLiteral("#EXTINF\n");
if (useUtf8 ||
useRelativePath) { //Issue: URL Location is not working properly for Relative Paths
if (useUtf8) {
if (useRelativePath) {
fileContents += baseDirectory.relativeFilePath(item) + QStringLiteral("\n");
} else {
Expand All @@ -118,7 +117,11 @@ bool ParserM3u::writeM3UFile(const QString &file_str, const QList<QString> &item
QByteArray trackByteArray = codec->fromUnicode(item);
QString trackName = codec->toUnicode(trackByteArray);
if (trackName == item) {
fileContents += item + QStringLiteral("\n");
if (useRelativePath) { //Issue: URL Location is not working properly for Relative Paths
fileContents += baseDirectory.relativeFilePath(item) + QStringLiteral("\n");
} else {
fileContents += item + QStringLiteral("\n");
}
} else {
QUrl itemUrl = QUrl::fromLocalFile(item);
QString itemUrlEncoded = itemUrl.toEncoded();
Expand Down

0 comments on commit 1d21ca2

Please sign in to comment.