Search in sources :

Example 1 with Printer

use of org.fagu.fmv.cli.utils.Printer in project fmv by f-agu.

the class Append method getConcatExecutable.

// ********************************************
/**
 * @return
 */
private ConcatExecutable getConcatExecutable() {
    Executable currentExecutable = environnement.getCurrentExecutable();
    if (currentExecutable != null && currentExecutable instanceof ConcatExecutable) {
        return (ConcatExecutable) currentExecutable;
    }
    List<ConcatExecutable> execs = BaseIdentifiable.stream(project).filter(id -> id instanceof ConcatExecutable).map(id -> (ConcatExecutable) id).collect(Collectors.toList());
    int size = execs.size();
    if (size == 0) {
        return new ConcatExecutable(project);
    }
    if (size == 1) {
        return execs.get(0);
    }
    Printer printer = getPrinter();
    printer.println("Too many executable.");
    printer.println("List all executables: execlist");
    printer.println("And select one: toexecutable <id>");
    return null;
}
Also used : Printer(org.fagu.fmv.cli.utils.Printer) CutExecutable(org.fagu.fmv.core.exec.executable.CutExecutable) ConcatExecutable(org.fagu.fmv.core.exec.executable.ConcatExecutable) Duration(org.fagu.fmv.utils.time.Duration) Collectors(java.util.stream.Collectors) Executable(org.fagu.fmv.core.exec.Executable) Command(org.fagu.fmv.cli.annotation.Command) List(java.util.List) Alias(org.fagu.fmv.cli.annotation.Alias) SourceSource(org.fagu.fmv.core.exec.source.SourceSource) Time(org.fagu.fmv.utils.time.Time) GenericExecutable(org.fagu.fmv.core.exec.executable.GenericExecutable) FileSource(org.fagu.fmv.core.project.FileSource) BaseIdentifiable(org.fagu.fmv.core.exec.BaseIdentifiable) ConcatExecutable(org.fagu.fmv.core.exec.executable.ConcatExecutable) CutExecutable(org.fagu.fmv.core.exec.executable.CutExecutable) ConcatExecutable(org.fagu.fmv.core.exec.executable.ConcatExecutable) Executable(org.fagu.fmv.core.exec.Executable) GenericExecutable(org.fagu.fmv.core.exec.executable.GenericExecutable) Printer(org.fagu.fmv.cli.utils.Printer)

Aggregations

List (java.util.List)1 Collectors (java.util.stream.Collectors)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 BaseIdentifiable (org.fagu.fmv.core.exec.BaseIdentifiable)1 Executable (org.fagu.fmv.core.exec.Executable)1 ConcatExecutable (org.fagu.fmv.core.exec.executable.ConcatExecutable)1 CutExecutable (org.fagu.fmv.core.exec.executable.CutExecutable)1 GenericExecutable (org.fagu.fmv.core.exec.executable.GenericExecutable)1 SourceSource (org.fagu.fmv.core.exec.source.SourceSource)1 FileSource (org.fagu.fmv.core.project.FileSource)1 Duration (org.fagu.fmv.utils.time.Duration)1 Time (org.fagu.fmv.utils.time.Time)1