Skip to content

Commit

Permalink
Merge pull request #146 from wushuo894/test
Browse files Browse the repository at this point in the history
支持设置RSS超时时间
  • Loading branch information
wushuo894 authored Jan 16, 2025
2 parents 737eaae + 7123903 commit 3c5d69c
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 7 deletions.
6 changes: 1 addition & 5 deletions UPDATE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
PWA主题色跟随系统主题

close #143

bgm点格子前先判断状态,防止刷屏 #142 @EzraRT
支持设置RSS超时时间
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>ani.rss</groupId>
<artifactId>ani-rss</artifactId>
<version>1.1.220</version>
<version>1.1.221</version>

<properties>
<maven.compiler.source>11</maven.compiler.source>
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/ani/rss/entity/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,11 @@ public class Config implements Serializable {
*/
private Boolean rss;

/**
* rss 超时时间 秒
*/
private Integer rssTimeout;

/**
* 文件已下载自动跳过
*/
Expand Down
1 change: 1 addition & 0 deletions src/main/java/ani/rss/util/AniUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ public static Ani getAni(String url, String text, String type, String bgmUrl) {
}

String s = HttpReq.get(url, true)
.timeout(config.getRssTimeout() * 1000)
.thenFunction(HttpResponse::body);
List<Item> items = ItemsUtil.getItems(ani, s, new Item());
if (items.size() == 1) {
Expand Down
1 change: 1 addition & 0 deletions src/main/java/ani/rss/util/ConfigUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public class ConfigUtil {
.setGcSleep(10)
.setRename(true)
.setRss(true)
.setRssTimeout(6)
.setWatchErrorTorrent(true)
.setDelayedDownload(0)
.setFileExist(false)
Expand Down
5 changes: 4 additions & 1 deletion src/main/java/ani/rss/util/ItemsUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,17 @@ public static synchronized List<Item> getItems(Ani ani) {

List<Item> items = new ArrayList<>();

Config config = ConfigUtil.CONFIG;

String s = HttpReq.get(url, true)
.timeout(config.getRssTimeout() * 1000)
.thenFunction(HttpResponse::body);
String subgroup = StrUtil.blankToDefault(ani.getSubgroup(), "未知字幕组");
items.addAll(ItemsUtil.getItems(ani, s, new Item().setSubgroup(subgroup))
.stream()
.peek(item -> item.setMaster(true))
.collect(Collectors.toList()));

Config config = ConfigUtil.CONFIG;
if (!config.getBackRss()) {
return items;
}
Expand All @@ -60,6 +62,7 @@ public static synchronized List<Item> getItems(Ani ani) {
for (Ani.BackRss rss : backRss) {
ThreadUtil.sleep(1000);
s = HttpReq.get(rss.getUrl(), true)
.timeout(config.getRssTimeout() * 1000)
.thenFunction(HttpResponse::body);
subgroup = StrUtil.blankToDefault(rss.getLabel(), "未知字幕组");
Ani clone = ObjUtil.clone(ani);
Expand Down
8 changes: 8 additions & 0 deletions ui/src/config/Basic.vue
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,14 @@
</template>
</el-input-number>
</el-form-item>
<el-form-item label="RSS超时">
<el-input-number v-model:model-value="props.config['rssTimeout']"
:min="6" :max="60">
<template #suffix>
<span>秒</span>
</template>
</el-input-number>
</el-form-item>
<el-form-item label="自动跳过">
<div style="width: 100%">
<el-switch v-model:model-value="props.config.fileExist" :disabled="!config.rename"/>
Expand Down

0 comments on commit 3c5d69c

Please sign in to comment.