aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2013-03-01 10:50:19 -0300
committerAlexander Yakushev <alex@bytopia.org>2013-03-01 16:20:56 +0200
commit4142a7aa82e938afc7e948c3744ba2b0e520e495 (patch)
tree1e09d37ffb19be1f84dbc860c8f19b118f85ef0e
parenta4b0eb83399093eb45651416c3f96276b6cb6c97 (diff)
downloadawesompd-4142a7aa82e938afc7e948c3744ba2b0e520e495.tar.gz
awesompd-4142a7aa82e938afc7e948c3744ba2b0e520e495.tar.bz2
Adding command_previous_server() and command_next_server()HEADmaster
-rw-r--r--awesompd.lua32
1 files changed, 32 insertions, 0 deletions
diff --git a/awesompd.lua b/awesompd.lua
index faf1253..362b6d8 100644
--- a/awesompd.lua
+++ b/awesompd.lua
@@ -386,6 +386,38 @@ function awesompd:command_open_in_browser(link)
end
end
+--- Change to the previous server.
+function awesompd:command_previous_server()
+ return function()
+ servers = table.getn(self.servers)
+ if servers == 1 or servers == nil then
+ return
+ else
+ if self.current_server > 1 then
+ self:change_server(self.current_server - 1)
+ else
+ self:change_server(servers)
+ end
+ end
+ end
+end
+
+--- Change to the previous server.
+function awesompd:command_next_server()
+ return function()
+ servers = table.getn(self.servers)
+ if servers == 1 or servers == nil then
+ return
+ else
+ if self.current_server < servers then
+ self:change_server(self.current_server + 1)
+ else
+ self:change_server(1)
+ end
+ end
+ end
+end
+
-- /// End of mpc command functions ///
-- /// Menu generation functions ///