forked from j62/ctbrec
Add suffix parameter to getFileForRecording
This allows different download types to support different file types
This commit is contained in:
parent
0b7eeca5f7
commit
1b129ebd41
|
@ -133,11 +133,11 @@ public class Config {
|
|||
return configDir;
|
||||
}
|
||||
|
||||
public File getFileForRecording(Model model) {
|
||||
public File getFileForRecording(Model model, String suffix) {
|
||||
File dirForRecording = getDirForRecording(model);
|
||||
SimpleDateFormat sdf = new SimpleDateFormat(RECORDING_DATE_FORMAT);
|
||||
String startTime = sdf.format(new Date());
|
||||
File targetFile = new File(dirForRecording, model.getSanitizedNamed() + '_' + startTime + ".ts");
|
||||
File targetFile = new File(dirForRecording, model.getSanitizedNamed() + '_' + startTime + '.' + suffix);
|
||||
return targetFile;
|
||||
}
|
||||
|
||||
|
|
|
@ -130,7 +130,7 @@ public class MergedHlsDownload extends AbstractHlsDownload {
|
|||
super.startTime = Instant.now();
|
||||
splitRecStartTime = ZonedDateTime.now();
|
||||
super.model = model;
|
||||
targetFile = Config.getInstance().getFileForRecording(model);
|
||||
targetFile = Config.getInstance().getFileForRecording(model, "ts");
|
||||
|
||||
// let the world know, that we are recording now
|
||||
RecordingStateChangedEvent evt = new RecordingStateChangedEvent(getTarget(), RECORDING, model, getStartTime());
|
||||
|
@ -328,7 +328,7 @@ public class MergedHlsDownload extends AbstractHlsDownload {
|
|||
File lastTargetFile = targetFile;
|
||||
|
||||
// switch to the next file
|
||||
targetFile = Config.getInstance().getFileForRecording(model);
|
||||
targetFile = Config.getInstance().getFileForRecording(model, "ts");
|
||||
LOG.debug("Switching to file {}", targetFile.getAbsolutePath());
|
||||
fileChannel = FileChannel.open(targetFile.toPath(), CREATE, WRITE);
|
||||
MTSSink sink = ByteChannelSink.builder().setByteChannel(fileChannel).build();
|
||||
|
|
|
@ -57,8 +57,7 @@ public class LiveJasminChunkedHttpDownload implements Download {
|
|||
public void start(Model model, Config config) throws IOException {
|
||||
this.model = model;
|
||||
startTime = Instant.now();
|
||||
File _targetFile = config.getFileForRecording(model);
|
||||
targetFile = new File(_targetFile.getAbsolutePath().replace(".ts", ".mp4"));
|
||||
targetFile = config.getFileForRecording(model, "mp4");
|
||||
|
||||
getPerformerDetails(model.getName());
|
||||
try {
|
||||
|
|
|
@ -59,8 +59,7 @@ public class LiveJasminWebSocketDownload implements Download {
|
|||
public void start(Model model, Config config) throws IOException {
|
||||
this.model = model;
|
||||
startTime = Instant.now();
|
||||
File _targetFile = config.getFileForRecording(model);
|
||||
targetFile = new File(_targetFile.getAbsolutePath().replace(".ts", ".mp4"));
|
||||
targetFile = config.getFileForRecording(model, "mp4");
|
||||
|
||||
getPerformerDetails(model.getName());
|
||||
LOG.debug("appid: {}", applicationId);
|
||||
|
|
Loading…
Reference in New Issue