Add channel number

This commit is contained in:
FongMi 2025-02-25 21:48:43 +08:00
parent 282f5829e4
commit 070285a32d
7 changed files with 18 additions and 7 deletions

View File

@ -8,6 +8,7 @@ import com.google.gson.annotations.SerializedName;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Locale;
public class Channel { public class Channel {
@ -84,6 +85,10 @@ public class Channel {
this.referer = referer; this.referer = referer;
} }
public void setNumber(int number) {
setNumber(String.format(Locale.getDefault(), "%03d", number));
}
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (this == obj) return true; if (this == obj) return true;

View File

@ -1,4 +1,4 @@
package com.github.catvod.bean.xc; package com.github.catvod.bean.xtream;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.SerializedName;

View File

@ -1,4 +1,4 @@
package com.github.catvod.bean.xc; package com.github.catvod.bean.xtream;
import android.text.TextUtils; import android.text.TextUtils;

View File

@ -1,4 +1,4 @@
package com.github.catvod.bean.xc; package com.github.catvod.bean.xtream;
import android.text.TextUtils; import android.text.TextUtils;

View File

@ -4,9 +4,9 @@ import android.content.Context;
import com.github.catvod.bean.live.Channel; import com.github.catvod.bean.live.Channel;
import com.github.catvod.bean.live.Group; import com.github.catvod.bean.live.Group;
import com.github.catvod.bean.xc.Config; import com.github.catvod.bean.xtream.Config;
import com.github.catvod.bean.xc.XCategory; import com.github.catvod.bean.xtream.XCategory;
import com.github.catvod.bean.xc.XStream; import com.github.catvod.bean.xtream.XStream;
import com.github.catvod.crawler.Spider; import com.github.catvod.crawler.Spider;
import com.github.catvod.net.OkHttp; import com.github.catvod.net.OkHttp;
import com.google.gson.Gson; import com.google.gson.Gson;
@ -46,6 +46,12 @@ public class XtreamCode extends Spider {
if (!stream.getEpgChannelId().isEmpty()) channel.setTvgName(stream.getEpgChannelId()); if (!stream.getEpgChannelId().isEmpty()) channel.setTvgName(stream.getEpgChannelId());
channel.getUrls().addAll(stream.getPlayUrl(config)); channel.getUrls().addAll(stream.getPlayUrl(config));
} }
int number = 0;
for (Group group : groups) {
for (Channel channel : group.getChannel()) {
if (channel.getNumber().isEmpty()) channel.setNumber(++number);
}
}
return new Gson().toJson(groups); return new Gson().toJson(groups);
} }

Binary file not shown.

View File

@ -1 +1 @@
90fd2379b3fb688bf7f56c442c78c6b3 0e8190a0e9fb28163c19789d2f3642fa