Menu

#172 Manual non-destructive rescan

Unstable (example)
open
nobody
None
5
2022-05-20
2017-10-13
Shrimpkin
No

Adds support for manual non-destructive rescan through signals. To automate rescans, add to job scheduler or script. Usage:

minidlnad -P /path/to/pidfile -U

Note: Path for pidfile is needed when not using default pidfile. Ordering of options is important. Disable inotify in config file (inotify=no), otherwise manual rescans requests will be ignored.

This patch is based on another patch of mine, updated for git head. I don't need this feature and have not tested much. Needs more testing.

See feature requests: 33, 68, 79.

1 Attachments

Discussion

  • fojtp

    fojtp - 2018-03-27

    Doesn't work:
    [2018/03/27 10:46:10] minidlna.c:173: warn: received signal 12, manual rescan
    [2018/03/27 10:46:10] minidlna.c:356: warn: Creating new database at /mnt/usb/minidlna/files.db

     
    • Shrimpkin

      Shrimpkin - 2018-03-27

      Make sure you have completed the initial scan and database build. Otherwise, the database will be rebuilt.

      Works for me:

      [2018/03/27 10:20:41] minidlna.c:173: warn: received signal 12, manual rescan
      [2018/03/27 10:20:41] scanner.c:856: info: Starting rescan
      [2018/03/27 10:20:41] scanner.c:834: debug: Removing /tmp/media/DeleteMe.mkv [file]
      [2018/03/27 10:20:41] playlist.c:135: warn: Parsing playlists...
      [2018/03/27 10:20:41] playlist.c:269: warn: Finished parsing playlists.
      [2018/03/27 10:20:41] scanner.c:890: info: Rescan completed. (changes found)
      [2018/03/27 10:20:53] minidlna.c:173: warn: received signal 12, manual rescan
      [2018/03/27 10:20:53] scanner.c:856: info: Starting rescan
      [2018/03/27 10:20:53] monitor.c:396: debug: Adding: /tmp/media/AddMe.mkv
      [2018/03/27 10:20:53] metadata.c:816: debug: Container: 'matroska,webm' [AddMe.mkv]
      [2018/03/27 10:20:53] albumart.c:258: debug: Found new embedded album art in AddMe.mkv
      [2018/03/27 10:20:53] playlist.c:135: warn: Parsing playlists...
      [2018/03/27 10:20:53] playlist.c:269: warn: Finished parsing playlists.
      [2018/03/27 10:20:53] scanner.c:890: info: Rescan completed. (changes found)
      
       
  • Shrimpkin

    Shrimpkin - 2018-03-27

    Updated patch (v2), add support for use with inotify. Includes small fix to use patch with current git. Usage is the same as OP except inotify can be set to yes.

    Briefly tested. If you have issues, post debug logs and how to duplicate the issue.

     
    • nero120

      nero120 - 2019-05-29

      Apologies if I'm being dumb, but when I attempt to apply this patch to v1.2.1 source I get errors:

          $ patch < manual-non-destructive-rescan_v2.patch
      
          patching file minidlna.c
          Hunk #1 succeeded at 166 (offset -45 lines).
          Hunk #2 succeeded at 870 with fuzz 2 (offset -53 lines).
          Hunk #3 succeeded at 915 (offset -71 lines).
          Hunk #4 succeeded at 925 (offset -71 lines).
          Hunk #5 FAILED at 1039.
          Hunk #6 succeeded at 998 with fuzz 2 (offset -66 lines).
          Hunk #7 FAILED at 1288.
          Hunk #8 succeeded at 1232 with fuzz 2 (offset -63 lines).
          2 out of 8 hunks FAILED -- saving rejects to file minidlna.c.rej
          patching file monitor.c
          Hunk #1 succeeded at 668 with fuzz 2 (offset -11 lines).
          Hunk #2 succeeded at 689 (offset -11 lines).
          Hunk #3 succeeded at 708 (offset -11 lines).
          Hunk #4 succeeded at 733 (offset -11 lines).
          patching file process.c
          Hunk #1 succeeded at 175 (offset -4 lines).
          Hunk #2 succeeded at 189 (offset -4 lines).
          patching file upnpglobalvars.c
          Hunk #1 FAILED at 58.
          1 out of 1 hunk FAILED -- saving rejects to file upnpglobalvars.c.rej
          patching file upnpglobalvars.h
          Hunk #1 succeeded at 180 (offset -6 lines).
          Hunk #2 FAILED at 203.
          1 out of 2 hunks FAILED -- saving rejects to file upnpglobalvars.h.rej
      

      Any ideas why the errors, this patch should work with v1.2.1 right?

       

      Last edit: nero120 2019-05-29
      • Shrimpkin

        Shrimpkin - 2019-05-30

        V2 is for git. Use the git version or use the first patch in OP for v1.2.1.

         
        👍
        1
  • fojtp

    fojtp - 2018-03-28

    ok, it works
    the problem was with folder which include BluRay Movie. when scan reach this folder, it never ended and database wasn't closed properly.

    thank you

     
  • fojtp

    fojtp - 2018-04-02

    1.2.1 + manual-non-destructive-rescan.patch
    rescan will not add subtitles (.srt file) when mkv file is already in database

     
    • Shrimpkin

      Shrimpkin - 2018-04-04

      The rescan feature works much like the scanner. minidlna only checks for subs when a video is added to db. A simple workaround is to touch a video file. minidlna will then readd the video to db and check for subs.

       
      • fojtp

        fojtp - 2018-04-05

        ok, but I can't use touch. Media directory is mounted read-only sshfs from other server over internet.

         
        • Shrimpkin

          Shrimpkin - 2018-04-05

          You can try this.

          diff --git a/utils.c b/utils.c
          index 294c1cd..9e8c258 100644
          --- a/utils.c
          +++ b/utils.c
          @@ -511,7 +511,7 @@ resolve_unknown_type(const char * path, media_types dir_type)
                          else if( S_ISREG(entry.st_mode) )
                          {
                                  media_types mtype = get_media_type(path);
          -                       if (dir_type & mtype)
          +                       if ((dir_type & mtype) || (mtype & TYPE_CAPTION))
                                          type = TYPE_FILE;
                          }
                  }
          
           
          • fojtp

            fojtp - 2018-04-09

            simple and works great, thank you

             
  • Sérgio M. Basto

    minidlnad -r is not enough ?

     
  • mrx23dot

    mrx23dot - 2022-05-20

    minidlnad -r / -R does nothing for me , see
    https://sourceforge.net/p/minidlna/bugs/344/

     

Log in to post a comment.