stashapp / stash

An organizer for your porn, written in Go. Documentation: https://docs.stashapp.cc
https://stashapp.cc/
GNU Affero General Public License v3.0
9.34k stars 802 forks source link

Filesystem monitoring #191

Open ghost opened 5 years ago

ghost commented 5 years ago

Feature enhancement suggestion to implement filesystem monitoring.

The different platforms have APIs for monitoring the filesystem for changes. This allows you to watch a filesystem tree for renames, movement within the tree, deletions, additions, or other modifications. The nice thing is that it requires no polling to keep the file paths up to date. If a file is renamed, the app immediately gets and event and can update the database with minimal processing requirements.

There are, unfortunately, quite a few shortcomings, such as incompatible APIs between platforms, limits on the number of watches, no way of monitoring network shares, etc. That said, I still think it's worth checking out since it can make working with a collection much smoother.

There is a cross-platform library for go which supports linux/mac/windows. I haven't looked at the limitations of the mac/windows implementations, but hopefully it's not too bad: https://github.com/fsnotify/fsnotify

More info about the APIs: https://en.wikipedia.org/wiki/Inotify https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-readdirectorychangesw

Leopere commented 5 years ago

This would be good to double-check the changes that the tagging system has done what was requested of it.