Browse Source

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

master
Reinhard Pointner 4 years ago
parent
commit
cf48247601
  1. 2
      CHANGES.md
  2. 10
      source/net/filebot/HistorySpooler.java
  3. 8
      source/net/filebot/Main.java
  4. 7
      source/net/filebot/cli/ArgumentBean.java

2
CHANGES.md

@ -8,7 +8,7 @@ Next Release (4.8.6) @@ -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`)

10
source/net/filebot/HistorySpooler.java

@ -81,6 +81,7 @@ public final class HistorySpooler { @@ -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 { @@ -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());
}

8
source/net/filebot/Main.java

@ -75,7 +75,13 @@ public class Main { @@ -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");

7
source/net/filebot/cli/ArgumentBean.java

@ -153,6 +153,9 @@ public class ArgumentBean { @@ -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 { @@ -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();

Loading…
Cancel
Save