feat: 初始化XMBOX项目
This commit is contained in:
@@ -0,0 +1 @@
|
||||
/build
|
||||
@@ -0,0 +1,18 @@
|
||||
plugins {
|
||||
id 'com.android.library'
|
||||
}
|
||||
|
||||
android {
|
||||
namespace 'com.ghost.thunder'
|
||||
|
||||
compileSdk 35
|
||||
|
||||
defaultConfig {
|
||||
minSdk 21
|
||||
targetSdk 28
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation project(':catvod')
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest />
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.xunlei.downloadlib;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class Util {
|
||||
|
||||
private static final List<String> VIDEO = Arrays.asList("avi", "flv", "mkv", "mov", "mp4", "mpeg", "mpe", "mpg", "wmv");
|
||||
private static final List<String> AUDIO = Arrays.asList("aac", "ape", "flac", "mp3", "m4a", "ogg");
|
||||
private static final String[] UNITS = new String[]{"bytes", "KB", "MB", "GB", "TB"};
|
||||
private static final long MINIMAL = 30 * 1024 * 1024;
|
||||
|
||||
public static boolean isMedia(String ext, long size) {
|
||||
return (VIDEO.contains(ext) || AUDIO.contains(ext)) && size > MINIMAL;
|
||||
}
|
||||
|
||||
public static String size(long size) {
|
||||
if (size <= 0) return "";
|
||||
int group = (int) (Math.log10(size) / Math.log10(1024));
|
||||
return "[" + new DecimalFormat("###0.#").format(size / Math.pow(1024, group)) + " " + UNITS[group] + "] ";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
package com.xunlei.downloadlib;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
|
||||
import com.github.catvod.Init;
|
||||
import com.github.catvod.utils.Prefers;
|
||||
import com.xunlei.downloadlib.android.XLUtil;
|
||||
import com.xunlei.downloadlib.parameter.BtIndexSet;
|
||||
import com.xunlei.downloadlib.parameter.BtSubTaskDetail;
|
||||
import com.xunlei.downloadlib.parameter.BtTaskParam;
|
||||
import com.xunlei.downloadlib.parameter.EmuleTaskParam;
|
||||
import com.xunlei.downloadlib.parameter.GetDownloadLibVersion;
|
||||
import com.xunlei.downloadlib.parameter.GetFileName;
|
||||
import com.xunlei.downloadlib.parameter.GetTaskId;
|
||||
import com.xunlei.downloadlib.parameter.InitParam;
|
||||
import com.xunlei.downloadlib.parameter.MagnetTaskParam;
|
||||
import com.xunlei.downloadlib.parameter.P2spTaskParam;
|
||||
import com.xunlei.downloadlib.parameter.ThunderUrlInfo;
|
||||
import com.xunlei.downloadlib.parameter.TorrentInfo;
|
||||
import com.xunlei.downloadlib.parameter.XLTaskInfo;
|
||||
import com.xunlei.downloadlib.parameter.XLTaskLocalUrl;
|
||||
|
||||
public class XLDownloadManager {
|
||||
|
||||
private XLLoader loader;
|
||||
private Context context;
|
||||
|
||||
public XLDownloadManager() {
|
||||
this.context = Init.context();
|
||||
this.loader = new XLLoader();
|
||||
this.init();
|
||||
}
|
||||
|
||||
public void init() {
|
||||
InitParam param = new InitParam(context.getFilesDir().getPath());
|
||||
loader.init(param.getSoKey(), "com.android.providers.downloads", param.mAppVersion, "", getPeerId(), getGuid(), param.mStatSavePath, param.mStatCfgSavePath, 0, param.mPermissionLevel, param.mQueryConfOnInit);
|
||||
getDownloadLibVersion(new GetDownloadLibVersion());
|
||||
setOSVersion(Build.VERSION.INCREMENTAL + "_alpha");
|
||||
setLocalProperty("PhoneModel", Build.MODEL);
|
||||
setStatReportSwitch(false);
|
||||
setSpeedLimit(-1, -1);
|
||||
}
|
||||
|
||||
public void release() {
|
||||
if (loader != null) loader.unInit();
|
||||
context = null;
|
||||
loader = null;
|
||||
}
|
||||
|
||||
private String getPeerId() {
|
||||
String uuid = Prefers.getString("phoneId5");
|
||||
if (uuid.isEmpty()) Prefers.put("phoneId5", uuid = XLUtil.getPeerId());
|
||||
return uuid;
|
||||
}
|
||||
|
||||
private String getGuid() {
|
||||
return XLUtil.getGuid();
|
||||
}
|
||||
|
||||
public void releaseTask(long taskId) {
|
||||
loader.releaseTask(taskId);
|
||||
}
|
||||
|
||||
public void startTask(long taskId) {
|
||||
loader.startTask(taskId);
|
||||
}
|
||||
|
||||
public void stopTask(long taskId) {
|
||||
loader.stopTask(taskId);
|
||||
}
|
||||
|
||||
public void getTaskInfo(long taskId, int i, XLTaskInfo taskInfo) {
|
||||
loader.getTaskInfo(taskId, i, taskInfo);
|
||||
}
|
||||
|
||||
public void getLocalUrl(String filePath, XLTaskLocalUrl localUrl) {
|
||||
loader.getLocalUrl(filePath, localUrl);
|
||||
}
|
||||
|
||||
public void getDownloadLibVersion(GetDownloadLibVersion version) {
|
||||
loader.getDownloadLibVersion(version);
|
||||
}
|
||||
|
||||
public void setStatReportSwitch(boolean value) {
|
||||
loader.setStatReportSwitch(value);
|
||||
}
|
||||
|
||||
private void setLocalProperty(String key, String value) {
|
||||
loader.setLocalProperty(key, value);
|
||||
}
|
||||
|
||||
public void setOSVersion(String str) {
|
||||
loader.setMiUiVersion(str);
|
||||
}
|
||||
|
||||
public void setOriginUserAgent(long taskId, String userAgent) {
|
||||
loader.setOriginUserAgent(taskId, userAgent);
|
||||
}
|
||||
|
||||
public void setDownloadTaskOrigin(long taskId, String str) {
|
||||
loader.setDownloadTaskOrigin(taskId, str);
|
||||
}
|
||||
|
||||
public void setTaskGsState(long j, int i, int i2) {
|
||||
loader.setTaskGsState(j, i, i2);
|
||||
}
|
||||
|
||||
public int createP2spTask(P2spTaskParam param, GetTaskId taskId) {
|
||||
return loader.createP2spTask(param.mUrl, param.mRefUrl, param.mCookie, param.mUser, param.mPass, param.mFilePath, param.mFileName, param.mCreateMode, param.mSeqId, taskId);
|
||||
}
|
||||
|
||||
public int createBtMagnetTask(MagnetTaskParam param, GetTaskId taskId) {
|
||||
return loader.createBtMagnetTask(param.mUrl, param.mFilePath, param.mFileName, taskId);
|
||||
}
|
||||
|
||||
public int createEmuleTask(EmuleTaskParam param, GetTaskId taskId) {
|
||||
return loader.createEmuleTask(param.mUrl, param.mFilePath, param.mFileName, param.mCreateMode, param.mSeqId, taskId);
|
||||
}
|
||||
|
||||
public int createBtTask(BtTaskParam param, GetTaskId taskId) {
|
||||
return loader.createBtTask(param.mTorrentPath, param.mFilePath, param.mMaxConcurrent, param.mCreateMode, param.mSeqId, taskId);
|
||||
}
|
||||
|
||||
public void getTorrentInfo(TorrentInfo info) {
|
||||
loader.getTorrentInfo(info.getFile().getAbsolutePath(), info);
|
||||
}
|
||||
|
||||
public void getBtSubTaskInfo(long taskId, int index, BtSubTaskDetail detail) {
|
||||
loader.getBtSubTaskInfo(taskId, index, detail);
|
||||
}
|
||||
|
||||
public void deselectBtSubTask(long taskId, BtIndexSet btIndexSet) {
|
||||
loader.deselectBtSubTask(taskId, btIndexSet);
|
||||
}
|
||||
|
||||
public String parserThunderUrl(String url) {
|
||||
ThunderUrlInfo thunderUrlInfo = new ThunderUrlInfo();
|
||||
loader.parserThunderUrl(url, thunderUrlInfo);
|
||||
return thunderUrlInfo.mUrl;
|
||||
}
|
||||
|
||||
public String getFileNameFromUrl(String url) {
|
||||
GetFileName getFileName = new GetFileName();
|
||||
loader.getFileNameFromUrl(url, getFileName);
|
||||
return getFileName.getFileName();
|
||||
}
|
||||
|
||||
public void setSpeedLimit(long min, long max) {
|
||||
loader.setSpeedLimit(min, max);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package com.xunlei.downloadlib;
|
||||
|
||||
import com.xunlei.downloadlib.parameter.BtIndexSet;
|
||||
import com.xunlei.downloadlib.parameter.BtSubTaskDetail;
|
||||
import com.xunlei.downloadlib.parameter.GetDownloadLibVersion;
|
||||
import com.xunlei.downloadlib.parameter.GetFileName;
|
||||
import com.xunlei.downloadlib.parameter.GetTaskId;
|
||||
import com.xunlei.downloadlib.parameter.ThunderUrlInfo;
|
||||
import com.xunlei.downloadlib.parameter.TorrentInfo;
|
||||
import com.xunlei.downloadlib.parameter.XLTaskInfo;
|
||||
import com.xunlei.downloadlib.parameter.XLTaskLocalUrl;
|
||||
|
||||
class XLLoader {
|
||||
|
||||
public XLLoader() {
|
||||
System.loadLibrary("xl_stat");
|
||||
System.loadLibrary("xl_thunder_sdk");
|
||||
}
|
||||
|
||||
public native int createBtMagnetTask(String str, String str2, String str3, GetTaskId getTaskId);
|
||||
|
||||
public native int createBtTask(String str, String str2, int i, int i2, int i3, GetTaskId getTaskId);
|
||||
|
||||
public native int createEmuleTask(String str, String str2, String str3, int i, int i2, GetTaskId getTaskId);
|
||||
|
||||
public native int createP2spTask(String str, String str2, String str3, String str4, String str5, String str6, String str7, int i, int i2, GetTaskId getTaskId);
|
||||
|
||||
public native int deselectBtSubTask(long j, BtIndexSet btIndexSet);
|
||||
|
||||
public native int getBtSubTaskInfo(long j, int i, BtSubTaskDetail btSubTaskDetail);
|
||||
|
||||
public native int getDownloadLibVersion(GetDownloadLibVersion getDownloadLibVersion);
|
||||
|
||||
public native int getFileNameFromUrl(String str, GetFileName getFileName);
|
||||
|
||||
public native int getLocalUrl(String str, XLTaskLocalUrl xLTaskLocalUrl);
|
||||
|
||||
public native int getTaskInfo(long j, int i, XLTaskInfo xLTaskInfo);
|
||||
|
||||
public native int getTorrentInfo(String str, TorrentInfo torrentInfo);
|
||||
|
||||
public native int init(String str, String str2, String str3, String str4, String str5, String str6, String str7, String str8, int i, int i2, int i3);
|
||||
|
||||
public native int parserThunderUrl(String str, ThunderUrlInfo thunderUrlInfo);
|
||||
|
||||
public native int releaseTask(long j);
|
||||
|
||||
public native int setDownloadTaskOrigin(long j, String str);
|
||||
|
||||
public native int setLocalProperty(String str, String str2);
|
||||
|
||||
public native int setMiUiVersion(String str);
|
||||
|
||||
public native int setOriginUserAgent(long j, String str);
|
||||
|
||||
public native int setStatReportSwitch(boolean z);
|
||||
|
||||
public native int setSpeedLimit(long j, long j2);
|
||||
|
||||
public native int setTaskGsState(long j, int i, int i2);
|
||||
|
||||
public native int startTask(long j);
|
||||
|
||||
public native int stopTask(long j);
|
||||
|
||||
public native int unInit();
|
||||
}
|
||||
@@ -0,0 +1,166 @@
|
||||
package com.xunlei.downloadlib;
|
||||
|
||||
import com.github.catvod.utils.Path;
|
||||
import com.xunlei.downloadlib.parameter.BtIndexSet;
|
||||
import com.xunlei.downloadlib.parameter.BtSubTaskDetail;
|
||||
import com.xunlei.downloadlib.parameter.BtTaskParam;
|
||||
import com.xunlei.downloadlib.parameter.EmuleTaskParam;
|
||||
import com.xunlei.downloadlib.parameter.GetTaskId;
|
||||
import com.xunlei.downloadlib.parameter.MagnetTaskParam;
|
||||
import com.xunlei.downloadlib.parameter.P2spTaskParam;
|
||||
import com.xunlei.downloadlib.parameter.TorrentFileInfo;
|
||||
import com.xunlei.downloadlib.parameter.TorrentInfo;
|
||||
import com.xunlei.downloadlib.parameter.XLConstant;
|
||||
import com.xunlei.downloadlib.parameter.XLTaskInfo;
|
||||
import com.xunlei.downloadlib.parameter.XLTaskLocalUrl;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
public class XLTaskHelper {
|
||||
|
||||
private XLDownloadManager manager;
|
||||
private AtomicInteger seq;
|
||||
|
||||
private static class Loader {
|
||||
static volatile XLTaskHelper INSTANCE = new XLTaskHelper();
|
||||
}
|
||||
|
||||
public synchronized static XLTaskHelper get() {
|
||||
return Loader.INSTANCE;
|
||||
}
|
||||
|
||||
private synchronized AtomicInteger getSeq() {
|
||||
return seq = seq == null ? new AtomicInteger(0) : seq;
|
||||
}
|
||||
|
||||
private synchronized XLDownloadManager getManager() {
|
||||
return manager = manager == null ? new XLDownloadManager() : manager;
|
||||
}
|
||||
|
||||
private synchronized GetTaskId startTask(GetTaskId taskId, int index) {
|
||||
getManager().setTaskGsState(taskId.getTaskId(), index, 2);
|
||||
getManager().startTask(taskId.getTaskId());
|
||||
return taskId;
|
||||
}
|
||||
|
||||
public synchronized GetTaskId parse(String url, File savePath) {
|
||||
if (url.startsWith("file://")) return new GetTaskId(url, savePath);
|
||||
if (url.startsWith("thunder://")) url = getManager().parserThunderUrl(url);
|
||||
String fileName = getManager().getFileNameFromUrl(url);
|
||||
GetTaskId taskId = new GetTaskId(savePath, fileName, url);
|
||||
if (!url.startsWith("magnet:?")) return taskId;
|
||||
MagnetTaskParam param = new MagnetTaskParam();
|
||||
param.setFilePath(savePath.getAbsolutePath());
|
||||
param.setFileName(fileName);
|
||||
param.setUrl(url);
|
||||
int code = getManager().createBtMagnetTask(param, taskId);
|
||||
if (code != XLConstant.XLErrorCode.NO_ERROR) return taskId;
|
||||
return startTask(taskId, 0);
|
||||
}
|
||||
|
||||
public synchronized GetTaskId addThunderTask(String url, File savePath) {
|
||||
String fileName = getManager().getFileNameFromUrl(url);
|
||||
GetTaskId taskId = new GetTaskId(savePath, fileName, url);
|
||||
if (url.startsWith("ftp://")) {
|
||||
P2spTaskParam param = new P2spTaskParam();
|
||||
param.setFilePath(savePath.getAbsolutePath());
|
||||
param.setSeqId(getSeq().incrementAndGet());
|
||||
param.setFileName(fileName);
|
||||
param.setCreateMode(1);
|
||||
param.setUrl(url);
|
||||
param.setCookie("");
|
||||
param.setRefUrl("");
|
||||
param.setUser("");
|
||||
param.setPass("");
|
||||
int code = getManager().createP2spTask(param, taskId);
|
||||
if (code != XLConstant.XLErrorCode.NO_ERROR) return taskId;
|
||||
} else if (url.startsWith("ed2k://")) {
|
||||
EmuleTaskParam param = new EmuleTaskParam();
|
||||
param.setFilePath(savePath.getAbsolutePath());
|
||||
param.setSeqId(getSeq().incrementAndGet());
|
||||
param.setFileName(fileName);
|
||||
param.setCreateMode(1);
|
||||
param.setUrl(url);
|
||||
int code = getManager().createEmuleTask(param, taskId);
|
||||
if (code != XLConstant.XLErrorCode.NO_ERROR) return taskId;
|
||||
}
|
||||
getManager().setDownloadTaskOrigin(taskId.getTaskId(), "out_app/out_app_paste");
|
||||
getManager().setOriginUserAgent(taskId.getTaskId(), "AndroidDownloadManager/4.4.4 (Linux; U; Android 4.4.4; Build/KTU84Q)");
|
||||
return startTask(taskId, 0);
|
||||
}
|
||||
|
||||
public synchronized GetTaskId addTorrentTask(File torrent, File savePath, int index) {
|
||||
TorrentInfo torrentInfo = getTorrentInfo(torrent);
|
||||
TorrentFileInfo[] fileInfos = torrentInfo.mSubFileInfo;
|
||||
BtTaskParam taskParam = new BtTaskParam();
|
||||
taskParam.setCreateMode(1);
|
||||
taskParam.setMaxConcurrent(3);
|
||||
taskParam.setSeqId(getSeq().incrementAndGet());
|
||||
taskParam.setFilePath(savePath.getAbsolutePath());
|
||||
taskParam.setTorrentPath(torrent.getAbsolutePath());
|
||||
GetTaskId taskId = new GetTaskId(savePath);
|
||||
int code = getManager().createBtTask(taskParam, taskId);
|
||||
if (code != XLConstant.XLErrorCode.NO_ERROR) return taskId;
|
||||
if (fileInfos.length > 1) {
|
||||
List<Integer> list = new CopyOnWriteArrayList<>();
|
||||
for (TorrentFileInfo fileInfo : fileInfos) {
|
||||
if (fileInfo.mFileIndex != index) {
|
||||
list.add(fileInfo.mFileIndex);
|
||||
}
|
||||
}
|
||||
BtIndexSet btIndexSet = new BtIndexSet(list.size());
|
||||
for (int i = 0; i < list.size(); i++) btIndexSet.mIndexSet[i] = list.get(i);
|
||||
getManager().deselectBtSubTask(taskId.getTaskId(), btIndexSet);
|
||||
}
|
||||
return startTask(taskId, index);
|
||||
}
|
||||
|
||||
public synchronized TorrentInfo getTorrentInfo(File file) {
|
||||
TorrentInfo torrentInfo = new TorrentInfo(file);
|
||||
getManager().getTorrentInfo(torrentInfo);
|
||||
return torrentInfo;
|
||||
}
|
||||
|
||||
public synchronized String getLocalUrl(File file) {
|
||||
XLTaskLocalUrl localUrl = new XLTaskLocalUrl();
|
||||
getManager().getLocalUrl(file.getAbsolutePath(), localUrl);
|
||||
return localUrl.mStrUrl;
|
||||
}
|
||||
|
||||
public synchronized void deleteTask(GetTaskId taskId) {
|
||||
new Thread(() -> deleteFile(taskId.getSavePath())).start();
|
||||
stopTask(taskId);
|
||||
}
|
||||
|
||||
private synchronized void deleteFile(File dir) {
|
||||
if (dir.isDirectory()) for (File file : Path.list(dir)) deleteFile(file);
|
||||
if (!dir.getAbsolutePath().endsWith(".torrent")) dir.delete();
|
||||
}
|
||||
|
||||
public synchronized void stopTask(GetTaskId taskId) {
|
||||
getManager().stopTask(taskId.getTaskId());
|
||||
getManager().releaseTask(taskId.getTaskId());
|
||||
}
|
||||
|
||||
public synchronized XLTaskInfo getTaskInfo(GetTaskId taskId) {
|
||||
XLTaskInfo taskInfo = new XLTaskInfo();
|
||||
if (taskId.getSaveFile().exists()) taskInfo.setTaskStatus(2);
|
||||
else getManager().getTaskInfo(taskId.getTaskId(), 1, taskInfo);
|
||||
return taskInfo;
|
||||
}
|
||||
|
||||
public synchronized BtSubTaskDetail getBtSubTaskInfo(GetTaskId taskId, int index) {
|
||||
BtSubTaskDetail subTaskDetail = new BtSubTaskDetail();
|
||||
getManager().getBtSubTaskInfo(taskId.getTaskId(), index, subTaskDetail);
|
||||
return subTaskDetail;
|
||||
}
|
||||
|
||||
public synchronized void release() {
|
||||
if (manager != null) manager.release();
|
||||
manager = null;
|
||||
seq = null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.xunlei.downloadlib.android;
|
||||
|
||||
import android.util.Base64;
|
||||
|
||||
import java.security.SecureRandom;
|
||||
import java.util.UUID;
|
||||
|
||||
public class XLUtil {
|
||||
|
||||
public static String getMAC() {
|
||||
return random("ABCDEF0123456", 12).toUpperCase();
|
||||
}
|
||||
|
||||
public static String getIMEI() {
|
||||
return random("0123456", 15);
|
||||
}
|
||||
|
||||
public static String getPeerId() {
|
||||
String uuid = UUID.randomUUID().toString().replace("-", "");
|
||||
uuid = uuid.substring(0, 12).toUpperCase() + "004V";
|
||||
return uuid;
|
||||
}
|
||||
|
||||
private static String random(String base, int length) {
|
||||
SecureRandom random = new SecureRandom();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < length; i++) sb.append(base.charAt(random.nextInt(base.length())));
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static String getGuid() {
|
||||
return getIMEI() + "_" + getMAC();
|
||||
}
|
||||
|
||||
public static String generateAppKey(String str, short s, byte b) {
|
||||
int length = str.length();
|
||||
int i = length + 1;
|
||||
byte[] bArr = new byte[(i + 2 + 1)];
|
||||
byte[] bytes = str.getBytes();
|
||||
System.arraycopy(bytes, 0, bArr, 0, bytes.length);
|
||||
bArr[length] = 0;
|
||||
bArr[i] = (byte) (s & 255);
|
||||
bArr[length + 2] = (byte) ((s >> 8) & 255);
|
||||
bArr[length + 3] = b;
|
||||
return new String(Base64.encode(bArr, 0)).trim();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.xunlei.downloadlib.parameter;
|
||||
|
||||
public class BtIndexSet {
|
||||
|
||||
public int[] mIndexSet;
|
||||
|
||||
public BtIndexSet(int i) {
|
||||
this.mIndexSet = new int[i];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.xunlei.downloadlib.parameter;
|
||||
|
||||
public class BtSubTaskDetail {
|
||||
|
||||
public int mFileIndex;
|
||||
public boolean mIsSelect;
|
||||
public XLTaskInfo mTaskInfo = new XLTaskInfo();
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.xunlei.downloadlib.parameter;
|
||||
|
||||
public class BtTaskParam {
|
||||
|
||||
public int mSeqId;
|
||||
public int mCreateMode;
|
||||
public int mMaxConcurrent;
|
||||
public String mFilePath;
|
||||
public String mTorrentPath;
|
||||
|
||||
public void setSeqId(int seqId) {
|
||||
this.mSeqId = seqId;
|
||||
}
|
||||
|
||||
public void setCreateMode(int createMode) {
|
||||
this.mCreateMode = createMode;
|
||||
}
|
||||
|
||||
public void setMaxConcurrent(int maxConcurrent) {
|
||||
this.mMaxConcurrent = maxConcurrent;
|
||||
}
|
||||
|
||||
public void setFilePath(String filePath) {
|
||||
this.mFilePath = filePath;
|
||||
}
|
||||
|
||||
public void setTorrentPath(String torrentPath) {
|
||||
this.mTorrentPath = torrentPath;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.xunlei.downloadlib.parameter;
|
||||
|
||||
public class EmuleTaskParam {
|
||||
|
||||
public int mCreateMode;
|
||||
public String mFileName;
|
||||
public String mFilePath;
|
||||
public int mSeqId;
|
||||
public String mUrl;
|
||||
|
||||
public void setFileName(String str) {
|
||||
this.mFileName = str;
|
||||
}
|
||||
|
||||
public void setFilePath(String str) {
|
||||
this.mFilePath = str;
|
||||
}
|
||||
|
||||
public void setUrl(String str) {
|
||||
this.mUrl = str;
|
||||
}
|
||||
|
||||
public void setCreateMode(int i) {
|
||||
this.mCreateMode = i;
|
||||
}
|
||||
|
||||
public void setSeqId(int i) {
|
||||
this.mSeqId = i;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.xunlei.downloadlib.parameter;
|
||||
|
||||
public class ErrorCode {
|
||||
|
||||
public static String get(int code) {
|
||||
switch (code) {
|
||||
case 9125:
|
||||
case 111120:
|
||||
return "檔案名稱太長";
|
||||
case 9301:
|
||||
case 111085:
|
||||
return "儲存空間不足";
|
||||
case 9304:
|
||||
case 114001:
|
||||
case 114004:
|
||||
case 114005:
|
||||
case 114006:
|
||||
case 114007:
|
||||
case 114011:
|
||||
case 111154:
|
||||
return "版權限制";
|
||||
case 114101:
|
||||
return "已失效";
|
||||
default:
|
||||
return "ErrorCode=" + code;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package com.xunlei.downloadlib.parameter;
|
||||
|
||||
public class GetDownloadLibVersion {
|
||||
|
||||
public String mVersion;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.xunlei.downloadlib.parameter;
|
||||
|
||||
public class GetFileName {
|
||||
|
||||
public String mFileName;
|
||||
|
||||
public String getFileName() {
|
||||
return mFileName;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.xunlei.downloadlib.parameter;
|
||||
|
||||
import com.github.catvod.utils.Path;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class GetTaskId {
|
||||
|
||||
public long mTaskId;
|
||||
public File mSavePath;
|
||||
public String mFileName;
|
||||
public String mRealUrl;
|
||||
|
||||
public GetTaskId(File savePath) {
|
||||
this.mSavePath = savePath;
|
||||
}
|
||||
|
||||
public GetTaskId(String url, File savePath) {
|
||||
File file = new File(url.substring(7));
|
||||
File dest = new File(savePath, file.getName());
|
||||
Path.copy(file, dest);
|
||||
this.mFileName = file.getName();
|
||||
this.mSavePath = savePath;
|
||||
this.mRealUrl = url;
|
||||
}
|
||||
|
||||
public GetTaskId(File savePath, String fileName, String realUrl) {
|
||||
this.mSavePath = savePath;
|
||||
this.mFileName = fileName;
|
||||
this.mRealUrl = realUrl;
|
||||
}
|
||||
|
||||
public long getTaskId() {
|
||||
return this.mTaskId;
|
||||
}
|
||||
|
||||
public File getSavePath() {
|
||||
return mSavePath;
|
||||
}
|
||||
|
||||
public String getFileName() {
|
||||
return mFileName;
|
||||
}
|
||||
|
||||
public String getRealUrl() {
|
||||
return mRealUrl;
|
||||
}
|
||||
|
||||
public File getSaveFile() {
|
||||
return new File(getSavePath(), getFileName());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.xunlei.downloadlib.parameter;
|
||||
|
||||
import android.util.Base64;
|
||||
|
||||
import com.xunlei.downloadlib.android.XLUtil;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
public class InitParam {
|
||||
|
||||
public String mAppKey;
|
||||
public String mAppVersion;
|
||||
public String mStatSavePath;
|
||||
public String mStatCfgSavePath;
|
||||
public int mQueryConfOnInit;
|
||||
public int mPermissionLevel;
|
||||
|
||||
public InitParam(String path) {
|
||||
this.mAppKey = "xzNjAwMQ^^yb==0^852^083dbcff^cee25055f125a2fde";
|
||||
this.mAppVersion = "21.01.07.800002";
|
||||
this.mPermissionLevel = 1;
|
||||
this.mQueryConfOnInit = 0;
|
||||
this.mStatSavePath = path;
|
||||
this.mStatCfgSavePath = path;
|
||||
}
|
||||
|
||||
public String getSoKey() {
|
||||
String[] split = mAppKey.split("==");
|
||||
String replace = split[0].replace('^', '=');
|
||||
String str = new String(Base64.decode(replace.substring(2, replace.length() - 2), 0), StandardCharsets.UTF_8);
|
||||
return XLUtil.generateAppKey("com.android.providers.downloads", Short.parseShort(str.split(";")[0]), (byte) 1);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.xunlei.downloadlib.parameter;
|
||||
|
||||
public class MagnetTaskParam {
|
||||
|
||||
public String mFileName;
|
||||
public String mFilePath;
|
||||
public String mUrl;
|
||||
|
||||
public void setUrl(String str) {
|
||||
this.mUrl = str;
|
||||
}
|
||||
|
||||
public void setFileName(String str) {
|
||||
this.mFileName = str;
|
||||
}
|
||||
|
||||
public void setFilePath(String str) {
|
||||
this.mFilePath = str;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.xunlei.downloadlib.parameter;
|
||||
|
||||
public class P2spTaskParam {
|
||||
|
||||
public String mCookie;
|
||||
public int mCreateMode;
|
||||
public String mFileName;
|
||||
public String mFilePath;
|
||||
public String mPass;
|
||||
public String mRefUrl;
|
||||
public int mSeqId;
|
||||
public String mUrl;
|
||||
public String mUser;
|
||||
|
||||
public void setUrl(String str) {
|
||||
this.mUrl = str;
|
||||
}
|
||||
|
||||
public void setFileName(String str) {
|
||||
this.mFileName = str;
|
||||
}
|
||||
|
||||
public void setFilePath(String str) {
|
||||
this.mFilePath = str;
|
||||
}
|
||||
|
||||
public void setCookie(String str) {
|
||||
this.mCookie = str;
|
||||
}
|
||||
|
||||
public void setRefUrl(String str) {
|
||||
this.mRefUrl = str;
|
||||
}
|
||||
|
||||
public void setUser(String str) {
|
||||
this.mUser = str;
|
||||
}
|
||||
|
||||
public void setPass(String str) {
|
||||
this.mPass = str;
|
||||
}
|
||||
|
||||
public void setCreateMode(int i) {
|
||||
this.mCreateMode = i;
|
||||
}
|
||||
|
||||
public void setSeqId(int i) {
|
||||
this.mSeqId = i;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package com.xunlei.downloadlib.parameter;
|
||||
|
||||
public class ThunderUrlInfo {
|
||||
|
||||
public String mUrl;
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package com.xunlei.downloadlib.parameter;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.xunlei.downloadlib.Util;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
public class TorrentFileInfo {
|
||||
|
||||
public boolean isSelected;
|
||||
public String mFileName;
|
||||
public String mSubPath;
|
||||
public long mFileSize;
|
||||
public int mFileIndex;
|
||||
public int mRealIndex;
|
||||
public File mFile;
|
||||
|
||||
public String getFileName() {
|
||||
return TextUtils.isEmpty(mFileName) ? "" : mFileName;
|
||||
}
|
||||
|
||||
public long getFileSize() {
|
||||
return mFileSize;
|
||||
}
|
||||
|
||||
public int getFileIndex() {
|
||||
return mFileIndex;
|
||||
}
|
||||
|
||||
public File getFile() {
|
||||
return mFile;
|
||||
}
|
||||
|
||||
public TorrentFileInfo file(File file) {
|
||||
this.mFile = file;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getSize() {
|
||||
return Util.size(mFileSize);
|
||||
}
|
||||
|
||||
public String getPlayUrl() {
|
||||
return "magnet://" + getFile().getAbsolutePath() + "?name=" + getFileName() + "&index=" + getFileIndex();
|
||||
}
|
||||
|
||||
public String getExt() {
|
||||
return getFileName().contains(".") ? getFileName().substring(getFileName().lastIndexOf(".") + 1).toLowerCase() : "";
|
||||
}
|
||||
|
||||
public static class Sorter implements Comparator<TorrentFileInfo> {
|
||||
|
||||
public static List<TorrentFileInfo> sort(List<TorrentFileInfo> items) {
|
||||
if (items.size() > 1) Collections.sort(items, new Sorter());
|
||||
return items;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compare(TorrentFileInfo o1, TorrentFileInfo o2) {
|
||||
return o1.getFileName().compareTo(o2.getFileName());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.xunlei.downloadlib.parameter;
|
||||
|
||||
import com.xunlei.downloadlib.Util;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class TorrentInfo {
|
||||
|
||||
public TorrentFileInfo[] mSubFileInfo;
|
||||
public String mMultiFileBaseFolder;
|
||||
public boolean mIsMultiFiles;
|
||||
public String mInfoHash;
|
||||
public int mFileCount;
|
||||
public File mFile;
|
||||
|
||||
public TorrentInfo(File file) {
|
||||
this.mFile = file;
|
||||
}
|
||||
|
||||
public File getFile() {
|
||||
return mFile;
|
||||
}
|
||||
|
||||
private TorrentFileInfo[] getSubFileInfo() {
|
||||
return mSubFileInfo == null ? new TorrentFileInfo[0] : mSubFileInfo;
|
||||
}
|
||||
|
||||
public List<TorrentFileInfo> getMedias() {
|
||||
List<TorrentFileInfo> items = new ArrayList<>();
|
||||
for (TorrentFileInfo item : getSubFileInfo()) if (Util.isMedia(item.getExt(), item.getFileSize())) items.add(item.file(getFile()));
|
||||
TorrentFileInfo.Sorter.sort(items);
|
||||
return items;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,197 @@
|
||||
package com.xunlei.downloadlib.parameter;
|
||||
|
||||
public class XLConstant {
|
||||
|
||||
public enum XLManagerStatus {
|
||||
MANAGER_UNINIT,
|
||||
MANAGER_INIT_FAIL,
|
||||
MANAGER_RUNNING
|
||||
}
|
||||
|
||||
public static class XLErrorCode {
|
||||
|
||||
public static final int ADD_RESOURCE_ERROR = 9122;
|
||||
public static final int ALREADY_INIT = 9101;
|
||||
public static final int APPKEY_CHECKER_ERROR = 9901;
|
||||
public static final int APPNAME_APPKEY_ERROR = 9116;
|
||||
public static final int ASYN_FILE_E_BASE = 111300;
|
||||
public static final int ASYN_FILE_E_EMPTY_FILE = 111305;
|
||||
public static final int ASYN_FILE_E_FILE_CLOSING = 111308;
|
||||
public static final int ASYN_FILE_E_FILE_NOT_OPEN = 111303;
|
||||
public static final int ASYN_FILE_E_FILE_REOPEN = 111304;
|
||||
public static final int ASYN_FILE_E_FILE_SIZE_LESS = 111306;
|
||||
public static final int ASYN_FILE_E_OP_BUSY = 111302;
|
||||
public static final int ASYN_FILE_E_OP_NONE = 111301;
|
||||
public static final int ASYN_FILE_E_TOO_MUCH_DATA = 111307;
|
||||
public static final int BAD_DIR_PATH = 111083;
|
||||
public static final int BT_SUB_TASK_NOT_SELECT = 9306;
|
||||
public static final int BUFFER_OVERFLOW = 111039;
|
||||
public static final int COMMON_ERRCODE_BASE = 111024;
|
||||
public static final int CONF_MGR_ERRCODE_BASE = 111159;
|
||||
public static final int CONTINUE_NO_NAME = 9115;
|
||||
public static final int CORRECT_CDN_ERROR = 111180;
|
||||
public static final int CORRECT_TIMES_TOO_MUCH = 111179;
|
||||
public static final int CREATE_FILE_FAIL = 111139;
|
||||
public static final int CREATE_THREAD_ERROR = 9117;
|
||||
public static final int DATA_MGR_ERRCODE_BASE = 111119;
|
||||
public static final int DISK_FULL = 9110;
|
||||
public static final int DISPATCHER_ERRCODE_BASE = 111118;
|
||||
public static final int DNS_INVALID_ADDR = 111078;
|
||||
public static final int DNS_NO_SERVER = 111077;
|
||||
public static final int DOWNLOAD_MANAGER_ERROR = 9900;
|
||||
public static final int DYNAMIC_PARAM_FAIL = 9114;
|
||||
public static final int ERROR_INVALID_INADDR = 111050;
|
||||
public static final int ERR_DPLAY_ALL_SEND_COMPLETE = 118000;
|
||||
public static final int ERR_DPLAY_BROKEN_SOCKET_RECV = 118307;
|
||||
public static final int ERR_DPLAY_BROKEN_SOCKET_SEND = 118306;
|
||||
public static final int ERR_DPLAY_CLIENT_ACTIVE_DISCONNECT = 118001;
|
||||
public static final int ERR_DPLAY_DO_DOWNLOAD_FAIL = 118305;
|
||||
public static final int ERR_DPLAY_DO_READFILE_FAIL = 118311;
|
||||
public static final int ERR_DPLAY_EV_SEND_TIMTOUT = 118310;
|
||||
public static final int ERR_DPLAY_HANDLE_DOWNLOAD_FAILED = 118302;
|
||||
public static final int ERR_DPLAY_NOT_FOUND = 118005;
|
||||
public static final int ERR_DPLAY_PLAY_FILE_NOT_EXIST = 118304;
|
||||
public static final int ERR_DPLAY_RECV_STATE_INVALID = 118308;
|
||||
public static final int ERR_DPLAY_SEND_FAILED = 118300;
|
||||
public static final int ERR_DPLAY_SEND_RANGE_INVALID = 118301;
|
||||
public static final int ERR_DPLAY_SEND_STATE_INVALID = 118309;
|
||||
public static final int ERR_DPLAY_TASK_FINISH_CANNT_DOWNLOAD = 118004;
|
||||
public static final int ERR_DPLAY_TASK_FINISH_CONTINUE = 118003;
|
||||
public static final int ERR_DPLAY_TASK_FINISH_DESTROY = 118002;
|
||||
public static final int ERR_DPLAY_UNKNOW_HTTP_METHOD = 118303;
|
||||
public static final int ERR_INVALID_ADDRESS_FAMILY = 116001;
|
||||
public static final int ERR_P2P_ALLOC_MEM_ERR = 11313;
|
||||
public static final int ERR_P2P_BROKER_CONNECT = 11308;
|
||||
public static final int ERR_P2P_CONNECT_FAILED = 11311;
|
||||
public static final int ERR_P2P_CONNECT_UPLOAD_SLOW = 11312;
|
||||
public static final int ERR_P2P_HANDSHAKE_RESP_FAIL = 11303;
|
||||
public static final int ERR_P2P_INVALID_COMMAND = 11309;
|
||||
public static final int ERR_P2P_INVALID_PARAM = 11310;
|
||||
public static final int ERR_P2P_NOT_SUPPORT_UDT = 11307;
|
||||
public static final int ERR_P2P_REMOTE_UNKNOWN_MY_CMD = 11306;
|
||||
public static final int ERR_P2P_REQUEST_RESP_FAIL = 11304;
|
||||
public static final int ERR_P2P_SEND_HANDSHAKE = 11314;
|
||||
public static final int ERR_P2P_UPLOAD_OVER_MAX = 11305;
|
||||
public static final int ERR_P2P_VERSION_NOT_SUPPORT = 11301;
|
||||
public static final int ERR_P2P_WAITING_CLOSE = 11302;
|
||||
public static final int ERR_PTL_GET_PEERSN_FAILED = 112600;
|
||||
public static final int ERR_PTL_PEER_OFFLINE = 112500;
|
||||
public static final int ERR_PTL_PROTOCOL_NOT_SUPPORT = 112400;
|
||||
public static final int FILE_CANNOT_TRUNCATE = 111084;
|
||||
public static final int FILE_CFG_ERASE_ERROR = 111130;
|
||||
public static final int FILE_CFG_MAGIC_ERROR = 111131;
|
||||
public static final int FILE_CFG_READ_ERROR = 111132;
|
||||
public static final int FILE_CFG_READ_HEADER_ERROR = 111134;
|
||||
public static final int FILE_CFG_RESOLVE_ERROR = 111135;
|
||||
public static final int FILE_CFG_TRY_FIX = 111129;
|
||||
public static final int FILE_CFG_WRITE_ERROR = 111133;
|
||||
public static final int FILE_CREATING = 111145;
|
||||
public static final int FILE_EXISTED = 9109;
|
||||
public static final int FILE_INVALID_PARA = 111144;
|
||||
public static final int FILE_NAME_TOO_LONG = 9125;
|
||||
public static final int FILE_NOT_EXIST = 111143;
|
||||
public static final int FILE_PATH_TOO_LONG = 111120;
|
||||
public static final int FILE_SIZE_NOT_BELIEVE = 111141;
|
||||
public static final int FILE_SIZE_TOO_SMALL = 111142;
|
||||
public static final int FILE_TOO_BIG = 111086;
|
||||
public static final int FIL_INFO_INVALID_DATA = 111146;
|
||||
public static final int FIL_INFO_RECVED_DATA = 111147;
|
||||
public static final int FULL_PATH_NAME_OCCUPIED = 9128;
|
||||
public static final int FULL_PATH_NAME_TOO_LONG = 9127;
|
||||
public static final int FUNCTION_NOT_SUPPORT = 9123;
|
||||
public static final int HTTP_HUB_CLIENT_E_BASE = 115100;
|
||||
public static final int HTTP_SERVER_NOT_START = 9400;
|
||||
public static final int INDEX_NOT_READY = 9303;
|
||||
public static final int INSUFFICIENT_DISK_SPACE = 111085;
|
||||
public static final int INVALID_ARGUMENT = 111041;
|
||||
public static final int INVALID_ITERATOR = 111038;
|
||||
public static final int INVALID_SOCKET_DESCRIPTOR = 111048;
|
||||
public static final int INVALID_TIMER_INDEX = 111074;
|
||||
public static final int IP6_ERRCODE_BASE = 116000;
|
||||
public static final int IP6_INVALID_IN6ADDR = 116002;
|
||||
public static final int IP6_NOT_SUPPORT_SSL = 116003;
|
||||
public static final int MAP_DUPLICATE_KEY = 111036;
|
||||
public static final int MAP_KEY_NOT_FOUND = 111037;
|
||||
public static final int MAP_UNINIT = 111035;
|
||||
public static final int NET_BROKEN_PIPE = 111170;
|
||||
public static final int NET_CONNECTION_REFUSED = 111171;
|
||||
public static final int NET_CONNECT_SSL_ERR = 111169;
|
||||
public static final int NET_NORMAL_CLOSE = 111175;
|
||||
public static final int NET_OP_CANCEL = 111173;
|
||||
public static final int NET_REACTOR_ERRCODE_BASE = 111168;
|
||||
public static final int NET_SSL_GET_FD_ERROR = 111172;
|
||||
public static final int NET_UNKNOWN_ERROR = 111174;
|
||||
public static final int NOT_FULL_PATH_NAME = 9404;
|
||||
public static final int NOT_IMPLEMENT = 111057;
|
||||
public static final int NO_ENOUGH_BUFFER = 9301;
|
||||
public static final int NO_ERROR = 9000;
|
||||
public static final int ONE_PATH_LEVEL_NAME_TOO_LONG = 9126;
|
||||
public static final int OPEN_FILE_ERR = 111128;
|
||||
public static final int OPEN_OLD_FILE_FAIL = 111140;
|
||||
public static final int OUT_OF_FIXED_MEMORY = 111032;
|
||||
public static final int OUT_OF_MEMORY = 111026;
|
||||
public static final int P2P_PIPE_ERRCODE_BASE = 11300;
|
||||
public static final int PARAM_ERROR = 9112;
|
||||
public static final int PAUSE_TASK_WRITE_CFG_ERR = 117000;
|
||||
public static final int PAUSE_TASK_WRITE_DATA_TIMEOUT = 117001;
|
||||
public static final int PRIOR_TASK_FINISH = 9308;
|
||||
public static final int PRIOR_TASK_NO_INDEX = 9307;
|
||||
public static final int QUEUE_NO_ROOM = 111033;
|
||||
public static final int READ_FILE_ERR = 111126;
|
||||
public static final int REDIRECT_TOO_MUCH = 111181;
|
||||
public static final int RES_QUERY_E_BASE = 115000;
|
||||
public static final int SCHEMA_NOT_SUPPORT = 9113;
|
||||
public static final int SDK_NOT_INIT = 9102;
|
||||
public static final int SETTINGS_ERR_CFG_FILE_NOT_EXIST = 111162;
|
||||
public static final int SETTINGS_ERR_INVALID_FILE_NAME = 111161;
|
||||
public static final int SETTINGS_ERR_INVALID_ITEM_NAME = 111164;
|
||||
public static final int SETTINGS_ERR_INVALID_ITEM_VALUE = 111165;
|
||||
public static final int SETTINGS_ERR_INVALID_LINE = 111163;
|
||||
public static final int SETTINGS_ERR_ITEM_NOT_FOUND = 111167;
|
||||
public static final int SETTINGS_ERR_LIST_EMPTY = 111166;
|
||||
public static final int SETTINGS_ERR_UNKNOWN = 111160;
|
||||
public static final int TARGET_THREAD_STOPING = 111025;
|
||||
public static final int TASK_ALREADY_EXIST = 9103;
|
||||
public static final int TASK_ALREADY_RUNNING = 9106;
|
||||
public static final int TASK_ALREADY_STOPPED = 9105;
|
||||
public static final int TASK_CONTROL_STRATEGY = 9501;
|
||||
public static final int TASK_FAILURE_ALL_SUBTASK_FAILED = 114009;
|
||||
public static final int TASK_FAILURE_BTHUB_NO_RECORD = 114008;
|
||||
public static final int TASK_FAILURE_CANNOT_START_SUBTASK = 114003;
|
||||
public static final int TASK_FAILURE_EMULE_NO_RECORD = 114101;
|
||||
public static final int TASK_FAILURE_GET_TORRENT_FAILED = 114006;
|
||||
public static final int TASK_FAILURE_NO_DATA_PIPE = 111136;
|
||||
public static final int TASK_FAILURE_PARSE_TORRENT_FAILED = 114005;
|
||||
public static final int TASK_FAILURE_PART_SUBTASK_FAILED = 114011;
|
||||
public static final int TASK_FAILURE_QUERY_BT_HUB_FAILED = 114004;
|
||||
public static final int TASK_FAILURE_QUERY_EMULE_HUB_FAILED = 114001;
|
||||
public static final int TASK_FAILURE_SAVE_TORRENT_FAILED = 114007;
|
||||
public static final int TASK_FAILURE_SUBTASK_FAILED = 114002;
|
||||
public static final int TASK_FAILURE_THEONLY_SUBTASK_FAILED = 114010;
|
||||
public static final int TASK_FAIL_LONG_TIME_NO_RECV_DATA = 111176;
|
||||
public static final int TASK_FILE_NAME_EMPTY = 9401;
|
||||
public static final int TASK_FILE_NOT_VEDIO = 9402;
|
||||
public static final int TASK_FILE_SIZE_TOO_LARGE = 111177;
|
||||
public static final int TASK_FINISH = 9118;
|
||||
public static final int TASK_NOT_EXIST = 9104;
|
||||
public static final int TASK_NOT_IDLE = 9120;
|
||||
public static final int TASK_NOT_RUNNING = 9119;
|
||||
public static final int TASK_NOT_START = 9107;
|
||||
public static final int TASK_NO_FILE_NAME = 9129;
|
||||
public static final int TASK_NO_INDEX_NO_ORIGIN = 111148;
|
||||
public static final int TASK_ORIGIN_NONEXISTENCE = 111149;
|
||||
public static final int TASK_RETRY_ALWAY_FAIL = 111178;
|
||||
public static final int TASK_STILL_RUNNING = 9108;
|
||||
public static final int TASK_TYPE_NOT_SUPPORT = 9121;
|
||||
public static final int TASK_UNKNOWN_ERROR = 9403;
|
||||
public static final int TASK_USE_TOO_MUCH_MEM = 111031;
|
||||
public static final int THUNDER_URL_PARSE_ERROR = 9305;
|
||||
public static final int TOO_MUCH_TASK = 9111;
|
||||
public static final int TORRENT_IMCOMPLETE = 9304;
|
||||
public static final int TORRENT_PARSE_ERROR = 9302;
|
||||
public static final int URL_IS_TOO_LONG = 111047;
|
||||
public static final int URL_PARSER_ERROR = 111046;
|
||||
public static final int VIDEO_CACHE_FINISH = 9410;
|
||||
public static final int WRITE_FILE_ERR = 111127;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.xunlei.downloadlib.parameter;
|
||||
|
||||
public class XLTaskInfo {
|
||||
|
||||
public String mCid;
|
||||
public String mFileName;
|
||||
public String mGcid;
|
||||
public int mAddedHighSourceState;
|
||||
public int mAdditionalResCount;
|
||||
public int mAdditionalResType;
|
||||
public int mDcdnState;
|
||||
public int mErrorCode;
|
||||
public int mInfoLen;
|
||||
public int mLanPeerResState;
|
||||
public int mOriginErrcode;
|
||||
public int mQueryIndexStatus;
|
||||
public int mTaskStatus;
|
||||
public long mAdditionalResDCDNBytes;
|
||||
public long mAdditionalResDCDNSpeed;
|
||||
public long mAdditionalResPeerBytes;
|
||||
public long mAdditionalResPeerSpeed;
|
||||
public long mAdditionalResVipRecvBytes;
|
||||
public long mAdditionalResVipSpeed;
|
||||
public long mCheckedSize;
|
||||
public long mDownloadFileCount;
|
||||
public long mDownloadSize;
|
||||
public long mDownloadSpeed;
|
||||
public long mFileSize;
|
||||
public long mOriginRecvBytes;
|
||||
public long mOriginSpeed;
|
||||
public long mP2PRecvBytes;
|
||||
public long mP2PSpeed;
|
||||
public long mP2SRecvBytes;
|
||||
public long mP2SSpeed;
|
||||
public long mScdnRecvBytes;
|
||||
public long mScdnSpeed;
|
||||
public long mTaskId;
|
||||
public long mTotalFileCount;
|
||||
|
||||
public int getTaskStatus() {
|
||||
return mTaskStatus;
|
||||
}
|
||||
|
||||
public void setTaskStatus(int taskStatus) {
|
||||
this.mTaskStatus = taskStatus;
|
||||
}
|
||||
|
||||
public String getErrorMsg() {
|
||||
return ErrorCode.get(mErrorCode);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package com.xunlei.downloadlib.parameter;
|
||||
|
||||
public class XLTaskLocalUrl {
|
||||
|
||||
public String mStrUrl;
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user