Skip to content

Commit

Permalink
增加 重命名模版
Browse files Browse the repository at this point in the history
  • Loading branch information
wushuo894 committed Oct 4, 2024
1 parent 0556d5b commit 45aafb3
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/main/java/ani/rss/util/AniUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ public static Ani getAni(String url, String text, String type) {
if (config.getOffset()) {
String s = HttpReq.get(url, true)
.thenFunction(HttpResponse::body);
List<Item> items = getItems(ani, s);
List<Item> items = getItems(ani, s, new Item());
if (items.isEmpty()) {
return ani;
}
Expand Down Expand Up @@ -307,7 +307,7 @@ public static String saveJpg(String coverUrl) {
* @param xml
* @return
*/
public static List<Item> getItems(Ani ani, String xml) {
public static List<Item> getItems(Ani ani, String xml, Item newItem) {
List<String> exclude = ani.getExclude();
List<String> match = ani.getMatch();
Boolean ova = ani.getOva();
Expand Down Expand Up @@ -391,7 +391,9 @@ public static List<Item> getItems(Ani ani, String xml) {
infoHash = infoHash.toLowerCase();
}

Item newItem = new Item()
Item addNewItem = ObjectUtil.clone(newItem);

addNewItem
.setEpisode(1.0)
.setTitle(itemTitle)
.setReName(itemTitle)
Expand All @@ -400,17 +402,17 @@ public static List<Item> getItems(Ani ani, String xml) {
.setSize(size);

// 进行过滤
if (exclude.stream().anyMatch(s -> ReUtil.contains(s, newItem.getTitle()))) {
if (exclude.stream().anyMatch(s -> ReUtil.contains(s, addNewItem.getTitle()))) {
continue;
}

// 全局排除
if (globalExclude) {
if (globalExcludeList.stream().anyMatch(s -> ReUtil.contains(s, newItem.getTitle()))) {
if (globalExcludeList.stream().anyMatch(s -> ReUtil.contains(s, addNewItem.getTitle()))) {
continue;
}
}
items.add(newItem);
items.add(addNewItem);
}

// 匹配规则
Expand Down Expand Up @@ -455,7 +457,7 @@ public static synchronized List<Item> getItems(Ani ani) {

String s = HttpReq.get(url, true)
.thenFunction(HttpResponse::body);
items.addAll(getItems(ani, s)
items.addAll(getItems(ani, s, new Item().setSubgroup(ani.getSubgroup()))
.stream()
.peek(item -> {
item.setMaster(true)
Expand All @@ -474,7 +476,7 @@ public static synchronized List<Item> getItems(Ani ani) {
ThreadUtil.sleep(1000);
s = HttpReq.get(rss.getUrl(), true)
.thenFunction(HttpResponse::body);
items.addAll(getItems(ani, s)
items.addAll(getItems(ani, s, new Item().setSubgroup(ani.getSubgroup()))
.stream()
.peek(item -> {
item.setMaster(false)
Expand Down

0 comments on commit 45aafb3

Please sign in to comment.