Support play back - part 5

pull/362/head
FongMi 2 years ago
parent 4e29557d17
commit 8e10c42ffb
  1. 15
      app/src/main/java/com/fongmi/android/tv/bean/Catchup.java
  2. 1
      app/src/main/java/com/fongmi/android/tv/bean/Channel.java

@ -13,6 +13,8 @@ public class Catchup {
private String type;
@SerializedName("days")
private String days;
@SerializedName("regex")
private String regex;
@SerializedName("source")
private String source;
@ -20,6 +22,7 @@ public class Catchup {
Catchup item = new Catchup();
item.setDays("7");
item.setType("append");
item.setRegex("/PLTV/");
item.setSource("?playseek=${(b)yyyyMMddHHmmss}-${(e)yyyyMMddHHmmss}");
return item;
}
@ -40,6 +43,14 @@ public class Catchup {
this.days = days;
}
public String getRegex() {
return TextUtils.isEmpty(regex) ? "" : regex;
}
public void setRegex(String regex) {
this.regex = regex;
}
public String getSource() {
return TextUtils.isEmpty(source) ? "" : source;
}
@ -48,6 +59,10 @@ public class Catchup {
this.source = source;
}
public boolean match(String url) {
return url.contains(getRegex()) || Pattern.compile(getRegex()).matcher(url).find();
}
public String format(EpgData data) {
String result = getSource();
Matcher matcher = Pattern.compile("(\\$\\{[^}]*\\})").matcher(result);

@ -288,6 +288,7 @@ 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;
}

Loading…
Cancel
Save