(2012-03-30 11:24)paddycarey Wrote: One option might be to use the JSON api to get a list of all the configured shares (pretty sure this can be done) and then attempt to write/delete/touch/whatever a small file on each one to make sure they're up. This obviously requires having write access to the shares.
Does the JSON API give a different response when attempting to list a share if it's down as opposed to empty? If so then that would be one simple way to implement this.
I checked the JSON API, you get the path and label for each source; no information on if it is accessible. Although this is a good way to find the available source paths, the problem still remains that this won't fix the cleanDB issue. Examine the following pseudo code:
if source exists
run libraryupdate on given path
Seems pretty simple right? Well the advancedsettings cleanonupdate entry is going to try to clean the library after each of those "run libraryupdate" commands. So even if only 1 out of 4 sources is connected, the clean DB process is going to run and wipe out the other three.
This method of updating the database is also highly inefficient. The default UpdateLibrary(video) command will go through all the sources first, then execute the clean command (based on your advanced settings entry). The code above will run the UpdateLibrary(video,path) command on each path separately, and then run the clean command after each individual update. Updating your library with 2 sources would require waiting through an entire clean operation between each path update.
I do have an alternate solution. Since it is really the clean update command, not the update library command, that is removing these sources. Why not check if your paths exist before running the clean command instead? It is doable for the Auto Update addon to check your sources for connectivity and then run a clean operation. If all of your sources aren't connected, the clean operation doesn't run and you don't lose your stuff. This would also get rid of the need for the advancedsettings entry.
Does this sound like a workable solution?