use of com.github.hakko.musiccabinet.io.LibraryScanner in project musiccabinet by hakko.
the class LibraryScannerService method update.
public void update(Set<String> paths, boolean isRootPaths) throws ApplicationException {
isLibraryBeingScanned = true;
try {
clearImport();
startReceivingServices();
Set<String> rootPaths = getRootPaths(paths);
for (String path : rootPaths) {
Files.walkFileTree(Paths.get(path), new LibraryScanner(libraryPresenceChannel));
}
if (isRootPaths) {
libraryPresenceChannel.send(msg(null, rootPaths, new HashSet<File>()));
}
libraryPresenceChannel.send(FINISHED_MESSAGE);
workerThreads.await();
updateLibrary();
} catch (IOException | InterruptedException e) {
throw new ApplicationException("Scanning aborted due to error!", e);
}
isLibraryBeingScanned = false;
}
Aggregations