调整BT下载

This commit is contained in:
zlzw 2024-06-09 12:16:20 +08:00
parent 25bee81d05
commit a366e15765

View File

@ -2,10 +2,7 @@ package com.yutou.nas.Controllers;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.yutou.nas.Services.IBangumiService; import com.yutou.nas.Services.IBangumiService;
import com.yutou.nas.utils.AnimRssManager; import com.yutou.nas.utils.*;
import com.yutou.nas.utils.BTDownloadManager;
import com.yutou.nas.utils.DmhyRssDownloadManager;
import com.yutou.nas.utils.Log;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
@ -15,6 +12,7 @@ import javax.servlet.http.HttpServletRequest;
import java.io.BufferedInputStream; import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.concurrent.TimeUnit;
@Controller @Controller
public class BTDownloadController { public class BTDownloadController {
@ -33,7 +31,17 @@ public class BTDownloadController {
@RequestMapping("/bt/done.do") @RequestMapping("/bt/done.do")
public String done(String path, String filename, String hash1, String hash2, String tid) { public String done(String path, String filename, String hash1, String hash2, String tid) {
Log.i("BTDownloadController.done", "path = " + path + ", filename = " + filename + ", hash1 = " + hash1 + ", hash2 = " + hash2 + ", tid = " + tid); Log.i("BTDownloadController.done", "path = " + path + ", filename = " + filename + ", hash1 = " + hash1 + ", hash2 = " + hash2 + ", tid = " + tid);
BTDownloadManager.done(path, filename, hash1, hash2, tid); //BTDownloadManager.done(path, filename, hash1, hash2, tid);
try {
String exec = ConfigTools.load(ConfigTools.CONFIG, "tiny.exec", String.class);
Process process = Runtime.getRuntime().exec(new String[]{"sh"
, "-c"
, exec});
process.waitFor(120, TimeUnit.SECONDS);
} catch (Exception e) {
Log.e("下崽器", e);
}
return "ok"; return "ok";
} }