forked from j62/ctbrec
Delete recordings, which have a size of 0
This commit is contained in:
parent
d5f2f043e4
commit
25770111da
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue