update:替换BT下载器

This commit is contained in:
Yutousama 2022-10-09 00:01:47 +08:00
parent 780e86c7af
commit c3ce37e1b4
2 changed files with 9 additions and 27 deletions

View File

@ -1,5 +1,6 @@
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;
@ -25,9 +26,9 @@ public class BTDownloadController {
}
@ResponseBody
@RequestMapping("/bt/done.do")
public String done(String id,String name){
Log.i("BTDownloadController.done","id = " + id + ", name = " + name);
BTDownloadManager.done(id,name);
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);
return "ok";
}
@ResponseBody

View File

@ -70,7 +70,7 @@ public class BTDownloadManager {
public static boolean download(String title, String url) {
try {
String exec = String.format("transmission-remote -n yutou:34864394 -w \"%sanim/%s\" -a \"%s\" --torrent-done-script \"/home/yutou/public/servier/btDone.sh\""
String exec = String.format("qbittorrent-nox --save-path=\"%sanim/%s\" \"%s\""
, DownloadHomePath
, title
, url
@ -106,31 +106,12 @@ public class BTDownloadManager {
return array.contains(key);
}
public synchronized static void done(String id, String name) {
AppTools.exec("transmission-remote -n yutou:34864394 -t"+id+" -i | grep Location", new ObjectInterface() {
String remoteLocation;
String remoteName;
@Override
public void out(String data) {
super.out(data);
Log.i("BTDownloadManager.out.location","location= "+data);
remoteLocation=data.replace("Location:","").trim();
AppTools.exec("transmission-remote -n yutou:34864394 -t"+id+" -i | grep Name:", new ObjectInterface() {
@Override
public void out(String data) {
super.out(data);
Log.i("BTDownloadManager.out.name","name = "+data);
remoteName =data.replace("Name:","").trim();
grep(remoteLocation, remoteName);
}
},false,true);
}
},false,true);
public synchronized static void done(String path,String filename,String hash1,String hash2,String tid) {
grep(path,filename);
}
private static void grep(String remoteLocation, String remoteName) {
if(remoteName.contains("265")){
/* if(remoteName.contains("265")){
String newName=remoteName.replace("265","贰陸伍");
String exec="mv \"" + remoteLocation + File.separator + remoteName + "\" \"" + remoteLocation + File.separator + newName+"\"";
Log.i("执行改名",exec);
@ -141,7 +122,7 @@ public class BTDownloadManager {
Log.i("改名结果:",data);
}
}, false, true);
}
}*/
AppTools.exec("/home/yutou/public/servier/tinyMediaManager/tinyMediaManager tvshow -u --scrapeUnscraped", null, false, true);
}
}