forked from j62/ctbrec
Automatically delete empty recordings
This commit is contained in:
parent
501f685626
commit
c0167155f3
|
@ -117,16 +117,17 @@ public class NextGenLocalRecorder implements Recorder {
|
|||
Model model = recording.getModel();
|
||||
tryRestartRecording(model);
|
||||
} else {
|
||||
// TODO is this ok?
|
||||
setRecordingStatus(recording, State.FAILED);
|
||||
recordingsLock.lock();
|
||||
try {
|
||||
recordingManager.delete(recording);
|
||||
} catch (IOException e) {
|
||||
LOG.error("Couldn't delete recording {}", recording, e);
|
||||
} finally {
|
||||
recordingsLock.unlock();
|
||||
if(recording.getStatus() != State.DELETED) {
|
||||
recordingsLock.lock();
|
||||
try {
|
||||
recordingManager.delete(recording);
|
||||
} catch (IOException e) {
|
||||
LOG.error("Couldn't delete recording {}", recording, e);
|
||||
} finally {
|
||||
recordingsLock.unlock();
|
||||
}
|
||||
}
|
||||
setRecordingStatus(recording, State.FAILED);
|
||||
}
|
||||
} catch (InterruptedException | ExecutionException e) {
|
||||
e.printStackTrace();
|
||||
|
@ -255,12 +256,8 @@ public class NextGenLocalRecorder implements Recorder {
|
|||
|
||||
private boolean deleteIfTooShort(Recording rec) throws IOException, ParseException, PlaylistException {
|
||||
Duration minimumLengthInSeconds = Duration.ofSeconds(Config.getInstance().getSettings().minimumLengthInSeconds);
|
||||
if (minimumLengthInSeconds.getSeconds() <= 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Duration recordingLength = rec.getLength();
|
||||
if (recordingLength.compareTo(minimumLengthInSeconds) < 0) {
|
||||
if (recordingLength.compareTo(minimumLengthInSeconds) < 0 || recordingLength.isZero()) {
|
||||
recordingManager.delete(rec);
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue