QMediaPlaylist and UTF-8

388 views Asked by At

I have trouble loading *m3u-playlistfiles with UTF-8-encoding with QMediaPlaylist. The path of the first entry is not loaded correctly.

As you can see in the screenshot the path of the first entry starts with D:/D/Media/New folder/ , which is the path to the playlist, followed by , followed by the relative path to the mediafile as it iis saved in the *m3u-file.

With *m3u-files with ANSI-encoding I do not have those troubles.

Also characters like "ü" in this case (second entry) aren't encoded properly.

Is there anyway to fix that without coding my own playlist-parser?

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    QDirIterator it("D:/D/Media/New folder", QStringList() << "*.m3u", QDir::Files, QDirIterator::Subdirectories);
    while (it.hasNext())
    {
        it.next();
        QMediaPlaylist currentPlaylist;
        currentPlaylist.clear();
        currentPlaylist.load(QUrl::fromLocalFile(it.filePath()));
        currentPlaylist.setCurrentIndex(0);
        int x = 1;
        ui->textBrowser->append(it.fileName());
        ui->textBrowser->append("-----");
        while(currentPlaylist.mediaCount() > 0)
        {
            ui->textBrowser->append(QString::number(x) + QString(": ") + currentPlaylist.currentMedia().canonicalUrl().toString());
            x++;
            currentPlaylist.removeMedia(0);
        }
        ui->textBrowser->append("");
    }
}

enter image description here

*m3u-content

..\Musik\Mittelalter Party\Mittelalter Party Volume 1\Tanzwut - Meer.mp3
..\Musik\ASP\Humility\ASP - Küss mich (Chamber version).mp3
..\Musik\Disturbed\Ten Thousand Fists\Disturbed - Ten Thousand Fists.mp3
1

There are 1 answers

6
Stuart Fisher On BEST ANSWER

Wikipedia says that UTF-8 encoded playlists should have a .m3u8 extension. Have you tried changing the file extension to .m3u8?