use of org.fagu.fmv.mymedia.classify.movie.Movie in project fmv by f-agu.
the class MovieFinder method flushToMap.
// *****************************************
/**
* @see org.fagu.fmv.utils.file.FileFinder#flushToMap(java.util.List, java.util.function.Consumer)
*/
@Override
protected Future<Map<FileFound, InfosFile>> flushToMap(List<FileFound> buffer, Consumer<List<FileFound>> consumer) {
Map<FileFound, InfosFile> outMap = new LinkedHashMap<>(buffer.size());
for (FileFound fileFound : buffer) {
File file = fileFound.getFileFound();
try {
MovieMetadatas movieMetadatas = FFHelper.videoMetadatas(file);
Map<FileFound, InfosFile> flushMap = Collections.singletonMap(fileFound, new InfosFile(new Movie(file, movieMetadatas)));
outMap.putAll(flushMap);
if (consumer != null) {
consumer.accept(Collections.singletonList(fileFound));
}
afterFlush(flushMap);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return new DoneFuture<>(outMap);
}
Aggregations