Add timeZone param for live epg

pull/553/head
okjack 1 year ago
parent 08deb19357
commit 61ba90812d
  1. 1
      README.md
  2. 14
      app/src/main/java/com/fongmi/android/tv/model/LiveViewModel.java
  3. 2
      other/sample/live/online.json

@ -22,6 +22,7 @@ https://github.com/CatVodTVOfficial/CatVodTVJarLoader
| ua | none | 用戶代理 | |
| origin | none | 來源 | |
| referer | none | 參照地址 | |
| epg | none | 節目地址 | &serverTimeZone |
| epg | none | 節目地址 | |
| logo | none | 台標地址 | |
| pass | false | 是否免密碼 | |

@ -1,5 +1,7 @@
package com.fongmi.android.tv.model;
import android.net.Uri;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;
@ -22,6 +24,7 @@ import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Iterator;
import java.util.Locale;
import java.util.TimeZone;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@ -59,6 +62,7 @@ public class LiveViewModel extends ViewModel {
public void getLive(Live item) {
execute(LIVE, () -> {
VodConfig.get().setRecent(item.getJar());
setTimeZone(item.getEpg());
LiveParser.start(item);
verify(item);
return item;
@ -94,6 +98,16 @@ public class LiveViewModel extends ViewModel {
});
}
private void setTimeZone(String url) {
try {
if (!url.contains("serverTimeZone=")) return;
TimeZone timeZone = TimeZone.getTimeZone(Uri.parse(url).getQueryParameter("serverTimeZone"));
formatDate.setTimeZone(timeZone);
formatTime.setTimeZone(timeZone);
} catch (Exception ignored) {
}
}
private void verify(Live item) {
Iterator<Group> iterator = item.getGroups().iterator();
while (iterator.hasNext()) if (iterator.next().isEmpty()) iterator.remove();

@ -38,7 +38,7 @@
"boot": false,
"pass": true,
"url": "https://github.com/live.txt",
"epg": "https://epg.112114.xyz/?ch={name}&date={date}",
"epg": "https://epg.112114.xyz/?ch={name}&date={date}&serverTimeZone=Asia/Shanghai",
"logo": "https://epg.112114.xyz/logo/{name}.png",
"header": {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36",

Loading…
Cancel
Save