Search in sources :

Example 11 with Executable

use of org.fagu.fmv.core.exec.Executable in project fmv by f-agu.

the class ToExecutable method run.

/**
 * @see org.fagu.fmv.cli.Command#run(java.lang.String[])
 */
@Override
public void run(String[] args) {
    if (args.length != 1) {
        help();
        return;
    }
    String id = args[0];
    if (".".equals(id)) {
        environnement.setCurrentExecutable(null);
        return;
    }
    Optional<Identifiable> opt = BaseIdentifiable.findById(project, id);
    if (!opt.isPresent()) {
        println("ID not found: " + id);
        return;
    }
    Identifiable identifiable = opt.get();
    if (!(identifiable instanceof Executable)) {
        println("ID is not an executable: " + id);
        return;
    }
    Executable executable = (Executable) identifiable;
    environnement.setCurrentExecutable(executable);
}
Also used : Executable(org.fagu.fmv.core.exec.Executable) Identifiable(org.fagu.fmv.core.exec.Identifiable) BaseIdentifiable(org.fagu.fmv.core.exec.BaseIdentifiable)

Aggregations

Executable (org.fagu.fmv.core.exec.Executable)11 File (java.io.File)6 Source (org.fagu.fmv.core.exec.Source)4 ArrayList (java.util.ArrayList)3 FFMPEGExecutorBuilder (org.fagu.fmv.ffmpeg.executor.FFMPEGExecutorBuilder)3 FilterInput (org.fagu.fmv.ffmpeg.filter.FilterInput)3 InputProcessor (org.fagu.fmv.ffmpeg.operation.InputProcessor)3 OpenFile (org.fagu.fmv.cli.utils.OpenFile)2 BaseIdentifiable (org.fagu.fmv.core.exec.BaseIdentifiable)2 ConcatExecutable (org.fagu.fmv.core.exec.executable.ConcatExecutable)2 GenericExecutable (org.fagu.fmv.core.exec.executable.GenericExecutable)2 MovieMetadatas (org.fagu.fmv.ffmpeg.metadatas.MovieMetadatas)2 OutputProcessor (org.fagu.fmv.ffmpeg.operation.OutputProcessor)2 List (java.util.List)1 Collectors (java.util.stream.Collectors)1 Element (org.dom4j.Element)1 Alias (org.fagu.fmv.cli.annotation.Alias)1 Command (org.fagu.fmv.cli.annotation.Command)1 Printer (org.fagu.fmv.cli.utils.Printer)1 FilterExec (org.fagu.fmv.core.exec.FilterExec)1