update
This commit is contained in:
@@ -41,16 +41,16 @@ public class BTDownloadManager implements ApplicationContextAware {
|
||||
List<BangumiItem> list = bangumiService.getAllBangumi();
|
||||
AnimationData data = new AnimationData();
|
||||
for (BangumiItem item : list) {
|
||||
item.setAuthor(data.nameToValue(item.getAuthor(), true) + "");
|
||||
item.setCategories(data.nameToValue(item.getCategories(), false) + "");
|
||||
String url = getRSSUrl(item);
|
||||
String _json = HttpTools.get(url);
|
||||
if (!StringUtils.isEmpty(_json)) {
|
||||
JSONObject json = JSONObject.parseObject(_json);
|
||||
item.setAuthor(data.nameToValue(item.getAuthor(),true)+"");
|
||||
item.setCategories(data.nameToValue(item.getCategories(),false)+"");
|
||||
download(item, json);
|
||||
}else{
|
||||
QQBotManager.getInstance().sendMessage(item.getTitle()+"\n下载失败");
|
||||
Log.i(item.getTitle()+"\n下载失败");
|
||||
} else {
|
||||
QQBotManager.getInstance().sendMessage(item.getTitle() + "\n下载失败");
|
||||
Log.i(item.getTitle() + "\n下载失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -84,21 +84,8 @@ public class BTDownloadManager implements ApplicationContextAware {
|
||||
array.add(item.getString("title"));
|
||||
RedisTools.set(bangumiItem.getTitle(), array.toJSONString());
|
||||
if (item.containsKey("thumbnail")) {
|
||||
HttpTools.download(item.getString("thumbnail"), bangumiItem.getTitle() + ".jpg", new DownloadInterface() {
|
||||
@Override
|
||||
public void onDownload(File file) {
|
||||
super.onDownload(file);
|
||||
onSend(file, item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Exception e) {
|
||||
super.onError(e);
|
||||
onSend(null, item);
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
File file = HttpTools.syncDownload(item.getString("thumbnail"), bangumiItem.getTitle() + ".jpg");
|
||||
onSend(file, item);
|
||||
} else {
|
||||
onSend(null, item);
|
||||
}
|
||||
@@ -120,12 +107,14 @@ public class BTDownloadManager implements ApplicationContextAware {
|
||||
|
||||
public boolean download(String title, String url) {
|
||||
try {
|
||||
Runtime.getRuntime().exec(new String[]{"sh"
|
||||
, "-c"
|
||||
, String.format("transmission-remote -n yutou:34864394 -w /media/yutou/4t/public/download/anim/%s -a \"%s\" "
|
||||
String exec = String.format("transmission-remote -n yutou:34864394 -w /media/yutou/4t/public/download/anim/%s -a \"%s\" "
|
||||
, title
|
||||
, url
|
||||
)});
|
||||
);
|
||||
Log.i(exec);
|
||||
Runtime.getRuntime().exec(new String[]{"sh"
|
||||
, "-c"
|
||||
, exec});
|
||||
return true;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
|
||||
Reference in New Issue
Block a user