File monitor and auto-indexer for Synology DiskStation NAS.
I'm using this on a DS213j, but I expect it may work on other models as well (DS214+ was reported successfully for one).
- Install Python from the DiskStation package manager.
SSH into your DiskStation as root (e.g.
ssh root@192.168.1.20
-- use the right IP address for your DiskStation) and install pyinotify:cd /root/ wget https://pypi.python.org/packages/source/p/pyinotify/pyinotify-0.9.4.tar.gz tar -xzvf pyinotify-0.9.4.tar.gz cd pyinotify-0.9.4/ python setup.py install
- Copy
mediamon.py
to the DiskStation's/root/
directory (scp mediamon.py root@192.168.1.20:/root/
). - Copy
S99mediamon.sh
to the DiskStation's/usr/syno/etc/rc.d/
directory (scp S99mediamon.sh root@192.168.1.20:/usr/syno/etc/rc.d/
). - SSH into the DiskStation again and run
chmod 755 /usr/syno/etc/rc.d/S99mediamon.sh
, then/usr/syno/etc/rc.d/S99mediamon.sh start
to start up the monitor. - Add some media files to
/volume1/photo
,/volume1/music
, or/volume1/video
, and check the log at/var/log/mediamon.log
to verify that it's working. You should see asynoindex -a
entry for each added file.
Note: To change the default watched folders, you can add /etc/mediamon/mediamon.ini (adapt to your needs):
[main]
# logging file logfile = /var/log/mediamon.log # pid file pidfile = /var/run/mediamon.pid # list of space separated paths to watch watched_paths = /volume1/video /volume1/tech-conf /volume1/foobar # list of space separated allowed extensions allowed_exts = jpg jpeg png tga gif bmp ogg ogv mp4 avi m4v # excluded pattern filter exclude_dir_patterns = @eaDir .sync .stfolder
I've noticed I have to repeat steps 2-5 after any DSM upgrade. There may be a way to avoid this by placing files in some other location that isn't wiped out by DSM upgrades, but so far I haven't looked into it. I don't think S99mediamon.sh
would work to restart the monitor after reboot if placed anywhere else.
Suggestions, improvements, bug reports or pull requests welcome!
Based on a blog post.