Search in sources :

Example 1 with FindProgress

use of org.fagu.fmv.utils.file.FindProgress in project fmv by f-agu.

the class Bootstrap method findImage.

// ---------------------------------------------------
/**
 * @param saveFile
 * @param srcFiles
 * @return
 * @throws IOException
 */
private ImageFinder findImage(File saveFile, File... srcFiles) throws IOException {
    ImageFinder imagesFinder = new ImageFinder(saveFile);
    // imagesFinder.addListener(new FileFinderListener<Image>() {
    // 
    // private int count;
    // 
    // /**
    // * @see org.fagu.fmv.utils.file.FileFinderListener#eventFind(java.io.File, java.lang.Object)
    // */
    // @Override
    // public void eventFind(File file, Image image) {
    // ImageMetadatas metadatas = image.getMetadatas();
    // String model = metadatas.getDeviceModel();
    // String device = metadatas.getDevice();
    // 
    // System.out.println(count + ": " + file.getName() + " : " + device + ", " + model);
    // ++count;
    // }
    // });
    FindProgress findProgress = new FindProgress() {

        private TextProgressBar textProgressBar = TextProgressBar.newBar().fixWidth(40).withText("Finding images").buildForPrinting();

        /**
         * @see org.fagu.fmv.utils.file.FindProgress#progress(int, int)
         */
        @Override
        public void progress(int done, int total) {
            textProgressBar.print((100 * done) / total);
        }
    };
    imagesFinder.find(Arrays.asList(srcFiles), findProgress);
    return imagesFinder;
}
Also used : ImageFinder(org.fagu.fmv.mymedia.file.ImageFinder) TextProgressBar(org.fagu.fmv.textprogressbar.TextProgressBar) FindProgress(org.fagu.fmv.utils.file.FindProgress)

Aggregations

ImageFinder (org.fagu.fmv.mymedia.file.ImageFinder)1 TextProgressBar (org.fagu.fmv.textprogressbar.TextProgressBar)1 FindProgress (org.fagu.fmv.utils.file.FindProgress)1