applications: add an application for miniDLNA
[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 s = m:section(TypedSection, "minidlna", "miniDLNA Settings")
19 s.addremove = false
20 s.anonymous = true
21
22 o = s:option(Flag, "enabled", translate("Enable:"))
23 o.rmempty = false
24
25 function o.cfgvalue(self, section)
26 return luci.sys.init.enabled("minidlna") and self.enabled or self.disabled
27 end
28
29 function o.write(self, section, value)
30 if value == "1" then
31 luci.sys.init.enable("minidlna")
32 luci.sys.call("/etc/init.d/minidlna start >/dev/null")
33 else
34 luci.sys.call("/etc/init.d/minidlna stop >/dev/null")
35 luci.sys.init.disable("minidlna")
36 end
37
38 return Flag.write(self, section, value)
39 end
40
41 port = s:option(Value, "port", translate("Port:"),
42 translate("Port for HTTP (descriptions, SOAP, media transfer) traffic."))
43 port.datatype = "port"
44 port.default = 8200
45
46 s:option(Value, "interface", translate("Interfaces:"),
47 translate("Network interfaces to serve, comma delimited list."))
48
49 o = s:option(Value, "friendly_name", translate("Friendly name:"),
50 translate("Set this if you want to customize the name that shows up on your clients."))
51 o.optional = true
52 o.placeholder = "OpenWrt DLNA Server"
53
54 o = s:option(Value, "db_dir", translate("Database directory:"),
55 translate("Set this if you would like to specify the directory where you want MiniDLNA to store its database and album art cache."))
56 o.optional = true
57 o.placeholder = "/var/cache/minidlna"
58
59 o = s:option(Value, "log_dir", translate("Log directory:"),
60 translate("Set this if you would like to specify the directory where you want MiniDLNA to store its log file."))
61 o.optional = true
62 o.placeholder = "/var/log"
63
64 s:option(Flag, "inotify", translate("Enable inotify:"),
65 translate("Set this to enable inotify monitoring to automatically discover new files."))
66
67 s:option(Flag, "enable_tivo", translate("Enable TIVO:"),
68 translate("Set this to enable support for streaming .jpg and .mp3 files to a TiVo supporting HMO."))
69 o.optional = true
70
71 o = s:option(Flag, "strict_dlna", translate("Strict to DLNA standard:"),
72 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."))
73 o.optional = true
74
75 o = s:option(Value, "presentation_url", translate("Presentation URL:"))
76 o.optional = true
77 o.placeholder = "http://192.168.1.1/"
78
79 o = s:option(Value, "notify_interval", translate("Notify interval:"),
80 translate("Notify interval in seconds."))
81 o.datatype = "uinteger"
82 o.placeholder = 900
83
84 o = s:option(Value, "serial", translate("Announced serial number:"),
85 translate("Serial number the miniDLNA daemon will report to clients in its XML description."))
86 o.placeholder = "12345678"
87
88 s:option(Value, "model_number", translate("Announced model number:"),
89 translate("Model number the miniDLNA daemon will report to clients in its XML description."))
90 o.placholder = "1"
91
92 o = s:option(Value, "minissdpsocket", translate("miniSSDP socket:"),
93 translate("Specify the path to the MiniSSDPd socket."))
94 o.optional = true
95 o.placeholder = "/var/run/minissdpd.sock"
96
97 o = s:option(ListValue, "root_container", translate("Root container:"))
98 o:value(".", translate("Standard container"))
99 o:value("B", translate("Browse directory"))
100 o:value("M", translate("Music"))
101 o:value("V", translate("Video"))
102 o:value("P", translate("Pictures"))
103
104 o = s:option(Value, "album_art_names", translate("Album art names:"),
105 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 '/'"))
106 o.optional = true
107 o.placeholder = "Cover.jpg/cover.jpg/AlbumArtSmall.jpg/albumartsmall.jpg"
108
109 s:option(DynamicList, "media_dir", translate("Media directories:"),
110 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."))
111
112 return m