Fix epg mapping

pull/586/head
FongMi 1 year ago
parent 8b45aefcaf
commit 7b1c35e5b3
  1. 4
      app/src/main/java/com/fongmi/android/tv/api/EpgParser.java
  2. 6
      app/src/main/java/com/fongmi/android/tv/api/LiveParser.java

@ -68,7 +68,9 @@ public class EpgParser {
for (Group group : live.getGroups()) for (Channel channel : group.getChannel()) exist.add(channel.getTvgName());
for (Tv.Channel channel : tv.getChannel()) mapping.put(channel.getId(), channel.getDisplayName());
for (Tv.Programme programme : tv.getProgramme()) {
String key = mapping.get(programme.getChannel());
String key = programme.getChannel();
String name = mapping.get(programme.getChannel());
if (!exist.contains(key) && exist.contains(name)) key = name;
Date startDate = formatFull.parse(programme.getStart());
Date endDate = formatFull.parse(programme.getStop());
if (!exist.contains(key)) continue;

@ -42,7 +42,7 @@ public class LiveParser {
}
public static void start(Live live) throws Exception {
if (live.getGroups().size() > 0) return;
if (!live.getGroups().isEmpty()) return;
if (live.getType() == 0) text(live, getText(live));
if (live.getType() == 1) json(live, getText(live));
if (live.getType() == 3) spider(live, getText(live));
@ -50,7 +50,7 @@ public class LiveParser {
public static void text(Live live, String text) {
int number = 0;
if (live.getGroups().size() > 0) return;
if (!live.getGroups().isEmpty()) return;
if (M3U.matcher(text).find()) m3u(live, text);
else if (live.isXtream()) xtream(live);
else txt(live, text);
@ -150,7 +150,7 @@ public class LiveParser {
if (url.startsWith("file")) return Path.read(url);
if (url.startsWith("http")) return OkHttp.string(url, header);
if (url.startsWith("assets") || url.startsWith("proxy")) return getText(UrlUtil.convert(url), header);
if (url.length() > 0 && url.length() % 4 == 0) return getText(new String(Base64.decode(url, Base64.DEFAULT)), header);
if (!url.isEmpty() && url.length() % 4 == 0) return getText(new String(Base64.decode(url, Base64.DEFAULT)), header);
return "";
}

Loading…
Cancel
Save