mirror of
https://github.com/mitb-archive/filebot
synced 2024-12-23 08:18:52 -05:00
Streamify -mediainfo and -list commands to make them more responsive when used on the command-line on large datasets
This commit is contained in:
parent
9e13e1928e
commit
f95689b5a1
@ -220,8 +220,8 @@ public class ArgumentBean {
|
|||||||
return filter == null ? null : new ExpressionFilter(filter);
|
return filter == null ? null : new ExpressionFilter(filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
public FileFilter getExpressionFileFilter() throws Exception {
|
public FileFilter getFileFilter() throws Exception {
|
||||||
return filter == null ? null : new ExpressionFileFilter(filter);
|
return filter == null ? FILES : new ExpressionFileFilter(filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Datasource getDatasource() {
|
public Datasource getDatasource() {
|
||||||
|
@ -60,12 +60,12 @@ public class ArgumentProcessor {
|
|||||||
|
|
||||||
// print media info
|
// print media info
|
||||||
if (args.mediaInfo) {
|
if (args.mediaInfo) {
|
||||||
return print(cli.getMediaInfo(args.getFiles(true), args.getExpressionFileFilter(), args.getExpressionFormat()));
|
return print(cli.getMediaInfo(args.getFiles(true), args.getFileFilter(), args.getExpressionFormat()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// revert files
|
// revert files
|
||||||
if (args.revert) {
|
if (args.revert) {
|
||||||
return cli.revert(args.getFiles(false), args.getExpressionFileFilter(), args.getRenameAction()).isEmpty() ? 1 : 0;
|
return cli.revert(args.getFiles(false), args.getFileFilter(), args.getRenameAction()).isEmpty() ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// file operations
|
// file operations
|
||||||
|
@ -1030,11 +1030,6 @@ public class CmdlineOperations implements CmdlineInterface {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Stream<String> getMediaInfo(Collection<File> files, FileFilter filter, ExpressionFormat format) throws Exception {
|
public Stream<String> getMediaInfo(Collection<File> files, FileFilter filter, ExpressionFormat format) throws Exception {
|
||||||
// use default file filter
|
|
||||||
if (filter == null) {
|
|
||||||
return getMediaInfo(files, FILES, format);
|
|
||||||
}
|
|
||||||
|
|
||||||
// use default expression format if not set
|
// use default expression format if not set
|
||||||
if (format == null) {
|
if (format == null) {
|
||||||
return getMediaInfo(files, filter, new ExpressionFormat("{fn} [{resolution} {vc} {channels} {ac} {minutes}m]"));
|
return getMediaInfo(files, filter, new ExpressionFormat("{fn} [{resolution} {vc} {channels} {ac} {minutes}m]"));
|
||||||
@ -1062,7 +1057,7 @@ public class CmdlineOperations implements CmdlineInterface {
|
|||||||
return history.entrySet().stream().filter(it -> {
|
return history.entrySet().stream().filter(it -> {
|
||||||
File original = it.getKey();
|
File original = it.getKey();
|
||||||
File current = it.getValue();
|
File current = it.getValue();
|
||||||
return Stream.of(current, original).flatMap(f -> listPath(f).stream()).anyMatch(whitelist::contains) && current.exists() && (filter == null || filter.accept(current));
|
return Stream.of(current, original).flatMap(f -> listPath(f).stream()).anyMatch(whitelist::contains) && current.exists() && filter.accept(current);
|
||||||
}).map(it -> {
|
}).map(it -> {
|
||||||
File original = it.getKey();
|
File original = it.getKey();
|
||||||
File current = it.getValue();
|
File current = it.getValue();
|
||||||
|
@ -437,7 +437,7 @@ public abstract class ScriptShellBaseClass extends Script {
|
|||||||
ArgumentBean args = getArgumentBean(parameters);
|
ArgumentBean args = getArgumentBean(parameters);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return getCLI().getMediaInfo(files, args.getExpressionFileFilter(), args.getExpressionFormat());
|
return getCLI().getMediaInfo(files, args.getFileFilter(), args.getExpressionFormat());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
printException(e);
|
printException(e);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user