From a366e15765939b0cf00a35c4e586c5071658e832 Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Sun, 9 Jun 2024 12:16:20 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4BT=E4=B8=8B=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nas/Controllers/BTDownloadController.java | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/yutou/nas/Controllers/BTDownloadController.java b/src/main/java/com/yutou/nas/Controllers/BTDownloadController.java index 295da50..8a59ae4 100644 --- a/src/main/java/com/yutou/nas/Controllers/BTDownloadController.java +++ b/src/main/java/com/yutou/nas/Controllers/BTDownloadController.java @@ -2,10 +2,7 @@ package com.yutou.nas.Controllers; import com.alibaba.fastjson2.JSONObject; import com.yutou.nas.Services.IBangumiService; -import com.yutou.nas.utils.AnimRssManager; -import com.yutou.nas.utils.BTDownloadManager; -import com.yutou.nas.utils.DmhyRssDownloadManager; -import com.yutou.nas.utils.Log; +import com.yutou.nas.utils.*; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; @@ -15,6 +12,7 @@ import javax.servlet.http.HttpServletRequest; import java.io.BufferedInputStream; import java.io.ByteArrayOutputStream; import java.nio.charset.StandardCharsets; +import java.util.concurrent.TimeUnit; @Controller public class BTDownloadController { @@ -33,7 +31,17 @@ public class BTDownloadController { @RequestMapping("/bt/done.do") 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); - 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"; }