aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Yakushev <yakushev.alex@gmail.com>2011-10-15 16:03:34 +0300
committerAlexander Yakushev <yakushev.alex@gmail.com>2011-10-15 16:03:34 +0300
commit0b423181c3271e48d6a898e67bb5bca5c8a4dee1 (patch)
treeab936d6887561d1c17d671533b2c4cebec2ceef6
parentd7687d3d406088dcbfee97ed8c4ee18fc2945f5c (diff)
downloadawesompd-0b423181c3271e48d6a898e67bb5bca5c8a4dee1.tar.gz
awesompd-0b423181c3271e48d6a898e67bb5bca5c8a4dee1.tar.bz2
Fix problem with music folder specified using ~
Function try_get_cover failed when the music folder specified in MPD config file used ~ instead of specifying the full path.
-rw-r--r--awesompd.lua8
1 files changed, 7 insertions, 1 deletions
diff --git a/awesompd.lua b/awesompd.lua
index 2887bff..8db3cb5 100644
--- a/awesompd.lua
+++ b/awesompd.lua
@@ -958,7 +958,6 @@ end
-- folders. If there is no cover art either returns the default album
-- cover.
function awesompd:get_cover(track)
- dbg(self.ICONS.DEFAULT_ALBUM_COVER)
return jamendo.try_get_cover(track) or
self:try_get_local_cover() or self.ICONS.DEFAULT_ALBUM_COVER
end
@@ -973,6 +972,13 @@ function awesompd:try_get_local_cover()
self.pread('cat ' .. self.mpd_config .. ' | grep -v "#" | grep music_directory', "*line"),
'music_directory%s+"(.+)"')
music_folder = music_folder .. "/"
+
+ -- If the music_folder is specified with ~ at the beginning,
+ -- replace it with user home directory
+ if string.sub(music_folder, 1, 1) == "~" then
+ local user_folder = self.pread("echo ~", "*line")
+ music_folder = user_folder .. string.sub(music_folder, 2)
+ end
-- Get the path to the file currently playing.
local _, _, current_file_folder =