From 9c08698b287439110d92c0cd9d5c1bf68d323208 Mon Sep 17 00:00:00 2001 From: Apeiros-46B Date: Fri, 15 Jul 2022 18:36:42 -0700 Subject: [PATCH] Use cache dir instead of /tmp --- signal/playerctl/playerctl_cli.lua | 3 ++- signal/playerctl/playerctl_lib.lua | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/signal/playerctl/playerctl_cli.lua b/signal/playerctl/playerctl_cli.lua index 96ada70..2b417c9 100644 --- a/signal/playerctl/playerctl_cli.lua +++ b/signal/playerctl/playerctl_cli.lua @@ -26,6 +26,7 @@ local gobject = require("gears.object") local gtable = require("gears.table") local gtimer = require("gears.timer") local gstring = require("gears.string") +local gfs = require("gears.filesystem") local beautiful = require("beautiful") local helpers = require(tostring(...):match(".*bling") .. ".helpers") local setmetatable = setmetatable @@ -184,7 +185,7 @@ local function emit_player_metadata(self) callback = function() if title and title ~= "" then if art_url ~= "" then - local art_path = "/tmp/bling_album_art/" .. art_url:gsub("https://", ""):gsub("http://", "") + local art_path = gfs.get_cache_dir() .. "bling_album_art/" .. art_url:gsub("https://", ""):gsub("http://", "") helpers.filesystem.save_image_async_curl(false, true, art_url, art_path, function() self:emit_signal("metadata", title, artist, art_path, album, player_name) capi.awesome.emit_signal("bling::playerctl::title_artist_album", title, artist, art_path) diff --git a/signal/playerctl/playerctl_lib.lua b/signal/playerctl/playerctl_lib.lua index 8c69abd..09acbba 100644 --- a/signal/playerctl/playerctl_lib.lua +++ b/signal/playerctl/playerctl_lib.lua @@ -37,6 +37,7 @@ local gobject = require("gears.object") local gtable = require("gears.table") local gtimer = require("gears.timer") local gstring = require("gears.string") +local gfs = require("gears.filesystem") local beautiful = require("beautiful") local helpers = require(tostring(...):match(".*bling") .. ".helpers") local setmetatable = setmetatable @@ -190,7 +191,7 @@ local function emit_metadata_signal(self, title, artist, artUrl, album, new, pla end if artUrl ~= "" then - local art_path = "/tmp/bling_album_art/" .. artUrl:gsub("https://", ""):gsub("http://", "") + local art_path = gfs.get_cache_dir() .. "bling_album_art/" .. artUrl:gsub("https://", ""):gsub("http://", "") helpers.filesystem.save_image_async_curl(false, true, artUrl, art_path, function() self:emit_signal("metadata", title, artist, art_path, album, new, player_name) capi.awesome.emit_signal("bling::playerctl::title_artist_album", title, artist, art_path, player_name)