How can I use minidlna with 2 USB-drives

2 posts / 0 new
Last post
mbo69
mbo69's picture
How can I use minidlna with 2 USB-drives

Hi,

I use kingkong build 21661 on an Asus RT N-16 (Good work !) and I can use ONE USB stick with minidlna. I added another USB-stick, but I am not able to add another video directory to the minidlna configuration. I CAN add it to the GUI, but the resulting entry in the minidlna.conf seems to be not used or only partially(1. directory) used:

media_dir=V,/mnt/Video,/opt/Video

As far as i understood minidlna needs one line for each directory ? Do I have to enter something special to create one line for each directory ? Os is this a new feature for the GUI ?

 

Best regards

mb69

mbo69
mbo69's picture
Hi,

Hi,
i had a look at the starting script for minidlna minidlna.startup. I extended the script to allow multiple directory entries, which each get a line in the configuration file. May be somebody else is interested as well ?

#!/bin/sh

# first: string from GUI, second: mediatype,
DIRS=""
getDirs()
{
REMAIN=${1#*,}
LAST=$1
DIRS=""
while [ $REMAIN != $LAST ]; do
DIRS="${DIRS}"media_dir=$2,${LAST%%,*}$'\n'
LAST=$REMAIN
REMAIN=${REMAIN#*,}
done
DIRS="${DIRS}"media_dir=$2,${LAST}
}

if [ "$(nvram get minidlna_enable)" = "1" ]; then

SRVSTRING="$(nvram get minidlna_srvstring)"
PICS="$(nvram get minidlna_pic)"
VIDS="$(nvram get minidlna_vid)"
MUSIC="$(nvram get minidlna_music)"
IP="$(nvram get lan_ipaddr)"
INTERVAL="$(nvram get minidlna_update)"
DB="$(nvram get minidlna_dbpath)/minidlnadb"

if [ "$(nvram get minidlna_srvstring)" = "" ]; then
SRVSTRING="DD-WRT"
fi
if [ "$(nvram get minidlna_pic)" = "" ]; then
PICDIRS="media_dir=P,/jffs"
else
getDirs "$PICS" P
PICDIRS=$DIRS
fi
if [ "$(nvram get minidlna_vid)" = "" ]; then
VIDDIRS="media_dir=V,/jffs"
else
getDirs "$VIDS" V
VIDDIRS=$DIRS
fi
if [ "$(nvram get minidlna_music)" = "" ]; then
MUSICDIRS="media_dir=A,/jffs"
else
getDirs "$MUSIC" A
MUSICDIRS=$DIRS
fi
if [ "$(nvram get minidlna_update)" = "" ]; then
INTERVAL="60"
fi
if [ "$(nvram get minidlna_dbpath)" = "" ]; then
DB="/tmp/minidlna"
fi

mkdir -p $DB

MINIDLNA_CONF=$( cat port=8200
network_interface=br0
$MUSICDIRS
$PICDIRS
$VIDDIRS
friendly_name=$SRVSTRING
db_dir=$DB
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
inotify=yes
enable_tivo=no
strict_dlna=no
presentation_url=http://$IP:8200
notify_interval=$INTERVAL
serial=12345678
model_number=1
EOF
)

echo "$MINIDLNA_CONF" > /tmp/minidlna.conf

if [ -d DB ]; then
sleep 10
fi

/usr/sbin/minidlna -f /tmp/minidlna.conf

fi

mbo69