packages/minidlna: add uci configuration support
git-svn-id: svn://svn.openwrt.org/openwrt/packages@31211 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
99386178ac
commit
2ae2fffaed
@ -75,12 +75,12 @@ MAKE_VARS +=\
|
||||
|
||||
|
||||
define Package/minidlna/install
|
||||
$(INSTALL_DIR) $(1)/etc
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/minidlna.conf $(1)/etc/
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/minidlna $(1)/usr/bin/
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./files/minidlna.init $(1)/etc/init.d/minidlna
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_BIN) ./files/minidlna.config $(1)/etc/config/minidlna
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,minidlna))
|
||||
|
17
multimedia/minidlna/files/minidlna.config
Normal file
17
multimedia/minidlna/files/minidlna.config
Normal file
@ -0,0 +1,17 @@
|
||||
config minidlna config
|
||||
option 'enabled' '0'
|
||||
option port '8200'
|
||||
option interface 'br-lan'
|
||||
option friendly_name 'OpenWrt DLNA Server'
|
||||
option db_dir '/var/run/minidlna'
|
||||
option log_dir '/var/log'
|
||||
option inotify '1'
|
||||
option enable_tivo '0'
|
||||
option strict_dlna '0'
|
||||
option presentation_url ''
|
||||
option notify_interval '900'
|
||||
option serial '12345678'
|
||||
option model_number '1'
|
||||
option root_container '.'
|
||||
list media_dir '/mnt'
|
||||
option album_art_names 'Cover.jpg/cover.jpg/AlbumArtSmall.jpg/albumartsmall.jpg/AlbumArt.jpg/albumart.jpg/Album.jpg/album.jpg/Folder.jpg/folder.jpg/Thumb.jpg/thumb.jpg'
|
@ -5,10 +5,85 @@ START=50
|
||||
|
||||
SERVICE_USE_PID=1
|
||||
|
||||
MINIDLNA_CONFIG_FILE="/tmp/minidlna.conf"
|
||||
|
||||
minidlna_cfg_append() {
|
||||
echo "$1" >> "$MINIDLNA_CONFIG_FILE"
|
||||
}
|
||||
|
||||
minidlna_cfg_addbool() {
|
||||
local cfg="$1"
|
||||
local key="$2"
|
||||
local def="$3"
|
||||
local val
|
||||
|
||||
config_get_bool val "$cfg" "$key" "$def"
|
||||
[ "$val" -gt 0 ] && val="yes" || val="no"
|
||||
minidlna_cfg_append "$key=$val"
|
||||
}
|
||||
|
||||
minidlna_cfg_addstr() {
|
||||
local cfg="$1"
|
||||
local key="$2"
|
||||
local def="$3"
|
||||
local val
|
||||
|
||||
config_get val "$cfg" "$key" "$def"
|
||||
[ -n "$val" ] && minidlna_cfg_append "$key=$val"
|
||||
}
|
||||
|
||||
minidlna_cfg_add_media_dir() {
|
||||
local val=$1
|
||||
|
||||
minidlna_cfg_append "media_dir=$val"
|
||||
}
|
||||
|
||||
minidlna_create_config() {
|
||||
local cfg=$1
|
||||
local port
|
||||
local interface
|
||||
|
||||
config_get port $cfg port
|
||||
config_get interface $cfg interface
|
||||
|
||||
[ -z "$interface" -o -t "$port" ] && return 1
|
||||
|
||||
echo "# this file is generated automatically, don't edit" > "$MINIDLNA_CONFIG_FILE"
|
||||
|
||||
minidlna_cfg_append "port=$port"
|
||||
minidlna_cfg_append "network_interface=$interface"
|
||||
|
||||
minidlna_cfg_addstr $cfg friendly_name
|
||||
minidlna_cfg_addstr $cfg db_dir
|
||||
minidlna_cfg_addstr $cfg log_dir
|
||||
minidlna_cfg_addbool $cfg inotify '1'
|
||||
minidlna_cfg_addbool $cfg enable_tivo '0'
|
||||
minidlna_cfg_addbool $cfg strict_dlna '0'
|
||||
minidlna_cfg_addstr $cfg album_art_names
|
||||
minidlna_cfg_addstr $cfg presentation_url
|
||||
minidlna_cfg_addstr $cfg notify_interval '900'
|
||||
minidlna_cfg_addstr $cfg serial '12345678'
|
||||
minidlna_cfg_addstr $cfg model_number '1'
|
||||
minidlna_cfg_addstr $cfg minissdpsocket
|
||||
minidlna_cfg_addstr $cfg root_container '.'
|
||||
config_list_foreach "$cfg" "media_dir" minidlna_cfg_add_media_dir
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
start() {
|
||||
local enabled
|
||||
|
||||
config_load 'minidlna'
|
||||
config_get_bool enabled config 'enabled' '0'
|
||||
|
||||
[ "$enabled" -gt 0 ] || return 1
|
||||
|
||||
minidlna_create_config config || return 1
|
||||
|
||||
mkdir -m 0755 -p /var/log
|
||||
mkdir -m 0755 -p /var/run/minidlna
|
||||
service_start /usr/bin/minidlna
|
||||
service_start /usr/bin/minidlna -f "$MINIDLNA_CONFIG_FILE"
|
||||
}
|
||||
|
||||
stop() {
|
||||
|
@ -1,24 +0,0 @@
|
||||
--- a/minidlna.conf
|
||||
+++ b/minidlna.conf
|
||||
@@ -2,7 +2,7 @@
|
||||
port=8200
|
||||
|
||||
# network interfaces to serve, comma delimited
|
||||
-#network_interface=eth0
|
||||
+network_interface=br-lan
|
||||
|
||||
# set this to the directory you want scanned.
|
||||
# * if have multiple directories, you can have multiple media_dir= lines
|
||||
@@ -11,10 +11,10 @@ port=8200
|
||||
# + "A" for audio (eg. media_dir=A,/home/jmaggard/Music)
|
||||
# + "V" for video (eg. media_dir=V,/home/jmaggard/Videos)
|
||||
# + "P" for images (eg. media_dir=P,/home/jmaggard/Pictures)
|
||||
-media_dir=/opt
|
||||
+media_dir=/mnt
|
||||
|
||||
# set this if you want to customize the name that shows up on your clients
|
||||
-#friendly_name=My DLNA Server
|
||||
+friendly_name=My DLNA Server
|
||||
|
||||
# set this if you would like to specify the directory where you want MiniDLNA to store its database and album art cache
|
||||
#db_dir=/var/cache/minidlna
|
Loading…
x
Reference in New Issue
Block a user