applications/luci-dump1090: update config to latest version
[project/luci.git] / applications / luci-shairplay / luasrc / model / cbi / shairplay.lua
1 --[[
2 LuCI - Lua Configuration Interface - Shairplay support
3
4 Copyright 2014 Álvaro Fernández Rojas <noltari@gmail.com>
5
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
9
10         http://www.apache.org/licenses/LICENSE-2.0
11
12 $Id$
13 ]]--
14
15 m = Map("shairplay", "Shairplay", translate("Shairplay is a simple AirPlay server implementation, here you can configure the settings."))
16
17 s = m:section(TypedSection, "shairplay", "")
18 s.addremove = true
19 s.anonymous = false
20
21 enable=s:option(Flag, "disabled", translate("Enabled"))
22 enable.enabled="0"
23 enable.disabled="1"
24 enable.default = "1"
25 respawn=s:option(Flag, "respawn", translate("Respawn"))
26 respawn.default = false
27
28 apname = s:option(Value, "apname", translate("Airport Name"))
29 apname.rmempty = true
30
31 port=s:option(Value, "port", translate("Port"))
32 port.rmempty = true
33 port.datatype = "port"
34
35 pw = s:option(Value, "password", translate("Password"))
36 pw.rmempty = true
37 pw.password = true
38
39 hwaddr=s:option(Value, "hwaddr", translate("HW Address"))
40 hwaddr.rmempty = true
41 hwaddr.datatype = "macaddr"
42
43 ao_driver=s:option(ListValue, "ao_driver", translate("AO Driver"))
44 ao_driver:value("", translate("Default"))
45 ao_driver:value("alsa")
46 --ao_driver:value("alsa05")
47 --ao_driver:value("arts")
48 --ao_driver:value("esd")
49 --ao_driver:value("irix")
50 --ao_driver:value("nas")
51 ao_driver:value("oss")
52 --ao_driver:value("sun")
53
54 ao_devicename=s:option(Value, "ao_devicename", translate("AO Device Name"))
55 ao_devicename.rmempty = true
56
57 ao_deviceid = s:option(ListValue, "ao_deviceid", translate("AO Device ID"))
58 ao_deviceid.rmempty = true
59 ao_deviceid:value("", translate("Default"))
60 local pats = io.popen("find /proc/asound/ -type d -name 'card*' | sort")
61 if pats then
62         local l
63         while true do
64                 l = pats:read("*l")
65                 if not l then break end
66
67                 l = string.gsub(l, "/proc/asound/card", "")
68                 if l then
69                         ao_deviceid:value(l)
70                 end
71         end
72         pats:close()
73 end
74
75 return m