forked from j62/ctbrec
Code cleanup
This commit is contained in:
parent
bce8de01fe
commit
2973dd2e6d
|
@ -3,7 +3,6 @@ package ctbrec;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.channels.ReadableByteChannel;
|
import java.nio.channels.ReadableByteChannel;
|
||||||
import java.time.Duration;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.jcodec.common.Demuxer;
|
import org.jcodec.common.Demuxer;
|
||||||
|
@ -22,15 +21,7 @@ import org.slf4j.LoggerFactory;
|
||||||
public class MpegUtil {
|
public class MpegUtil {
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(MpegUtil.class);
|
private static final Logger LOG = LoggerFactory.getLogger(MpegUtil.class);
|
||||||
|
|
||||||
public static void main(String[] args) throws IOException {
|
private MpegUtil() {}
|
||||||
readFile(new File("../../test-recs/ff.ts"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void readFile(File file) throws IOException {
|
|
||||||
System.out.println(file.getCanonicalPath());
|
|
||||||
double duration = MpegUtil.getFileDuration(file);
|
|
||||||
System.out.println(Duration.ofSeconds((long) duration));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static double getFileDuration(File file) throws IOException {
|
public static double getFileDuration(File file) throws IOException {
|
||||||
try(FileChannelWrapper ch = NIOUtils.readableChannel(file)) {
|
try(FileChannelWrapper ch = NIOUtils.readableChannel(file)) {
|
||||||
|
|
|
@ -59,7 +59,6 @@ public class DashDownload implements Download {
|
||||||
private ZonedDateTime splitRecStartTime;
|
private ZonedDateTime splitRecStartTime;
|
||||||
|
|
||||||
private File targetFile;
|
private File targetFile;
|
||||||
private File finalFile;
|
|
||||||
|
|
||||||
public DashDownload(HttpClient httpClient, String manifestUrl) {
|
public DashDownload(HttpClient httpClient, String manifestUrl) {
|
||||||
this.httpClient = httpClient;
|
this.httpClient = httpClient;
|
||||||
|
@ -198,7 +197,7 @@ public class DashDownload implements Download {
|
||||||
this.config = config;
|
this.config = config;
|
||||||
this.model = model;
|
this.model = model;
|
||||||
startTime = Instant.now();
|
startTime = Instant.now();
|
||||||
finalFile = Config.getInstance().getFileForRecording(model, "mp4");
|
File finalFile = Config.getInstance().getFileForRecording(model, "mp4");
|
||||||
targetFile = new File(finalFile.getParentFile(), finalFile.getName() + ".part");
|
targetFile = new File(finalFile.getParentFile(), finalFile.getName() + ".part");
|
||||||
downloadDir = targetFile.toPath();
|
downloadDir = targetFile.toPath();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue