flathub / org.strawberrymusicplayer.strawberry

https://flathub.org/apps/details/org.strawberrymusicplayer.strawberry
1 stars 4 forks source link

mpris:artUrl=/tmp/strawberry-cover-XXXXXX.jpg is not created #31

Closed Zren closed 1 year ago

Zren commented 2 years ago

https://www.reddit.com/r/kde/comments/x93cro/how_can_i_make_strawberry_player_show_the_songs/inoff58/?context=3

When strawberry is running, you should be able to get the thumbnail exposed to mpris with:

❯ qdbus org.mpris.MediaPlayer2.strawberry /org/mpris/MediaPlayer2 Metadata
mpris:artUrl: file:///tmp/strawberry-cover-fdnDwu.jpg

The user was not able to find the thumbnail file in /tmp/.

Notes: Strawberry seems to be using QDir::tempPath() for the temp dir.

Lunarequest commented 2 years ago

would you mind checking if this issue is still present?

jonaski commented 2 years ago

I don't think this will work with flatpak. For local songs which has local accessible album cover art, strawberry uses that URL directly in mpris:artUrl. But for embedded covers and streams, strawberry uses the temporary saved cover in /tmp. The /tmp location used by Strawberry in flatpak is not accessible to the outside system (https://docs.flatpak.org/en/latest/sandbox-permissions.html). I suggest to patch https://github.com/strawberrymusicplayer/strawberry/blob/master/src/covermanager/currentalbumcoverloader.cpp#L42 to use QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) instead. This is the only place strawberry uses /tmp, most other code uses QStandardPaths::writableLocation(QStandardPaths::CacheLocation) on unix, and QStandardPaths::writableLocation(QStandardPaths::TempLocation) on other systems to avoid using /tmp. And i'm not a fan of using /tmp at all, the only reason it's used here is because, if strawberry is forcefully shutdown or crashing, it's more likely /tmp is on a ramdisk on modern system and it will be cleared on boot, if they were in the cache location (~/.cache/strawberry/strawberry/), it might fill up with temporary covers over time.