1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-11-17 23:05:03 -05:00

Print lines as we go along (instead of all at the end) when calling -mediainfo on many files

This commit is contained in:
Reinhard Pointner 2016-05-29 04:24:30 +08:00
parent d1691f5718
commit 369574a9aa

View File

@ -70,6 +70,7 @@ import net.filebot.subtitle.SubtitleFormat;
import net.filebot.subtitle.SubtitleNaming; import net.filebot.subtitle.SubtitleNaming;
import net.filebot.util.EntryList; import net.filebot.util.EntryList;
import net.filebot.util.FileUtilities.ParentFilter; import net.filebot.util.FileUtilities.ParentFilter;
import net.filebot.util.FunctionList;
import net.filebot.vfs.FileInfo; import net.filebot.vfs.FileInfo;
import net.filebot.vfs.MemoryFile; import net.filebot.vfs.MemoryFile;
import net.filebot.vfs.SimpleFileInfo; import net.filebot.vfs.SimpleFileInfo;
@ -1057,14 +1058,9 @@ public class CmdlineOperations implements CmdlineInterface {
@Override @Override
public List<String> getMediaInfo(Collection<File> files, String format, String filter) throws Exception { public List<String> getMediaInfo(Collection<File> files, String format, String filter) throws Exception {
ExpressionFormat formatter = new ExpressionFormat(format != null && format.length() > 0 ? format : "{fn} [{resolution} {vc} {channels} {ac} {minutes+'m'}]"); ExpressionFormat formatter = new ExpressionFormat(format != null && format.length() > 0 ? format : "{fn} [{resolution} {vc} {channels} {ac} {minutes+'m'}]");
FileFilter fileFilter = filter == null || filter.isEmpty() ? f -> true : new ExpressionFileFilter(new ExpressionFilter(filter), false); List<File> selection = filter(files, filter == null || filter.isEmpty() ? f -> true : new ExpressionFileFilter(new ExpressionFilter(filter), false));
List<String> output = new ArrayList<String>(); return new FunctionList<File, String>(selection, f -> formatter.format(new MediaBindingBean(xattr.getMetaInfo(f), f, null)));
for (File file : filter(files, fileFilter)) {
String line = formatter.format(new MediaBindingBean(xattr.getMetaInfo(file), file, null));
output.add(line);
}
return output;
} }
@Override @Override