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
|
* Added XloveCam
|
||||||
* Improved Chaturbate search
|
* Improved Chaturbate search
|
||||||
* Fixed tipping function
|
* 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
|
4.3.1
|
||||||
========================
|
========================
|
||||||
|
|
|
@ -31,6 +31,7 @@ public class RecordingPreconditions {
|
||||||
}
|
}
|
||||||
|
|
||||||
void check(Model model) throws IOException, InvalidKeyException, NoSuchAlgorithmException {
|
void check(Model model) throws IOException, InvalidKeyException, NoSuchAlgorithmException {
|
||||||
|
LOG.debug("Checking preconditions for model {}", model);
|
||||||
ensureRecorderIsActive();
|
ensureRecorderIsActive();
|
||||||
ensureModelIsNotSuspended(model);
|
ensureModelIsNotSuspended(model);
|
||||||
ensureModelIsNotMarkedForLaterRecording(model);
|
ensureModelIsNotMarkedForLaterRecording(model);
|
||||||
|
@ -38,9 +39,9 @@ public class RecordingPreconditions {
|
||||||
ensureNoRecordingRunningForModel(model);
|
ensureNoRecordingRunningForModel(model);
|
||||||
ensureModelShouldBeRecorded(model);
|
ensureModelShouldBeRecorded(model);
|
||||||
ensureEnoughSpaceForRecording();
|
ensureEnoughSpaceForRecording();
|
||||||
ensureDownloadSlotAvailable(model);
|
|
||||||
ensureModelIsOnline(model);
|
|
||||||
ensureNoOtherFromModelGroupIsRecording(model);
|
ensureNoOtherFromModelGroupIsRecording(model);
|
||||||
|
ensureModelIsOnline(model);
|
||||||
|
ensureDownloadSlotAvailable(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ensureModelIsOnline(Model model) {
|
private void ensureModelIsOnline(Model model) {
|
||||||
|
@ -147,7 +148,7 @@ public class RecordingPreconditions {
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
Optional<Model> otherModel = getModelForUrl(modelUrl);
|
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");
|
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 {
|
private void stopModelsWithLowerPrio(ModelGroup modelGroup) throws InvalidKeyException, NoSuchAlgorithmException, IOException {
|
||||||
recorder.getCurrentlyRecording().stream()
|
recorder.getCurrentlyRecording().stream()
|
||||||
.filter(m -> modelGroup.getModelUrls().contains(m.getUrl()))
|
.filter(m -> modelGroup.getModelUrls().contains(m.getUrl()))
|
||||||
|
|
Loading…
Reference in New Issue