Search in sources :

Example 1 with FileFound

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

the class Bootstrap method findMovie.

// ---------------------------------------------------
/**
 */
private MovieFinder findMovie(File saveFile, File... srcFiles) throws IOException {
    MovieFinder movieFinder = new MovieFinder(saveFile);
    movieFinder.addInfoFile(new VolumeInfoFile());
    movieFinder.addListener(new FileFinderListener<Movie>() {

        private int count;

        /**
         * @see org.fagu.fmv.utils.file.FileFinderListener#eventFindPre(org.fagu.fmv.utils.file.FileFinder.FileFound)
         */
        @Override
        public void eventFindPre(FileFound fileFound) {
            System.out.println(count + ": " + fileFound.getFileFound().getName());
            ++count;
        }

        /**
         * @see org.fagu.fmv.utils.file.FileFinderListener#eventFindPost(FileFound, java.lang.Object)
         */
        @Override
        public void eventFindPost(FileFound fileFound, FileFinder<Movie>.InfosFile infosFile) {
            Movie movie = infosFile.getMain();
            MovieMetadatas videoMetadatas = movie.getMetadatas();
            // Format format = videoMetadatas.getFormat();
            VideoStream videoStream = videoMetadatas.getVideoStream();
            Rotation rotate = videoStream.rotate();
            // System.out.println(count + ": " + file.getName() + " " + infos); // .getFormat().creationDate()
            System.out.println("   " + rotate + ", " + videoStream.handlerName());
        }
    });
    for (File srcFile : srcFiles) {
        movieFinder.find(srcFile);
    }
    return movieFinder;
}
Also used : VideoStream(org.fagu.fmv.ffmpeg.metadatas.VideoStream) FileFinder(org.fagu.fmv.utils.file.FileFinder) Rotation(org.fagu.fmv.utils.media.Rotation) MovieMetadatas(org.fagu.fmv.ffmpeg.metadatas.MovieMetadatas) MovieFinder(org.fagu.fmv.mymedia.file.MovieFinder) FileFound(org.fagu.fmv.utils.file.FileFinder.FileFound) File(java.io.File)

Aggregations

File (java.io.File)1 MovieMetadatas (org.fagu.fmv.ffmpeg.metadatas.MovieMetadatas)1 VideoStream (org.fagu.fmv.ffmpeg.metadatas.VideoStream)1 MovieFinder (org.fagu.fmv.mymedia.file.MovieFinder)1 FileFinder (org.fagu.fmv.utils.file.FileFinder)1 FileFound (org.fagu.fmv.utils.file.FileFinder.FileFound)1 Rotation (org.fagu.fmv.utils.media.Rotation)1