From d63480280c1bf2526818c3d0dc7ee6ae293cf03d Mon Sep 17 00:00:00 2001 From: FongMi Date: Fri, 19 Dec 2025 20:53:59 +0800 Subject: [PATCH] Fix gz file refresh --- app/src/main/java/com/fongmi/android/tv/api/EpgParser.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/fongmi/android/tv/api/EpgParser.java b/app/src/main/java/com/fongmi/android/tv/api/EpgParser.java index aaeabdb87..a38734af2 100644 --- a/app/src/main/java/com/fongmi/android/tv/api/EpgParser.java +++ b/app/src/main/java/com/fongmi/android/tv/api/EpgParser.java @@ -38,7 +38,7 @@ public class EpgParser { public static boolean start(Live live, String url) throws Exception { File file = Path.epg(Uri.parse(url).getLastPathSegment()); - if (shouldDownload(file)) Download.create(url, file).get(); + if (shouldRefresh(file)) Download.create(url, file).get(); if (isGzip(file)) readGzip(live, file); else readXml(live, file); return true; @@ -51,7 +51,7 @@ public class EpgParser { return epg; } - private static boolean shouldDownload(File file) { + private static boolean shouldRefresh(File file) { return !Path.exists(file) || !isToday(file.lastModified()) || System.currentTimeMillis() - file.lastModified() > TimeUnit.HOURS.toMillis(6); } @@ -71,7 +71,7 @@ public class EpgParser { private static void readGzip(Live live, File file) throws Exception { File xml = Path.epg(file.getName() + ".xml"); - if (!Path.exists(xml)) FileUtil.gzipDecompress(file, xml); + if (shouldRefresh(xml)) FileUtil.gzipDecompress(file, xml); readXml(live, xml); }