Menu

#145 Non-destructive update rescan

Unstable (example)
open
nobody
None
5
2021-12-27
2015-05-21
Shrimpkin
No

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

1 Attachments

Discussion

  • Stuart Henderson

    This seems like a nice approach to me. Here's an updated version of the diff against git HEAD, with whitespace cleaned up.

     
  • Lévai Dániel

    Lévai Dániel - 2015-08-31

    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

     
  • Shrimpkin

    Shrimpkin - 2015-09-06

    @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.

     
  • TeHashX

    TeHashX - 2015-09-11
     
    • Shrimpkin

      Shrimpkin - 2015-10-12

      Thanks for posting your results. Didn't realize the patch was being used by many.

       
  • Shrimpkin

    Shrimpkin - 2015-10-12

    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
  • Stuart Henderson

    Nice, this updated version is cleaner still, and also working fine for me.

     
  • TeHashX

    TeHashX - 2015-10-13

    Thanks guys for such a great ideea, I didn't tried yet but I'm sure it's working fine.

     
  • Dave

    Dave - 2015-10-14

    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?

     
  • TeHashX

    TeHashX - 2015-10-14

    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?

     
  • Dave

    Dave - 2015-10-14

    On my nas WD MyCloud...

     
  • TeHashX

    TeHashX - 2015-10-14

    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

     
  • Dave

    Dave - 2015-10-16

    How Can I call this script?

     
  • wdog

    wdog - 2015-11-15

    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?

     
  • Shrimpkin

    Shrimpkin - 2015-11-16

    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.

     
  • TCC

    TCC - 2017-05-02

    Hi all,
    this usefull patch does not work anymore:
    Applying:
    patch -p1 < rescan_v2.patch

    Results in:

    ...
    patching file inotify.h
    Hunk #1 FAILED at 1.
    1 out of 1 hunk FAILED -- saving rejects to file inotify.h.rej
    ...
    

    'make' throws error of course.
    Does anybody have a clue ?
    Thx
    Gerry

     
  • Shrimpkin

    Shrimpkin - 2017-05-03

    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.

     
  • TCC

    TCC - 2017-05-03

    Thank you very much for taking care immediately. Highly appreciated !

    Best regards
    Gerry

     
  • Justin Maggard

    Justin Maggard - 2017-05-05

    I've pushed some changes largely based on this patchset. Please try with current git master code.

     
  • Shrimpkin

    Shrimpkin - 2017-06-09

    Looks like this patch made it. Thanks.

    Here is a fix for a minor issue with updateID. Only increments updateID on database changes.

     
  • Shrimpkin

    Shrimpkin - 2017-08-27

    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.

     
  • Martin H

    Martin H - 2017-12-09

    Please , how to apply patch?
    Thanks

     
    • Shrimpkin

      Shrimpkin - 2017-12-18

      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.

       
  • Sérgio M. Basto

    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

Log in to post a comment.