Skip to content

Commit

Permalink
Upd: Adapt new image cache api
Browse files Browse the repository at this point in the history
  • Loading branch information
jcorporation committed Jan 5, 2025
1 parent 015e88d commit 595b474
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Albumart/Albumart.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-- {"name": "Albumart", "file": "Albumart/Albumart.lua", "version": 1, "desc": "Fetches albumart on demand.", "order": 0, "arguments": ["uri"]}
-- {"name": "Albumart", "file": "Albumart/Albumart.lua", "version": 2, "desc": "Fetches albumart on demand.", "order": 0, "arguments": ["uri"]}
local providers = require "scripts/AlbumartProviders"

-- Get the song details
Expand All @@ -25,7 +25,7 @@ end

-- Cache the fetched albumart and send it to the client
local filename
rc, filename = mympd.cache_cover_write(out, mympd_arguments.uri)
rc, filename = mympd.cache_cover_write(out, mympd_arguments.uri, nil)
if rc == 0 then
return mympd.http_serve_file(filename)
end
Expand Down
2 changes: 1 addition & 1 deletion Covercache/CovercachePrepopulate.lua
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ for _, album in pairs(result.data) do
create_placeholder(path .. ".svg")
elseif rc == 0 then
local name
rc, name = mympd.cache_cover_write(out, album.uri)
rc, name = mympd.cache_cover_write(out, album.uri, mympd.http_header_get(headers, "Content-Type"))
if rc == 0 then
mympd.log(6, "Covercache: " .. name)
downloaded = downloaded + 1
Expand Down
4 changes: 2 additions & 2 deletions Tagart/Tagart.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-- {"name": "Tagart", "file": "Tagart/Tagart.lua", "version": 1, "desc": "Fetches tagart on demand.", "order":0, "arguments":["tag", "value"]}
-- {"name": "Tagart", "file": "Tagart/Tagart.lua", "version": 2, "desc": "Fetches tagart on demand.", "order":0, "arguments":["tag", "value"]}
local providers = require "scripts/TagartProviders"

local tag = mympd_arguments.tag
Expand All @@ -22,7 +22,7 @@ end

-- Cache the fetched tagart and send it to the client
local filename
rc, filename = mympd.cache_thumbs_write(out, value)
rc, filename = mympd.cache_thumbs_write(out, value, nil)
if rc == 0 then
return mympd.http_serve_file(filename)
end
Expand Down
6 changes: 3 additions & 3 deletions yt-dlp/yt-dlp.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-- {"name": "yt-dlp", "file": "yt-dlp/yt-dlp.lua", "version": 2, "desc": "Stream music from YouTube and other services with the help of yt-dlp.", "order":0, "arguments":["uri"]}
-- {"name": "yt-dlp", "file": "yt-dlp/yt-dlp.lua", "version": 3, "desc": "Stream music from YouTube and other services with the help of yt-dlp.", "order":0, "arguments":["uri"]}

-- yt-dlp helper functions
local yt_dlp_path = "yt-dlp"
Expand Down Expand Up @@ -183,7 +183,7 @@ else
mympd.log(6, "Downloading " .. thumb .. " to " ..tmp_file)
local rc, code, headers = mympd.http_download(thumb, "", tmp_file)
if rc == 0 then
rc = mympd.cache_cover_write(tmp_file, uri)
rc = mympd.cache_cover_write(tmp_file, uri, nil)
if rc == 1 then
mympd.notify_client(2, "Failed to rename thumbnail!")
end
Expand All @@ -194,7 +194,7 @@ else
end
else
-- if yt-dlp downloaded the thumbnail, rename it from id to hash
local rc = mympd.cache_cover_write(thumb, uri)
local rc = mympd.cache_cover_write(thumb, uri, nil)
if rc == 1 then
mympd.notify_client(2, "Failed to rename thumbnail!")
end
Expand Down

0 comments on commit 595b474

Please sign in to comment.