forked from j62/ctbrec
Add config setting for the number post-processing threads
This commit is contained in:
parent
ff9ff8f40f
commit
d716354dc1
|
@ -3,6 +3,7 @@
|
||||||
* Filter terms can now be negated by prepending them with a "!"
|
* Filter terms can now be negated by prepending them with a "!"
|
||||||
* Added pinning for recordings. Pinned recordings cannot be deleted
|
* Added pinning for recordings. Pinned recordings cannot be deleted
|
||||||
* Added possibility to specify media player parameters
|
* Added possibility to specify media player parameters
|
||||||
|
* Added config setting for the number of post-processing threads
|
||||||
|
|
||||||
3.4.0
|
3.4.0
|
||||||
========================
|
========================
|
||||||
|
|
|
@ -80,6 +80,7 @@ public class SettingsTab extends Tab implements TabSelectionListener {
|
||||||
private TextField onlineCheckIntervalInSecs;
|
private TextField onlineCheckIntervalInSecs;
|
||||||
private TextField leaveSpaceOnDevice;
|
private TextField leaveSpaceOnDevice;
|
||||||
private TextField minimumLengthInSecs;
|
private TextField minimumLengthInSecs;
|
||||||
|
private TextField ppThreads;
|
||||||
private TextField ffmpegParameters;
|
private TextField ffmpegParameters;
|
||||||
private TextField fileExtension;
|
private TextField fileExtension;
|
||||||
private CheckBox useAuthentication = new CheckBox();
|
private CheckBox useAuthentication = new CheckBox();
|
||||||
|
@ -281,6 +282,10 @@ public class SettingsTab extends Tab implements TabSelectionListener {
|
||||||
private Node createRecorderPanel() {
|
private Node createRecorderPanel() {
|
||||||
int row = 0;
|
int row = 0;
|
||||||
GridPane layout = createGridLayout();
|
GridPane layout = createGridLayout();
|
||||||
|
layout.getColumnConstraints().add(new ColumnConstraints(260));
|
||||||
|
layout.getColumnConstraints().add(new ColumnConstraints(100, 400, Double.MAX_VALUE, Priority.ALWAYS, HPos.LEFT, true));
|
||||||
|
layout.getColumnConstraints().add(new ColumnConstraints(80));
|
||||||
|
layout.getColumnConstraints().add(new ColumnConstraints(40));
|
||||||
|
|
||||||
layout.add(new Label("Recordings Directory"), 0, row);
|
layout.add(new Label("Recordings Directory"), 0, row);
|
||||||
recordingsDirectory = new DirectorySelectionBox(Config.getInstance().getSettings().recordingsDir);
|
recordingsDirectory = new DirectorySelectionBox(Config.getInstance().getSettings().recordingsDir);
|
||||||
|
@ -295,6 +300,7 @@ public class SettingsTab extends Tab implements TabSelectionListener {
|
||||||
GridPane.setFillWidth(recordingsDirectory, true);
|
GridPane.setFillWidth(recordingsDirectory, true);
|
||||||
GridPane.setHgrow(recordingsDirectory, Priority.ALWAYS);
|
GridPane.setHgrow(recordingsDirectory, Priority.ALWAYS);
|
||||||
GridPane.setMargin(recordingsDirectory, new Insets(0, 0, 0, CHECKBOX_MARGIN));
|
GridPane.setMargin(recordingsDirectory, new Insets(0, 0, 0, CHECKBOX_MARGIN));
|
||||||
|
GridPane.setColumnSpan(recordingsDirectory, 3);
|
||||||
layout.add(recordingsDirectory, 1, row++);
|
layout.add(recordingsDirectory, 1, row++);
|
||||||
|
|
||||||
layout.add(new Label("Directory Structure"), 0, row);
|
layout.add(new Label("Directory Structure"), 0, row);
|
||||||
|
@ -358,6 +364,7 @@ public class SettingsTab extends Tab implements TabSelectionListener {
|
||||||
maxResolution.prefWidthProperty().bind(directoryStructure.widthProperty());
|
maxResolution.prefWidthProperty().bind(directoryStructure.widthProperty());
|
||||||
layout.add(maxResolution, 1, row++);
|
layout.add(maxResolution, 1, row++);
|
||||||
GridPane.setMargin(l, new Insets(0, 0, 0, 0));
|
GridPane.setMargin(l, new Insets(0, 0, 0, 0));
|
||||||
|
GridPane.setColumnSpan(maxResolution, 3);
|
||||||
GridPane.setMargin(maxResolution, new Insets(0, 0, 0, CHECKBOX_MARGIN));
|
GridPane.setMargin(maxResolution, new Insets(0, 0, 0, CHECKBOX_MARGIN));
|
||||||
|
|
||||||
l = new Label("Concurrent Recordings (0 = unlimited)");
|
l = new Label("Concurrent Recordings (0 = unlimited)");
|
||||||
|
@ -378,6 +385,7 @@ public class SettingsTab extends Tab implements TabSelectionListener {
|
||||||
concurrentRecordings.prefWidthProperty().bind(directoryStructure.widthProperty());
|
concurrentRecordings.prefWidthProperty().bind(directoryStructure.widthProperty());
|
||||||
layout.add(concurrentRecordings, 1, row++);
|
layout.add(concurrentRecordings, 1, row++);
|
||||||
GridPane.setMargin(l, new Insets(0, 0, 0, 0));
|
GridPane.setMargin(l, new Insets(0, 0, 0, 0));
|
||||||
|
GridPane.setColumnSpan(concurrentRecordings, 3);
|
||||||
GridPane.setMargin(concurrentRecordings, new Insets(0, 0, 0, CHECKBOX_MARGIN));
|
GridPane.setMargin(concurrentRecordings, new Insets(0, 0, 0, CHECKBOX_MARGIN));
|
||||||
|
|
||||||
layout.add(new Label("Post-Processing"), 0, row);
|
layout.add(new Label("Post-Processing"), 0, row);
|
||||||
|
@ -393,7 +401,30 @@ public class SettingsTab extends Tab implements TabSelectionListener {
|
||||||
GridPane.setFillWidth(postProcessing, true);
|
GridPane.setFillWidth(postProcessing, true);
|
||||||
GridPane.setHgrow(postProcessing, Priority.ALWAYS);
|
GridPane.setHgrow(postProcessing, Priority.ALWAYS);
|
||||||
GridPane.setMargin(postProcessing, new Insets(0, 0, 0, CHECKBOX_MARGIN));
|
GridPane.setMargin(postProcessing, new Insets(0, 0, 0, CHECKBOX_MARGIN));
|
||||||
layout.add(postProcessing, 1, row++);
|
layout.add(postProcessing, 1, row);
|
||||||
|
|
||||||
|
l = new Label("PP-Threads");
|
||||||
|
layout.add(l, 2, row);
|
||||||
|
GridPane.setMargin(l, new Insets(0, 0, 0, CHECKBOX_MARGIN));
|
||||||
|
GridPane.setHalignment(l, HPos.RIGHT);
|
||||||
|
ppThreads = new TextField(Integer.toString(Config.getInstance().getSettings().postProcessingThreads));
|
||||||
|
ppThreads.prefWidth(40);
|
||||||
|
ppThreads.minWidth(40);
|
||||||
|
ppThreads.maxWidth(40);
|
||||||
|
ppThreads.textProperty().addListener((observable, oldValue, newValue) -> {
|
||||||
|
if (!newValue.matches("\\d*")) {
|
||||||
|
ppThreads.setText(newValue.replaceAll(PATTERN_NOT_A_DIGIT, ""));
|
||||||
|
}
|
||||||
|
if (!ppThreads.getText().isEmpty()) {
|
||||||
|
int newPpThreads = Integer.parseInt(ppThreads.getText());
|
||||||
|
if (newPpThreads != Config.getInstance().getSettings().postProcessingThreads) {
|
||||||
|
Config.getInstance().getSettings().postProcessingThreads = newPpThreads;
|
||||||
|
saveConfig();
|
||||||
|
showRestartRequired();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
layout.add(ppThreads, 3, row++);
|
||||||
|
|
||||||
tt = new Tooltip("Check every x seconds, if a model came online");
|
tt = new Tooltip("Check every x seconds, if a model came online");
|
||||||
l = new Label("Check online state every (seconds)");
|
l = new Label("Check online state every (seconds)");
|
||||||
|
@ -410,6 +441,7 @@ public class SettingsTab extends Tab implements TabSelectionListener {
|
||||||
saveConfig();
|
saveConfig();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
GridPane.setColumnSpan(onlineCheckIntervalInSecs, 3);
|
||||||
GridPane.setMargin(onlineCheckIntervalInSecs, new Insets(0, 0, 0, CHECKBOX_MARGIN));
|
GridPane.setMargin(onlineCheckIntervalInSecs, new Insets(0, 0, 0, CHECKBOX_MARGIN));
|
||||||
layout.add(onlineCheckIntervalInSecs, 1, row++);
|
layout.add(onlineCheckIntervalInSecs, 1, row++);
|
||||||
|
|
||||||
|
@ -431,6 +463,7 @@ public class SettingsTab extends Tab implements TabSelectionListener {
|
||||||
saveConfig();
|
saveConfig();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
GridPane.setColumnSpan(leaveSpaceOnDevice, 3);
|
||||||
GridPane.setMargin(leaveSpaceOnDevice, new Insets(0, 0, 0, CHECKBOX_MARGIN));
|
GridPane.setMargin(leaveSpaceOnDevice, new Insets(0, 0, 0, CHECKBOX_MARGIN));
|
||||||
layout.add(leaveSpaceOnDevice, 1, row++);
|
layout.add(leaveSpaceOnDevice, 1, row++);
|
||||||
|
|
||||||
|
@ -451,6 +484,7 @@ public class SettingsTab extends Tab implements TabSelectionListener {
|
||||||
saveConfig();
|
saveConfig();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
GridPane.setColumnSpan(minimumLengthInSecs, 3);
|
||||||
GridPane.setMargin(minimumLengthInSecs, new Insets(0, 0, 0, CHECKBOX_MARGIN));
|
GridPane.setMargin(minimumLengthInSecs, new Insets(0, 0, 0, CHECKBOX_MARGIN));
|
||||||
layout.add(minimumLengthInSecs, 1, row++);
|
layout.add(minimumLengthInSecs, 1, row++);
|
||||||
|
|
||||||
|
@ -467,6 +501,7 @@ public class SettingsTab extends Tab implements TabSelectionListener {
|
||||||
saveConfig();
|
saveConfig();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
GridPane.setColumnSpan(ffmpegParameters, 3);
|
||||||
GridPane.setMargin(ffmpegParameters, new Insets(0, 0, 0, CHECKBOX_MARGIN));
|
GridPane.setMargin(ffmpegParameters, new Insets(0, 0, 0, CHECKBOX_MARGIN));
|
||||||
layout.add(ffmpegParameters, 1, row++);
|
layout.add(ffmpegParameters, 1, row++);
|
||||||
|
|
||||||
|
@ -483,6 +518,7 @@ public class SettingsTab extends Tab implements TabSelectionListener {
|
||||||
saveConfig();
|
saveConfig();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
GridPane.setColumnSpan(fileExtension, 3);
|
||||||
GridPane.setMargin(fileExtension, new Insets(0, 0, 0, CHECKBOX_MARGIN));
|
GridPane.setMargin(fileExtension, new Insets(0, 0, 0, CHECKBOX_MARGIN));
|
||||||
layout.add(fileExtension, 1, row);
|
layout.add(fileExtension, 1, row);
|
||||||
|
|
||||||
|
@ -737,6 +773,7 @@ public class SettingsTab extends Tab implements TabSelectionListener {
|
||||||
postProcessing.setDisable(!local);
|
postProcessing.setDisable(!local);
|
||||||
minimumLengthInSecs.setDisable(!local);
|
minimumLengthInSecs.setDisable(!local);
|
||||||
concurrentRecordings.setDisable(!local);
|
concurrentRecordings.setDisable(!local);
|
||||||
|
ppThreads.setDisable(!local);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -91,6 +91,7 @@ public class Settings {
|
||||||
public int overviewUpdateIntervalInSecs = 10;
|
public int overviewUpdateIntervalInSecs = 10;
|
||||||
public String password = ""; // chaturbate password TODO maybe rename this onetime
|
public String password = ""; // chaturbate password TODO maybe rename this onetime
|
||||||
public String postProcessing = "";
|
public String postProcessing = "";
|
||||||
|
public int postProcessingThreads = 2;
|
||||||
public String proxyHost;
|
public String proxyHost;
|
||||||
public String proxyPassword;
|
public String proxyPassword;
|
||||||
public String proxyPort;
|
public String proxyPort;
|
||||||
|
|
|
@ -69,7 +69,7 @@ public class NextGenLocalRecorder implements Recorder {
|
||||||
|
|
||||||
private ExecutorCompletionService<Recording> completionService = new ExecutorCompletionService<>(downloadPool);
|
private ExecutorCompletionService<Recording> completionService = new ExecutorCompletionService<>(downloadPool);
|
||||||
private BlockingQueue<Runnable> ppQueue = new LinkedBlockingQueue<>();
|
private BlockingQueue<Runnable> ppQueue = new LinkedBlockingQueue<>();
|
||||||
private ThreadPoolExecutor ppPool = new ThreadPoolExecutor(2, 2, 5, TimeUnit.MINUTES, ppQueue, createThreadFactory("PP"));
|
private ThreadPoolExecutor ppPool;
|
||||||
|
|
||||||
private ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor();
|
private ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor();
|
||||||
|
|
||||||
|
@ -88,6 +88,9 @@ public class NextGenLocalRecorder implements Recorder {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
int ppThreads = config.getSettings().postProcessingThreads;
|
||||||
|
ppPool = new ThreadPoolExecutor(ppThreads, ppThreads, 5, TimeUnit.MINUTES, ppQueue, createThreadFactory("PP"));
|
||||||
|
|
||||||
recording = true;
|
recording = true;
|
||||||
registerEventBusListener();
|
registerEventBusListener();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue