shairport.lua 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. -- Copyright 2014 Álvaro Fernández Rojas <noltari@gmail.com>
  2. -- Licensed to the public under the Apache License 2.0.
  3. m = Map("shairport", "Shairport", translate("Shairport is a simple AirPlay server implementation, here you can configure the settings."))
  4. s = m:section(TypedSection, "shairport", "")
  5. s.addremove = true
  6. s.anonymous = false
  7. enable=s:option(Flag, "disabled", translate("Enabled"))
  8. enable.enabled="0"
  9. enable.disabled="1"
  10. enable.default = "1"
  11. enable.rmempty = false
  12. respawn=s:option(Flag, "respawn", translate("Respawn"))
  13. respawn.default = false
  14. bname = s:option(Value, "bname", translate("Airport Name"))
  15. bname.rmempty = true
  16. pw = s:option(Value, "password", translate("Password"))
  17. pw.rmempty = true
  18. pw.password = true
  19. port=s:option(Value, "port", translate("Port"))
  20. port.rmempty = true
  21. port.datatype = "port"
  22. buffer=s:option(Value, "buffer", translate("Buffer fill"))
  23. buffer.rmempty = true
  24. buffer.datatype = "uinteger"
  25. log_file=s:option(Value, "log_file", translate("Log file"))
  26. log_file.rmempty = true
  27. --log_file.datatype = "file"
  28. err_file=s:option(Value, "err_file", translate("Error file"))
  29. err_file.rmempty = true
  30. --err_file.datatype = "file"
  31. meta_dir=s:option(Value, "meta_dir", translate("Metadata directory"))
  32. meta_dir.rmempty = true
  33. meta_dir.datatype = "directory"
  34. cmd_start=s:option(Value, "cmd_start", translate("Command when playback begins"))
  35. cmd_start.rmempty = true
  36. cmd_stop=s:option(Value, "cmd_stop", translate("Command when playback ends"))
  37. cmd_stop.rmempty = true
  38. cmd_wait=s:option(Flag, "cmd_wait", translate("Block while the commands run"))
  39. cmd_wait.default = false
  40. mdns=s:option(ListValue, "mdns", translate("mDNS"))
  41. mdns.rmempty = true
  42. mdns:value("", translate("Default"))
  43. mdns:value("avahi")
  44. mdns:value("dns_sd")
  45. mdns:value("external_avahi")
  46. mdns:value("external_dns_sd")
  47. mdns:value("tinysvcmdns")
  48. audio_output=s:option(ListValue, "audio_output", translate("Audio output"))
  49. audio_output.rmempty = true
  50. audio_output:value("", translate("Default"))
  51. audio_output:value("alsa")
  52. audio_output:value("ao")
  53. audio_output:value("dummy")
  54. audio_output:value("pulse")
  55. audio_output:value("pipe")
  56. -- alsa output --
  57. output_dev=s:option(Value, "output_dev", translate("Output device"))
  58. output_dev.rmempty = true
  59. output_dev:depends("audio_output", "alsa")
  60. mixer_dev=s:option(Value, "mixer_dev", translate("Mixer device"))
  61. mixer_dev.rmempty = true
  62. mixer_dev:depends("audio_output", "alsa")
  63. mixer_type=s:option(ListValue, "mixer_type", translate("Mixer type"))
  64. mixer_type.rmempty = true
  65. mixer_type:value("", translate("Default"))
  66. mixer_type:value("software")
  67. mixer_type:value("hardware")
  68. mixer_type:depends("audio_output", "alsa")
  69. mixer_control=s:option(Value, "mixer_control", translate("Mixer control"))
  70. mixer_control.rmempty = true
  71. mixer_control:depends("audio_output", "alsa")
  72. mixer_index = s:option(ListValue, "mixer_index", translate("Mixer index"))
  73. mixer_index.rmempty = true
  74. mixer_index:depends("audio_output", "alsa")
  75. mixer_index:value("", translate("Default"))
  76. local pats = io.popen("find /proc/asound/ -type d -name 'card*' | sort")
  77. if pats then
  78. local l
  79. while true do
  80. l = pats:read("*l")
  81. if not l then break end
  82. l = string.gsub(l, "/proc/asound/card", "")
  83. if l then
  84. mixer_index:value(l)
  85. end
  86. end
  87. pats:close()
  88. end
  89. -- ao output --
  90. ao_driver=s:option(Value, "ao_driver", translate("AO driver"))
  91. ao_driver.rmempty = true
  92. ao_driver:depends("audio_output", "ao")
  93. ao_name=s:option(Value, "ao_name", translate("AO name"))
  94. ao_name.rmempty = true
  95. ao_name:depends("audio_output", "ao")
  96. ao_id = s:option(ListValue, "ao_id", translate("AO id"))
  97. ao_id.rmempty = true
  98. ao_id:depends("audio_output", "ao")
  99. ao_id:value("", translate("Default"))
  100. local pats = io.popen("find /proc/asound/ -type d -name 'card*' | sort")
  101. if pats then
  102. local l
  103. while true do
  104. l = pats:read("*l")
  105. if not l then break end
  106. l = string.gsub(l, "/proc/asound/card", "")
  107. if l then
  108. ao_id:value(l)
  109. end
  110. end
  111. pats:close()
  112. end
  113. ao_options=s:option(Value, "ao_options", translate("AO options"))
  114. ao_options.rmempty = true
  115. ao_options:depends("audio_output", "ao")
  116. -- pipe output --
  117. output_fifo=s:option(Value, "output_fifo", translate("Output FIFO"))
  118. output_fifo.rmempty = true
  119. output_fifo:depends("audio_output", "pipe")
  120. -- pulse output --
  121. pulse_server=s:option(Value, "pulse_server", translate("Pulse server"))
  122. pulse_server.rmempty = true
  123. pulse_server:depends("audio_output", "pulse")
  124. pulse_sink=s:option(Value, "pulse_sink", translate("Pulse sink"))
  125. pulse_sink.rmempty = true
  126. pulse_sink:depends("audio_output", "pulse")
  127. pulse_appname=s:option(Value, "pulse_appname", translate("Pulse application name"))
  128. pulse_appname.rmempty = true
  129. pulse_appname:depends("audio_output", "pulse")
  130. return m