Clean code
This commit is contained in:
parent
4f34fb8414
commit
cae3e20af7
|
|
@ -6,7 +6,6 @@ import com.github.catvod.bean.Vod;
|
||||||
import com.github.catvod.utils.Utils;
|
import com.github.catvod.utils.Utils;
|
||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class Data {
|
public class Data {
|
||||||
|
|
@ -34,7 +33,7 @@ public class Data {
|
||||||
@SerializedName("directors")
|
@SerializedName("directors")
|
||||||
private List<Value> directors;
|
private List<Value> directors;
|
||||||
@SerializedName("btbo_downlist")
|
@SerializedName("btbo_downlist")
|
||||||
private List<BtboDown> btboDownlist;
|
private List<Value> btboDownlist;
|
||||||
|
|
||||||
public String getJumpId() {
|
public String getJumpId() {
|
||||||
return TextUtils.isEmpty(jumpId) ? "" : jumpId;
|
return TextUtils.isEmpty(jumpId) ? "" : jumpId;
|
||||||
|
|
@ -53,74 +52,64 @@ public class Data {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
return TextUtils.isEmpty(description) ? "" : description;
|
return TextUtils.isEmpty(description) ? "" : description.replace(" ", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPlaylist() {
|
public String getPlaylist() {
|
||||||
return playlist == null ? "" : playlist.getTitle();
|
return playlist == null ? "" : playlist.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getYear() {
|
public String getYear() {
|
||||||
return year == null ? "" : year.getTitle();
|
return year == null ? "" : year.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getArea() {
|
public String getArea() {
|
||||||
return area == null ? "" : area.getTitle();
|
return area == null ? "" : area.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTypes() {
|
public String getTypes() {
|
||||||
return types == null ? "" : getValues(types);
|
return types == null ? "" : getValues(types, false, " ");
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getActors() {
|
public String getActors() {
|
||||||
return actors == null ? "" : getValues(actors);
|
return actors == null ? "" : getValues(actors, true, " ");
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDirectors() {
|
public String getDirectors() {
|
||||||
return directors == null ? "" : getValues(directors);
|
return directors == null ? "" : getValues(directors, true, " ");
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<BtboDown> getBtboDownlist() {
|
public String getPlayUrl() {
|
||||||
return btboDownlist == null ? Collections.emptyList() : btboDownlist;
|
return btboDownlist == null ? "" : getValues(btboDownlist, false, "#");
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vod vod() {
|
public Vod vod() {
|
||||||
return new Vod(getJumpId(), getTitle(), getThumbnail(), getMask());
|
return new Vod(getJumpId(), getTitle(), getThumbnail(), getMask());
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPlayUrl() {
|
public String getValues(List<Value> items, boolean link, String join) {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
for (BtboDown value : getBtboDownlist()) sb.append(value.getVal()).append("#");
|
for (Value value : items) sb.append(value.getValue(link)).append(join);
|
||||||
return Utils.substring(sb.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getValues(List<Value> items) {
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
for (Value value : items) sb.append(value.getLink()).append(" ");
|
|
||||||
return Utils.substring(sb.toString());
|
return Utils.substring(sb.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Value {
|
public static class Value {
|
||||||
|
|
||||||
@SerializedName(value = "title", alternate = "name")
|
@SerializedName(value = "val", alternate = {"name", "title"})
|
||||||
private String title;
|
private String value;
|
||||||
|
|
||||||
public String getTitle() {
|
private String getValue() {
|
||||||
return TextUtils.isEmpty(title) ? "" : title;
|
if (TextUtils.isEmpty(value)) return "";
|
||||||
|
if (value.startsWith("ftp://")) return "tvbox-xg:" + value;
|
||||||
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLink() {
|
private String getLink() {
|
||||||
return String.format("[a=cr:{\"id\":\"%s\",\"name\":\"%s\"}/]%s[/a]", getTitle() + "/{pg}", getTitle(), getTitle());
|
return String.format("[a=cr:{\"id\":\"%s\",\"name\":\"%s\"}/]%s[/a]", getValue() + "/{pg}", getValue(), getValue());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class BtboDown {
|
public String getValue(boolean link) {
|
||||||
|
return link ? getLink() : getValue();
|
||||||
@SerializedName("val")
|
|
||||||
private String val;
|
|
||||||
|
|
||||||
public String getVal() {
|
|
||||||
return TextUtils.isEmpty(val) ? "" : val.replaceAll("ftp", "tvbox-xg:ftp");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -1 +1 @@
|
||||||
3373bc113deec1bad88de323923dbe4f
|
6e09ca5f0d30c65076c316b3260deafd
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue