Bug 259953 - net/minidlna: rescan support/fix
Summary: net/minidlna: rescan support/fix
Status: Open
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Gleb Smirnoff
URL:
Keywords: needs-patch, needs-qa
Depends on:
Blocks:
 
Reported: 2021-11-20 18:48 UTC by gerrit
Modified: 2021-12-08 23:44 UTC (History)
3 users (show)

See Also:


Attachments
Proposed patch to rectify rescan/rebuild commands (470 bytes, text/plain)
2021-11-24 07:50 UTC, gerrit
no flags Details
patch with correct PREFIX path added (470 bytes, text/plain)
2021-11-24 07:54 UTC, gerrit
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description gerrit 2021-11-20 18:48:42 UTC
minidlna comes with a "rescan" command for rc.d. However, this reads

rescan_cmd="$command -R -u $minidlna_uid -f /usr/local/etc/minidlna.conf"

This is in line with the manpage, but obviously wrong when comparing to the commandline help (minidlnad -h):

        -r forces a rescan
        -R forces a rebuild

So "-R" forces a rebuild of the database while a rescan uses "-r". I verified that this is what is actually happening by checking the database file and the time each command takes (rescan is fast and just adds new stuff, rebuild takes much longer and also removed outdated entries). Thus I propose to change the rc.d script to contain

extra_commands="rescan rebuild"
rescan_cmd="$command -r -u $minidlna_uid -f /usr/local/etc/minidlna.conf"
rebuild_cmd="$command -R -u $minidlna_uid -f /usr/local/etc/minidlna.conf"

Furthermore, as this is not handled via signals on the running process, it might be useful to force a stop command before doing either rescan or rebuild.
Comment 1 gerrit 2021-11-24 07:50:18 UTC
Created attachment 229687 [details]
Proposed patch to rectify rescan/rebuild commands

Add proposed patch (so far without forcing stop).
Comment 2 gerrit 2021-11-24 07:51:15 UTC
Comment on attachment 229687 [details]
Proposed patch to rectify rescan/rebuild commands

>--- minidlna.in~	2021-11-24 08:46:30.000000000 +0100
>+++ minidlna.in	2021-11-24 08:47:17.757510000 +0100
>@@ -27,7 +27,8 @@
> start_precmd="install -d -o $minidlna_uid ${pidfile%/*} /var/db/minidlna"
> stop_postcmd="rm -f $pidfile"
> 
>-extra_commands=rescan
>+extra_commands="rescan rebuild"
>+rescan_cmd="$command -r -u $minidlna_uid -f %%PREFIX%%/etc/minidlna.conf"
> rescan_cmd="$command -R -u $minidlna_uid -f %%PREFIX%%/etc/minidlna.conf"
> 
> run_rc_command $1
Comment 3 gerrit 2021-11-24 07:54:34 UTC
Created attachment 229688 [details]
patch with correct PREFIX path added

Sorry for messing up the patch creation before, hopefully this will work now. ;-)
Comment 4 gerrit 2021-11-24 08:07:57 UTC
For the record: There is an open request for minidlna to support signal for rescan unter
https://sourceforge.net/p/minidlna/patches/172/

However, it looks like this hasn't made it into any release, yet.