pull/137/head
FongMi 3 years ago
parent d24ee9f103
commit 31e3f4c5f2
  1. 6
      app/src/main/java/com/fongmi/android/tv/bean/Epg.java
  2. 4
      app/src/main/java/com/fongmi/android/tv/bean/Vod.java
  3. 11
      app/src/main/java/com/fongmi/android/tv/utils/Utils.java
  4. 1
      catvod/build.gradle
  5. 17
      catvod/src/main/java/com/github/catvod/utils/Util.java
  6. 1
      quickjs/build.gradle

@ -5,7 +5,7 @@ import android.text.TextUtils;
import com.fongmi.android.tv.R;
import com.fongmi.android.tv.utils.ResUtil;
import com.fongmi.android.tv.utils.Trans;
import com.fongmi.android.tv.utils.Utils;
import com.github.catvod.utils.Util;
import com.google.gson.Gson;
import com.google.gson.annotations.SerializedName;
@ -85,8 +85,8 @@ public class Epg {
private void setTime(SimpleDateFormat format) {
for (Epg item : getList()) {
item.setStartTime(Utils.format(format, getDate().concat(item.getStart())));
item.setEndTime(Utils.format(format, getDate().concat(item.getEnd())));
item.setStartTime(Util.format(format, getDate().concat(item.getStart())));
item.setEndTime(Util.format(format, getDate().concat(item.getEnd())));
item.setTitle(Trans.s2t(item.getTitle()));
}
}

@ -330,7 +330,7 @@ public class Vod {
}
public Episode find(String remarks, boolean strict) {
int number = Utils.digit(remarks);
int number = Utils.getDigit(remarks);
if (getEpisodes().size() == 0) return null;
if (getEpisodes().size() == 1) return getEpisodes().get(0);
if (getPosition() != -1) return getEpisodes().get(getPosition());
@ -391,7 +391,7 @@ public class Vod {
}
public Episode(String name, String url) {
this.number = Utils.digit(name);
this.number = Utils.getDigit(name);
this.name = Trans.s2t(name);
this.url = url;
}

@ -22,7 +22,6 @@ import com.github.catvod.utils.Util;
import com.google.common.net.HttpHeaders;
import com.permissionx.guolindev.PermissionX;
import java.text.SimpleDateFormat;
import java.util.Map;
public class Utils {
@ -123,15 +122,7 @@ public class Utils {
return url;
}
public static long format(SimpleDateFormat format, String src) {
try {
return format.parse(src).getTime();
} catch (Exception e) {
return 0;
}
}
public static int digit(String text) {
public static int getDigit(String text) {
try {
if (text.startsWith("上") || text.startsWith("下")) return -1;
if (text.contains(".")) text = text.substring(0, text.lastIndexOf("."));

@ -12,6 +12,7 @@ android {
}
dependencies {
api project(':media-lib-common')
api 'androidx.annotation:annotation:' + annotationVersion
api 'androidx.preference:preference:1.2.1'
api 'com.google.code.gson:gson:' + gsonVersion

@ -13,6 +13,7 @@ import java.io.FileInputStream;
import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.text.SimpleDateFormat;
public class Util {
@ -53,10 +54,6 @@ public class Util {
return host == null ? "" : host.toLowerCase();
}
public static boolean equals(String name, String md5) {
return md5(Path.jar(name)).equalsIgnoreCase(md5);
}
public static String md5(String src) {
try {
if (TextUtils.isEmpty(src)) return "";
@ -86,4 +83,16 @@ public class Util {
return "";
}
}
public static boolean equals(String name, String md5) {
return md5(Path.jar(name)).equalsIgnoreCase(md5);
}
public static long format(SimpleDateFormat format, String src) {
try {
return format.parse(src).getTime();
} catch (Exception e) {
return 0;
}
}
}

@ -13,6 +13,5 @@ android {
dependencies {
implementation project(':catvod')
implementation project(':media-lib-common')
implementation 'wang.harlon.quickjs:wrapper-android:0.21.0'
}
Loading…
Cancel
Save