Fix status switching between FINISHED and DOWNLOADING

Do not change the status from an update, if it is in the status
DOWNLOADING. Reason: The FINISHED status is overwritten with
DOWNLOADING, if the recording is downloading. But during the update of
the recordings, it gets reset with the FINISHED status from the server
until it is overriden again.
This commit is contained in:
0xboobface 2018-08-28 17:16:44 +02:00
parent f30d13609b
commit 8d4ba6d513
1 changed files with 8 additions and 0 deletions

View File

@ -3,6 +3,7 @@ package ctbrec.ui;
import java.text.DecimalFormat;
import java.time.Instant;
import ctbrec.Config;
import ctbrec.Recording;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
@ -113,6 +114,13 @@ public class JavaFxRecording extends Recording {
}
public void update(Recording updated) {
if(!Config.getInstance().getSettings().localRecording) {
if(getStatus() == STATUS.DOWNLOADING && updated.getStatus() != STATUS.DOWNLOADING) {
// ignore, because the the status coming from the server is FINISHED and we are
// overriding it with DOWNLOADING
return;
}
}
setStatus(updated.getStatus());
setProgress(updated.getProgress());
setSizeInByte(updated.getSizeInByte());