-
Notifications
You must be signed in to change notification settings - Fork 49
Cache album art for playerctl module #179
base: master
Are you sure you want to change the base?
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_url
is used as the pathsave_image_async_curl
function inhelpers/filesystem.lua
(required for 1.):redownload
: if this isfalse
and the file already exists,curl
isn't calledcreate_dirs
: if this istrue
the--create-dirs
flag is added to thecurl
callThis means that
Notes
Haven't tested if this works when passing some other values for
redownload
andcreate_dirs
to the save image function, but it theoretically should still work just fine