1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-11-13 04:45:01 -05:00

Added -no-history and -clear-history CLI options

This commit is contained in:
Reinhard Pointner 2019-06-14 02:23:55 +07:00
parent 2553d11494
commit cf48247601
4 changed files with 25 additions and 2 deletions

View File

@ -8,7 +8,7 @@ Next Release (4.8.6)
* Evaluate `{closures}` automatically in `String.plus(Closure)` constructs (e.g. `{"[" + {n} + " " + {s00e00} + "]"}`)
* Ensure that `ActionPopup` is always displayed on top of the Windows Task Bar
* Improved `-mediainfo -exec` pipeline
* Added `-no-history` CLI option
* Added `-no-history` and `-clear-history` CLI options
* Allow dynamic code evaluation (e.g. `evaluate('/path/to/snippet.groovy' as File)`)
* Allow `@file.groovy` syntax in `Format Editor` and `Preset Editor` (e.g. `@/path/to/MyFormat.groovy`)
* Added `--mapper` option (e.g. `--mapper XEM.TheTVDB`)

View File

@ -81,6 +81,7 @@ public final class HistorySpooler {
channel.truncate(channel.position());
sessionHistory.clear();
sessionHistoryTotalSize = 0;
persistentHistoryTotalSize = history.totalSize();
}
}
@ -89,6 +90,15 @@ public final class HistorySpooler {
}
}
public synchronized void clear() throws IOException {
log.fine("* Delete " + persistentHistoryFile);
persistentHistoryFile.delete();
sessionHistory.clear();
sessionHistoryTotalSize = 0;
persistentHistoryTotalSize = 0;
}
public synchronized void append(Map<File, File> elements) {
append(elements.entrySet());
}

View File

@ -75,7 +75,13 @@ public class Main {
System.exit(SUCCESS);
}
if (args.clearCache() || args.clearUserData()) {
if (args.clearCache() || args.clearUserData() || args.clearHistory()) {
// clear persistent history
if (args.clearHistory) {
log.info("Reset history");
HistorySpooler.getInstance().clear();
}
// clear persistent user preferences
if (args.clearUserData()) {
log.info("Reset preferences");

View File

@ -153,6 +153,9 @@ public class ArgumentBean {
@Option(name = "-clear-prefs", usage = "Clear application settings")
public boolean clearPrefs = false;
@Option(name = "-clear-history", usage = "Clear application history")
public boolean clearHistory = false;
@Option(name = "-version", usage = "Print version identifier")
public boolean version = false;
@ -189,6 +192,10 @@ public class ArgumentBean {
return clearPrefs;
}
public boolean clearHistory() {
return clearHistory;
}
public List<File> getFiles(boolean resolveFolders) throws Exception {
if (arguments == null || arguments.isEmpty()) {
return emptyList();