use of org.fagu.fmv.core.project.FileSource in project fmv by f-agu.
the class Info method run.
/**
* @see org.fagu.fmv.cli.Command#run(java.lang.String[])
*/
@Override
public void run(String[] args) {
if (args.length == 0) {
help();
return;
}
for (String arg : args) {
int num = NumberUtils.toInt(arg, -1);
if (num < 0) {
println("Source error: " + arg);
}
FileSource source = project.getSource(num);
File file = source.getFile();
println(file.getPath());
if (source.isImage()) {
display(source.getImageMetadatas(), DEFAULT_PADDING);
} else if (source.isAudioOrVideo()) {
display(source.getVideoMetadatas());
} else {
println(" undefined...");
}
}
}
use of org.fagu.fmv.core.project.FileSource in project fmv by f-agu.
the class ViewShift method view.
/**
*/
public void view() {
Integer lastView = project.getProperty(Properties.VIEW_LAST_MEDIA);
if (lastView == null) {
// getPrinter().println("last view not defined");
// return;
lastView = Integer.valueOf(0);
}
FileSource source = project.getSource(lastView);
getPrinter().println("Last view n°" + lastView + ": " + source.getFile().getName());
lastView = operator.applyAsInt(lastView);
super.run(new String[] { lastView.toString() });
}
use of org.fagu.fmv.core.project.FileSource in project fmv by f-agu.
the class Append method run.
/**
* @see org.fagu.fmv.cli.Command#run(java.lang.String[])
*/
@Override
public void run(String[] args) {
if (args.length == 0) {
getPrinter().println("usage: append <num-source> ...");
return;
}
int sourceNum = Integer.parseInt(args[0]);
FileSource source = project.getSource(sourceNum);
if (source.isAudioOrVideo()) {
appendAudioOrVideo(sourceNum, args);
} else if (source.isImage()) {
appendImage(sourceNum, args);
} else {
throw new IllegalStateException("Unknown file type: " + source.getFileType());
}
}
use of org.fagu.fmv.core.project.FileSource in project fmv by f-agu.
the class AppendLastView method run.
/**
* @see org.fagu.fmv.cli.Command#run(java.lang.String[])
*/
@Override
public void run(String[] args) {
if (args.length == 0) {
getPrinter().println("usage: appendlastview ...");
return;
}
Integer lastView = project.getProperty(Properties.VIEW_LAST_MEDIA);
if (lastView == null) {
getPrinter().println("last view not defined");
return;
}
FileSource source = project.getSource(lastView);
getPrinter().println("Last view n°" + lastView + ": " + source.getFile().getName());
String[] strs = new String[args.length + 1];
strs[0] = lastView.toString();
System.arraycopy(args, 0, strs, 1, args.length);
super.run(strs);
}
use of org.fagu.fmv.core.project.FileSource in project fmv by f-agu.
the class List method getFilter.
// *************************************************
/**
* @param args
* @return
*/
private Predicate<FileSource> getFilter(String[] args) {
CommandLine cmdLine = parse(args);
Predicate<FileSource> predicate = null;
for (final FileType fileType : FileType.values()) {
String name = fileType.name().toLowerCase();
if (cmdLine.hasOption(name)) {
Predicate<FileSource> tmp = fs -> fileType == fs.getFileType();
predicate = predicate == null ? tmp : predicate.or(tmp);
}
}
if (predicate == null) {
return s -> true;
}
return predicate;
}
Aggregations