aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Yakushev <yakushev.alex@gmail.com>2012-03-03 21:54:47 +0200
committerAlexander Yakushev <yakushev.alex@gmail.com>2012-03-03 21:54:47 +0200
commitde72a92036e8f5b6f73c04ea3f85dfd0e4e0ca89 (patch)
tree573365890cb021e41fcc88a891ff395abf9e709c
parentf755552fdb3d5a80ed41cbff307ebf8b79b262b3 (diff)
downloadawesompd-de72a92036e8f5b6f73c04ea3f85dfd0e4e0ca89.tar.gz
awesompd-de72a92036e8f5b6f73c04ea3f85dfd0e4e0ca89.tar.bz2
Stop looking for local album covers for external tracks and streams
-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