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;
|
return configDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
public File getFileForRecording(Model model) {
|
public File getFileForRecording(Model model, String suffix) {
|
||||||
File dirForRecording = getDirForRecording(model);
|
File dirForRecording = getDirForRecording(model);
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat(RECORDING_DATE_FORMAT);
|
SimpleDateFormat sdf = new SimpleDateFormat(RECORDING_DATE_FORMAT);
|
||||||
String startTime = sdf.format(new Date());
|
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;
|
return targetFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -130,7 +130,7 @@ public class MergedHlsDownload extends AbstractHlsDownload {
|
||||||
super.startTime = Instant.now();
|
super.startTime = Instant.now();
|
||||||
splitRecStartTime = ZonedDateTime.now();
|
splitRecStartTime = ZonedDateTime.now();
|
||||||
super.model = model;
|
super.model = model;
|
||||||
targetFile = Config.getInstance().getFileForRecording(model);
|
targetFile = Config.getInstance().getFileForRecording(model, "ts");
|
||||||
|
|
||||||
// let the world know, that we are recording now
|
// let the world know, that we are recording now
|
||||||
RecordingStateChangedEvent evt = new RecordingStateChangedEvent(getTarget(), RECORDING, model, getStartTime());
|
RecordingStateChangedEvent evt = new RecordingStateChangedEvent(getTarget(), RECORDING, model, getStartTime());
|
||||||
|
@ -328,7 +328,7 @@ public class MergedHlsDownload extends AbstractHlsDownload {
|
||||||
File lastTargetFile = targetFile;
|
File lastTargetFile = targetFile;
|
||||||
|
|
||||||
// switch to the next file
|
// switch to the next file
|
||||||
targetFile = Config.getInstance().getFileForRecording(model);
|
targetFile = Config.getInstance().getFileForRecording(model, "ts");
|
||||||
LOG.debug("Switching to file {}", targetFile.getAbsolutePath());
|
LOG.debug("Switching to file {}", targetFile.getAbsolutePath());
|
||||||
fileChannel = FileChannel.open(targetFile.toPath(), CREATE, WRITE);
|
fileChannel = FileChannel.open(targetFile.toPath(), CREATE, WRITE);
|
||||||
MTSSink sink = ByteChannelSink.builder().setByteChannel(fileChannel).build();
|
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 {
|
public void start(Model model, Config config) throws IOException {
|
||||||
this.model = model;
|
this.model = model;
|
||||||
startTime = Instant.now();
|
startTime = Instant.now();
|
||||||
File _targetFile = config.getFileForRecording(model);
|
targetFile = config.getFileForRecording(model, "mp4");
|
||||||
targetFile = new File(_targetFile.getAbsolutePath().replace(".ts", ".mp4"));
|
|
||||||
|
|
||||||
getPerformerDetails(model.getName());
|
getPerformerDetails(model.getName());
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -59,8 +59,7 @@ public class LiveJasminWebSocketDownload implements Download {
|
||||||
public void start(Model model, Config config) throws IOException {
|
public void start(Model model, Config config) throws IOException {
|
||||||
this.model = model;
|
this.model = model;
|
||||||
startTime = Instant.now();
|
startTime = Instant.now();
|
||||||
File _targetFile = config.getFileForRecording(model);
|
targetFile = config.getFileForRecording(model, "mp4");
|
||||||
targetFile = new File(_targetFile.getAbsolutePath().replace(".ts", ".mp4"));
|
|
||||||
|
|
||||||
getPerformerDetails(model.getName());
|
getPerformerDetails(model.getName());
|
||||||
LOG.debug("appid: {}", applicationId);
|
LOG.debug("appid: {}", applicationId);
|
||||||
|
|
Loading…
Reference in New Issue