Bug 397736

Summary: Support pls playlists
Product: [Applications] Elisa Reporter: Michael D <nortexoid>
Component: generalAssignee: Matthieu Gallien <matthieu_gallien>
Status: RESOLVED FIXED    
Severity: wishlist CC: christian.rohmann, hutson, nathan, nmariusp1
Priority: NOR    
Version: 0.2.1   
Target Milestone: ---   
Platform: Manjaro   
OS: Linux   
Latest Commit: Version Fixed In: 23.04

Description Michael D 2018-08-22 09:04:10 UTC
It would be great if Elisa supported the popular pls playlist format.
Comment 1 Matthieu Gallien 2019-05-03 15:25:42 UTC
Thanks for the report.

I was not sure what to do with this.

I am collecting a lot of new features and plan to add them as junior jobs open for new contributors. This one will be a part of that.
Comment 2 Hutson 2020-05-30 07:19:03 UTC
Ran into the same issue when attempting to play `http://somafm.com/groovesalad130.pls`.

```
$ elisa --version
elisa 19.12.3

$ elisa
<Unknown File>: QML QQuickLayoutAttached: Binding loop detected for property "preferredHeight"
org.kde.elisa.indexers.manager: Local file system indexer is inactive
org.kde.elisa.indexers.manager: Baloo indexer is unavailable
org.kde.elisa.indexers.manager: Baloo indexer is inactive
MediaPlayList::setPersistentState QMap(("currentTrack", QVariant(int, 8))("playList", QVariant(QVariantList, (QVariant(QStringList, ("0", "", "", "Tron", "1", "", "6")), QVariant(QStringList, ("0", "", "", "Tron", "2", "", "6")), QVariant(QStringList, ("0", "", "", "Tron", "3", "", "6")), QVariant(QStringList, ("0", "", "", "Tron", "5", "", "6")), QVariant(QStringList, ("0", "", "", "Tron", "6", "", "6")), QVariant(QStringList, ("0", "", "", "Tron", "7", "", "6")), QVariant(QStringList, ("0", "", "", "Tron", "8", "", "6")), QVariant(QStringList, ("0", "", "", "Tron", "9", "", "6")), QVariant(QStringList, ("0", "", "", "Tron", "10", "", "6")), QVariant(QStringList, ("0", "", "", "Tron", "11", "", "6")), QVariant(QStringList, ("0", "", "", "Tron", "12", "", "6")), QVariant(QStringList, ("0", "", "", "Tron", "13", "", "6")), QVariant(QStringList, ("0", "", "", "Tron", "14", "", "6")), QVariant(QStringList, ("0", "", "", "Tron", "15", "", "6")), QVariant(QStringList, ("0", "", "", "Tron", "16", "", "6")), QVariant(QStringList, ("0", "", "", "Tron", "17", "", "6")), QVariant(QStringList, ("0", "", "", "Tron", "18", "", "6")), QVariant(QStringList, ("0", "", "", "Tron", "19", "", "6")), QVariant(QStringList, ("0", "", "", "Tron", "20", "", "6")), QVariant(QStringList, ("0", "", "", "Tron", "21", "", "6")), QVariant(QStringList, ("0", "", "", "Tron", "22", "", "6")))))("randomPlay", QVariant(bool, false))("repeatPlay", QVariant(bool, false)))
org.kde.elisa.indexers.manager: Baloo indexer is available
org.kde.elisa.indexers.manager: Baloo indexer is active
org.kde.elisa.indexers.manager: trigger init of baloo file indexer
qrc:/qml/HeaderBar.qml:94:9: QML Image: Failed to get image from provider: image://icon/error
qrc:/qml/HeaderBar.qml:60:9: QML Image: Failed to get image from provider: image://icon/error
QGridLayoutEngine::addItem: Cell (0, 0) already taken
QGridLayoutEngine::addItem: Cell (0, 1) already taken
QGridLayoutEngine::addItem: Cell (0, 2) already taken
QGridLayoutEngine::addItem: Cell (0, 0) already taken
QGridLayoutEngine::addItem: Cell (0, 1) already taken
QGridLayoutEngine::addItem: Cell (0, 3) already taken
PowerManagementInterface::inhibitDBusCallFinishedGnomeWorkspace QDBusError("org.freedesktop.DBus.Error.ServiceUnknown", "The name org.gnome.SessionManager was not provided by any .service files")
PowerManagementInterface::uninhibitDBusCallFinished QDBusError("org.freedesktop.DBus.Error.ServiceUnknown", "The name org.gnome.SessionManager was not provided by any .service files")
```

At the point I attempted to play the `pls` stream I saw the `PowerManagementInterface::inhibitDBusCallFinishedGnomeWorkspace` console output.

Same behavior when running version 20.04.1 from Flathub.
Comment 3 Christian Rohmann 2020-11-12 10:42:06 UTC
This would really be a great addition as there is no feedback shown to the user and most users would have a hard time finding the real URL or extracting it out of the pls file -- in addition this does not allow larger streaming radios to provide multiple, redundant endpoints.
Comment 4 nathan 2022-02-21 03:12:54 UTC
*** Bug 450625 has been marked as a duplicate of this bug. ***
Comment 5 Marius P 2022-11-25 22:55:28 UTC
Start with a git commit like "    ElisaMainWindow.qml playlist file dialog add "pls" filter

------------------------- src/qml/ElisaMainWindow.qml -------------------------
index 94c19e6d..d42a3317 100644
@@ -153,7 +153,7 @@ Kirigami.ApplicationWindow {
 
         defaultSuffix: 'm3u8'
         folder: StandardPaths.writableLocation(StandardPaths.MusicLocation)
-        nameFilters: [i18nc("@option file type (mime type) for m3u and m3u8 playlist file formats; do not translate *.m3u*", "Playlist (*.m3u*)")]
+        nameFilters: [i18nc("@option file type (mime type) for m3u and m3u8 playlist file formats; do not translate *.m3u*", "m3u Playlist (*.m3u*)"), i18nc("@option file type (mime type) for pls playlist file formats; do not translate *.pls", "pls Playlist (*.pls)")]
 
         onAccepted:
         {
"
Comment 6 Marius P 2022-11-25 23:00:29 UTC
Continue by extracting as a class the part "    auto newTracks = DataTypes::EntryDataList{};
    for (const auto &l : data.split('\n')) {
        const auto &line = QString::fromUtf8(l);
        const auto &url = line.startsWith(QStringLiteral("file:/")) ? QUrl(line) : QUrl::fromLocalFile(line);
        newTracks.push_back({{{{DataTypes::ElementTypeRole, ElisaUtils::FileName},
            {DataTypes::ResourceRole, url}}}, {}, {}});
    }".

Name the class something like FromFileToTracksComputer. Entry point method signature in pseudocode: "list of DataTypes::EntryDataList FromFileToTracks(const QString &filePath, const QString &fileBody);".
Fix support for *.m3u in this class, e.g. "https://raw.githubusercontent.com/iptv-org/iptv/master/streams/af.m3u does not show entry title correctly".
Add support for *.pls in this class.
Comment 7 Marius P 2022-11-27 11:59:32 UTC
I started implementing this feature https://invent.kde.org/multimedia/elisa/-/merge_requests/401
Comment 8 Nate Graham 2022-12-20 18:19:48 UTC
Git commit 0a4901a87c7161a0c4ba342d1a71212325f2e13c by Nate Graham, on behalf of Marius Pa.
Committed on 20/12/2022 at 18:19.
Pushed by ngraham into branch 'master'.

Implement support for *.pls playlist files
FIXED-IN: 23.04

M  +63   -0    autotests/mediaplaylistproxymodeltest.cpp
M  +10   -0    autotests/mediaplaylistproxymodeltest.h
M  +127  -12   src/mediaplaylistproxymodel.cpp
M  +21   -0    src/mediaplaylistproxymodel.h
M  +3    -2    src/qml/ElisaMainWindow.qml

https://invent.kde.org/multimedia/elisa/commit/0a4901a87c7161a0c4ba342d1a71212325f2e13c