Synology – automatic indexing via synoindex

To my knowledge, no DiskStation model currently exists where the kernel supports inotify. This represents a huge problem for people who have custom scripts to add multimedia to your DiskStations. While the DiskStations media indexer supports automatic indexing of files being added via SMB, AFP or FTP, it is not aware if you move or copy files via SSH/Telnet on the DiskStation directly.

I have therefore written the Synology Media Indexer which is a simple perl-script which scans your video directory and adds new video-files to the indexer. The indexing is lighting fast as only new files get added (compared to the full reindex of all media if you use the “Reindex”-function in the admin interface).

The script will scan the video directory for modified files over the last two days and will then query the synoindex-service if the file was already indexed. If the file does not exist in the index database, the script will manually add it for immediate indexing.

I have included my most common media types in the script, but if I missed something, you are welcome to extend the script (and let me know what types I have missed). The script itself is easy to read, and I suggest you go through the code as there might be minor tweaks you want to make.



VN:F [1.9.17_1161]
Rating: 10.0/10 (1 vote cast)
VN:F [1.9.17_1161]
Rating: +1 (from 1 vote)
Synology - automatic indexing via synoindex, 10.0 out of 10 based on 1 rating
  • Pingback: Infographic - most popular content | naschenweng.info

  • Xavier

    Hi,
    Gret idea but how to install it?
    How this can be extended to all directory (music, photo, video, doc…
    Thanks to the one who can help me on this

    • http://www.naschenweng.info/ Gerd Naschenweng

      Have a look at the script itself – has all the instructions and you can adjust it to extend it to other dirs too.

  • Xavier

    I get this error when I run the script.
    No idea if the script indexed the files or not.
    Can’t call method “entry” on an undefined value at update-syno.sh line 80
    Any idea what needs to be corrected.?
    Thx

    • http://www.naschenweng.info/ Gerd Naschenweng

      When you open the script you need to adjust the path on line 31 to where you placed the Logging folder:
      use lib qw(/volume1/Extensions/scripts);

  • GL

    Hi Gerd,

    Thanks for the great script. I just tested it out on the command line and it quickly addeda couple of new movie files that I copied over a mounted NFS from Fedora.

    One change I had to make was to comment out all the logging as I was getting the following error:
    Can’t locate Logging/Log.pm in @INC (@INC contains: /volume1/Extensions/scripts /usr/lib/perl5/5.8.6/MARVELL_88F6281 /usr/lib/perl5/5.8.6 /usr/lib/perl5/site_perl/5.8.6/MARVELL_88F6281 /usr/lib/perl5/site_perl/5.8.6 /usr/lib/perl5/site_perl .) at update-syno.sh line 32.
    BEGIN failed–compilation aborted at update-syno.sh line 32.

    Did you have to do any additional configuration or did you have to install the logging module?

    perl -v
    This is perl, v5.8.6 built for MARVELL_88F6281

    • http://www.naschenweng.info/ Gerd Naschenweng

      When you open the script you need to adjust the path on line 31 to where you placed the Logging folder:use lib qw(/volume1/Extensions/scripts);

      • Xmg67fr

        Thank you Gerd,
        Well I commented all looging references but now this is what I get :
        perl update-syno.sh /volume1/video
        WARNING:  nonstandard use of \ in a string literal
        LINE 1: … * FROM video WHERE fs_online = ‘t’ AND path like ‘/volume1/…
                                                                     ^
        HINT:  Use the escape string syntax for backslashes, e.g., E’\’.
        WARNING:  nonstandard use of \ in a string literal
        LINE 1: … * FROM video WHERE fs_online = ‘t’ AND path like ‘/volume1/…
                                                                     ^
        HINT:  Use the escape string syntax for backslashes, e.g., E’\’.
        WARNING:  nonstandard use of \ in a string literal
        LINE 1: … * FROM video WHERE fs_online = ‘t’ AND path like ‘/volume1/…
                                                                     ^
        HINT:  Use the escape string syntax for backslashes, e.g., E’\’.
        Can’t call method “entry” on an undefined value at update-syno.sh line 82.I am really lost and not a professional on this.Sorry. Little help would be welcome

  • Pingback: Sync iTunes music & playlists with Synology Diskstation « tech.log

  • chris

    great script.
    Only a little problem with the @eadir:disqus  folders. but very nice!

    thx a lot.chris