forked from j62/ctbrec
1
0
Fork 0

Update mark unmark model immediately in remote mode

This commit is contained in:
0xb00bface 2021-08-07 16:31:24 +02:00
parent 4a2f7c2d27
commit 87f7bd6e83
1 changed files with 7 additions and 3 deletions

View File

@ -706,17 +706,21 @@ public class RemoteRecorder implements Recorder {
@Override @Override
public void markForLaterRecording(Model model, boolean mark) throws InvalidKeyException, NoSuchAlgorithmException, IOException { public void markForLaterRecording(Model model, boolean mark) throws InvalidKeyException, NoSuchAlgorithmException, IOException {
model.setMarkedForLaterRecording(mark);
LOG.info("Marking model {} {}", model, mark);
if (mark) { if (mark) {
sendRequest("markForLater", model); sendRequest("markForLater", model);
} else { } else {
sendRequest("unmarkForLater", model); sendRequest("unmarkForLater", model);
} }
model.setMarkedForLaterRecording(mark); // update locally cached model
// update cached model
int index = models.indexOf(model); int index = models.indexOf(model);
if (index >= 0) { if (index >= 0) {
Model m = models.get(index); Model m = models.get(index);
m.setSuspended(mark); m.setMarkedForLaterRecording(mark);
models.remove(index);
} else {
models.add(model);
} }
} }
} }