applications/luci-minidlna: fix whitespace in controller, add status display to cbi map
[project/luci.git] / applications / luci-minidlna / luasrc / model / cbi / minidlna.lua
1 --[[
2 LuCI - Lua Configuration Interface - miniDLNA support
3
4 Copyright 2012 Gabor Juhos <juhosg@openwrt.org>
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("minidlna", translate("miniDLNA"),
16         translate("MiniDLNA is server software with the aim of being fully compliant with DLNA/UPnP-AV clients."))
17
18 m:section(SimpleSection).template  = "minidlna_status"
19
20 s = m:section(TypedSection, "minidlna", "miniDLNA Settings")
21 s.addremove = false
22 s.anonymous = true
23
24 o = s:option(Flag, "enabled", translate("Enable:"))
25 o.rmempty = false
26
27 function o.cfgvalue(self, section)
28         return luci.sys.init.enabled("minidlna") and self.enabled or self.disabled
29 end
30
31 function o.write(self, section, value)
32         if value == "1" then
33                 luci.sys.init.enable("minidlna")
34                 luci.sys.call("/etc/init.d/minidlna start >/dev/null")
35         else
36                 luci.sys.call("/etc/init.d/minidlna stop >/dev/null")
37                 luci.sys.init.disable("minidlna")
38         end
39
40         return Flag.write(self, section, value)
41 end
42
43 port = s:option(Value, "port", translate("Port:"),
44         translate("Port for HTTP (descriptions, SOAP, media transfer) traffic."))
45 port.datatype = "port"
46 port.default = 8200
47
48 s:option(Value, "interface", translate("Interfaces:"),
49         translate("Network interfaces to serve, comma delimited list."))
50
51 o = s:option(Value, "friendly_name", translate("Friendly name:"),
52         translate("Set this if you want to customize the name that shows up on your clients."))
53 o.optional = true
54 o.placeholder = "OpenWrt DLNA Server"
55
56 o = s:option(Value, "db_dir", translate("Database directory:"),
57         translate("Set this if you would like to specify the directory where you want MiniDLNA to store its database and album art cache."))
58 o.optional = true
59 o.placeholder = "/var/cache/minidlna"
60
61 o = s:option(Value, "log_dir", translate("Log directory:"),
62         translate("Set this if you would like to specify the directory where you want MiniDLNA to store its log file."))
63 o.optional = true
64 o.placeholder = "/var/log"
65
66 s:option(Flag, "inotify", translate("Enable inotify:"),
67         translate("Set this to enable inotify monitoring to automatically discover new files."))
68
69 s:option(Flag, "enable_tivo", translate("Enable TIVO:"),
70         translate("Set this to enable support for streaming .jpg and .mp3 files to a TiVo supporting HMO."))
71 o.optional = true
72
73 o = s:option(Flag, "strict_dlna", translate("Strict to DLNA standard:"),
74         translate("Set this to strictly adhere to DLNA standards. This will allow server-side downscaling of very large JPEG images, which may hurt JPEG serving performance on (at least) Sony DLNA products."))
75 o.optional = true
76
77 o = s:option(Value, "presentation_url", translate("Presentation URL:"))
78 o.optional = true
79 o.placeholder = "http://192.168.1.1/"
80
81 o = s:option(Value, "notify_interval", translate("Notify interval:"),
82         translate("Notify interval in seconds."))
83 o.datatype = "uinteger"
84 o.placeholder = 900
85
86 o = s:option(Value, "serial", translate("Announced serial number:"),
87         translate("Serial number the miniDLNA daemon will report to clients in its XML description."))
88 o.placeholder = "12345678"
89
90 s:option(Value, "model_number", translate("Announced model number:"),
91         translate("Model number the miniDLNA daemon will report to clients in its XML description."))
92 o.placholder = "1"
93
94 o = s:option(Value, "minissdpsocket", translate("miniSSDP socket:"),
95         translate("Specify the path to the MiniSSDPd socket."))
96 o.optional = true
97 o.placeholder = "/var/run/minissdpd.sock"
98
99 o = s:option(ListValue, "root_container", translate("Root container:"))
100 o:value(".", translate("Standard container"))
101 o:value("B", translate("Browse directory"))
102 o:value("M", translate("Music"))
103 o:value("V", translate("Video"))
104 o:value("P", translate("Pictures"))
105
106 o = s:option(Value, "album_art_names", translate("Album art names:"),
107         translate("This is a list of file names to check for when searching for album art. Note: names must be delimited with a forward slash '/'"))
108 o.optional = true
109 o.placeholder = "Cover.jpg/cover.jpg/AlbumArtSmall.jpg/albumartsmall.jpg"
110
111 s:option(DynamicList, "media_dir", translate("Media directories:"),
112         translate("Set this to the directory you want scanned. If you want to restrict the directory to a specific content type, you can prepend the type ('A' for audio, 'V' for video, 'P' for images), followed by a comma, to the directory (eg. media_dir=A,/mnt/media/Music). Multiple directories can be specified."))
113
114 return m