Support bypass live

pull/137/head
FongMi 3 years ago
parent c3e1772fc5
commit 8b55067ddc
  1. 2
      app/src/main/java/com/fongmi/android/tv/api/LiveParser.java
  2. 14
      app/src/main/java/com/fongmi/android/tv/bean/Group.java
  3. 6
      app/src/main/java/com/fongmi/android/tv/bean/Live.java

@ -73,7 +73,7 @@ public class LiveParser {
String[] split = line.split(","); String[] split = line.split(",");
if (split.length < 2) continue; if (split.length < 2) continue;
if (Thread.interrupted()) break; if (Thread.interrupted()) break;
if (line.contains("#genre#")) live.getGroups().add(Group.create(split[0])); if (line.contains("#genre#")) live.getGroups().add(Group.create(split[0], live.isPass()));
if (live.getGroups().isEmpty()) live.getGroups().add(Group.create(R.string.live_group)); if (live.getGroups().isEmpty()) live.getGroups().add(Group.create(R.string.live_group));
if (split[1].contains("://")) { if (split[1].contains("://")) {
Group group = live.getGroups().get(live.getGroups().size() - 1); Group group = live.getGroups().get(live.getGroups().size() - 1);

@ -37,20 +37,28 @@ public class Group {
return items == null ? Collections.emptyList() : items; return items == null ? Collections.emptyList() : items;
} }
public static Group create(@StringRes int resId) {
return new Group(ResUtil.getString(resId));
}
public static Group create(String name) { public static Group create(String name) {
return new Group(name); return new Group(name);
} }
public static Group create(@StringRes int resId) { public static Group create(String name, boolean pass) {
return new Group(ResUtil.getString(resId)); return new Group(name, pass);
} }
public Group(String name) { public Group(String name) {
this(name, false);
}
public Group(String name, boolean pass) {
this.name = name; this.name = name;
this.position = -1; this.position = -1;
if (!name.contains("_")) return; if (!name.contains("_")) return;
setName(name.split("_")[0]); setName(name.split("_")[0]);
setPass(name.split("_")[1]); setPass(pass ? "" : name.split("_")[1]);
} }
public List<Channel> getChannel() { public List<Channel> getChannel() {

@ -21,6 +21,8 @@ public class Live {
private int type; private int type;
@SerializedName("boot") @SerializedName("boot")
private boolean boot; private boolean boot;
@SerializedName("pass")
private boolean pass;
@SerializedName("name") @SerializedName("name")
private String name; private String name;
@SerializedName("group") @SerializedName("group")
@ -79,6 +81,10 @@ public class Live {
return boot; return boot;
} }
public boolean isPass() {
return pass;
}
public String getName() { public String getName() {
return TextUtils.isEmpty(name) ? "" : name; return TextUtils.isEmpty(name) ? "" : name;
} }

Loading…
Cancel
Save