diff options
author | Alexander Yakushev <yakushev.alex@gmail.com> | 2010-11-04 17:29:21 +0200 |
---|---|---|
committer | Alexander Yakushev <yakushev.alex@gmail.com> | 2010-11-04 17:31:38 +0200 |
commit | 66fcaca495eae424bd0613ffad1264c3bb865826 (patch) | |
tree | 61d1b21d8882bf8ef8f3c0917b9b665e74dc6087 /awesompd.lua | |
parent | 81bf847c85fe5ace93f85fbeabc3e526dd5510ca (diff) | |
download | awesompd-66fcaca495eae424bd0613ffad1264c3bb865826.tar.gz awesompd-66fcaca495eae424bd0613ffad1264c3bb865826.tar.bz2 |
Playlist add\replace
Diffstat (limited to 'awesompd.lua')
-rw-r--r-- | awesompd.lua | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/awesompd.lua b/awesompd.lua index 1746077..6481dc9 100644 --- a/awesompd.lua +++ b/awesompd.lua @@ -216,6 +216,14 @@ function awesompd:command_load_playlist(name) end end +function awesompd:command_replace_playlist(name) + return function() + self:command("clear") + self:command("load " .. name) + self:command("play 1", self.update_track) + end +end + function awesompd:command_echo_prompt() return function() self:run_prompt("Sample text: ",function(s) @@ -305,8 +313,10 @@ function awesompd:get_playlists_menu() local new_menu = {} if table.getn(self.playlists_array) > 0 then for i = 1, table.getn(self.playlists_array) do - new_menu[i] = { self.playlists_array[i], - self:command_load_playlist(self.playlists_array[i]) } + local submenu = {} + submenu[1] = { "Add to current", self:command_load_playlist(self.playlists_array[i]) } + submenu[2] = { "Replace current", self:command_replace_playlist(self.playlists_array[i]) } + new_menu[i] = { self.playlists_array[i], submenu } end table.insert(new_menu, {"", ""}) -- This is a separator end |