xbmc/xbmc — pull request #5530 by Montellese (2014-10-18 23:54:03+00:00)
Title: improve handling of unavailable remote sources during library scanning/cleaning

This is an improvement of #4304 and it improves the way we handle unavailable remote sources during library scanning and cleaning. Right now if the remote server on which a source is located isn't online we constantly call `CFile::Exists()` and `CDirectory::Exists()` on every path which we know from the remote source and on every call we run into a timeout which slows the whole process down a lot.

The idea here is to first go through all available sources and check if they are available or not. During **library scanning** (both video and music), if one of the sources is not available we ask the user if he wants to retry accessing the source or if he wants to skip it completely. Once skip has been chosen we do not call `CFile::Exists()` or `CDirectory::Exists()` on any sub-path of the skipped source and therefore greatly reduce the number of times we run into the timeout from `X` to `1`. During **library cleaning** (only video) we take the same approach but we ask the user if he wants to keep all the items from that source or if he wants to delete them all. Once again we greatly reduce the number of times we run into the timeout.

I have to admit that `CVideoDatabase::CleanDatabase()` is getting uglier and uglier and it might be best to re-think the process in there and re-write it completely. So if we feel safer with only the library scanning improvements I'd be happy to split the PR into two. Also the library scanning changes almost match the ones from #4304 except that #4304 checked all sources and not just the ones that were actually being scanned.