forked from j62/ctbrec
Make loading of recording meta data more robust
This commit is contained in:
parent
e39ff8d7d4
commit
2131b596cb
|
@ -71,15 +71,19 @@ public class RecordingManager {
|
|||
if (metaFiles != null) {
|
||||
for (File file : metaFiles) {
|
||||
String json = new String(Files.readAllBytes(file.toPath()), "utf-8");
|
||||
Recording recording = adapter.fromJson(json);
|
||||
if (recording.getStatus() == State.RECORDING) {
|
||||
recording.setStatus(State.WAITING);
|
||||
}
|
||||
if (recordingExists(recording)) {
|
||||
recordings.add(recording);
|
||||
} else {
|
||||
LOG.info("Recording {} does not exist anymore -> deleting meta data", recording);
|
||||
Files.deleteIfExists(file.toPath());
|
||||
try {
|
||||
Recording recording = adapter.fromJson(json);
|
||||
if (recording.getStatus() == State.RECORDING) {
|
||||
recording.setStatus(State.WAITING);
|
||||
}
|
||||
if (recordingExists(recording)) {
|
||||
recordings.add(recording);
|
||||
} else {
|
||||
LOG.info("Recording {} does not exist anymore -> deleting meta data", recording);
|
||||
Files.deleteIfExists(file.toPath());
|
||||
}
|
||||
} catch(Exception e) {
|
||||
LOG.error("Couldn't load recording {}", file, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue