From b2e68f2af116f994f6148d8f762859027f50ecca Mon Sep 17 00:00:00 2001 From: FongMi Date: Thu, 22 Feb 2024 10:23:48 +0800 Subject: [PATCH] live support catchup config --- .../main/java/com/fongmi/android/tv/api/LiveParser.java | 1 - .../main/java/com/fongmi/android/tv/bean/Channel.java | 9 +++++---- app/src/main/java/com/fongmi/android/tv/bean/Live.java | 8 ++++++++ 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/fongmi/android/tv/api/LiveParser.java b/app/src/main/java/com/fongmi/android/tv/api/LiveParser.java index 9a7f25b52..0859e3fd9 100644 --- a/app/src/main/java/com/fongmi/android/tv/api/LiveParser.java +++ b/app/src/main/java/com/fongmi/android/tv/api/LiveParser.java @@ -1,7 +1,6 @@ package com.fongmi.android.tv.api; import android.util.Base64; -import android.util.Log; import com.fongmi.android.tv.bean.Catchup; import com.fongmi.android.tv.bean.Channel; diff --git a/app/src/main/java/com/fongmi/android/tv/bean/Channel.java b/app/src/main/java/com/fongmi/android/tv/bean/Channel.java index d29943aba..0c46a7c58 100644 --- a/app/src/main/java/com/fongmi/android/tv/bean/Channel.java +++ b/app/src/main/java/com/fongmi/android/tv/bean/Channel.java @@ -159,7 +159,7 @@ public class Channel { } public Catchup getCatchup() { - return catchup; + return catchup == null ? new Catchup() : catchup; } public void setCatchup(Catchup catchup) { @@ -287,9 +287,9 @@ public class Channel { } public boolean hasCatchup() { - if (getCatchup() == null && getCurrent().contains("/PLTV/")) setCatchup(Catchup.PLTV()); - if (getCatchup() != null && !getCatchup().getRegex().isEmpty()) return getCatchup().match(getCurrent()); - return getCatchup() != null && !getCatchup().isEmpty(); + if (getCatchup().isEmpty() && getCurrent().contains("/PLTV/")) setCatchup(Catchup.PLTV()); + if (!getCatchup().getRegex().isEmpty()) return getCatchup().match(getCurrent()); + return !getCatchup().isEmpty(); } public String getLineText() { @@ -313,6 +313,7 @@ public class Channel { if (live.getHeader() != null && getHeader() == null) setHeader(live.getHeader()); if (live.getClick().length() > 0 && getClick().isEmpty()) setClick(live.getClick()); if (live.getOrigin().length() > 0 && getOrigin().isEmpty()) setOrigin(live.getOrigin()); + if (!live.getCatchup().isEmpty() && getCatchup().isEmpty()) setCatchup(live.getCatchup()); if (live.getReferer().length() > 0 && getReferer().isEmpty()) setReferer(live.getReferer()); if (live.getPlayerType() != -1 && getPlayerType() == -1) setPlayerType(live.getPlayerType()); if (!getEpg().startsWith("http")) setEpg(live.getEpg().replace("{name}", getName()).replace("{epg}", getEpg())); diff --git a/app/src/main/java/com/fongmi/android/tv/bean/Live.java b/app/src/main/java/com/fongmi/android/tv/bean/Live.java index 7485cfd61..ebcc45244 100644 --- a/app/src/main/java/com/fongmi/android/tv/bean/Live.java +++ b/app/src/main/java/com/fongmi/android/tv/bean/Live.java @@ -90,6 +90,10 @@ public class Live { @SerializedName("groups") private List groups; + @Ignore + @SerializedName("catchup") + private Catchup catchup; + @Ignore @SerializedName("core") private Core core; @@ -213,6 +217,10 @@ public class Live { return groups = groups == null ? new ArrayList<>() : groups; } + public Catchup getCatchup() { + return catchup == null ? new Catchup() : catchup; + } + public Core getCore() { return core == null ? new Core() : core; }