aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--awesompd.lua11
1 files changed, 9 insertions, 2 deletions
diff --git a/awesompd.lua b/awesompd.lua
index a9e38a6..faa1a97 100644
--- a/awesompd.lua
+++ b/awesompd.lua
@@ -300,6 +300,7 @@ end
-- Takes a command to mpc and read mode and returns the result.
function awesompd:command_read(com, mode)
+ mode = mode or "*line"
self:command(com, function(_, f)
result = f:read(mode)
end)
@@ -1089,8 +1090,14 @@ function awesompd:try_get_local_cover()
end
-- Get the path to the file currently playing.
- local _, _, current_file_folder =
- string.find(self:command_read('current -f "%file%"', "*line"), '(.+%/).*')
+ local current_file = self:command_read('current -f "%file%"')
+ local _, _, current_file_folder = string.find(current_file, '(.+%/).*')
+
+ -- Check if the current file is not some kind of http stream or
+ -- Spotify track (like spotify:track:5r65GeuIoebfJB5sLcuPoC)
+ if not current_file_folder or string.match(current_file, "%w+://") then
+ return -- Let the default image to be the cover
+ end
local folder = music_folder .. current_file_folder