forked from j62/ctbrec
1
0
Fork 0

Set bandwidth throughput to 0 if no model is recorded

This commit is contained in:
0xboobface 2020-06-12 18:46:50 +02:00
parent f4ad1a4f61
commit f45429a01e
1 changed files with 11 additions and 3 deletions

View File

@ -324,6 +324,7 @@ public class CamrecApplication extends Application {
activeRecordings = models.size();
String windowTitle = activeRecordings > 0 ? "(" + activeRecordings + ") " + title : title;
Platform.runLater(() -> primaryStage.setTitle(windowTitle));
updateStatus();
} catch (Exception e) {
LOG.warn("Couldn't update window title", e);
}
@ -336,12 +337,19 @@ public class CamrecApplication extends Application {
BandwidthMeter.addListener((bytes, dur) -> {
long seconds = dur.getSeconds();
bytesPerSecond = bytes / (double)seconds;
String humanreadable = ByteUnitFormatter.format(bytesPerSecond);
String status = String.format("Recording %s / %s models @ %s/s", activeRecordings, recorder.getModels().size(), humanreadable);
Platform.runLater(() -> statusLabel.setText(status));
updateStatus();
});
}
private void updateStatus() {
if (activeRecordings == 0) {
bytesPerSecond = 0;
}
String humanreadable = ByteUnitFormatter.format(bytesPerSecond);
String status = String.format("Recording %s / %s models @ %s/s", activeRecordings, recorder.getModels().size(), humanreadable);
Platform.runLater(() -> statusLabel.setText(status));
}
private void writeColorSchemeStyleSheet() {
File colorCss = new File(Config.getInstance().getConfigDir(), "color.css");
try(FileOutputStream fos = new FileOutputStream(colorCss)) {