forked from j62/ctbrec
1
0
Fork 0

Delete recordings, which have a size of 0

This commit is contained in:
0xboobface 2019-06-01 17:27:16 +02:00
parent d5f2f043e4
commit 25770111da
1 changed files with 13 additions and 1 deletions

View File

@ -255,9 +255,21 @@ public class NextGenLocalRecorder implements Recorder {
}
private boolean deleteIfTooShort(Recording rec) throws IOException, ParseException, PlaylistException {
// if the size is 0, we don't need to go ahead and check the length
rec.refresh();
long sizeInByte = rec.getSizeInByte();
if (sizeInByte == 0) {
recordingManager.delete(rec);
return true;
}
Duration minimumLengthInSeconds = Duration.ofSeconds(Config.getInstance().getSettings().minimumLengthInSeconds);
if (minimumLengthInSeconds.getSeconds() <= 0) {
return false;
}
Duration recordingLength = rec.getLength();
if (recordingLength.compareTo(minimumLengthInSeconds) < 0 || recordingLength.isZero()) {
if (recordingLength.compareTo(minimumLengthInSeconds) < 0) {
recordingManager.delete(rec);
return true;
}