Cloudbox / autoscan

Autoscan replaces the default Plex and Emby behaviour for picking up changes on the file system.
MIT License
611 stars 53 forks source link

Pre/Post hook/task #45

Closed camjac251 closed 3 years ago

camjac251 commented 3 years ago

Would it be possible to support pre/post hooks/task that run with new scan requests? I have to run Plexarr often to fix matches that Plex couldn't find and doing it on a schedule (cron) is possible but I was hoping to run it as soon as the autoscan task finished.

m-rots commented 3 years ago

Unfortunately Plex and Emby do not tell Autoscan when they have actually scanned the path we specified them to scan. Instead, both Plex and Emby queue the request and we are simply told whether this queuing process was successful.

Some background info: We initially wanted to know whether scans were successful by using Plex's web socket. However, the events didn't include the path to the folder, so we had no way of knowing whether Plex and Autoscan were talking about the same event.

camjac251 commented 3 years ago

Could it still be possible to add a hook? Maybe with a delay that would be long enough for Plex/Emby to finish the scan? Like --posthook /path/to/plexarr.sh --posthook /path/to/other.sh --posthookwait 30s

m-rots commented 3 years ago

No. We have no idea when Plex/Emby finish the scan. If things are already queued up, it could take hours. The wait time varies too much.