From 2973dd2e6d9a606ad0d7550e3217b5c62eb3dce4 Mon Sep 17 00:00:00 2001 From: 0xboobface <0xboobface@gmail.com> Date: Mon, 23 Dec 2019 13:38:07 +0100 Subject: [PATCH] Code cleanup --- common/src/main/java/ctbrec/MpegUtil.java | 11 +---------- .../ctbrec/recorder/download/dash/DashDownload.java | 3 +-- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/common/src/main/java/ctbrec/MpegUtil.java b/common/src/main/java/ctbrec/MpegUtil.java index 7fd75c1e..3bb370be 100644 --- a/common/src/main/java/ctbrec/MpegUtil.java +++ b/common/src/main/java/ctbrec/MpegUtil.java @@ -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)) { diff --git a/common/src/main/java/ctbrec/recorder/download/dash/DashDownload.java b/common/src/main/java/ctbrec/recorder/download/dash/DashDownload.java index b9686286..54f0c770 100644 --- a/common/src/main/java/ctbrec/recorder/download/dash/DashDownload.java +++ b/common/src/main/java/ctbrec/recorder/download/dash/DashDownload.java @@ -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(); }