Minidlna, how to use "merge_media_dirs=yes"?

Minidlna on Raspberry Pi seems to miss a feature normally found on other platforms, namely the ability to merge folders as seen by the upnp control point.

The configuration of minidlna is normally done in a "minidlna.conf" file found somewhere on the system.
The OpenWrt version of minidlna for Raspberry Pi seems to create /tmp/minidlna.conf when /etc/init.d/minidlna reads variables from /etc/config/minidlna and writes the variables into /tmp/minidlna.conf.
The problem seems to be, that neither /etc/init.d/minidlna nor /etc/config/minidlna knows anything about the variable "merge_media_dirs" which then defaults to "no".

Has anyone had succes making "merge_media_dirs=yes" work?

Well, the function "merge_media_dirs" do actually work. But it slows down significantly the proces of updating the library at boot, which is probably the reason why the function is not included in the scripts and the LuCI interface. Here is a temporary solution using ssh. Have in mind it won't survive a reboot/powercycle, and you must be able to use command line tools.

Log in to openwrt using PuTTY or some other ssh client.
Use the ps command to locate the /usr/bin/minidlna proces and stop it with the kill command.
Copy the minidlna.conf file to a place where it will not be overwritten by the normal bootproces: "cp /tmp/minidlna.conf /etc/minidlna.conf".
Use vi to edit /etc/minidlna.conf, insert "merge_media_dirs=yes" somewhere.
Start minidlna again typing: "/usr/bin/minidlna -f /etc/minidlna.conf". This forces minidlna to read the merge parameter.

In my case, the merging operation was slowed by approx 3 minutes, updating an approx 1.000 files library from a usb-sata disk. (Usb-sticks, SD-cards and the like will of course be slower).

In order to make it survive a reboot one probably have to insert something in the /etc/init.d and /etc/config files so the parameter will be included when the start scripts create /tmp/minidlna.conf. But even so, it will take an update of LuCI to make the parameter visible there.

It seems that minidlna handles configuration a little different under openwrt than other other systems do.
have minidlna call configuration parameters from /tmp/minidlna.conf
Before this happens, the init script reads variables from
and then use these variables to construct /tmp/minidlna.conf
The latter file is overwritten at each start, so you can't make permanent changes by editing /tmp/minidlna.conf

The trick is to edit /etc/init.d/mindilna. After the line:
minidlna_cfg_addstr $cfg root_container '.'
ad a line:
minidlna_cfg_addstr $cfg merge_media_dirs 'yes'

This sets the merge function as default.

Should you regret, add a line to /etc/config/minidlna:
option merge_media_dirs=no