]> gitweb.fluxo.info Git - awesompd.git/commitdiff
Stop looking for local album covers for external tracks and streams
authorAlexander Yakushev <yakushev.alex@gmail.com>
Sat, 3 Mar 2012 19:54:47 +0000 (21:54 +0200)
committerAlexander Yakushev <yakushev.alex@gmail.com>
Sat, 3 Mar 2012 19:54:47 +0000 (21:54 +0200)
awesompd.lua

index a9e38a6936d3958c0e4b96f807fab53b4de4b4df..faa1a97e022670786367ba5ef7a1f3dc8c6a2fb3 100644 (file)
@@ -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