From de72a92036e8f5b6f73c04ea3f85dfd0e4e0ca89 Mon Sep 17 00:00:00 2001 From: Alexander Yakushev Date: Sat, 3 Mar 2012 21:54:47 +0200 Subject: Stop looking for local album covers for external tracks and streams --- awesompd.lua | 11 +++++++++-- 1 file 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 -- cgit v1.2.3