Non-destructive update rescan
Brought to you by:
jmaggard
There could be a patch for this but I couldn't find it. I found a partial attempt (patch #54) and a fork minidlna-fastscan which still rebuilds the database on rescan. I took a different approach.
Adds [-r] option to rescan without rebuilding the database:
-r forces a rescan
-R forces a rebuild
NOTE: On rescan, any directories and files which cannot be access are removed. Any files with different timestamps are removed, then reinserted. New files and directories are added as long as they are readable.
Several requests to add a rescan interval option but IMO would fork the existing code too much.
This patch needs further testing.
patch -p1 < rescan.diff
This seems like a nice approach to me. Here's an updated version of the diff against git HEAD, with whitespace cleaned up.
I applied this about a month ago, and have been using it on OpenBSD.
I've been constantly restarting minidlna, so this saved me a lot of time, and couldn't notice any missing or duplicate entries, but that's about all that I done, so I don't know if there are any corner cases where something should fail.
Daniel
@Stuart: Thanks for the update and fixing the whitespace. Sometimes I forget to change my vim settings.
@Levai: Thanks for posting your results. I've been using a version of this patch since the end of 2014. Haven't encountered any bugs but my collection consists of flac, mkv files with embedded metadata.
Thanks for the patch, works fine here
https://www.hqt.ro/minidlna-media-server-with-thumbnails-through-optware-ng/
Thanks for posting your results. Didn't realize the patch was being used by many.
Here is an updated patch (v2) of this feature which cleans up the code a little bit. Also, it removes the duplicate inotify code by modifying the existing inotify code.
Last edit: Shrimpkin 2015-10-12
Nice, this updated version is cleaner still, and also working fine for me.
Thanks guys for such a great ideea, I didn't tried yet but I'm sure it's working fine.
How the script can be launch? Does this patch will fix my problem if I move a file to another folder will be visible in my smarttv?
This script is not launched, you have to download minidlna source code, apply this patch and compile minidlna.
Where do you use minidlna, on a nas, linux pc, router?
On my nas WD MyCloud...
Yes, this patch will fix the problem if you move a file to another folder...
Try this steps to compile with non-desctructive patch or ask someone to do this for you, I don't have a WD MyCloud nas, sorry.
http://community.wd.com/t5/My-Cloud-EX2/Compile-and-install-Minidlna/td-p/906358
How Can I call this script?
hi all
i've patched the latest release 1.1.5 and compiled, but stop and start of the service always recreates the db.
I've added the -r and removed -R
minidlnad -r -f /root/.minidlna/minidlna.conf
what I am doing wrong?
The rescan [-r] option will not override minidlna default re(build) behavior. If minidlna detects an error with the database and in a few other cases will rebuild the database regardless of the [-r] option.
You will need to run in debug mode and see why it's failing the initial build.
Hi all,
this usefull patch does not work anymore:
Applying:
patch -p1 < rescan_v2.patch
Results in:
'make' throws error of course.
Does anybody have a clue ?
Thx
Gerry
A few minor changes were made in git (after v1.1.6) that broke the patch. I was waiting to see what other changes were going to be made before posting an updated patch. Until then, this should work.
Apply this patch before applying rescan_v2.patch.
Thank you very much for taking care immediately. Highly appreciated !
Best regards
Gerry
I've pushed some changes largely based on this patchset. Please try with current git master code.
Looks like this patch made it. Thanks.
Here is a fix for a minor issue with updateID. Only increments updateID on database changes.
There is an updateID fix in current version/git and the above patch is no longer needed.
Also, there are some additional fixes to the inotify code which the rescan feature depends on. So use current version or git.
Please , how to apply patch?
Thanks
You don't... use v1.2 or later.
If you want to use earlier version:
1) download patch.
2) download and extract source.
3) use patch command.
4) compile and install.
Search online for patch and compiling tutorials.
yeah this is already available on minidlna
50b1a2e 2017-08-23 23:43 Justin Maggard scanner: Clean up non-destructive rescan
49aa42d 2017-05-04 23:29 Justin Maggard scanner: Add non-destructive update rescan
Last edit: Sérgio M. Basto 2021-12-27