forked from j62/ctbrec
1
0
Fork 0

Code cleanup

This commit is contained in:
0xboobface 2019-12-23 13:38:07 +01:00
parent bce8de01fe
commit 2973dd2e6d
2 changed files with 2 additions and 12 deletions

View File

@ -3,7 +3,6 @@ package ctbrec;
import java.io.File;
import java.io.IOException;
import java.nio.channels.ReadableByteChannel;
import java.time.Duration;
import java.util.Set;
import org.jcodec.common.Demuxer;
@ -22,15 +21,7 @@ import org.slf4j.LoggerFactory;
public class MpegUtil {
private static final Logger LOG = LoggerFactory.getLogger(MpegUtil.class);
public static void main(String[] args) throws IOException {
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));
}
private MpegUtil() {}
public static double getFileDuration(File file) throws IOException {
try(FileChannelWrapper ch = NIOUtils.readableChannel(file)) {

View File

@ -59,7 +59,6 @@ public class DashDownload implements Download {
private ZonedDateTime splitRecStartTime;
private File targetFile;
private File finalFile;
public DashDownload(HttpClient httpClient, String manifestUrl) {
this.httpClient = httpClient;
@ -198,7 +197,7 @@ public class DashDownload implements Download {
this.config = config;
this.model = model;
startTime = Instant.now();
finalFile = Config.getInstance().getFileForRecording(model, "mp4");
File finalFile = Config.getInstance().getFileForRecording(model, "mp4");
targetFile = new File(finalFile.getParentFile(), finalFile.getName() + ".part");
downloadDir = targetFile.toPath();
}