add task file
This commit is contained in:
parent
4e543be55b
commit
1772fad042
@ -3,6 +3,7 @@ package cn.montaro.aria2;
|
|||||||
import cn.montaro.aria2.annotation.Aria2Method;
|
import cn.montaro.aria2.annotation.Aria2Method;
|
||||||
import cn.montaro.aria2.bean.GlobalStat;
|
import cn.montaro.aria2.bean.GlobalStat;
|
||||||
import cn.montaro.aria2.bean.Task;
|
import cn.montaro.aria2.bean.Task;
|
||||||
|
import cn.montaro.aria2.bean.TaskFile;
|
||||||
import cn.montaro.aria2.constants.Aria2MethodName;
|
import cn.montaro.aria2.constants.Aria2MethodName;
|
||||||
import cn.montaro.aria2.resp.Aria2Status;
|
import cn.montaro.aria2.resp.Aria2Status;
|
||||||
|
|
||||||
@ -73,7 +74,7 @@ public interface Aria2Client {
|
|||||||
String getUris(String gid);
|
String getUris(String gid);
|
||||||
|
|
||||||
@Aria2Method(Aria2MethodName.GET_FILES)
|
@Aria2Method(Aria2MethodName.GET_FILES)
|
||||||
String getFiles(String gid);
|
List<TaskFile> getFiles(String gid);
|
||||||
|
|
||||||
@Aria2Method(Aria2MethodName.GET_PEERS)
|
@Aria2Method(Aria2MethodName.GET_PEERS)
|
||||||
String getPeers(String gid);
|
String getPeers(String gid);
|
||||||
|
|||||||
@ -24,24 +24,27 @@ public class Task implements Serializable {
|
|||||||
|
|
||||||
private List<TaskFile> files;
|
private List<TaskFile> files;
|
||||||
|
|
||||||
static class TaskFile {
|
public String getDir() {
|
||||||
|
return dir;
|
||||||
|
}
|
||||||
|
|
||||||
String path;
|
public void setDir(String dir) {
|
||||||
|
this.dir = dir;
|
||||||
|
}
|
||||||
|
|
||||||
public String getPath() {
|
public List<TaskFile> getFiles() {
|
||||||
return path;
|
return files;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPath(String path) {
|
public void setFiles(List<TaskFile> files) {
|
||||||
this.path = path;
|
this.files = files;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
if (Objects.isNull(dir) || this.files.isEmpty()) {
|
if (Objects.isNull(dir) || this.files.isEmpty()) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
String name = files.get(0).path.replace(dir + "/", "");
|
String name = files.get(0).getPath().replace(dir + "/", "");
|
||||||
if (name.length() <= 20) {
|
if (name.length() <= 20) {
|
||||||
return String.format("%-20s", name);
|
return String.format("%-20s", name);
|
||||||
}
|
}
|
||||||
|
|||||||
44
src/main/java/cn/montaro/aria2/bean/TaskFile.java
Normal file
44
src/main/java/cn/montaro/aria2/bean/TaskFile.java
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
package cn.montaro.aria2.bean;
|
||||||
|
|
||||||
|
public class TaskFile {
|
||||||
|
|
||||||
|
private int index;
|
||||||
|
|
||||||
|
private Long length;
|
||||||
|
|
||||||
|
private String path;
|
||||||
|
|
||||||
|
private Long completedLength;
|
||||||
|
|
||||||
|
public Long getLength() {
|
||||||
|
return length;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLength(Long length) {
|
||||||
|
this.length = length;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getIndex() {
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIndex(int index) {
|
||||||
|
this.index = index;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPath() {
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPath(String path) {
|
||||||
|
this.path = path;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getCompletedLength() {
|
||||||
|
return completedLength;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCompletedLength(Long completedLength) {
|
||||||
|
this.completedLength = completedLength;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user