diff options
author | Alexander Yakushev <yakushev.alex@gmail.com> | 2011-07-30 14:44:15 +0300 |
---|---|---|
committer | Alexander Yakushev <yakushev.alex@gmail.com> | 2011-07-30 14:44:43 +0300 |
commit | a2505707458e7a8af53d9a2e55e1dfac61f6b401 (patch) | |
tree | 94a01b40e6907bf72a8a66e17da440bafdff12e5 | |
parent | 249f3d20563f3a4a22c9a91214136585f9e390b8 (diff) | |
download | awesompd-a2505707458e7a8af53d9a2e55e1dfac61f6b401.tar.gz awesompd-a2505707458e7a8af53d9a2e55e1dfac61f6b401.tar.bz2 |
Minor bugfixes
-rw-r--r-- | awesompd.lua | 2 | ||||
-rw-r--r-- | jamendo.lua | 13 |
2 files changed, 13 insertions, 2 deletions
diff --git a/awesompd.lua b/awesompd.lua index 3b11ad7..4e76258 100644 --- a/awesompd.lua +++ b/awesompd.lua @@ -367,7 +367,7 @@ function awesompd:get_playback_menu() self:command_toggle(), self.ICONS.PLAY_PAUSE }) if self.connected and self.status ~= "Stopped" then - if self.current_number ~= 1 then + if self.list_array[self.current_number-1] then table.insert(new_menu, { "Prev: " .. awesompd.protect_string(jamendo.replace_link( diff --git a/jamendo.lua b/jamendo.lua index d907f26..f805f2f 100644 --- a/jamendo.lua +++ b/jamendo.lua @@ -330,10 +330,12 @@ retrieve_cache() function get_album_cover(track_id) local track = jamendo_list[track_id] local album_id = track.album_id + if album_id == 0 then -- No cover for tracks without album! return nil end local file_path = album_covers_folder .. album_id .. ".jpg" + if not file_exists(file_path) then -- We need to download it -- First check if cache directory exists f = io.popen('test -d ' .. album_covers_folder .. ' && echo t') @@ -341,7 +343,16 @@ function get_album_cover(track_id) awful.util.spawn("mkdir " .. album_covers_folder) end f:close() - + + if not track.album_image then -- Wow! We have album_id, but + local a_id = tostring(album_id) --don't have album_image. Well, + local prefix = --it happens. + string.sub(a_id, 1, string.len(a_id) - 3) + track.album_image = + string.format("http://imgjam.com/albums/s%s/%s/covers/1.100.jpg", + prefix, a_id) + end + f = io.popen("wget " .. track.album_image .. " -O " .. file_path .. " > /dev/null") f:close() |