From 595b4742822ee5162deb9639301eb0908da5baff Mon Sep 17 00:00:00 2001 From: jcorporation Date: Sun, 5 Jan 2025 16:45:32 +0100 Subject: [PATCH] Upd: Adapt new image cache api --- Albumart/Albumart.lua | 4 ++-- Covercache/CovercachePrepopulate.lua | 2 +- Tagart/Tagart.lua | 4 ++-- yt-dlp/yt-dlp.lua | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Albumart/Albumart.lua b/Albumart/Albumart.lua index 79b4a13..619d383 100644 --- a/Albumart/Albumart.lua +++ b/Albumart/Albumart.lua @@ -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 @@ -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 diff --git a/Covercache/CovercachePrepopulate.lua b/Covercache/CovercachePrepopulate.lua index 2bc3600..ff28577 100644 --- a/Covercache/CovercachePrepopulate.lua +++ b/Covercache/CovercachePrepopulate.lua @@ -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 diff --git a/Tagart/Tagart.lua b/Tagart/Tagart.lua index a85cb68..7dcf7b3 100644 --- a/Tagart/Tagart.lua +++ b/Tagart/Tagart.lua @@ -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 @@ -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 diff --git a/yt-dlp/yt-dlp.lua b/yt-dlp/yt-dlp.lua index 53ef0d1..387db06 100644 --- a/yt-dlp/yt-dlp.lua +++ b/yt-dlp/yt-dlp.lua @@ -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" @@ -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 @@ -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