Cache album art for playerctl module#179
Cache album art for playerctl module#179Apeiros-46B wants to merge 4 commits intoBlingCorp:masterfrom
Conversation
|
Another thing I wanted to point out: on some systems the |
|
Consider that some clients cache there own artwork and generate a temporary filename, with this implementation every time you play a youtube video (even if its the same video!) for example from firefox a new file is created, which, with this solution, will never be deleted. I think a task to clean old files is outside of the scope, but this new behavior should be considered with this change Edit: Since those files are local (they begin with a file:// uri) maybe they could be filtered and set directly cause there is no need to run curl for them anyways. (And according to freedesktop spec this should be always the case - "URIs should be sent as (UTF-8) strings. Local files should use the "file://" schema.") Example metadata from firefox: {
["mpris:artUrl"] = "file:///home/nawuko/.mozilla/firefox/firefox-mpris/4688_6.png",
["xesam:album"] = "",
["xesam:artist"] = { "Practical Engineering" },
["xesam:title"] = "What Happens When a Reservoir Goes Dry?"
} |
|
Don't know much about the playerctl module. @Kasper24 is the contact person for that. Nawuko seems to have valid concerns too |
|
Would checking if the art url starts with |
|
@JavaCafe01 The issue with storing it in cache is it won't get deleted, that's why I saved it to tmp instead. It also uses a blocking function to query if the file exists or not, so that would need to be converted to async. |
Summary
This PR
os.tmpname()with a URL-based path in the playerctl module and prevents album art from being downloaded multiple times, andhttps://andhttp://are first removed from the URL, then/tmp/bling_album_art .. trimmed_urlis used as the pathsave_image_async_curlfunction inhelpers/filesystem.lua(required for 1.):redownload: if this isfalseand the file already exists,curlisn't calledcreate_dirs: if this istruethe--create-dirsflag is added to thecurlcallThis means that
Notes
Haven't tested if this works when passing some other values for
redownloadandcreate_dirsto the save image function, but it theoretically should still work just fine