Fix bug in handleMissedSegments

It used a path to /tmp in the createTempFile method, which caused
Windows to complain with java.io.IOException: The filename, directory
name, or volume label syntax is incorrect
This commit is contained in:
0xb00bface 2021-09-14 18:05:00 +02:00
parent ff9ce1d205
commit f1e6800a15
1 changed files with 2 additions and 2 deletions

View File

@ -358,7 +358,7 @@ public abstract class AbstractHlsDownload extends AbstractDownload {
if (nextSegmentNumber > 0 && playlist.seq > nextSegmentNumber) {
recordingEvents.add(RecordingEvent.of("Missed segments: "+nextSegmentNumber+" < " + playlist.seq));
if (config.getSettings().logMissedSegments) {
File hlsEventsFile = File.createTempFile("/tmp/rec_evt_" + Instant.now() + "_" + model.getSanitizedNamed(), ".log");
File hlsEventsFile = File.createTempFile("rec_evt_" + Instant.now() + "_" + model.getSanitizedNamed(), ".log");
try (OutputStream outputStream = Files.newOutputStream(hlsEventsFile.toPath(), CREATE, WRITE, TRUNCATE_EXISTING)) {
BufferedWriter br = new BufferedWriter(new OutputStreamWriter(outputStream));
DateTimeFormatter dtf = DateTimeFormatter.ISO_LOCAL_TIME;
@ -369,7 +369,7 @@ public abstract class AbstractHlsDownload extends AbstractDownload {
}
br.flush();
} catch (IOException e) {
e.printStackTrace();
LOG.error("Couldn't write log file for missed segments", e);
}
}
}