The current behavior in plasma-workspace's mediacontroller is to get the
title and the album info from the URL contained in the MPRIS metadata,
if it is dealing with a local file and missing title and artist. This
commit aligns the behavior to the one mediacontroller has.
Details
- Reviewers
nicolasfella - Group Reviewers
KDE Connect - Commits
- R224:8aca11e102a9: Use URL as title and album in MPRIS plugin
Diff Detail
- Repository
- R224 KDE Connect
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
Thanks for the patch!
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.
plugins/mpriscontrol/mpriscontrolplugin.cpp | ||
---|---|---|
364 | You can convert it into a QUrl directly: | |
369 | For the title you can use fileUrl.fileName() |
Thanks for the review. I had two reasons in mind for restricting to file:///:
- it's what mediacontroller does
- plasma-browser-integration for example gives the URL of the page playing the media (so a http link)
Not restricting would mean having to select schemes that would be allowed to be parsed as title/album.
BTW, we are moving to gitlab so please submit your future patches at https://invent.kde.org/kde/kdeconnect-kde