D26097: Use URL as title and album in MPRIS plugin

Nicolas Fella noreply at phabricator.kde.org
Thu Dec 19 15:19:55 GMT 2019


nicolasfella requested changes to this revision.
nicolasfella added a comment.
This revision now requires changes to proceed.


  Thanks for the path!
  
  There is a minor problem with this approach.
  
  You are checking if the URL starts with "file:///" and then do QUrl::fromLocalFile on it. The docs say that fromLocalFile expects the input to have no scheme (see https://doc.qt.io/qt-5/qurl.html#fromLocalFile). Is there a particular reason to restrict it to file:// URLs? I can imagine that doing the same for e.g. sftp:// urls could be useful as well.

INLINE COMMENTS

> mpriscontrolplugin.cpp:364
>      QString albumArtUrl = nowPlayingMap[QStringLiteral("mpris:artUrl")].toString();
> +    QString fileUrl = nowPlayingMap[QStringLiteral("xesam:url")].toString();
> +

You can convert it into a QUrl directly:
QUrl fileUrl = nowPlayingMap[QStringLiteral("xesam:url")].toUrl();

> mpriscontrolplugin.cpp:369
> +        QStringList splitUrl = file.path().split(QDir::separator());
> +        title = splitUrl.takeLast();
> +

For the title you can use fileUrl.fileName()

REPOSITORY
  R224 KDE Connect

REVISION DETAIL
  https://phabricator.kde.org/D26097

To: ashka, #kde_connect, nicolasfella
Cc: nicolasfella, kdeconnect, ankit, aliencode, ritwizsinha, ewentzel, dshelley, pawelkwiecinski, ctakano, vporvaznik, mschroeder, varunp, shivanshukantprasad, skymoore, fbampaloukas, brute4s99, wistak, anoopv, dvalencia, rmenezes, julioc, Leptopoda, timothyc, Danial0_0, johnq, Pitel, domson, adeen-s, SemperPeritus, daniel.z.tg, jeanv, seebauer, bugzy, MayeulC, lemuel, menasshock, mikesomov, tctara, apol
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdeconnect/attachments/20191219/aa6e04ad/attachment.html>


More information about the KDEConnect mailing list