diff --git a/client/src/main/java/ctbrec/ui/settings/SettingsTab.java b/client/src/main/java/ctbrec/ui/settings/SettingsTab.java index 40a5a9dc..6b9a8eb7 100644 --- a/client/src/main/java/ctbrec/ui/settings/SettingsTab.java +++ b/client/src/main/java/ctbrec/ui/settings/SettingsTab.java @@ -72,6 +72,7 @@ public class SettingsTab extends Tab implements TabSelectionListener { private ToggleGroup recordLocation; private ProxySettingsPane proxySettingsPane; private TextField maxResolution; + private TextField concurrentRecordings; private ComboBox splitAfter; private ComboBox directoryStructure; private ComboBox startTab; @@ -310,6 +311,26 @@ public class SettingsTab extends Tab implements TabSelectionListener { GridPane.setMargin(l, new Insets(0, 0, 0, 0)); GridPane.setMargin(maxResolution, new Insets(0, 0, 0, CHECKBOX_MARGIN)); + l = new Label("Concurrent Recordings (0 = unlimited)"); + layout.add(l, 0, row); + concurrentRecordings = new TextField(Integer.toString(Config.getInstance().getSettings().concurrentRecordings)); + concurrentRecordings.textProperty().addListener((observable, oldValue, newValue) -> { + if (!newValue.matches("\\d*")) { + concurrentRecordings.setText(newValue.replaceAll("[^\\d]", "")); + } + if (!concurrentRecordings.getText().isEmpty()) { + int newConcurrentRecordings = Integer.parseInt(concurrentRecordings.getText()); + if (newConcurrentRecordings != Config.getInstance().getSettings().concurrentRecordings) { + Config.getInstance().getSettings().concurrentRecordings = newConcurrentRecordings; + saveConfig(); + } + } + }); + concurrentRecordings.prefWidthProperty().bind(directoryStructure.widthProperty()); + layout.add(concurrentRecordings, 1, row++); + GridPane.setMargin(l, new Insets(0, 0, 0, 0)); + GridPane.setMargin(concurrentRecordings, new Insets(0, 0, 0, CHECKBOX_MARGIN)); + layout.add(new Label("Post-Processing"), 0, row); postProcessing = new ProgramSelectionBox(Config.getInstance().getSettings().postProcessing); postProcessing.allowEmptyValue(); diff --git a/common/src/main/java/ctbrec/recorder/LocalRecorder.java b/common/src/main/java/ctbrec/recorder/LocalRecorder.java index 94e1ca14..dd997053 100644 --- a/common/src/main/java/ctbrec/recorder/LocalRecorder.java +++ b/common/src/main/java/ctbrec/recorder/LocalRecorder.java @@ -214,7 +214,7 @@ public class LocalRecorder implements Recorder { private boolean downloadSlotAvailable() { int concurrentRecordings = Config.getInstance().getSettings().concurrentRecordings; - return concurrentRecordings > 0 && recordingProcesses.size() < concurrentRecordings; + return concurrentRecordings == 0 || concurrentRecordings > 0 && recordingProcesses.size() < concurrentRecordings; } private void stopRecordingProcess(Model model) {