summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2014-10-29 22:38:15 +0100
committerJo-Philipp Wich <jow@openwrt.org>2014-10-29 22:38:15 +0100
commit517ba7dadb1a05aa1f0b0950d64b87270cddbbba (patch)
treef9ca8802b26cc84d680ad7eac91512d838b244eb
parent98a878691d2fa5ab9582944499da75e0292e5260 (diff)
parenta33be327312ee5fd0981be65001074e72a7f3d81 (diff)
Merge pull request #236 from openwrt-es/luci-next
applications/luci-shairplay: add new package.
-rw-r--r--applications/luci-shairplay/Makefile4
-rw-r--r--applications/luci-shairplay/luasrc/controller/shairplay.lua25
-rw-r--r--applications/luci-shairplay/luasrc/model/cbi/shairplay.lua75
-rw-r--r--applications/luci-shairplay/root/etc/uci-defaults/luci-shairplay12
-rw-r--r--contrib/package/luci-addons/Makefile1
5 files changed, 117 insertions, 0 deletions
diff --git a/applications/luci-shairplay/Makefile b/applications/luci-shairplay/Makefile
new file mode 100644
index 000000000..b6c2db4a5
--- /dev/null
+++ b/applications/luci-shairplay/Makefile
@@ -0,0 +1,4 @@
+PO = shairplay
+
+include ../../build/config.mk
+include ../../build/module.mk
diff --git a/applications/luci-shairplay/luasrc/controller/shairplay.lua b/applications/luci-shairplay/luasrc/controller/shairplay.lua
new file mode 100644
index 000000000..3a2c2ea1b
--- /dev/null
+++ b/applications/luci-shairplay/luasrc/controller/shairplay.lua
@@ -0,0 +1,25 @@
+--[[
+LuCI - Lua Configuration Interface - Shairplay support
+
+Copyright 2014 Álvaro Fernández Rojas <noltari@gmail.com>
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+$Id$
+]]--
+
+module("luci.controller.shairplay", package.seeall)
+
+function index()
+ if not nixio.fs.access("/etc/config/shairplay") then
+ return
+ end
+
+ local page = entry({"admin", "services", "shairplay"}, cbi("shairplay"), _("Shairplay"))
+ page.dependent = true
+
+end
diff --git a/applications/luci-shairplay/luasrc/model/cbi/shairplay.lua b/applications/luci-shairplay/luasrc/model/cbi/shairplay.lua
new file mode 100644
index 000000000..553917454
--- /dev/null
+++ b/applications/luci-shairplay/luasrc/model/cbi/shairplay.lua
@@ -0,0 +1,75 @@
+--[[
+LuCI - Lua Configuration Interface - Shairplay support
+
+Copyright 2014 Álvaro Fernández Rojas <noltari@gmail.com>
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+$Id$
+]]--
+
+m = Map("shairplay", "Shairplay", translate("Shairplay is a simple AirPlay server implementation, here you can configure the settings."))
+
+s = m:section(TypedSection, "shairplay", "")
+s.addremove = true
+s.anonymous = false
+
+enable=s:option(Flag, "disabled", translate("Enabled"))
+enable.enabled="0"
+enable.disabled="1"
+enable.default = "1"
+respawn=s:option(Flag, "respawn", translate("Respawn"))
+respawn.default = false
+
+apname = s:option(Value, "apname", translate("Airport Name"))
+apname.rmempty = true
+
+port=s:option(Value, "port", translate("Port"))
+port.rmempty = true
+port.datatype = "port"
+
+pw = s:option(Value, "password", translate("Password"))
+pw.rmempty = true
+pw.password = true
+
+hwaddr=s:option(Value, "hwaddr", translate("HW Address"))
+hwaddr.rmempty = true
+hwaddr.datatype = "macaddr"
+
+ao_driver=s:option(ListValue, "ao_driver", translate("AO Driver"))
+ao_driver:value("", translate("Default"))
+ao_driver:value("alsa")
+--ao_driver:value("alsa05")
+--ao_driver:value("arts")
+--ao_driver:value("esd")
+--ao_driver:value("irix")
+--ao_driver:value("nas")
+ao_driver:value("oss")
+--ao_driver:value("sun")
+
+ao_devicename=s:option(Value, "ao_devicename", translate("AO Device Name"))
+ao_devicename.rmempty = true
+
+ao_deviceid = s:option(ListValue, "ao_deviceid", translate("AO Device ID"))
+ao_deviceid.rmempty = true
+ao_deviceid:value("", translate("Default"))
+local pats = io.popen("find /proc/asound/ -type d -name 'card*' | sort")
+if pats then
+ local l
+ while true do
+ l = pats:read("*l")
+ if not l then break end
+
+ l = string.gsub(l, "/proc/asound/card", "")
+ if l then
+ ao_deviceid:value(l)
+ end
+ end
+ pats:close()
+end
+
+return m
diff --git a/applications/luci-shairplay/root/etc/uci-defaults/luci-shairplay b/applications/luci-shairplay/root/etc/uci-defaults/luci-shairplay
new file mode 100644
index 000000000..efc8a89bb
--- /dev/null
+++ b/applications/luci-shairplay/root/etc/uci-defaults/luci-shairplay
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+# needed for "Save and Apply" to restart shairplay
+uci -q batch <<-EOF >/dev/null
+ delete ucitrack.@shairplay[-1]
+ add ucitrack shairplay
+ set ucitrack.@shairplay[-1].init="shairplay"
+ commit ucitrack
+EOF
+
+rm -f /tmp/luci-indexcache
+exit 0
diff --git a/contrib/package/luci-addons/Makefile b/contrib/package/luci-addons/Makefile
index a08ac9db9..a3e293582 100644
--- a/contrib/package/luci-addons/Makefile
+++ b/contrib/package/luci-addons/Makefile
@@ -212,6 +212,7 @@ $(eval $(call application,pbx,LuCI PBX Administration,\
$(eval $(call application,pbx-voicemail,LuCI PBX Administration Voicemail Support,luci-app-pbx asterisk18 msmtp coreutils-base64))
$(eval $(call application,ltqtapi,Lantiq voip))
$(eval $(call application,minidlna,LuCI Support for miniDLNA,minidlna))
+$(eval $(call application,shairplay,LuCI Support for Shairplay,shairplay))
$(eval $(call application,transmission,LuCI Support for Transmission,transmission-daemon))
$(eval $(call application,watchcat,LuCI Support for Watchcat,watchcat))