Alist support custom pic

This commit is contained in:
FongMi 2023-04-04 23:13:48 +08:00
parent 5343334ca1
commit 44776ec440
5 changed files with 23 additions and 13 deletions

View File

@ -17,6 +17,8 @@ public class Drive {
@SerializedName("drives") @SerializedName("drives")
private List<Drive> drives; private List<Drive> drives;
@SerializedName("vodPic")
private String vodPic;
@SerializedName("name") @SerializedName("name")
private String name; private String name;
@SerializedName("server") @SerializedName("server")
@ -40,6 +42,10 @@ public class Drive {
this.name = name; this.name = name;
} }
public String getVodPic() {
return TextUtils.isEmpty(vodPic) ? "https://s1.ax1x.com/2023/04/03/pp4F4bT.png" : vodPic;
}
public String getName() { public String getName() {
return TextUtils.isEmpty(name) ? "" : name; return TextUtils.isEmpty(name) ? "" : name;
} }

View File

@ -36,7 +36,8 @@ public class Item {
} }
public static List<Item> arrayFrom(String str) { public static List<Item> arrayFrom(String str) {
Type listType = new TypeToken<List<Item>>() {}.getType(); Type listType = new TypeToken<List<Item>>() {
}.getType();
return new Gson().fromJson(str, listType); return new Gson().fromJson(str, listType);
} }
@ -112,8 +113,8 @@ public class Item {
return id + getPath() + "/" + getName(); return id + getPath() + "/" + getName();
} }
public String getPic() { public String getPic(String pic) {
return getThumb().isEmpty() && isFolder() ? "https://s1.ax1x.com/2023/04/03/pp4F4bT.png" : getThumb(); return getThumb().isEmpty() && isFolder() ? pic : getThumb();
} }
public String getRemark() { public String getRemark() {
@ -124,11 +125,11 @@ public class Item {
return isFolder() ? "folder" : "file"; return isFolder() ? "folder" : "file";
} }
public Vod getVod(String id) { public Vod getVod(String id, String pic) {
return new Vod(getVodId(id), getName(), getPic(), getRemark(), getVodTag()); return new Vod(getVodId(id), getName(), getPic(pic), getRemark(), getVodTag());
} }
public Vod getVod(Drive drive) { public Vod getVod(Drive drive, String pic) {
return new Vod(getVodId(drive.getName()), getName(), getPic(), drive.getName(), getVodTag()); return new Vod(getVodId(drive.getName()), getName(), getPic(pic), drive.getName(), getVodTag());
} }
} }

View File

@ -30,6 +30,7 @@ import java.util.concurrent.CountDownLatch;
public class AList extends Spider { public class AList extends Spider {
private List<Drive> drives; private List<Drive> drives;
private String vodPic;
private String ext; private String ext;
private List<Filter> getFilter() { private List<Filter> getFilter() {
@ -42,7 +43,9 @@ public class AList extends Spider {
private void fetchRule() { private void fetchRule() {
if (drives != null && !drives.isEmpty()) return; if (drives != null && !drives.isEmpty()) return;
if (ext.startsWith("http")) ext = OkHttp.string(ext); if (ext.startsWith("http")) ext = OkHttp.string(ext);
drives = Drive.objectFrom(ext).getDrives(); Drive drive = Drive.objectFrom(ext);
drives = drive.getDrives();
vodPic = drive.getVodPic();
} }
private Drive getDrive(String name) { private Drive getDrive(String name) {
@ -84,8 +87,8 @@ public class AList extends Spider {
Sorter.sort(type, order, folders); Sorter.sort(type, order, folders);
Sorter.sort(type, order, files); Sorter.sort(type, order, files);
} }
for (Item item : folders) list.add(item.getVod(tid)); for (Item item : folders) list.add(item.getVod(tid, vodPic));
for (Item item : files) list.add(item.getVod(tid)); for (Item item : files) list.add(item.getVod(tid, vodPic));
return Result.get().vod(list).page().string(); return Result.get().vod(list).page().string();
} }
@ -108,9 +111,9 @@ public class AList extends Spider {
Vod vod = new Vod(); Vod vod = new Vod();
vod.setVodId(id); vod.setVodId(id);
vod.setVodName(name); vod.setVodName(name);
vod.setVodPic(vodPic);
vod.setVodPlayFrom(key); vod.setVodPlayFrom(key);
vod.setVodPlayUrl(TextUtils.join("#", playUrls)); vod.setVodPlayUrl(TextUtils.join("#", playUrls));
vod.setVodPic("http://img1.3png.com/281e284a670865a71d91515866552b5f172b.png");
return Result.string(vod); return Result.string(vod);
} }
@ -167,7 +170,7 @@ public class AList extends Spider {
try { try {
String response = OkHttp.postJson(drive.searchApi(), drive.params(keyword)); String response = OkHttp.postJson(drive.searchApi(), drive.params(keyword));
List<Item> items = Item.arrayFrom(getSearchJson(drive.isNew(), response)); List<Item> items = Item.arrayFrom(getSearchJson(drive.isNew(), response));
for (Item item : items) if (!item.ignore(drive.isNew())) list.add(item.getVod(drive)); for (Item item : items) if (!item.ignore(drive.isNew())) list.add(item.getVod(drive, vodPic));
} catch (Exception ignored) { } catch (Exception ignored) {
} finally { } finally {
cd.countDown(); cd.countDown();

Binary file not shown.

View File

@ -1 +1 @@
debd4cf545c08d546b477c80319b9ad0 9dad9b968f26436fc4e681d0dc372d55