Cloudbox / autoscan

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

On download triggers: verify the media file is present before scanning #201

Closed buroa closed 1 year ago

buroa commented 1 year ago

This will allow common syncing issues and potentially notify Plex faster than waiting on some arbitrary minimum-age.

m-rots commented 1 year ago

Autoscan used to perform file-checking in combination with the retries and minimum-age fields back in the pre-1.0 days. However, in #34, we removed the file presence check for a couple reasons:

  1. Plex takes a folder path as input, so storing the file paths is redundant.
  2. The minimum-age field was carried over from the original idea behind Plex Autoscan: grouping multiple changes together to minimise the number of scans Plex performs, reducing the number of API calls made to Google Drive by Rclone.
  3. Bernard, our Google Drive trigger at the time, had issues with providing file paths.
  4. We wanted Autoscan to not have to rely on the file system to make for an easier general Docker configuration (e.g. the added complexity of mounts) and allow for more flexibility in the rewriting rules of paths.

In the general case though, the speed at which Plex and other targets are notified is unchanged. In a setup where files are immediately available on the file-system when Autoscan is notified of their existence, a scan can be sent right away with a minimum-age of 0s. However, such a minimum-age would disable the grouping behaviour, which is undesirable. With and without file existence checking, a minimum-age of e.g. 5m would perform exactly the same. The only setups which suffer from the lack of file existence checking are network-shares, not including Google Drive through Rclone, but including e.g. SMB and NFS. Here the minimum-age should not only take the grouping behaviour into account, but also the maximum time it takes for a file to become available on the remote-side of these network shares. However, we think only a minor percentage of users have such setups, so we decided that the file existence checking wasn't worth it.

I'm curious to hear about any common syncing issues you're experiencing. In the meanwhile, I'm closing this issue.

buroa commented 1 year ago

I implemented it myself: https://github.com/buroa/autoscan/commit/452a1392a2ca7104088bd3bb3a22db37b26529d5