Hi,
I’m not yet using the Synology Indexer notification because I’m running the Master branch, but I had a bit of a look at the code on github. If I’m reading it correctly there are a couple of things that may result in undesirable or unintended behavior.
1. The directories in the file path are never indexed or confirmed as having been indexed.
The Synology Indexer database stores an absolute path to each sub-directory in the file path in a “directory” table. As well as an absolute path to the video file itself in the “video” table. If any sub-directory in the path is not in the “directory” table, the file will be inaccessible.
Example Scenario: User adds a new show telling Sonarr to “Create empty series folders”. Sonarr creates the folders, adds the show, downloads the episodes and places them in appropriate folders. Synology indexer is notified to add each episode file to the database.
Expected Result: User can access all episodes from chosen media player/device.
Actual Result: Entire series remains unlisted on media server.
2. Renaming triggers a re-indexing of the entire series folder.
This I assume is the intended behavior. However it has some side effects that may be unintended:
- If the series has many seasons and/or episodes this can take a long time even when only a small number of files have been renamed, as Synology Indexer will re-index all of them anyway.
- All episodes are effectively removed and re-added, this causes ALL the episodes in the series to be unavailable during this time.
Re-indexing is generally very time consuming on a Synology NAS. As an alternative Synology Indexer provides renaming options in the form:
-N new_dirpath old_dirpath
rename a dir
-n new_filepath old_filepath
rename a file
Finally I have a handful of general notes about Synology Indexer quirks.
-
I noticed you have an “UpdateLibrary()” function that runs " /usr/syno/bin/synoindex -R video". Please don’t ever use this for anything. For anyone with any kind of substantial collection this will cause days if not weeks of indexer activity and general mayhem as their series and episodes pop back in.
-
The obvious fix for #1 above is to run your “AddFolder” function on every sub-directory in the file path every time you add a file. Doing this however causes another problem. That is, any time a new file is downloaded it will re-add all the sub-directories to the index causing anyone who is watching ANY file in those directories to be disconnected. (This is the same problem as re-indexing the entire directory.)
-
Finally, Synology Indexer used to have an option for checking if a file or directory has already been indexed using the “-g” flag. However in recent versions this has been removed. An alternative to this is to query the database directly, I have my own solution for this, as I’m sure others do. If this interests you at all just let me know and I’d be happy to send it your way.
Apologies for the long winded post. I hope all of the above was clear. If you require any more information or clarification on the above points please let me know. Also as I noted at the top, I haven’t actually used your implementation of this as I’m still on the Master branch, so if I’ve misread/misinterpreted or otherwise made an error in the above, I apologise.
If you got this far, thank you for reading.
Cheers,
Igor.