summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-shairport
diff options
context:
space:
mode:
authorÁlvaro Fernández Rojas <noltari@gmail.com>2014-10-30 12:34:25 +0100
committerÁlvaro Fernández Rojas <noltari@gmail.com>2014-10-30 12:34:25 +0100
commit8414e7142259519ea006bf4081288bc742ed8131 (patch)
tree884ca726c34d9a463a23d4085efc9325b5807753 /applications/luci-shairport
parent5189dda49f8764898e3f9289b73d8b347d2fe1e7 (diff)
applications/luci-shairport: add new package.
This adds support for configuring shairport. Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
Diffstat (limited to 'applications/luci-shairport')
-rw-r--r--applications/luci-shairport/Makefile4
-rw-r--r--applications/luci-shairport/luasrc/controller/shairport.lua25
-rw-r--r--applications/luci-shairport/luasrc/model/cbi/shairport.lua171
-rw-r--r--applications/luci-shairport/root/etc/uci-defaults/luci-shairport12
4 files changed, 212 insertions, 0 deletions
diff --git a/applications/luci-shairport/Makefile b/applications/luci-shairport/Makefile
new file mode 100644
index 0000000000..4c827554c4
--- /dev/null
+++ b/applications/luci-shairport/Makefile
@@ -0,0 +1,4 @@
+PO = shairport
+
+include ../../build/config.mk
+include ../../build/module.mk
diff --git a/applications/luci-shairport/luasrc/controller/shairport.lua b/applications/luci-shairport/luasrc/controller/shairport.lua
new file mode 100644
index 0000000000..d201eca542
--- /dev/null
+++ b/applications/luci-shairport/luasrc/controller/shairport.lua
@@ -0,0 +1,25 @@
+--[[
+LuCI - Lua Configuration Interface - Shairport 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.shairport", package.seeall)
+
+function index()
+ if not nixio.fs.access("/etc/config/shairport") then
+ return
+ end
+
+ local page = entry({"admin", "services", "shairport"}, cbi("shairport"), _("Shairport"))
+ page.dependent = true
+
+end
diff --git a/applications/luci-shairport/luasrc/model/cbi/shairport.lua b/applications/luci-shairport/luasrc/model/cbi/shairport.lua
new file mode 100644
index 0000000000..eb0772572b
--- /dev/null
+++ b/applications/luci-shairport/luasrc/model/cbi/shairport.lua
@@ -0,0 +1,171 @@
+--[[
+LuCI - Lua Configuration Interface - Shairport 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("shairport", "Shairport", translate("Shairport is a simple AirPlay server implementation, here you can configure the settings."))
+
+s = m:section(TypedSection, "shairport", "")
+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
+
+bname = s:option(Value, "bname", translate("Airport Name"))
+bname.rmempty = true
+
+pw = s:option(Value, "password", translate("Password"))
+pw.rmempty = true
+pw.password = true
+
+port=s:option(Value, "port", translate("Port"))
+port.rmempty = true
+port.datatype = "port"
+
+buffer=s:option(Value, "buffer", translate("Buffer fill"))
+buffer.rmempty = true
+buffer.datatype = "uinteger"
+
+log_file=s:option(Value, "log_file", translate("Log file"))
+log_file.rmempty = true
+--log_file.datatype = "file"
+
+err_file=s:option(Value, "err_file", translate("Error file"))
+err_file.rmempty = true
+--err_file.datatype = "file"
+
+meta_dir=s:option(Value, "meta_dir", translate("Metadata directory"))
+meta_dir.rmempty = true
+meta_dir.datatype = "directory"
+
+cmd_start=s:option(Value, "cmd_start", translate("Command when playback begins"))
+cmd_start.rmempty = true
+
+cmd_stop=s:option(Value, "cmd_stop", translate("Command when playback ends"))
+cmd_stop.rmempty = true
+
+cmd_wait=s:option(Flag, "cmd_wait", translate("Block while the commands run"))
+cmd_wait.default = false
+
+mdns=s:option(ListValue, "mdns", translate("mDNS"))
+mdns.rmempty = true
+mdns:value("", translate("Default"))
+mdns:value("avahi")
+mdns:value("dns_sd")
+mdns:value("external_avahi")
+mdns:value("external_dns_sd")
+mdns:value("tinysvcmdns")
+
+audio_output=s:option(ListValue, "audio_output", translate("Audio output"))
+audio_output.rmempty = true
+audio_output:value("", translate("Default"))
+audio_output:value("alsa")
+audio_output:value("ao")
+audio_output:value("dummy")
+audio_output:value("pulse")
+audio_output:value("pipe")
+
+-- alsa output --
+output_dev=s:option(Value, "output_dev", translate("Output device"))
+output_dev.rmempty = true
+output_dev:depends("audio_output", "alsa")
+
+mixer_dev=s:option(Value, "mixer_dev", translate("Mixer device"))
+mixer_dev.rmempty = true
+mixer_dev:depends("audio_output", "alsa")
+
+mixer_type=s:option(ListValue, "mixer_type", translate("Mixer type"))
+mixer_type.rmempty = true
+mixer_type:value("", translate("Default"))
+mixer_type:value("software")
+mixer_type:value("hardware")
+mixer_type:depends("audio_output", "alsa")
+
+mixer_control=s:option(Value, "mixer_control", translate("Mixer control"))
+mixer_control.rmempty = true
+mixer_control:depends("audio_output", "alsa")
+
+mixer_index = s:option(ListValue, "mixer_index", translate("Mixer index"))
+mixer_index.rmempty = true
+mixer_index:depends("audio_output", "alsa")
+mixer_index: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
+ mixer_index:value(l)
+ end
+ end
+ pats:close()
+end
+
+-- ao output --
+ao_driver=s:option(Value, "ao_driver", translate("AO driver"))
+ao_driver.rmempty = true
+ao_driver:depends("audio_output", "ao")
+
+ao_name=s:option(Value, "ao_name", translate("AO name"))
+ao_name.rmempty = true
+ao_name:depends("audio_output", "ao")
+
+ao_id = s:option(ListValue, "ao_id", translate("AO id"))
+ao_id.rmempty = true
+ao_id:depends("audio_output", "ao")
+ao_id: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_id:value(l)
+ end
+ end
+ pats:close()
+end
+
+ao_options=s:option(Value, "ao_options", translate("AO options"))
+ao_options.rmempty = true
+ao_options:depends("audio_output", "ao")
+
+-- pipe output --
+output_fifo=s:option(Value, "output_fifo", translate("Output FIFO"))
+output_fifo.rmempty = true
+output_fifo:depends("audio_output", "pipe")
+
+-- pulse output --
+pulse_server=s:option(Value, "pulse_server", translate("Pulse server"))
+pulse_server.rmempty = true
+pulse_server:depends("audio_output", "pulse")
+
+pulse_sink=s:option(Value, "pulse_sink", translate("Pulse sink"))
+pulse_sink.rmempty = true
+pulse_sink:depends("audio_output", "pulse")
+
+pulse_appname=s:option(Value, "pulse_appname", translate("Pulse application name"))
+pulse_appname.rmempty = true
+pulse_appname:depends("audio_output", "pulse")
+
+return m
diff --git a/applications/luci-shairport/root/etc/uci-defaults/luci-shairport b/applications/luci-shairport/root/etc/uci-defaults/luci-shairport
new file mode 100644
index 0000000000..be9412bac8
--- /dev/null
+++ b/applications/luci-shairport/root/etc/uci-defaults/luci-shairport
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+# needed for "Save and Apply" to restart shairport
+uci -q batch <<-EOF >/dev/null
+ delete ucitrack.@shairport[-1]
+ add ucitrack shairport
+ set ucitrack.@shairport[-1].init="shairport"
+ commit ucitrack
+EOF
+
+rm -f /tmp/luci-indexcache
+exit 0