Skip to content

Commit

Permalink
优化坏种处理逻辑
Browse files Browse the repository at this point in the history
webhook支持代理
  • Loading branch information
wushuo894 committed Nov 9, 2024
1 parent ca4602d commit a2cf4c6
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 6 deletions.
4 changes: 3 additions & 1 deletion UPDATE.md
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
为下载任务增加分类
优化坏种处理逻辑

webhook支持代理
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.180</version>
<version>1.1.181</version>

<properties>
<maven.compiler.source>11</maven.compiler.source>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/ani/rss/action/AniAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ public void delete() {
.filter(it -> ids.contains(it.getId()))
.collect(Collectors.toList());
if (anis.isEmpty()) {
resultErrorMsg("修改失败");
resultErrorMsg("删除失败");
return;
}
for (Ani ani : anis) {
Expand Down
9 changes: 7 additions & 2 deletions src/main/java/ani/rss/download/Transmission.java
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,13 @@ public Boolean download(Item item, String savePath, File torrentFile, Boolean ov
torrent = FileUtil.readUtf8String(torrentFile);
body = StrFormatter.format(body, GsonStatic.toJson(tags), savePath, "", torrent);
} else {
torrent = Base64.encode(torrentFile);
body = StrFormatter.format(body, GsonStatic.toJson(tags), savePath, torrent, "");
if (torrentFile.length() > 0) {
torrent = Base64.encode(torrentFile);
body = StrFormatter.format(body, GsonStatic.toJson(tags), savePath, torrent, "");
} else {
torrent = "magnet:?xt=urn:btih:" + FileUtil.mainName(torrentFile);
body = StrFormatter.format(body, GsonStatic.toJson(tags), savePath, "", torrent);
}
}

String id = HttpReq.post(host + "/transmission/rpc", false)
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/ani/rss/download/qBittorrent.java
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,11 @@ public Boolean download(Item item, String savePath, File torrentFile, Boolean ov
if ("txt".equals(extName)) {
httpRequest.form("urls", FileUtil.readUtf8String(torrentFile));
} else {
httpRequest.form("torrents", torrentFile);
if (torrentFile.length() > 0) {
httpRequest.form("torrents", torrentFile);
} else {
httpRequest.form("urls", "magnet:?xt=urn:btih:" + FileUtil.mainName(torrentFile));
}
}
httpRequest.thenFunction(HttpResponse::isOk);

Expand Down

0 comments on commit a2cf4c6

Please sign in to comment.