2012-04-06 09:44:36 +00:00
--[[
LuCI - Lua Configuration Interface - miniDLNA support
Copyright 2012 Gabor Juhos < juhosg @ openwrt.org >
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 $
] ] --
2012-04-09 12:35:49 +00:00
local m , s , o
2012-04-06 09:44:36 +00:00
m = Map ( " minidlna " , translate ( " miniDLNA " ) ,
translate ( " MiniDLNA is server software with the aim of being fully compliant with DLNA/UPnP-AV clients. " ) )
2012-04-07 23:39:27 +00:00
m : section ( SimpleSection ) . template = " minidlna_status "
2012-04-06 09:44:36 +00:00
s = m : section ( TypedSection , " minidlna " , " miniDLNA Settings " )
s.addremove = false
s.anonymous = true
2012-04-09 12:35:49 +00:00
s : tab ( " general " , translate ( " General Settings " ) )
s : tab ( " advanced " , translate ( " Advanced Settings " ) )
o = s : taboption ( " general " , Flag , " enabled " , translate ( " Enable: " ) )
2012-04-06 09:44:36 +00:00
o.rmempty = false
function o . cfgvalue ( self , section )
return luci.sys . init.enabled ( " minidlna " ) and self.enabled or self.disabled
end
function o . write ( self , section , value )
if value == " 1 " then
luci.sys . init.enable ( " minidlna " )
luci.sys . call ( " /etc/init.d/minidlna start >/dev/null " )
else
luci.sys . call ( " /etc/init.d/minidlna stop >/dev/null " )
luci.sys . init.disable ( " minidlna " )
end
return Flag.write ( self , section , value )
end
2012-04-09 12:35:49 +00:00
o = s : taboption ( " general " , Value , " port " , translate ( " Port: " ) ,
2012-04-06 09:44:36 +00:00
translate ( " Port for HTTP (descriptions, SOAP, media transfer) traffic. " ) )
2012-04-09 12:35:49 +00:00
o.datatype = " port "
o.default = 8200
o = s : taboption ( " general " , Value , " interface " , translate ( " Interfaces: " ) ,
translate ( " Network interfaces to serve. " ) )
o.template = " cbi/network_ifacelist "
o.widget = " checkbox "
o.nocreate = true
function o . cfgvalue ( self , section )
local rv = { }
local val = Value.cfgvalue ( self , section )
if val then
local ifc
for ifc in val : gmatch ( " [^,%s]+ " ) do
rv [ # rv + 1 ] = ifc
end
end
return rv
end
function o . write ( self , section , value )
local rv = { }
local ifc
for ifc in luci.util . imatch ( value ) do
rv [ # rv + 1 ] = ifc
end
Value.write ( self , section , table.concat ( rv , " , " ) )
end
2012-04-06 09:44:36 +00:00
2012-04-09 12:35:49 +00:00
o = s : taboption ( " general " , Value , " friendly_name " , translate ( " Friendly name: " ) ,
2012-04-06 09:44:36 +00:00
translate ( " Set this if you want to customize the name that shows up on your clients. " ) )
2012-04-09 12:35:49 +00:00
o.rmempty = true
2012-04-06 09:44:36 +00:00
o.placeholder = " OpenWrt DLNA Server "
2012-04-09 12:35:49 +00:00
o = s : taboption ( " advanced " , Value , " db_dir " , translate ( " Database directory: " ) ,
2012-04-06 09:44:36 +00:00
translate ( " Set this if you would like to specify the directory where you want MiniDLNA to store its database and album art cache. " ) )
2012-04-09 12:35:49 +00:00
o.rmempty = true
2012-04-06 09:44:36 +00:00
o.placeholder = " /var/cache/minidlna "
2012-04-09 12:35:49 +00:00
o = s : taboption ( " advanced " , Value , " log_dir " , translate ( " Log directory: " ) ,
2012-04-06 09:44:36 +00:00
translate ( " Set this if you would like to specify the directory where you want MiniDLNA to store its log file. " ) )
2012-04-09 12:35:49 +00:00
o.rmempty = true
2012-04-06 09:44:36 +00:00
o.placeholder = " /var/log "
2012-04-09 12:35:49 +00:00
s : taboption ( " advanced " , Flag , " inotify " , translate ( " Enable inotify: " ) ,
2012-04-06 09:44:36 +00:00
translate ( " Set this to enable inotify monitoring to automatically discover new files. " ) )
2012-04-09 12:35:49 +00:00
s : taboption ( " advanced " , Flag , " enable_tivo " , translate ( " Enable TIVO: " ) ,
2012-04-06 09:44:36 +00:00
translate ( " Set this to enable support for streaming .jpg and .mp3 files to a TiVo supporting HMO. " ) )
2012-04-09 12:35:49 +00:00
o.rmempty = true
2012-04-06 09:44:36 +00:00
2012-04-09 12:35:49 +00:00
o = s : taboption ( " advanced " , Flag , " strict_dlna " , translate ( " Strict to DLNA standard: " ) ,
2012-04-06 09:44:36 +00:00
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. " ) )
2012-04-09 12:35:49 +00:00
o.rmempty = true
2012-04-06 09:44:36 +00:00
2012-04-09 12:35:49 +00:00
o = s : taboption ( " advanced " , Value , " presentation_url " , translate ( " Presentation URL: " ) )
o.rmempty = true
2012-04-06 09:44:36 +00:00
o.placeholder = " http://192.168.1.1/ "
2012-04-09 12:35:49 +00:00
o = s : taboption ( " advanced " , Value , " notify_interval " , translate ( " Notify interval: " ) ,
2012-04-06 09:44:36 +00:00
translate ( " Notify interval in seconds. " ) )
o.datatype = " uinteger "
o.placeholder = 900
2012-04-09 12:35:49 +00:00
o = s : taboption ( " advanced " , Value , " serial " , translate ( " Announced serial number: " ) ,
2012-04-06 09:44:36 +00:00
translate ( " Serial number the miniDLNA daemon will report to clients in its XML description. " ) )
o.placeholder = " 12345678 "
2012-04-09 12:35:49 +00:00
s : taboption ( " advanced " , Value , " model_number " , translate ( " Announced model number: " ) ,
2012-04-06 09:44:36 +00:00
translate ( " Model number the miniDLNA daemon will report to clients in its XML description. " ) )
o.placholder = " 1 "
2012-04-09 12:35:49 +00:00
o = s : taboption ( " advanced " , Value , " minissdpsocket " , translate ( " miniSSDP socket: " ) ,
2012-04-06 09:44:36 +00:00
translate ( " Specify the path to the MiniSSDPd socket. " ) )
2012-04-09 12:35:49 +00:00
o.rmempty = true
2012-04-06 09:44:36 +00:00
o.placeholder = " /var/run/minissdpd.sock "
2012-04-09 12:35:49 +00:00
o = s : taboption ( " general " , ListValue , " root_container " , translate ( " Root container: " ) )
2012-04-06 09:44:36 +00:00
o : value ( " . " , translate ( " Standard container " ) )
o : value ( " B " , translate ( " Browse directory " ) )
o : value ( " M " , translate ( " Music " ) )
o : value ( " V " , translate ( " Video " ) )
o : value ( " P " , translate ( " Pictures " ) )
2012-04-09 12:35:49 +00:00
s : taboption ( " general " , DynamicList , " media_dir " , translate ( " Media directories: " ) ,
2012-04-06 09:44:36 +00:00
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. " ) )
2012-04-09 12:35:49 +00:00
o = s : taboption ( " general " , DynamicList , " album_art_names " , translate ( " Album art names: " ) ,
translate ( " This is a list of file names to check for when searching for album art. " ) )
o.rmempty = true
o.placeholder = " Cover.jpg/cover.jpg/AlbumArtSmall.jpg/albumartsmall.jpg "
function o . cfgvalue ( self , section )
local rv = { }
local val = Value.cfgvalue ( self , section )
if type ( val ) == " table " then val = table.concat ( val , " / " ) end
local file
for file in val : gmatch ( " [^/%s]+ " ) do
rv [ # rv + 1 ] = file
end
return rv
end
function o . write ( self , section , value )
local rv = { }
local file
for file in luci.util . imatch ( value ) do
rv [ # rv + 1 ] = file
end
Value.write ( self , section , table.concat ( rv , " / " ) )
end
2012-04-06 09:44:36 +00:00
return m