Why is the minidlna database not being refreshed?

前端 未结 6 1527
执笔经年
执笔经年 2021-01-31 14:08

I am developing a MiniDLNA server to stream media over WiFi. Existing files are shown properly. However, when I add new files to media folders the changes are not updated acros

相关标签:
6条回答
  • 2021-01-31 14:42

    Resolved with crontab root

    10 * * * * /usr/bin/minidlnad -r
    
    0 讨论(0)
  • 2021-01-31 14:45

    In summary, the most reliable way to have MiniDLNA rescan all media files is by issuing the following set of commands:

    $ sudo minidlnad -R
    $ sudo service minidlna restart
    

    Client-side script to rescan server

    However, every so often MiniDLNA will be running on a server. Here is a client-side script to request a rescan on such a server:

    #!/usr/bin/env bash
    ssh -t server.on.lan 'sudo minidlnad -R && sudo service minidlna restart'
    
    0 讨论(0)
  • 2021-01-31 14:49

    MiniDLNA uses inotify, which is a functionality within the Linux kernel, used to discover changes in specific files and directories on the file system. To get it to work, you need inotify support enabled in your kernel.

    The notify_interval (notice the lack of a leading 'i'), as far as I can tell, is only used if you have inotify disabled. To use the notify_interval (ie. get the server to 'poll' the file system for changes instead of automatically being notified of them), you have to disable the inotify functionality.

    This is how it looks in my /etc/minidlna.conf:

    # set this to no to disable inotify monitoring to automatically discover new files
    # note: the default is yes
    inotify=yes
    

    Make sure that inotify is enabled in your kernel.

    If it's not enabled, and you don't want to enable it, a forced rescan is the way to force MiniDLNA to re-scan the drive.

    0 讨论(0)
  • 2021-01-31 14:55

    There is a patch for the sourcecode of minidlna at sourceforge available that does not make a full rescan, but a kind of incremental scan. That worked fine, but with some later version, the patch is broken. See here Link to SF

    Regards Gerry

    0 讨论(0)
  • 2021-01-31 15:01

    I have recently discovered that minidlna doesn't update the database if the media file is a hardlink. If you want these files to show up in the database, a full rescan is necessary.

    ex: If you have a file /home/movies/foo.mkv and a hardlink in /home/minidlna/video/foo.mkv, where '/home/minidlna' is your minidlna share, you will have to do a rescan till that file appears in the db (and subsequently your dlna client).

    I'm still trying to find a way around this. If anyone has any input, it's most welcome.

    0 讨论(0)
  • 2021-01-31 15:05

    AzP already provided most of the information, but some of it is incorrect.

    First of all, there is no such option inotify_interval. The only option that exists is notify_interval and has nothing to do with inotify.

    So to clarify, notify_interval controls how frequently the (mini)dlna server announces itself in the network. The default value of 895 means it will announce itself about once every 15 minutes, meaning clients will need at most 15 minutes to find the server. I personally use 1-5 minutes depending on client volatility in the network.

    In terms of getting minidlna to find files that have been added, there are two options:

    • The first is equivalent to removing the file files.db and consists in restarting minidlna while passing the -R argument, which forces a full rescan and builds the database from scratch. Since version 1.2.0 there's now also the -r argument which performs a rebuild action. This preserves any existing database and drops and adds old and new records, respectively.
    • The second is to rely on inotify events by setting inotify=yes and restarting minidlna. If inotify is set to =no, the only option to update the file database is the forced full rescan.

    Additionally, in order to have inotify working, the file-system must support inotify events, which is not the case in most remote file-systems. If you have minidlna running over NFS it will not see any inotify events because these are generated on the server side and not on the client.

    Finally, even if inotify is working and is supported by the file-system, the user under which minidlna is running must be able to read the file, otherwise it will not be able to retrieve necessary metadata. In this case, the logfile (usually /var/log/minidlna.log) should contain useful information.

    0 讨论(0)
提交回复
热议问题