forked from j62/ctbrec
Fix bug in precondition check, which caused recordings to get restarted
The bug occured when model groups were used in combination with priorities.
This commit is contained in:
parent
0b25c68bdb
commit
12899cac4c
|
@ -4,6 +4,9 @@
|
|||
* Added XloveCam
|
||||
* Improved Chaturbate search
|
||||
* Fixed tipping function
|
||||
* Fixed bug in recording precondition check, which caused recordings to get
|
||||
restarted. The bug occured when model groups were used in combination with
|
||||
priorities.
|
||||
|
||||
4.3.1
|
||||
========================
|
||||
|
|
|
@ -31,6 +31,7 @@ public class RecordingPreconditions {
|
|||
}
|
||||
|
||||
void check(Model model) throws IOException, InvalidKeyException, NoSuchAlgorithmException {
|
||||
LOG.debug("Checking preconditions for model {}", model);
|
||||
ensureRecorderIsActive();
|
||||
ensureModelIsNotSuspended(model);
|
||||
ensureModelIsNotMarkedForLaterRecording(model);
|
||||
|
@ -38,9 +39,9 @@ public class RecordingPreconditions {
|
|||
ensureNoRecordingRunningForModel(model);
|
||||
ensureModelShouldBeRecorded(model);
|
||||
ensureEnoughSpaceForRecording();
|
||||
ensureDownloadSlotAvailable(model);
|
||||
ensureModelIsOnline(model);
|
||||
ensureNoOtherFromModelGroupIsRecording(model);
|
||||
ensureModelIsOnline(model);
|
||||
ensureDownloadSlotAvailable(model);
|
||||
}
|
||||
|
||||
private void ensureModelIsOnline(Model model) {
|
||||
|
@ -147,7 +148,7 @@ public class RecordingPreconditions {
|
|||
return;
|
||||
} else {
|
||||
Optional<Model> otherModel = getModelForUrl(modelUrl);
|
||||
if (otherModel.isPresent() && otherModelCanBeRecorded(otherModel.get())) {
|
||||
if (otherModel.isPresent() && (otherModelIsRecorded(otherModel.get()) || otherModelCanBeRecorded(otherModel.get()))) {
|
||||
throw new PreconditionNotMetException(otherModel.get() + " from the same group is already recorded");
|
||||
}
|
||||
}
|
||||
|
@ -155,6 +156,10 @@ public class RecordingPreconditions {
|
|||
}
|
||||
}
|
||||
|
||||
private boolean otherModelIsRecorded(Model model) throws InvalidKeyException, NoSuchAlgorithmException, IOException {
|
||||
return recorder.getCurrentlyRecording().contains(model);
|
||||
}
|
||||
|
||||
private void stopModelsWithLowerPrio(ModelGroup modelGroup) throws InvalidKeyException, NoSuchAlgorithmException, IOException {
|
||||
recorder.getCurrentlyRecording().stream()
|
||||
.filter(m -> modelGroup.getModelUrls().contains(m.getUrl()))
|
||||
|
|
Loading…
Reference in New Issue