Skip to content

Commit

Permalink
parserm3u: info box added
Browse files Browse the repository at this point in the history
  • Loading branch information
fatihemreyildiz committed May 14, 2022
1 parent 1d21ca2 commit 214dbbc
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/library/parserm3u.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ bool ParserM3u::writeM3UFile(const QString &file_str, const QList<QString> &item
// Important note:
// On Windows \n will produce a <CR><CL> (=\r\n)
// On Linux and OS X \n is <CR> (which remains \n)

bool urlEncodingUsed = false;
QDir baseDirectory(QFileInfo(file_str).canonicalPath());
QTextCodec* codec = QTextCodec::codecForName(kStandardM3uTextEncoding);
QString fileContents(QStringLiteral("#EXTM3U\n"));
Expand All @@ -126,6 +126,7 @@ bool ParserM3u::writeM3UFile(const QString &file_str, const QList<QString> &item
QUrl itemUrl = QUrl::fromLocalFile(item);
QString itemUrlEncoded = itemUrl.toEncoded();
fileContents += itemUrlEncoded + QStringLiteral("\n");
urlEncodingUsed = true;
}
}
}
Expand All @@ -146,6 +147,13 @@ bool ParserM3u::writeM3UFile(const QString &file_str, const QList<QString> &item
QObject::tr("Could not create file") + " " + file_str);
return false;
}
if (urlEncodingUsed) {
QMessageBox::information(nullptr,
QObject::tr("Playlist Export Has Special Characters"),
QObject::tr("Some file paths in the playlist have special characters. "
"These file paths will be encoded as absolute path URLs. "
"Please select the m3u8 format for better and lossless exporting."));
}
file.write(outputByteArray);
file.close();

Expand Down

0 comments on commit 214dbbc

Please sign in to comment.