MiniDLNA - rebuild database on startup

Post new topic   Reply to topic    DD-WRT Forum Forum Index -> Broadcom SoC based Hardware
Author Message
PowerPoldi
DD-WRT User


Joined: 15 Oct 2016
Posts: 65

PostPosted: Sat Jan 30, 2021 7:56    Post subject: MiniDLNA - rebuild database on startup Reply with quote
How can I force a clear&rebuild of the mindlna database on every startup of the router?

I've already tried various settings of the miniDLNA options without any success.
The problme I face, that every startup my router scans the media folders and adds the entries to the database, so after several reboots (I normally shut down the router in the night) the database is full of the same entries.

My setup:
Router: DLlink DIR890-L
250 GB SSD attached on USB3 Port
jiffs enabled (1GB)
ddwrt: DD-WRT v3.0-r43171 std (05/16/20)
Sponsor
mwchang
DD-WRT Guru


Joined: 26 Mar 2013
Posts: 747
Location: Hung Hom, Hong Kong

PostPosted: Sun Jan 31, 2021 14:02    Post subject: Re: MiniDLNA - rebuild database on startup Reply with quote
PowerPoldi wrote:
How can I force a clear&rebuild of the mindlna database on every startup of the router?

I've already tried various settings of the miniDLNA options without any success.
The problme I face, that every startup my router scans the media folders and adds the entries to the database, so after several reboots (I normally shut down the router in the night) the database is full of the same entries.

I found that MiniDLNA always re-scan media folders on reboot. The process is very slow and you have to wait patiently. I don't think it cares about the "Keep Metadata on Storage" setting.

find / -type f -iname *dlna*
Code:
/etc/config/05minidlna.webnas
/etc/config/minidlna.nvramconfig
/etc/minidlna.conf
/jffs/configs/minidlna.conf.add
/tmp/minidlna.conf
/tmp/nvstate/dlna_no_art.state
/tmp/nvstate/dlna_tumb.state
/tmp/nvstate/dlna_subtitles.state
/tmp/nvstate/dlna_metadata.state
/tmp/nvstate/dlna_merge.state
/tmp/nvstate/dlna_album_art.state
/tmp/nvstate/dlna_rescan.state
/tmp/nvstate/dlna_cleandb.state
/tmp/nvstate/dlna_shares.state
/tmp/nvstate/dlna_enable.state
/tmp/services/dlna_rescan.0
/tmp/services/dlna.0
/tmp/var/run/minidlna/minidlna.pid
/usr/sbin/minidlna

cat /tmp/minidlna.conf
Code:
db_dir=/jffs/minidlna
port=8200
network_interface=br0
media_dir=A,/mnt/sda1/Music
friendly_name=RT-N18U
merge_media_dirs=no
enable_subtitles=no
no_album_art=yes
keep_metadata=yes
keep_metadata_with_media=yes
inotify=yes
enable_tivo=no
strict_dlna=no
root_container=B
max_connections=10
notify_interval=300
serial=12345678
model_number=AllShare1.0

ls /jffs/minidlna
Code:

total 9512
-rw-r--r--    1 root     root       5046272 Jan 31 21:57 files.db
-rw-r--r--    1 root     root       4694016 Dec 10 17:46 files.db.old


I think you can first disable MiniDLNA via WEBUI, then manually delete those cache files in /jffs/minidlna, if and only if you think the "Clean Database now" in the MiniDLNA WEBUI was not working.

_________________
Router: Asus RT-N18U (rev. A1)

May the Force and farces be with you! Live long and proper!

Facebook: https://www.facebook.com/changmanwai
Website: https://sites.google.com/site/changmw
SETI@Home profile: http://setiathome.berkeley.edu/view_profile.php?userid=211832
egc
DD-WRT Guru


Joined: 18 Mar 2014
Posts: 7449
Location: Netherlands

PostPosted: Sun Jan 31, 2021 14:09    Post subject: Reply with quote
Remove the db on shutdown with the shutdown script?
_________________
Routers:Netgear R7800, R6400v1, R6400v2, Linksys EA8500, EA6900 (XvortexCFE), E2000 (converted WRT320N), WRT54GS v1.
WireGuard Documents & Guides:https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=327397
OpenVPN Documents & Guides: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=327398
IPSET: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=327261
Install guide R6400v2:http://forum.dd-wrt.com/phpBB2/viewtopic.php?t=316399
Install guide R7800: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=320614
Forum Guide Lines (important read):https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=324087
PowerPoldi
DD-WRT User


Joined: 15 Oct 2016
Posts: 65

PostPosted: Sun Jan 31, 2021 17:12    Post subject: Reply with quote
@egc:
Was thinking about that proposal, but when I'll turn off the router at night, I'll turn off mains-power at the wall outlet. In this situation the router will have not chance of executing a "shutdown script"...

I'm trying to delet the files.db (located in /jffs/minidlna/) at startup but I don't know if the jffs mounts before the minidlna service is started.

@mwchang
cleaning and rebuilding the database via the web-gui works fine. The question is, how to run/start this procedure automatically on startup without needing to log into the web-gui and starting it manually.
The rebuild takes about 2...3 minutes in my case, so the time it takes is no problem for me.
egc
DD-WRT Guru


Joined: 18 Mar 2014
Posts: 7449
Location: Netherlands

PostPosted: Sun Jan 31, 2021 17:27    Post subject: Reply with quote
You are right about that.

You probably have to stop minidlna at startup, remove the database and then start it again.

Maybe with stopservice dlna /startservice dlna ?

Maybe just deleting the database when /jfss is up will work.
There is a utility on recent builds which you can use to wait until /jffs is mounted:
Code:
is-mounted.sh /jffs


# wait until directory is mounted and writable
# usage: is-mounted.sh /name-of directory
# default is /jffs

_________________
Routers:Netgear R7800, R6400v1, R6400v2, Linksys EA8500, EA6900 (XvortexCFE), E2000 (converted WRT320N), WRT54GS v1.
WireGuard Documents & Guides:https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=327397
OpenVPN Documents & Guides: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=327398
IPSET: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=327261
Install guide R6400v2:http://forum.dd-wrt.com/phpBB2/viewtopic.php?t=316399
Install guide R7800: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=320614
Forum Guide Lines (important read):https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=324087
PowerPoldi
DD-WRT User


Joined: 15 Oct 2016
Posts: 65

PostPosted: Thu Feb 04, 2021 17:39    Post subject: Reply with quote
Since the "is-mounted.sh" script is not implemented in the build im running, I've fiddled around with the timings. Here's what I've come up, and which seems to work for my needs. Ofcourse, this is just an early evaluation, so I'll keep watching in the near future.

My start-up script under "Administration --> Commands" looks like this:

stopservice dlna
sleep 5
rm /jffs/minidlna/files.db
sleep 5
startservice dlna
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Forum Index -> Broadcom SoC based Hardware All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum