Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3871d8f056 | ||
|
|
669aa6981c | ||
|
|
91daecd039 | ||
|
|
297cc99f2b | ||
|
|
f5f8e9b528 | ||
|
|
94c3e8bb58 |
39
.github/ISSUE_TEMPLATE/Custom.md
vendored
39
.github/ISSUE_TEMPLATE/Custom.md
vendored
@@ -1,35 +1,26 @@
|
|||||||
---
|
---
|
||||||
name: 问题描述
|
name: 问题描述
|
||||||
about: 请详细描述你遇到的问题
|
about: 提交问题前,请先阅读文档和搜索issue
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
<!-- 请详细描述以下信息,即使是一个简单的bug,没有充足的信息,作者却需要花费大量的时间去查找可能的原因!! -->
|
<!-- 提交问题前,请先阅读文档和搜索相应问题的issue -->
|
||||||
|
|
||||||
## 预期行为
|
|
||||||
|
|
||||||
|
|
||||||
## 当前行为
|
|
||||||
|
|
||||||
|
|
||||||
## 可能的解决方案
|
|
||||||
<!-- 不是强制性的,针对该错误的修复/原因的建议-->
|
|
||||||
|
|
||||||
|
|
||||||
## 重现步骤
|
|
||||||
<!-- 请提供明确的步骤 -->
|
|
||||||
|
|
||||||
1.
|
|
||||||
2.
|
|
||||||
3.
|
|
||||||
4.
|
|
||||||
|
|
||||||
|
|
||||||
## 错误日志
|
|
||||||
|
|
||||||
|
|
||||||
## 版本
|
## 版本
|
||||||
* 框架版本
|
* 框架版本
|
||||||
|
|
||||||
* 系统版本
|
* 系统版本
|
||||||
|
|
||||||
|
## 错误日志
|
||||||
|
<!-- 请提供详细的错误日志 -->
|
||||||
|
|
||||||
|
|
||||||
|
## 重现步骤
|
||||||
|
<!-- 请提供明确的步骤 -->
|
||||||
|
1.
|
||||||
|
2.
|
||||||
|
3.
|
||||||
|
4.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -23,8 +23,6 @@ import android.app.Dialog;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
|
||||||
import android.os.Looper;
|
|
||||||
import android.widget.PopupWindow;
|
import android.widget.PopupWindow;
|
||||||
import com.arialyy.aria.core.command.CommandManager;
|
import com.arialyy.aria.core.command.CommandManager;
|
||||||
import com.arialyy.aria.core.common.QueueMod;
|
import com.arialyy.aria.core.common.QueueMod;
|
||||||
@@ -76,7 +74,6 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||||||
*/
|
*/
|
||||||
private Map<String, List<String>> mSubClass = new ConcurrentHashMap<>();
|
private Map<String, List<String>> mSubClass = new ConcurrentHashMap<>();
|
||||||
private static Context APP;
|
private static Context APP;
|
||||||
private Handler mAriaHandler;
|
|
||||||
private DelegateWrapper mDbWrapper;
|
private DelegateWrapper mDbWrapper;
|
||||||
private AriaConfig mConfig;
|
private AriaConfig mConfig;
|
||||||
|
|
||||||
@@ -98,9 +95,6 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static AriaManager getInstance() {
|
public static AriaManager getInstance() {
|
||||||
if (INSTANCE == null) {
|
|
||||||
throw new NullPointerException("请使用AriaManager.init(context)初始化管理器");
|
|
||||||
}
|
|
||||||
return INSTANCE;
|
return INSTANCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -171,13 +165,6 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized Handler getAriaHandler() {
|
|
||||||
if (mAriaHandler == null) {
|
|
||||||
mAriaHandler = new Handler(Looper.getMainLooper());
|
|
||||||
}
|
|
||||||
return mAriaHandler;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<String, AbsReceiver> getReceiver() {
|
public Map<String, AbsReceiver> getReceiver() {
|
||||||
return mReceivers;
|
return mReceivers;
|
||||||
}
|
}
|
||||||
@@ -295,7 +282,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||||||
RecordUtil.delTaskRecord(key, IRecordHandler.TYPE_DOWNLOAD, removeFile, true);
|
RecordUtil.delTaskRecord(key, IRecordHandler.TYPE_DOWNLOAD, removeFile, true);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
RecordUtil.delGroupTaskRecord(key, removeFile);
|
RecordUtil.delGroupTaskRecordByHash(key, removeFile);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
RecordUtil.delTaskRecord(key, IRecordHandler.TYPE_UPLOAD);
|
RecordUtil.delTaskRecord(key, IRecordHandler.TYPE_UPLOAD);
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.arialyy.aria.core.command;
|
package com.arialyy.aria.core.command;
|
||||||
|
|
||||||
|
import com.arialyy.aria.core.AriaConfig;
|
||||||
import com.arialyy.aria.core.AriaManager;
|
import com.arialyy.aria.core.AriaManager;
|
||||||
import com.arialyy.aria.core.task.DownloadTask;
|
import com.arialyy.aria.core.task.DownloadTask;
|
||||||
import com.arialyy.aria.core.wrapper.AbsTaskWrapper;
|
import com.arialyy.aria.core.wrapper.AbsTaskWrapper;
|
||||||
@@ -41,7 +42,7 @@ final class HighestPriorityCmd<T extends AbsTaskWrapper> extends AbsNormalCmd<T>
|
|||||||
|
|
||||||
@Override public void executeCmd() {
|
@Override public void executeCmd() {
|
||||||
if (!canExeCmd) return;
|
if (!canExeCmd) return;
|
||||||
if (!NetUtils.isConnected(AriaManager.getInstance().getAPP())){
|
if (!NetUtils.isConnected(AriaConfig.getInstance().getAPP())){
|
||||||
ALog.e(TAG, "启动任务失败,网络未连接");
|
ALog.e(TAG, "启动任务失败,网络未连接");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.arialyy.aria.core.command;
|
package com.arialyy.aria.core.command;
|
||||||
|
|
||||||
import com.arialyy.aria.core.AriaManager;
|
import com.arialyy.aria.core.AriaConfig;
|
||||||
import com.arialyy.aria.core.inf.IEntity;
|
import com.arialyy.aria.core.inf.IEntity;
|
||||||
import com.arialyy.aria.core.wrapper.AbsTaskWrapper;
|
import com.arialyy.aria.core.wrapper.AbsTaskWrapper;
|
||||||
import com.arialyy.aria.util.ALog;
|
import com.arialyy.aria.util.ALog;
|
||||||
@@ -36,7 +36,7 @@ final class ResumeAllCmd<T extends AbsTaskWrapper> extends AbsNormalCmd<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override public void executeCmd() {
|
@Override public void executeCmd() {
|
||||||
if (!NetUtils.isConnected(AriaManager.getInstance().getAPP())) {
|
if (!NetUtils.isConnected(AriaConfig.getInstance().getAPP())) {
|
||||||
ALog.w(TAG, "恢复任务失败,网络未连接");
|
ALog.w(TAG, "恢复任务失败,网络未连接");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
package com.arialyy.aria.core.command;
|
package com.arialyy.aria.core.command;
|
||||||
|
|
||||||
import com.arialyy.aria.core.AriaManager;
|
import com.arialyy.aria.core.AriaConfig;
|
||||||
import com.arialyy.aria.core.common.QueueMod;
|
import com.arialyy.aria.core.common.QueueMod;
|
||||||
import com.arialyy.aria.core.inf.IEntity;
|
import com.arialyy.aria.core.inf.IEntity;
|
||||||
import com.arialyy.aria.core.task.AbsTask;
|
import com.arialyy.aria.core.task.AbsTask;
|
||||||
@@ -37,6 +37,7 @@ final public class StartCmd<T extends AbsTaskWrapper> extends AbsNormalCmd<T> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 立即执行任务
|
* 立即执行任务
|
||||||
|
*
|
||||||
* @param newStart true 立即执行任务,无论执行队列是否满了
|
* @param newStart true 立即执行任务,无论执行队列是否满了
|
||||||
*/
|
*/
|
||||||
public void setNewStart(boolean newStart) {
|
public void setNewStart(boolean newStart) {
|
||||||
@@ -45,17 +46,17 @@ final public class StartCmd<T extends AbsTaskWrapper> extends AbsNormalCmd<T> {
|
|||||||
|
|
||||||
@Override public void executeCmd() {
|
@Override public void executeCmd() {
|
||||||
if (!canExeCmd) return;
|
if (!canExeCmd) return;
|
||||||
if (!NetUtils.isConnected(AriaManager.getInstance().getAPP())) {
|
if (!NetUtils.isConnected(AriaConfig.getInstance().getAPP())) {
|
||||||
ALog.e(TAG, "启动任务失败,网络未连接");
|
ALog.e(TAG, "启动任务失败,网络未连接");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String mod;
|
String mod;
|
||||||
int maxTaskNum = mQueue.getMaxTaskNum();
|
int maxTaskNum = mQueue.getMaxTaskNum();
|
||||||
AriaManager manager = AriaManager.getInstance();
|
AriaConfig config = AriaConfig.getInstance();
|
||||||
if (isDownloadCmd) {
|
if (isDownloadCmd) {
|
||||||
mod = manager.getDownloadConfig().getQueueMod();
|
mod = config.getDConfig().getQueueMod();
|
||||||
} else {
|
} else {
|
||||||
mod = manager.getUploadConfig().getQueueMod();
|
mod = config.getUConfig().getQueueMod();
|
||||||
}
|
}
|
||||||
|
|
||||||
AbsTask task = getTask();
|
AbsTask task = getTask();
|
||||||
@@ -81,9 +82,9 @@ final public class StartCmd<T extends AbsTaskWrapper> extends AbsNormalCmd<T> {
|
|||||||
startTask();
|
startTask();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (newStart){
|
if (newStart) {
|
||||||
startTask();
|
startTask();
|
||||||
}else {
|
} else {
|
||||||
sendWaitState(task);
|
sendWaitState(task);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,12 +15,12 @@
|
|||||||
*/
|
*/
|
||||||
package com.arialyy.aria.core.common;
|
package com.arialyy.aria.core.common;
|
||||||
|
|
||||||
import com.arialyy.aria.core.common.controller.IStartFeature;
|
|
||||||
import com.arialyy.aria.core.common.controller.BuilderController;
|
import com.arialyy.aria.core.common.controller.BuilderController;
|
||||||
|
import com.arialyy.aria.core.common.controller.IStartFeature;
|
||||||
import com.arialyy.aria.core.inf.AbsTarget;
|
import com.arialyy.aria.core.inf.AbsTarget;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理第一次下载
|
* 处理第一次创建的任务
|
||||||
*/
|
*/
|
||||||
public abstract class AbsBuilderTarget<TARGET extends AbsBuilderTarget> extends AbsTarget<TARGET>
|
public abstract class AbsBuilderTarget<TARGET extends AbsBuilderTarget> extends AbsTarget<TARGET>
|
||||||
implements IStartFeature {
|
implements IStartFeature {
|
||||||
@@ -34,6 +34,23 @@ public abstract class AbsBuilderTarget<TARGET extends AbsBuilderTarget> extends
|
|||||||
return mStartController;
|
return mStartController;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否忽略权限检查
|
||||||
|
*/
|
||||||
|
public TARGET ignoreCheckPermissions() {
|
||||||
|
getController().ignoreCheckPermissions();
|
||||||
|
return (TARGET) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 忽略文件占用,不管文件路径是否被其它任务占用,都执行上传\下载任务
|
||||||
|
* 需要注意的是:如果文件被其它任务占用,并且还调用了该方法,将自动删除占用了该文件路径的任务
|
||||||
|
*/
|
||||||
|
public TARGET ignoreFilePathOccupy() {
|
||||||
|
getController().ignoreFilePathOccupy();
|
||||||
|
return (TARGET) this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加任务
|
* 添加任务
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -31,6 +31,14 @@ import com.arialyy.aria.util.RecordUtil;
|
|||||||
public abstract class AbsNormalTarget<TARGET extends AbsNormalTarget> extends AbsTarget<TARGET>
|
public abstract class AbsNormalTarget<TARGET extends AbsNormalTarget> extends AbsTarget<TARGET>
|
||||||
implements INormalFeature {
|
implements INormalFeature {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否忽略权限检查
|
||||||
|
*/
|
||||||
|
public TARGET ignoreCheckPermissions() {
|
||||||
|
getController().ignoreCheckPermissions();
|
||||||
|
return (TARGET) this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 任务是否在执行
|
* 任务是否在执行
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -19,21 +19,21 @@ import android.Manifest;
|
|||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import com.arialyy.aria.core.AriaManager;
|
import com.arialyy.aria.core.AriaConfig;
|
||||||
|
import com.arialyy.aria.core.common.AbsEntity;
|
||||||
import com.arialyy.aria.core.download.CheckDEntityUtil;
|
import com.arialyy.aria.core.download.CheckDEntityUtil;
|
||||||
import com.arialyy.aria.core.download.CheckDGEntityUtil;
|
import com.arialyy.aria.core.download.CheckDGEntityUtil;
|
||||||
import com.arialyy.aria.core.download.CheckFtpDirEntityUtil;
|
import com.arialyy.aria.core.download.CheckFtpDirEntityUtil;
|
||||||
import com.arialyy.aria.core.download.DGTaskWrapper;
|
import com.arialyy.aria.core.download.DGTaskWrapper;
|
||||||
import com.arialyy.aria.core.download.DTaskWrapper;
|
import com.arialyy.aria.core.download.DTaskWrapper;
|
||||||
import com.arialyy.aria.core.common.AbsEntity;
|
|
||||||
import com.arialyy.aria.core.wrapper.AbsTaskWrapper;
|
|
||||||
import com.arialyy.aria.core.inf.ICheckEntityUtil;
|
import com.arialyy.aria.core.inf.ICheckEntityUtil;
|
||||||
import com.arialyy.aria.core.task.ITask;
|
|
||||||
import com.arialyy.aria.core.wrapper.ITaskWrapper;
|
|
||||||
import com.arialyy.aria.core.listener.ISchedulers;
|
import com.arialyy.aria.core.listener.ISchedulers;
|
||||||
import com.arialyy.aria.core.scheduler.TaskSchedulers;
|
import com.arialyy.aria.core.scheduler.TaskSchedulers;
|
||||||
|
import com.arialyy.aria.core.task.ITask;
|
||||||
import com.arialyy.aria.core.upload.CheckUEntityUtil;
|
import com.arialyy.aria.core.upload.CheckUEntityUtil;
|
||||||
import com.arialyy.aria.core.upload.UTaskWrapper;
|
import com.arialyy.aria.core.upload.UTaskWrapper;
|
||||||
|
import com.arialyy.aria.core.wrapper.AbsTaskWrapper;
|
||||||
|
import com.arialyy.aria.core.wrapper.ITaskWrapper;
|
||||||
import com.arialyy.aria.util.ALog;
|
import com.arialyy.aria.util.ALog;
|
||||||
import com.arialyy.aria.util.CommonUtil;
|
import com.arialyy.aria.util.CommonUtil;
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
@@ -46,6 +46,10 @@ public abstract class FeatureController {
|
|||||||
private final String TAG;
|
private final String TAG;
|
||||||
|
|
||||||
private AbsTaskWrapper mTaskWrapper;
|
private AbsTaskWrapper mTaskWrapper;
|
||||||
|
/**
|
||||||
|
* 是否忽略权限检查 true 忽略权限检查
|
||||||
|
*/
|
||||||
|
private boolean ignoreCheckPermissions = false;
|
||||||
|
|
||||||
FeatureController(AbsTaskWrapper wrapper) {
|
FeatureController(AbsTaskWrapper wrapper) {
|
||||||
mTaskWrapper = wrapper;
|
mTaskWrapper = wrapper;
|
||||||
@@ -87,6 +91,20 @@ public abstract class FeatureController {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否忽略权限检查
|
||||||
|
*/
|
||||||
|
public void ignoreCheckPermissions() {
|
||||||
|
this.ignoreCheckPermissions = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 强制执行任务,不管文件路径是否被占用
|
||||||
|
*/
|
||||||
|
public void ignoreFilePathOccupy() {
|
||||||
|
mTaskWrapper.setIgnoreFilePathOccupy(true);
|
||||||
|
}
|
||||||
|
|
||||||
protected AbsTaskWrapper getTaskWrapper() {
|
protected AbsTaskWrapper getTaskWrapper() {
|
||||||
return mTaskWrapper;
|
return mTaskWrapper;
|
||||||
}
|
}
|
||||||
@@ -111,7 +129,7 @@ public abstract class FeatureController {
|
|||||||
* 如果检查实体失败,将错误回调
|
* 如果检查实体失败,将错误回调
|
||||||
*/
|
*/
|
||||||
boolean checkConfig() {
|
boolean checkConfig() {
|
||||||
if (!checkPermission()) {
|
if (!ignoreCheckPermissions && !checkPermission()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
boolean b = checkEntity();
|
boolean b = checkEntity();
|
||||||
@@ -134,21 +152,21 @@ public abstract class FeatureController {
|
|||||||
*/
|
*/
|
||||||
private boolean checkPermission() {
|
private boolean checkPermission() {
|
||||||
|
|
||||||
if (AriaManager.getInstance()
|
if (AriaConfig.getInstance()
|
||||||
.getAPP()
|
.getAPP()
|
||||||
.checkCallingOrSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE)
|
.checkCallingOrSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE)
|
||||||
!= PackageManager.PERMISSION_GRANTED) {
|
!= PackageManager.PERMISSION_GRANTED) {
|
||||||
ALog.e(TAG, "启动失败,缺少权限:Manifest.permission.WRITE_EXTERNAL_STORAGE");
|
ALog.e(TAG, "启动失败,缺少权限:Manifest.permission.WRITE_EXTERNAL_STORAGE");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (AriaManager.getInstance()
|
if (AriaConfig.getInstance()
|
||||||
.getAPP()
|
.getAPP()
|
||||||
.checkCallingOrSelfPermission(Manifest.permission.INTERNET)
|
.checkCallingOrSelfPermission(Manifest.permission.INTERNET)
|
||||||
!= PackageManager.PERMISSION_GRANTED) {
|
!= PackageManager.PERMISSION_GRANTED) {
|
||||||
ALog.e(TAG, "启动失败,缺少权限:Manifest.permission.INTERNET");
|
ALog.e(TAG, "启动失败,缺少权限:Manifest.permission.INTERNET");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (AriaManager.getInstance()
|
if (AriaConfig.getInstance()
|
||||||
.getAPP()
|
.getAPP()
|
||||||
.checkCallingOrSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE)
|
.checkCallingOrSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE)
|
||||||
!= PackageManager.PERMISSION_GRANTED) {
|
!= PackageManager.PERMISSION_GRANTED) {
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import com.arialyy.aria.core.wrapper.ITaskWrapper;
|
|||||||
import com.arialyy.aria.util.ALog;
|
import com.arialyy.aria.util.ALog;
|
||||||
import com.arialyy.aria.util.CheckUtil;
|
import com.arialyy.aria.util.CheckUtil;
|
||||||
import com.arialyy.aria.util.CommonUtil;
|
import com.arialyy.aria.util.CommonUtil;
|
||||||
|
import com.arialyy.aria.util.FileUtil;
|
||||||
import com.arialyy.aria.util.RecordUtil;
|
import com.arialyy.aria.util.RecordUtil;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
@@ -65,8 +66,7 @@ public class CheckDEntityUtil implements ICheckEntityUtil {
|
|||||||
File file = new File(mWrapper.getTempFilePath());
|
File file = new File(mWrapper.getTempFilePath());
|
||||||
Object bw = mWrapper.getM3U8Params().getParam(IOptionConstant.bandWidth);
|
Object bw = mWrapper.getM3U8Params().getParam(IOptionConstant.bandWidth);
|
||||||
int bandWidth = bw == null ? 0 : (int) bw;
|
int bandWidth = bw == null ? 0 : (int) bw;
|
||||||
// 缓存文件夹格式:问文件夹/.文件名_码率
|
String cacheDir = FileUtil.getTsCacheDir(file.getPath(), bandWidth);
|
||||||
String cacheDir = String.format("%s/.%s_%s", file.getParent(), file.getName(), bandWidth);
|
|
||||||
|
|
||||||
mWrapper.getM3U8Params().setParams(IOptionConstant.cacheDir, cacheDir);
|
mWrapper.getM3U8Params().setParams(IOptionConstant.cacheDir, cacheDir);
|
||||||
M3U8Entity m3U8Entity = mEntity.getM3U8Entity();
|
M3U8Entity m3U8Entity = mEntity.getM3U8Entity();
|
||||||
@@ -134,7 +134,7 @@ public class CheckDEntityUtil implements ICheckEntityUtil {
|
|||||||
//设置文件保存路径,如果新文件路径和旧文件路径不同,则修改路径
|
//设置文件保存路径,如果新文件路径和旧文件路径不同,则修改路径
|
||||||
if (!filePath.equals(mEntity.getFilePath())) {
|
if (!filePath.equals(mEntity.getFilePath())) {
|
||||||
// 检查路径冲突
|
// 检查路径冲突
|
||||||
if (!CheckUtil.checkDownloadPathConflicts(mWrapper.isForceDownload(), filePath)) {
|
if (!CheckUtil.checkDPathConflicts(mWrapper.isIgnoreFilePathOccupy(), filePath)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,12 +16,12 @@
|
|||||||
package com.arialyy.aria.core.download;
|
package com.arialyy.aria.core.download;
|
||||||
|
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import com.arialyy.aria.core.common.ErrorCode;
|
|
||||||
import com.arialyy.aria.core.common.RequestEnum;
|
import com.arialyy.aria.core.common.RequestEnum;
|
||||||
import com.arialyy.aria.core.inf.ICheckEntityUtil;
|
import com.arialyy.aria.core.inf.ICheckEntityUtil;
|
||||||
import com.arialyy.aria.core.inf.IOptionConstant;
|
import com.arialyy.aria.core.inf.IOptionConstant;
|
||||||
import com.arialyy.aria.orm.DbEntity;
|
import com.arialyy.aria.orm.DbEntity;
|
||||||
import com.arialyy.aria.util.ALog;
|
import com.arialyy.aria.util.ALog;
|
||||||
|
import com.arialyy.aria.util.CheckUtil;
|
||||||
import com.arialyy.aria.util.CommonUtil;
|
import com.arialyy.aria.util.CommonUtil;
|
||||||
import com.arialyy.aria.util.RecordUtil;
|
import com.arialyy.aria.util.RecordUtil;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@@ -70,10 +70,9 @@ public class CheckDGEntityUtil implements ICheckEntityUtil {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((mEntity.getDirPath() == null || !mEntity.getDirPath().equals(mWrapper.getDirPathTemp()))
|
// 检查路径冲突
|
||||||
&& DbEntity.checkDataExist(DownloadGroupEntity.class, "dirPath=?",
|
if (mWrapper.isNewTask() && !CheckUtil.checkDGPathConflicts(mWrapper.isIgnoreFilePathOccupy(),
|
||||||
mWrapper.getDirPathTemp())) {
|
mWrapper.getDirPathTemp())) {
|
||||||
ALog.e(TAG, String.format("文件夹路径【%s】已被其它任务占用,请重新设置文件夹路径", mWrapper.getDirPathTemp()));
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ package com.arialyy.aria.core.download;
|
|||||||
import androidx.annotation.CheckResult;
|
import androidx.annotation.CheckResult;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import com.arialyy.annotations.TaskEnum;
|
import com.arialyy.annotations.TaskEnum;
|
||||||
|
import com.arialyy.aria.core.AriaConfig;
|
||||||
import com.arialyy.aria.core.AriaManager;
|
import com.arialyy.aria.core.AriaManager;
|
||||||
import com.arialyy.aria.core.command.CancelAllCmd;
|
import com.arialyy.aria.core.command.CancelAllCmd;
|
||||||
import com.arialyy.aria.core.command.CmdHelper;
|
import com.arialyy.aria.core.command.CmdHelper;
|
||||||
@@ -64,7 +65,7 @@ public class DownloadReceiver extends AbsReceiver {
|
|||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public DownloadReceiver setMaxSpeed(int maxSpeed) {
|
public DownloadReceiver setMaxSpeed(int maxSpeed) {
|
||||||
AriaManager.getInstance().getDownloadConfig().setMaxSpeed(maxSpeed);
|
AriaConfig.getInstance().getDConfig().setMaxSpeed(maxSpeed);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -287,10 +288,10 @@ public class DownloadReceiver extends AbsReceiver {
|
|||||||
* @return 如果实体不存在,返回null
|
* @return 如果实体不存在,返回null
|
||||||
*/
|
*/
|
||||||
public DownloadGroupEntity getGroupEntity(List<String> urls) {
|
public DownloadGroupEntity getGroupEntity(List<String> urls) {
|
||||||
if (CheckUtil.checkDownloadUrlsIsEmpty(urls)){
|
if (CheckUtil.checkDownloadUrlsIsEmpty(urls)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return DbDataHelper.getDGEntity(CommonUtil.getMd5Code(urls));
|
return DbDataHelper.getDGEntityByHash(CommonUtil.getMd5Code(urls));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -303,7 +304,7 @@ public class DownloadReceiver extends AbsReceiver {
|
|||||||
if (!CheckUtil.checkUrl(url)) {
|
if (!CheckUtil.checkUrl(url)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return DbDataHelper.getDGEntity(url);
|
return DbDataHelper.getDGEntityByHash(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ class DNormalConfigHandler<TARGET extends AbsTarget> implements IConfigHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setForceDownload(boolean forceDownload) {
|
void setForceDownload(boolean forceDownload) {
|
||||||
getWrapper().setForceDownload(forceDownload);
|
getWrapper().setIgnoreFilePathOccupy(forceDownload);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setUrl(String url) {
|
void setUrl(String url) {
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ public class FtpBuilderTarget extends AbsBuilderTarget<FtpBuilderTarget> {
|
|||||||
mConfigHandler = new DNormalConfigHandler<>(this, -1);
|
mConfigHandler = new DNormalConfigHandler<>(this, -1);
|
||||||
mConfigHandler.setUrl(url);
|
mConfigHandler.setUrl(url);
|
||||||
getTaskWrapper().setRequestType(ITaskWrapper.D_FTP);
|
getTaskWrapper().setRequestType(ITaskWrapper.D_FTP);
|
||||||
|
getTaskWrapper().setNewTask(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -70,7 +71,9 @@ public class FtpBuilderTarget extends AbsBuilderTarget<FtpBuilderTarget> {
|
|||||||
*
|
*
|
||||||
* @param filePath 路径必须为文件路径,不能为文件夹路径
|
* @param filePath 路径必须为文件路径,不能为文件夹路径
|
||||||
* @param forceDownload {@code true}强制下载,不考虑文件路径是否被占用
|
* @param forceDownload {@code true}强制下载,不考虑文件路径是否被占用
|
||||||
|
* @deprecated 使用 {@link #ignoreFilePathOccupy()}
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
@CheckResult(suggest = Suggest.TASK_CONTROLLER)
|
@CheckResult(suggest = Suggest.TASK_CONTROLLER)
|
||||||
public FtpBuilderTarget setFilePath(@NonNull String filePath, boolean forceDownload) {
|
public FtpBuilderTarget setFilePath(@NonNull String filePath, boolean forceDownload) {
|
||||||
mConfigHandler.setTempFilePath(filePath);
|
mConfigHandler.setTempFilePath(filePath);
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ public class FtpDirBuilderTarget extends AbsBuilderTarget<FtpDirBuilderTarget> {
|
|||||||
this.url = url;
|
this.url = url;
|
||||||
mConfigHandler = new FtpDirConfigHandler<>(this, -1);
|
mConfigHandler = new FtpDirConfigHandler<>(this, -1);
|
||||||
getEntity().setGroupHash(url);
|
getEntity().setGroupHash(url);
|
||||||
|
getTaskWrapper().setNewTask(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ public class FtpDirNormalTarget extends AbsNormalTarget<FtpDirNormalTarget> {
|
|||||||
|
|
||||||
FtpDirNormalTarget(long taskId) {
|
FtpDirNormalTarget(long taskId) {
|
||||||
mConfigHandler = new FtpDirConfigHandler<>(this, taskId);
|
mConfigHandler = new FtpDirConfigHandler<>(this, taskId);
|
||||||
|
getTaskWrapper().setNewTask(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public boolean isRunning() {
|
@Override public boolean isRunning() {
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ public class FtpNormalTarget extends AbsNormalTarget<FtpNormalTarget> {
|
|||||||
FtpNormalTarget(long taskId) {
|
FtpNormalTarget(long taskId) {
|
||||||
mConfigHandler = new DNormalConfigHandler<>(this, taskId);
|
mConfigHandler = new DNormalConfigHandler<>(this, taskId);
|
||||||
getTaskWrapper().setRequestType(ITaskWrapper.D_FTP);
|
getTaskWrapper().setRequestType(ITaskWrapper.D_FTP);
|
||||||
|
getTaskWrapper().setNewTask(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -34,8 +34,9 @@ public class GroupBuilderTarget extends AbsBuilderTarget<GroupBuilderTarget> {
|
|||||||
|
|
||||||
GroupBuilderTarget(List<String> urls) {
|
GroupBuilderTarget(List<String> urls) {
|
||||||
mConfigHandler = new HttpGroupConfigHandler<>(this, -1);
|
mConfigHandler = new HttpGroupConfigHandler<>(this, -1);
|
||||||
getTaskWrapper().setRequestType(ITaskWrapper.DG_HTTP);
|
|
||||||
mConfigHandler.setGroupUrl(urls);
|
mConfigHandler.setGroupUrl(urls);
|
||||||
|
getTaskWrapper().setRequestType(ITaskWrapper.DG_HTTP);
|
||||||
|
getTaskWrapper().setNewTask(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ public class GroupNormalTarget extends AbsNormalTarget<GroupNormalTarget> {
|
|||||||
GroupNormalTarget(long taskId) {
|
GroupNormalTarget(long taskId) {
|
||||||
mConfigHandler = new HttpGroupConfigHandler<>(this, taskId);
|
mConfigHandler = new HttpGroupConfigHandler<>(this, taskId);
|
||||||
getTaskWrapper().setRequestType(ITaskWrapper.DG_HTTP);
|
getTaskWrapper().setRequestType(ITaskWrapper.DG_HTTP);
|
||||||
|
getTaskWrapper().setNewTask(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -22,12 +22,9 @@ import com.arialyy.aria.core.common.HttpOption;
|
|||||||
import com.arialyy.aria.core.download.DTaskWrapper;
|
import com.arialyy.aria.core.download.DTaskWrapper;
|
||||||
import com.arialyy.aria.core.download.m3u8.M3U8LiveOption;
|
import com.arialyy.aria.core.download.m3u8.M3U8LiveOption;
|
||||||
import com.arialyy.aria.core.download.m3u8.M3U8VodOption;
|
import com.arialyy.aria.core.download.m3u8.M3U8VodOption;
|
||||||
import com.arialyy.aria.core.inf.IOptionConstant;
|
|
||||||
import com.arialyy.aria.core.inf.Suggest;
|
import com.arialyy.aria.core.inf.Suggest;
|
||||||
import com.arialyy.aria.core.processor.IHttpFileLenAdapter;
|
|
||||||
import com.arialyy.aria.core.wrapper.AbsTaskWrapper;
|
import com.arialyy.aria.core.wrapper.AbsTaskWrapper;
|
||||||
import com.arialyy.aria.core.wrapper.ITaskWrapper;
|
import com.arialyy.aria.core.wrapper.ITaskWrapper;
|
||||||
import com.arialyy.aria.util.CheckUtil;
|
|
||||||
|
|
||||||
public class HttpBuilderTarget extends AbsBuilderTarget<HttpBuilderTarget> {
|
public class HttpBuilderTarget extends AbsBuilderTarget<HttpBuilderTarget> {
|
||||||
|
|
||||||
@@ -35,13 +32,14 @@ public class HttpBuilderTarget extends AbsBuilderTarget<HttpBuilderTarget> {
|
|||||||
|
|
||||||
HttpBuilderTarget(String url) {
|
HttpBuilderTarget(String url) {
|
||||||
mConfigHandler = new DNormalConfigHandler<>(this, -1);
|
mConfigHandler = new DNormalConfigHandler<>(this, -1);
|
||||||
getTaskWrapper().setRequestType(ITaskWrapper.D_HTTP);
|
|
||||||
mConfigHandler.setUrl(url);
|
mConfigHandler.setUrl(url);
|
||||||
|
getTaskWrapper().setRequestType(ITaskWrapper.D_HTTP);
|
||||||
|
getTaskWrapper().setNewTask(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@CheckResult(suggest = Suggest.TASK_CONTROLLER)
|
@CheckResult(suggest = Suggest.TASK_CONTROLLER)
|
||||||
public HttpBuilderTarget m3u8VodOption(M3U8VodOption m3U8VodOption) {
|
public HttpBuilderTarget m3u8VodOption(M3U8VodOption m3U8VodOption) {
|
||||||
if (m3U8VodOption == null){
|
if (m3U8VodOption == null) {
|
||||||
throw new NullPointerException("m3u8任务设置为空");
|
throw new NullPointerException("m3u8任务设置为空");
|
||||||
}
|
}
|
||||||
getTaskWrapper().setRequestType(AbsTaskWrapper.M3U8_VOD);
|
getTaskWrapper().setRequestType(AbsTaskWrapper.M3U8_VOD);
|
||||||
@@ -52,7 +50,7 @@ public class HttpBuilderTarget extends AbsBuilderTarget<HttpBuilderTarget> {
|
|||||||
|
|
||||||
@CheckResult(suggest = Suggest.TASK_CONTROLLER)
|
@CheckResult(suggest = Suggest.TASK_CONTROLLER)
|
||||||
public HttpBuilderTarget m3u8LiveOption(M3U8LiveOption m3U8LiveOption) {
|
public HttpBuilderTarget m3u8LiveOption(M3U8LiveOption m3U8LiveOption) {
|
||||||
if (m3U8LiveOption == null){
|
if (m3U8LiveOption == null) {
|
||||||
throw new NullPointerException("m3u8任务设置为空");
|
throw new NullPointerException("m3u8任务设置为空");
|
||||||
}
|
}
|
||||||
getTaskWrapper().setRequestType(AbsTaskWrapper.M3U8_LIVE);
|
getTaskWrapper().setRequestType(AbsTaskWrapper.M3U8_LIVE);
|
||||||
@@ -92,7 +90,9 @@ public class HttpBuilderTarget extends AbsBuilderTarget<HttpBuilderTarget> {
|
|||||||
*
|
*
|
||||||
* @param filePath 路径必须为文件路径,不能为文件夹路径
|
* @param filePath 路径必须为文件路径,不能为文件夹路径
|
||||||
* @param forceDownload {@code true}强制下载,不考虑文件路径是否被占用
|
* @param forceDownload {@code true}强制下载,不考虑文件路径是否被占用
|
||||||
|
* @deprecated 使用 {@link #ignoreFilePathOccupy()}
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
@CheckResult(suggest = Suggest.TASK_CONTROLLER)
|
@CheckResult(suggest = Suggest.TASK_CONTROLLER)
|
||||||
public HttpBuilderTarget setFilePath(@NonNull String filePath, boolean forceDownload) {
|
public HttpBuilderTarget setFilePath(@NonNull String filePath, boolean forceDownload) {
|
||||||
mConfigHandler.setTempFilePath(filePath);
|
mConfigHandler.setTempFilePath(filePath);
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ public class HttpNormalTarget extends AbsNormalTarget<HttpNormalTarget> {
|
|||||||
HttpNormalTarget(long taskId) {
|
HttpNormalTarget(long taskId) {
|
||||||
mConfigHandler = new DNormalConfigHandler<>(this, taskId);
|
mConfigHandler = new DNormalConfigHandler<>(this, taskId);
|
||||||
getTaskWrapper().setRequestType(getTaskWrapper().getEntity().getTaskType());
|
getTaskWrapper().setRequestType(getTaskWrapper().getEntity().getTaskType());
|
||||||
|
getTaskWrapper().setNewTask(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@CheckResult(suggest = Suggest.TASK_CONTROLLER)
|
@CheckResult(suggest = Suggest.TASK_CONTROLLER)
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ public class M3U8NormalTarget extends AbsNormalTarget<M3U8NormalTarget> {
|
|||||||
|
|
||||||
M3U8NormalTarget(DTaskWrapper wrapper) {
|
M3U8NormalTarget(DTaskWrapper wrapper) {
|
||||||
setTaskWrapper(wrapper);
|
setTaskWrapper(wrapper);
|
||||||
|
getTaskWrapper().setNewTask(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ public class TcpBuilderTarget extends AbsBuilderTarget<TcpBuilderTarget> {
|
|||||||
TcpBuilderTarget(String ip, int port) {
|
TcpBuilderTarget(String ip, int port) {
|
||||||
mConfigHandler = new DNormalConfigHandler<>(this, -1);
|
mConfigHandler = new DNormalConfigHandler<>(this, -1);
|
||||||
getTaskWrapper().setRequestType(ITaskWrapper.D_TCP);
|
getTaskWrapper().setRequestType(ITaskWrapper.D_TCP);
|
||||||
|
getTaskWrapper().setNewTask(true);
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
///**
|
///**
|
||||||
@@ -56,18 +57,4 @@ public class TcpBuilderTarget extends AbsBuilderTarget<TcpBuilderTarget> {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 设置文件存储路径,如果需要修改新的文件名,修改路径便可。
|
|
||||||
* 如:原文件路径 /mnt/sdcard/test.zip
|
|
||||||
* 如果需要将test.zip改为game.zip,只需要重新设置文件路径为:/mnt/sdcard/game.zip
|
|
||||||
*
|
|
||||||
* @param filePath 路径必须为文件路径,不能为文件夹路径
|
|
||||||
* @param forceDownload {@code true}强制下载,不考虑文件路径是否被占用
|
|
||||||
*/
|
|
||||||
@CheckResult(suggest = Suggest.TASK_CONTROLLER)
|
|
||||||
public TcpBuilderTarget setFilePath(@NonNull String filePath, boolean forceDownload) {
|
|
||||||
mConfigHandler.setTempFilePath(filePath);
|
|
||||||
mConfigHandler.setForceDownload(forceDownload);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,13 +16,13 @@
|
|||||||
|
|
||||||
package com.arialyy.aria.core.queue;
|
package com.arialyy.aria.core.queue;
|
||||||
|
|
||||||
import com.arialyy.aria.core.AriaManager;
|
import com.arialyy.aria.core.AriaConfig;
|
||||||
import com.arialyy.aria.core.download.DGTaskWrapper;
|
import com.arialyy.aria.core.download.DGTaskWrapper;
|
||||||
import com.arialyy.aria.core.task.DownloadGroupTask;
|
|
||||||
import com.arialyy.aria.core.event.DGMaxNumEvent;
|
import com.arialyy.aria.core.event.DGMaxNumEvent;
|
||||||
import com.arialyy.aria.core.event.Event;
|
import com.arialyy.aria.core.event.Event;
|
||||||
import com.arialyy.aria.core.event.EventMsgUtil;
|
import com.arialyy.aria.core.event.EventMsgUtil;
|
||||||
import com.arialyy.aria.core.scheduler.TaskSchedulers;
|
import com.arialyy.aria.core.scheduler.TaskSchedulers;
|
||||||
|
import com.arialyy.aria.core.task.DownloadGroupTask;
|
||||||
import com.arialyy.aria.util.ALog;
|
import com.arialyy.aria.util.ALog;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -57,7 +57,7 @@ public class DGroupTaskQueue
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override public int getMaxTaskNum() {
|
@Override public int getMaxTaskNum() {
|
||||||
return AriaManager.getInstance().getDGroupConfig().getMaxTaskNum();
|
return AriaConfig.getInstance().getDConfig().getMaxTaskNum();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public DownloadGroupTask createTask(DGTaskWrapper wrapper) {
|
@Override public DownloadGroupTask createTask(DGTaskWrapper wrapper) {
|
||||||
@@ -74,6 +74,6 @@ public class DGroupTaskQueue
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override public int getOldMaxNum() {
|
@Override public int getOldMaxNum() {
|
||||||
return AriaManager.getInstance().getDGroupConfig().oldMaxTaskNum;
|
return AriaConfig.getInstance().getDGConfig().oldMaxTaskNum;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,14 +16,14 @@
|
|||||||
|
|
||||||
package com.arialyy.aria.core.queue;
|
package com.arialyy.aria.core.queue;
|
||||||
|
|
||||||
import com.arialyy.aria.core.AriaManager;
|
import com.arialyy.aria.core.AriaConfig;
|
||||||
import com.arialyy.aria.core.download.DTaskWrapper;
|
import com.arialyy.aria.core.download.DTaskWrapper;
|
||||||
import com.arialyy.aria.core.task.DownloadTask;
|
|
||||||
import com.arialyy.aria.core.event.DMaxNumEvent;
|
import com.arialyy.aria.core.event.DMaxNumEvent;
|
||||||
import com.arialyy.aria.core.event.Event;
|
import com.arialyy.aria.core.event.Event;
|
||||||
import com.arialyy.aria.core.event.EventMsgUtil;
|
import com.arialyy.aria.core.event.EventMsgUtil;
|
||||||
import com.arialyy.aria.core.inf.TaskSchedulerType;
|
import com.arialyy.aria.core.inf.TaskSchedulerType;
|
||||||
import com.arialyy.aria.core.scheduler.TaskSchedulers;
|
import com.arialyy.aria.core.scheduler.TaskSchedulers;
|
||||||
|
import com.arialyy.aria.core.task.DownloadTask;
|
||||||
import com.arialyy.aria.util.ALog;
|
import com.arialyy.aria.util.ALog;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -60,7 +60,7 @@ public class DTaskQueue extends AbsTaskQueue<DownloadTask, DTaskWrapper> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override public int getOldMaxNum() {
|
@Override public int getOldMaxNum() {
|
||||||
return AriaManager.getInstance().getDownloadConfig().oldMaxTaskNum;
|
return AriaConfig.getInstance().getDConfig().oldMaxTaskNum;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -81,7 +81,7 @@ public class DTaskQueue extends AbsTaskQueue<DownloadTask, DTaskWrapper> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int maxSize = AriaManager.getInstance().getDownloadConfig().getMaxTaskNum();
|
int maxSize = AriaConfig.getInstance().getDConfig().getMaxTaskNum();
|
||||||
int currentSize = mExecutePool.size();
|
int currentSize = mExecutePool.size();
|
||||||
if (currentSize == 0 || currentSize < maxSize) {
|
if (currentSize == 0 || currentSize < maxSize) {
|
||||||
startTask(task);
|
startTask(task);
|
||||||
@@ -126,6 +126,6 @@ public class DTaskQueue extends AbsTaskQueue<DownloadTask, DTaskWrapper> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override public int getMaxTaskNum() {
|
@Override public int getMaxTaskNum() {
|
||||||
return AriaManager.getInstance().getDownloadConfig().getMaxTaskNum();
|
return AriaConfig.getInstance().getDConfig().getMaxTaskNum();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package com.arialyy.aria.core.queue;
|
package com.arialyy.aria.core.queue;
|
||||||
|
|
||||||
|
import com.arialyy.aria.core.AriaConfig;
|
||||||
import com.arialyy.aria.core.AriaManager;
|
import com.arialyy.aria.core.AriaManager;
|
||||||
import com.arialyy.aria.core.event.Event;
|
import com.arialyy.aria.core.event.Event;
|
||||||
import com.arialyy.aria.core.event.EventMsgUtil;
|
import com.arialyy.aria.core.event.EventMsgUtil;
|
||||||
@@ -55,11 +56,11 @@ public class UTaskQueue extends AbsTaskQueue<UploadTask, UTaskWrapper> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override public int getOldMaxNum() {
|
@Override public int getOldMaxNum() {
|
||||||
return AriaManager.getInstance().getUploadConfig().oldMaxTaskNum;
|
return AriaConfig.getInstance().getUConfig().oldMaxTaskNum;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public int getMaxTaskNum() {
|
@Override public int getMaxTaskNum() {
|
||||||
return AriaManager.getInstance().getUploadConfig().getMaxTaskNum();
|
return AriaConfig.getInstance().getUConfig().getMaxTaskNum();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public UploadTask createTask(UTaskWrapper wrapper) {
|
@Override public UploadTask createTask(UTaskWrapper wrapper) {
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.arialyy.aria.core.queue.pool;
|
package com.arialyy.aria.core.queue.pool;
|
||||||
|
|
||||||
|
import com.arialyy.aria.core.AriaConfig;
|
||||||
import com.arialyy.aria.core.AriaManager;
|
import com.arialyy.aria.core.AriaManager;
|
||||||
import com.arialyy.aria.core.task.AbsTask;
|
import com.arialyy.aria.core.task.AbsTask;
|
||||||
|
|
||||||
@@ -26,6 +27,6 @@ class DGLoadExecutePool<TASK extends AbsTask> extends DLoadExecutePool<TASK> {
|
|||||||
private final String TAG = "DGLoadExecutePool";
|
private final String TAG = "DGLoadExecutePool";
|
||||||
|
|
||||||
@Override protected int getMaxSize() {
|
@Override protected int getMaxSize() {
|
||||||
return AriaManager.getInstance().getDGroupConfig().getMaxTaskNum();
|
return AriaConfig.getInstance().getDGConfig().getMaxTaskNum();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.arialyy.aria.core.queue.pool;
|
package com.arialyy.aria.core.queue.pool;
|
||||||
|
|
||||||
import com.arialyy.aria.core.AriaManager;
|
import com.arialyy.aria.core.AriaConfig;
|
||||||
import com.arialyy.aria.core.task.AbsTask;
|
import com.arialyy.aria.core.task.AbsTask;
|
||||||
import com.arialyy.aria.util.ALog;
|
import com.arialyy.aria.util.ALog;
|
||||||
import com.arialyy.aria.util.CommonUtil;
|
import com.arialyy.aria.util.CommonUtil;
|
||||||
@@ -30,7 +30,7 @@ class DLoadExecutePool<TASK extends AbsTask> extends BaseExecutePool<TASK> {
|
|||||||
private final String TAG = "DownloadExecutePool";
|
private final String TAG = "DownloadExecutePool";
|
||||||
|
|
||||||
@Override protected int getMaxSize() {
|
@Override protected int getMaxSize() {
|
||||||
return AriaManager.getInstance().getDownloadConfig().getMaxTaskNum();
|
return AriaConfig.getInstance().getDConfig().getMaxTaskNum();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public boolean putTask(TASK task) {
|
@Override public boolean putTask(TASK task) {
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.arialyy.aria.core.queue.pool;
|
package com.arialyy.aria.core.queue.pool;
|
||||||
|
|
||||||
import com.arialyy.aria.core.AriaManager;
|
import com.arialyy.aria.core.AriaConfig;
|
||||||
import com.arialyy.aria.core.task.AbsTask;
|
import com.arialyy.aria.core.task.AbsTask;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -23,6 +23,6 @@ import com.arialyy.aria.core.task.AbsTask;
|
|||||||
*/
|
*/
|
||||||
public class UploadExecutePool<TASK extends AbsTask> extends BaseExecutePool<TASK> {
|
public class UploadExecutePool<TASK extends AbsTask> extends BaseExecutePool<TASK> {
|
||||||
@Override protected int getMaxSize() {
|
@Override protected int getMaxSize() {
|
||||||
return AriaManager.getInstance().getUploadConfig().getMaxTaskNum();
|
return AriaConfig.getInstance().getUConfig().getMaxTaskNum();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,11 +15,11 @@
|
|||||||
*/
|
*/
|
||||||
package com.arialyy.aria.core.scheduler;
|
package com.arialyy.aria.core.scheduler;
|
||||||
|
|
||||||
import com.arialyy.aria.core.AriaManager;
|
import com.arialyy.aria.core.AriaConfig;
|
||||||
import com.arialyy.aria.core.common.AbsEntity;
|
import com.arialyy.aria.core.common.AbsEntity;
|
||||||
import com.arialyy.aria.core.task.ITask;
|
|
||||||
import com.arialyy.aria.core.manager.TaskWrapperManager;
|
import com.arialyy.aria.core.manager.TaskWrapperManager;
|
||||||
import com.arialyy.aria.core.queue.ITaskQueue;
|
import com.arialyy.aria.core.queue.ITaskQueue;
|
||||||
|
import com.arialyy.aria.core.task.ITask;
|
||||||
import com.arialyy.aria.util.ALog;
|
import com.arialyy.aria.util.ALog;
|
||||||
import com.arialyy.aria.util.CommonUtil;
|
import com.arialyy.aria.util.CommonUtil;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -42,7 +42,6 @@ class FailureTaskHandler<TASK extends ITask> {
|
|||||||
private TaskSchedulers mSchedulers;
|
private TaskSchedulers mSchedulers;
|
||||||
private final ReentrantLock LOCK = new ReentrantLock();
|
private final ReentrantLock LOCK = new ReentrantLock();
|
||||||
private Condition mCondition = LOCK.newCondition();
|
private Condition mCondition = LOCK.newCondition();
|
||||||
private AriaManager mAriaManager;
|
|
||||||
|
|
||||||
static FailureTaskHandler init(TaskSchedulers schedulers) {
|
static FailureTaskHandler init(TaskSchedulers schedulers) {
|
||||||
if (INSTANCE == null) {
|
if (INSTANCE == null) {
|
||||||
@@ -57,7 +56,6 @@ class FailureTaskHandler<TASK extends ITask> {
|
|||||||
|
|
||||||
private FailureTaskHandler(TaskSchedulers schedulers) {
|
private FailureTaskHandler(TaskSchedulers schedulers) {
|
||||||
mSchedulers = schedulers;
|
mSchedulers = schedulers;
|
||||||
mAriaManager = AriaManager.getInstance();
|
|
||||||
new Thread(new Runnable() {
|
new Thread(new Runnable() {
|
||||||
@Override public void run() {
|
@Override public void run() {
|
||||||
while (true) {
|
while (true) {
|
||||||
@@ -82,35 +80,46 @@ class FailureTaskHandler<TASK extends ITask> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void retryTask(final TASK task) {
|
private void retryTask(final TASK task) {
|
||||||
long interval = task.getTaskWrapper().getConfig().getReTryInterval();
|
|
||||||
final int num = task.getTaskWrapper().getConfig().getReTryNum();
|
|
||||||
final ITaskQueue queue = mSchedulers.getQueue(task.getTaskType());
|
final ITaskQueue queue = mSchedulers.getQueue(task.getTaskType());
|
||||||
mAriaManager.getAriaHandler().postDelayed(new Runnable() {
|
if (task.isNeedRetry()){
|
||||||
@Override public void run() {
|
long interval = task.getTaskWrapper().getConfig().getReTryInterval();
|
||||||
AbsEntity entity = task.getTaskWrapper().getEntity();
|
final int num = task.getTaskWrapper().getConfig().getReTryNum();
|
||||||
if (entity.getFailNum() <= num) {
|
AriaConfig.getInstance().getAriaHandler().postDelayed(new Runnable() {
|
||||||
ALog.d(TAG, String.format("任务【%s】开始重试", task.getTaskName()));
|
@Override public void run() {
|
||||||
queue.reTryStart(task);
|
AbsEntity entity = task.getTaskWrapper().getEntity();
|
||||||
} else {
|
if (entity.getFailNum() <= num) {
|
||||||
queue.removeTaskFormQueue(task.getKey());
|
ALog.d(TAG, String.format("任务【%s】开始重试", task.getTaskName()));
|
||||||
mSchedulers.startNextTask(queue, task.getSchedulerType());
|
queue.reTryStart(task);
|
||||||
TaskWrapperManager.getInstance().removeTaskWrapper(task.getTaskWrapper());
|
} else {
|
||||||
}
|
queue.removeTaskFormQueue(task.getKey());
|
||||||
mExeQueue.remove(task);
|
mSchedulers.startNextTask(queue, task.getSchedulerType());
|
||||||
int index = mHashList.indexOf(task.hashCode());
|
TaskWrapperManager.getInstance().removeTaskWrapper(task.getTaskWrapper());
|
||||||
if (index != -1) {
|
|
||||||
mHashList.remove(index);
|
|
||||||
}
|
|
||||||
if (LOCK.isLocked()) {
|
|
||||||
try {
|
|
||||||
LOCK.lock();
|
|
||||||
mCondition.signalAll();
|
|
||||||
} finally {
|
|
||||||
LOCK.unlock();
|
|
||||||
}
|
}
|
||||||
|
next(task);
|
||||||
}
|
}
|
||||||
|
}, interval);
|
||||||
|
}else {
|
||||||
|
queue.removeTaskFormQueue(task.getKey());
|
||||||
|
mSchedulers.startNextTask(queue, task.getSchedulerType());
|
||||||
|
TaskWrapperManager.getInstance().removeTaskWrapper(task.getTaskWrapper());
|
||||||
|
next(task);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void next(TASK task){
|
||||||
|
mExeQueue.remove(task);
|
||||||
|
int index = mHashList.indexOf(task.hashCode());
|
||||||
|
if (index != -1) {
|
||||||
|
mHashList.remove(index);
|
||||||
|
}
|
||||||
|
if (LOCK.isLocked()) {
|
||||||
|
try {
|
||||||
|
LOCK.lock();
|
||||||
|
mCondition.signalAll();
|
||||||
|
} finally {
|
||||||
|
LOCK.unlock();
|
||||||
}
|
}
|
||||||
}, interval);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void offer(TASK task) {
|
void offer(TASK task) {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import android.content.Intent;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
import com.arialyy.annotations.TaskEnum;
|
import com.arialyy.annotations.TaskEnum;
|
||||||
import com.arialyy.aria.core.AriaManager;
|
import com.arialyy.aria.core.AriaConfig;
|
||||||
import com.arialyy.aria.core.common.AbsEntity;
|
import com.arialyy.aria.core.common.AbsEntity;
|
||||||
import com.arialyy.aria.core.common.AbsNormalEntity;
|
import com.arialyy.aria.core.common.AbsNormalEntity;
|
||||||
import com.arialyy.aria.core.group.GroupSendParams;
|
import com.arialyy.aria.core.group.GroupSendParams;
|
||||||
@@ -53,10 +53,10 @@ public class TaskSchedulers<TASK extends ITask> implements ISchedulers {
|
|||||||
private static FailureTaskHandler mFailureTaskHandler;
|
private static FailureTaskHandler mFailureTaskHandler;
|
||||||
|
|
||||||
private Map<String, Map<TaskEnum, ISchedulerListener>> mObservers = new ConcurrentHashMap<>();
|
private Map<String, Map<TaskEnum, ISchedulerListener>> mObservers = new ConcurrentHashMap<>();
|
||||||
private AriaManager mAriaManager;
|
private AriaConfig mAriaConfig;
|
||||||
|
|
||||||
private TaskSchedulers() {
|
private TaskSchedulers() {
|
||||||
mAriaManager = AriaManager.getInstance();
|
mAriaConfig = AriaConfig.getInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TaskSchedulers getInstance() {
|
public static TaskSchedulers getInstance() {
|
||||||
@@ -230,11 +230,11 @@ public class TaskSchedulers<TASK extends ITask> implements ISchedulers {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean canSend = mAriaManager.getAppConfig().isUseBroadcast();
|
boolean canSend = mAriaConfig.getAConfig().isUseBroadcast();
|
||||||
if (canSend) {
|
if (canSend) {
|
||||||
Intent intent = new Intent(ISchedulers.ARIA_TASK_INFO_ACTION);
|
Intent intent = new Intent(ISchedulers.ARIA_TASK_INFO_ACTION);
|
||||||
intent.putExtras(data);
|
intent.putExtras(data);
|
||||||
mAriaManager.getAPP().sendBroadcast(intent);
|
mAriaConfig.getAPP().sendBroadcast(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -284,9 +284,9 @@ public class TaskSchedulers<TASK extends ITask> implements ISchedulers {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean canSend = mAriaManager.getAppConfig().isUseBroadcast();
|
boolean canSend = mAriaConfig.getAConfig().isUseBroadcast();
|
||||||
if (canSend) {
|
if (canSend) {
|
||||||
mAriaManager.getAPP().sendBroadcast(
|
mAriaConfig.getAPP().sendBroadcast(
|
||||||
createData(msg.what, ITask.DOWNLOAD_GROUP_SUB, params.entity));
|
createData(msg.what, ITask.DOWNLOAD_GROUP_SUB, params.entity));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -353,13 +353,13 @@ public class TaskSchedulers<TASK extends ITask> implements ISchedulers {
|
|||||||
startNextTask(getQueue(taskType), TaskSchedulerType.TYPE_DEFAULT);
|
startNextTask(getQueue(taskType), TaskSchedulerType.TYPE_DEFAULT);
|
||||||
|
|
||||||
// 发送广播
|
// 发送广播
|
||||||
boolean canSend = mAriaManager.getAppConfig().isUseBroadcast();
|
boolean canSend = mAriaConfig.getAConfig().isUseBroadcast();
|
||||||
if (canSend) {
|
if (canSend) {
|
||||||
Intent intent = new Intent(ISchedulers.ARIA_TASK_INFO_ACTION);
|
Intent intent = new Intent(ISchedulers.ARIA_TASK_INFO_ACTION);
|
||||||
Bundle b = new Bundle();
|
Bundle b = new Bundle();
|
||||||
b.putInt(ISchedulers.TASK_TYPE, taskType);
|
b.putInt(ISchedulers.TASK_TYPE, taskType);
|
||||||
b.putInt(ISchedulers.TASK_STATE, ISchedulers.FAIL);
|
b.putInt(ISchedulers.TASK_STATE, ISchedulers.FAIL);
|
||||||
mAriaManager.getAPP().sendBroadcast(intent);
|
mAriaConfig.getAPP().sendBroadcast(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 处理回调
|
// 处理回调
|
||||||
@@ -470,16 +470,16 @@ public class TaskSchedulers<TASK extends ITask> implements ISchedulers {
|
|||||||
* 发送普通任务的广播
|
* 发送普通任务的广播
|
||||||
*/
|
*/
|
||||||
private void sendNormalBroadcast(int state, TASK task) {
|
private void sendNormalBroadcast(int state, TASK task) {
|
||||||
boolean canSend = mAriaManager.getAppConfig().isUseBroadcast();
|
boolean canSend = mAriaConfig.getAConfig().isUseBroadcast();
|
||||||
if (!canSend) {
|
if (!canSend) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int type = task.getTaskType();
|
int type = task.getTaskType();
|
||||||
if (type == ITask.DOWNLOAD || type == ITask.DOWNLOAD_GROUP) {
|
if (type == ITask.DOWNLOAD || type == ITask.DOWNLOAD_GROUP) {
|
||||||
mAriaManager.getAPP().sendBroadcast(
|
mAriaConfig.getAPP().sendBroadcast(
|
||||||
createData(state, type, task.getTaskWrapper().getEntity()));
|
createData(state, type, task.getTaskWrapper().getEntity()));
|
||||||
} else if (type == ITask.UPLOAD) {
|
} else if (type == ITask.UPLOAD) {
|
||||||
mAriaManager.getAPP().sendBroadcast(
|
mAriaConfig.getAPP().sendBroadcast(
|
||||||
createData(state, type, task.getTaskWrapper().getEntity()));
|
createData(state, type, task.getTaskWrapper().getEntity()));
|
||||||
} else {
|
} else {
|
||||||
ALog.w(TAG, "发送广播失败,没有对应的任务");
|
ALog.w(TAG, "发送广播失败,没有对应的任务");
|
||||||
@@ -519,9 +519,9 @@ public class TaskSchedulers<TASK extends ITask> implements ISchedulers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int num = task.getTaskWrapper().getConfig().getReTryNum();
|
int num = task.getTaskWrapper().getConfig().getReTryNum();
|
||||||
boolean isNotNetRetry = mAriaManager.getAppConfig().isNotNetRetry();
|
boolean isNotNetRetry = mAriaConfig.getAConfig().isNotNetRetry();
|
||||||
|
|
||||||
if ((!NetUtils.isConnected(mAriaManager.getAPP()) && !isNotNetRetry)
|
if ((!NetUtils.isConnected(mAriaConfig.getAPP()) && !isNotNetRetry)
|
||||||
|| task.getTaskWrapper().getEntity().getFailNum() > num) {
|
|| task.getTaskWrapper().getEntity().getFailNum() > num) {
|
||||||
queue.removeTaskFormQueue(task.getKey());
|
queue.removeTaskFormQueue(task.getKey());
|
||||||
startNextTask(queue, task.getSchedulerType());
|
startNextTask(queue, task.getSchedulerType());
|
||||||
|
|||||||
@@ -58,9 +58,9 @@ public class CheckUEntityUtil implements ICheckEntityUtil {
|
|||||||
ALog.e(TAG, "上传失败,文件路径【" + filePath + "】不合法");
|
ALog.e(TAG, "上传失败,文件路径【" + filePath + "】不合法");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
// 任务是新任务,并且路径冲突就不会继续执行
|
||||||
// 检查路径冲突
|
if (mWrapper.isNewTask() && !CheckUtil.checkUPathConflicts(
|
||||||
if (!CheckUtil.checkUploadPathConflicts(mWrapper.isForceUpload(), filePath)) {
|
mWrapper.isIgnoreFilePathOccupy(), filePath)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import android.text.TextUtils;
|
|||||||
import androidx.annotation.CheckResult;
|
import androidx.annotation.CheckResult;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import com.arialyy.annotations.TaskEnum;
|
import com.arialyy.annotations.TaskEnum;
|
||||||
|
import com.arialyy.aria.core.AriaConfig;
|
||||||
import com.arialyy.aria.core.AriaManager;
|
import com.arialyy.aria.core.AriaManager;
|
||||||
import com.arialyy.aria.core.command.CancelAllCmd;
|
import com.arialyy.aria.core.command.CancelAllCmd;
|
||||||
import com.arialyy.aria.core.command.CmdHelper;
|
import com.arialyy.aria.core.command.CmdHelper;
|
||||||
@@ -58,7 +59,7 @@ public class UploadReceiver extends AbsReceiver {
|
|||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public UploadReceiver setMaxSpeed(int maxSpeed) {
|
public UploadReceiver setMaxSpeed(int maxSpeed) {
|
||||||
AriaManager.getInstance().getUploadConfig().setMaxSpeed(maxSpeed);
|
AriaConfig.getInstance().getUConfig().setMaxSpeed(maxSpeed);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -52,9 +52,12 @@ public class FtpBuilderTarget extends AbsBuilderTarget<FtpBuilderTarget> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 如果文件路径被其它任务占用,删除其它任务
|
* 如果文件路径被其它任务占用,删除其它任务
|
||||||
|
*
|
||||||
|
* @deprecated 使用 {@link #ignoreFilePathOccupy()}
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public FtpBuilderTarget forceUpload() {
|
public FtpBuilderTarget forceUpload() {
|
||||||
((UTaskWrapper)getTaskWrapper()).setForceUpload(true);
|
getTaskWrapper().setIgnoreFilePathOccupy(true);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ public class FtpNormalTarget extends AbsNormalTarget<FtpNormalTarget> {
|
|||||||
FtpNormalTarget(long taskId) {
|
FtpNormalTarget(long taskId) {
|
||||||
mConfigHandler = new UNormalConfigHandler<>(this, taskId);
|
mConfigHandler = new UNormalConfigHandler<>(this, taskId);
|
||||||
getTaskWrapper().setRequestType(ITaskWrapper.U_FTP);
|
getTaskWrapper().setRequestType(ITaskWrapper.U_FTP);
|
||||||
|
getTaskWrapper().setNewTask(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ import androidx.annotation.CheckResult;
|
|||||||
import com.arialyy.aria.core.common.AbsBuilderTarget;
|
import com.arialyy.aria.core.common.AbsBuilderTarget;
|
||||||
import com.arialyy.aria.core.common.HttpOption;
|
import com.arialyy.aria.core.common.HttpOption;
|
||||||
import com.arialyy.aria.core.inf.Suggest;
|
import com.arialyy.aria.core.inf.Suggest;
|
||||||
import com.arialyy.aria.core.upload.UTaskWrapper;
|
|
||||||
import com.arialyy.aria.core.wrapper.AbsTaskWrapper;
|
import com.arialyy.aria.core.wrapper.AbsTaskWrapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -30,12 +29,12 @@ public class HttpBuilderTarget extends AbsBuilderTarget<HttpBuilderTarget> {
|
|||||||
private UNormalConfigHandler<HttpBuilderTarget> mConfigHandler;
|
private UNormalConfigHandler<HttpBuilderTarget> mConfigHandler;
|
||||||
|
|
||||||
HttpBuilderTarget(String filePath) {
|
HttpBuilderTarget(String filePath) {
|
||||||
|
|
||||||
mConfigHandler = new UNormalConfigHandler<>(this, -1);
|
mConfigHandler = new UNormalConfigHandler<>(this, -1);
|
||||||
mConfigHandler.setFilePath(filePath);
|
mConfigHandler.setFilePath(filePath);
|
||||||
//http暂时不支持断点上传
|
//http暂时不支持断点上传
|
||||||
getTaskWrapper().setSupportBP(false);
|
getTaskWrapper().setSupportBP(false);
|
||||||
getTaskWrapper().setRequestType(AbsTaskWrapper.U_HTTP);
|
getTaskWrapper().setRequestType(AbsTaskWrapper.U_HTTP);
|
||||||
|
getTaskWrapper().setNewTask(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -64,9 +63,12 @@ public class HttpBuilderTarget extends AbsBuilderTarget<HttpBuilderTarget> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 如果文件路径被其它任务占用,删除其它任务
|
* 如果文件路径被其它任务占用,删除其它任务
|
||||||
|
*
|
||||||
|
* @deprecated 使用 {@link #ignoreFilePathOccupy()}
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public HttpBuilderTarget forceUpload() {
|
public HttpBuilderTarget forceUpload() {
|
||||||
((UTaskWrapper) getTaskWrapper()).setForceUpload(true);
|
getTaskWrapper().setIgnoreFilePathOccupy(true);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ public class HttpNormalTarget extends AbsNormalTarget<HttpNormalTarget> {
|
|||||||
mConfigHandler = new UNormalConfigHandler<>(this, taskId);
|
mConfigHandler = new UNormalConfigHandler<>(this, taskId);
|
||||||
getTaskWrapper().setSupportBP(false);
|
getTaskWrapper().setSupportBP(false);
|
||||||
getTaskWrapper().setRequestType(AbsTaskWrapper.U_HTTP);
|
getTaskWrapper().setRequestType(AbsTaskWrapper.U_HTTP);
|
||||||
|
getTaskWrapper().setNewTask(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,4 +1,13 @@
|
|||||||
## 开发日志
|
## 开发日志
|
||||||
|
+ v_3.7.10 (2019/12/3)
|
||||||
|
- fix bug https://github.com/AriaLyy/Aria/issues/543#issuecomment-559733124
|
||||||
|
- fix bug https://github.com/AriaLyy/Aria/issues/542
|
||||||
|
- fix bug https://github.com/AriaLyy/Aria/issues/547
|
||||||
|
- 修复下载失败时,中断重试无效的问题
|
||||||
|
- 增加忽略权限检查的api,`ignoreCheckPermissions()`
|
||||||
|
- 增加通用的的忽略文件路径被占用的api,`isIgnoreFilePathOccupy()`
|
||||||
|
+ v_3.7.9 (2019/11/28)
|
||||||
|
- fix bug https://github.com/AriaLyy/Aria/issues/537
|
||||||
+ v_3.7.8 (2019/11/28)
|
+ v_3.7.8 (2019/11/28)
|
||||||
- fix bug https://github.com/AriaLyy/Aria/issues/526
|
- fix bug https://github.com/AriaLyy/Aria/issues/526
|
||||||
- fix bug https://github.com/AriaLyy/Aria/issues/533
|
- fix bug https://github.com/AriaLyy/Aria/issues/533
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ public class FtpDirInfoThread extends AbsFtpInfoThread<DownloadGroupEntity, DGTa
|
|||||||
entity.setConvertFileSize(CommonUtil.formatFileSize(ftpFile.getSize()));
|
entity.setConvertFileSize(CommonUtil.formatFileSize(ftpFile.getSize()));
|
||||||
entity.setFileSize(ftpFile.getSize());
|
entity.setFileSize(ftpFile.getSize());
|
||||||
|
|
||||||
//if(CheckUtil.checkDownloadPathConflicts(mTaskWrapper.is))
|
//if(CheckUtil.checkDPathConflicts(mTaskWrapper.is))
|
||||||
|
|
||||||
entity.insert();
|
entity.insert();
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ import java.io.UnsupportedEncodingException;
|
|||||||
* Created by Aria.Lao on 2017/7/28. D_FTP 单线程上传任务,需要FTP 服务器给用户打开append和write的权限
|
* Created by Aria.Lao on 2017/7/28. D_FTP 单线程上传任务,需要FTP 服务器给用户打开append和write的权限
|
||||||
*/
|
*/
|
||||||
class FtpUThreadTaskAdapter extends BaseFtpThreadTaskAdapter {
|
class FtpUThreadTaskAdapter extends BaseFtpThreadTaskAdapter {
|
||||||
private final String TAG = "FtpThreadTask";
|
|
||||||
private String dir, remotePath;
|
private String dir, remotePath;
|
||||||
|
|
||||||
FtpUThreadTaskAdapter(SubThreadConfig config) {
|
FtpUThreadTaskAdapter(SubThreadConfig config) {
|
||||||
@@ -66,7 +65,8 @@ class FtpUThreadTaskAdapter extends BaseFtpThreadTaskAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
file =
|
file =
|
||||||
new BufferedRandomAccessFile(getThreadConfig().tempFile, "rwd", getTaskConfig().getBuffSize());
|
new BufferedRandomAccessFile(getThreadConfig().tempFile, "rwd",
|
||||||
|
getTaskConfig().getBuffSize());
|
||||||
if (getThreadRecord().startLocation != 0) {
|
if (getThreadRecord().startLocation != 0) {
|
||||||
//file.skipBytes((int) getThreadConfig().START_LOCATION);
|
//file.skipBytes((int) getThreadConfig().START_LOCATION);
|
||||||
file.seek(getThreadRecord().startLocation);
|
file.seek(getThreadRecord().startLocation);
|
||||||
@@ -103,10 +103,8 @@ class FtpUThreadTaskAdapter extends BaseFtpThreadTaskAdapter {
|
|||||||
private void initPath() throws UnsupportedEncodingException {
|
private void initPath() throws UnsupportedEncodingException {
|
||||||
dir = CommonUtil.convertFtpChar(charSet, mTaskOption.getUrlEntity().remotePath);
|
dir = CommonUtil.convertFtpChar(charSet, mTaskOption.getUrlEntity().remotePath);
|
||||||
|
|
||||||
String fileName =
|
String fileName = TextUtils.isEmpty(mTaskOption.getNewFileName()) ? getEntity().getFileName()
|
||||||
TextUtils.isEmpty(mTaskOption.getNewFileName()) ? CommonUtil.convertFtpChar(charSet,
|
: mTaskOption.getNewFileName();
|
||||||
getEntity().getFileName())
|
|
||||||
: CommonUtil.convertFtpChar(charSet, mTaskOption.getNewFileName());
|
|
||||||
|
|
||||||
remotePath =
|
remotePath =
|
||||||
CommonUtil.convertFtpChar(charSet,
|
CommonUtil.convertFtpChar(charSet,
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.arialyy.aria.m3u8;
|
package com.arialyy.aria.m3u8;
|
||||||
|
|
||||||
|
import android.text.TextUtils;
|
||||||
import com.arialyy.aria.core.common.RecordHandler;
|
import com.arialyy.aria.core.common.RecordHandler;
|
||||||
import com.arialyy.aria.core.download.DTaskWrapper;
|
import com.arialyy.aria.core.download.DTaskWrapper;
|
||||||
import com.arialyy.aria.core.download.DownloadEntity;
|
import com.arialyy.aria.core.download.DownloadEntity;
|
||||||
@@ -59,6 +60,9 @@ public abstract class BaseM3U8Loader extends AbsLoader {
|
|||||||
|
|
||||||
protected String getCacheDir() {
|
protected String getCacheDir() {
|
||||||
String cacheDir = mM3U8Option.getCacheDir();
|
String cacheDir = mM3U8Option.getCacheDir();
|
||||||
|
if (TextUtils.isEmpty(cacheDir)) {
|
||||||
|
cacheDir = FileUtil.getTsCacheDir(getEntity().getFilePath(), mM3U8Option.getBandWidth());
|
||||||
|
}
|
||||||
if (!new File(cacheDir).exists()) {
|
if (!new File(cacheDir).exists()) {
|
||||||
FileUtil.createDir(cacheDir);
|
FileUtil.createDir(cacheDir);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -131,7 +131,8 @@ public class M3U8RecordAdapter extends AbsRecordHandlerAdapter {
|
|||||||
|
|
||||||
@Override public int initTaskThreadNum() {
|
@Override public int initTaskThreadNum() {
|
||||||
if (getWrapper().getRequestType() == ITaskWrapper.M3U8_VOD) {
|
if (getWrapper().getRequestType() == ITaskWrapper.M3U8_VOD) {
|
||||||
return mOption.getUrls().size();
|
return
|
||||||
|
mOption.getUrls() == null || mOption.getUrls().isEmpty() ? 1 : mOption.getUrls().size();
|
||||||
}
|
}
|
||||||
if (getWrapper().getRequestType() == ITaskWrapper.M3U8_LIVE) {
|
if (getWrapper().getRequestType() == ITaskWrapper.M3U8_LIVE) {
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ import android.net.Network;
|
|||||||
import android.net.NetworkCapabilities;
|
import android.net.NetworkCapabilities;
|
||||||
import android.net.NetworkRequest;
|
import android.net.NetworkRequest;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.os.Looper;
|
||||||
import com.arialyy.aria.core.config.AppConfig;
|
import com.arialyy.aria.core.config.AppConfig;
|
||||||
import com.arialyy.aria.core.config.Configuration;
|
import com.arialyy.aria.core.config.Configuration;
|
||||||
import com.arialyy.aria.core.config.DGroupConfig;
|
import com.arialyy.aria.core.config.DGroupConfig;
|
||||||
@@ -56,6 +58,7 @@ public class AriaConfig {
|
|||||||
* 是否已经联网,true 已经联网
|
* 是否已经联网,true 已经联网
|
||||||
*/
|
*/
|
||||||
private static boolean isConnectedNet = true;
|
private static boolean isConnectedNet = true;
|
||||||
|
private Handler mAriaHandler;
|
||||||
|
|
||||||
private AriaConfig(Context context) {
|
private AriaConfig(Context context) {
|
||||||
APP = context.getApplicationContext();
|
APP = context.getApplicationContext();
|
||||||
@@ -105,6 +108,13 @@ public class AriaConfig {
|
|||||||
return mDGConfig;
|
return mDGConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public synchronized Handler getAriaHandler() {
|
||||||
|
if (mAriaHandler == null) {
|
||||||
|
mAriaHandler = new Handler(Looper.getMainLooper());
|
||||||
|
}
|
||||||
|
return mAriaHandler;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 注册网络监听,只有配置了检查网络{@link AppConfig#isNetCheck()}才会注册事件
|
* 注册网络监听,只有配置了检查网络{@link AppConfig#isNetCheck()}才会注册事件
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -54,11 +54,6 @@ public class DTaskWrapper extends AbsTaskWrapper<DownloadEntity> {
|
|||||||
*/
|
*/
|
||||||
private String mTempFilePath;
|
private String mTempFilePath;
|
||||||
|
|
||||||
/**
|
|
||||||
* {@code true}强制下载,不考虑文件路径是否被占用
|
|
||||||
*/
|
|
||||||
private boolean forceDownload = false;
|
|
||||||
|
|
||||||
public DTaskWrapper(DownloadEntity entity) {
|
public DTaskWrapper(DownloadEntity entity) {
|
||||||
super(entity);
|
super(entity);
|
||||||
}
|
}
|
||||||
@@ -124,12 +119,4 @@ public class DTaskWrapper extends AbsTaskWrapper<DownloadEntity> {
|
|||||||
public void setTempFilePath(String mTempFilePath) {
|
public void setTempFilePath(String mTempFilePath) {
|
||||||
this.mTempFilePath = mTempFilePath;
|
this.mTempFilePath = mTempFilePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isForceDownload() {
|
|
||||||
return forceDownload;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setForceDownload(boolean forceDownload) {
|
|
||||||
this.forceDownload = forceDownload;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,55 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2016 AriaLyy(https://github.com/AriaLyy/Aria)
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
package com.arialyy.aria.core.listener;
|
|
||||||
|
|
||||||
import com.arialyy.aria.exception.BaseException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by lyy on 2017/2/23.
|
|
||||||
*/
|
|
||||||
class UploadListener implements IUploadListener {
|
|
||||||
@Override public void onPre() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public void onStart(long startLocation) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public void onResume(long resumeLocation) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public void onStop(long stopLocation) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public void onProgress(long currentLocation) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public void onCancel() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public void onComplete() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public void onFail(boolean needRetry, BaseException e) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -84,7 +84,7 @@ public class ThreadStateManager implements IThreadState {
|
|||||||
mFailNum++;
|
mFailNum++;
|
||||||
if (isFail()) {
|
if (isFail()) {
|
||||||
Bundle b = msg.getData();
|
Bundle b = msg.getData();
|
||||||
mListener.onFail(b.getBoolean(KEY_RETRY, true),
|
mListener.onFail(b.getBoolean(KEY_RETRY, false),
|
||||||
(BaseException) b.getSerializable(KEY_ERROR_INFO));
|
(BaseException) b.getSerializable(KEY_ERROR_INFO));
|
||||||
quitLooper();
|
quitLooper();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -353,7 +353,7 @@ public class ThreadTask implements IThreadTask, IThreadTaskObserver {
|
|||||||
} else {
|
} else {
|
||||||
ALog.e(TAG, String.format("任务【%s】执行失败", getFileName()));
|
ALog.e(TAG, String.format("任务【%s】执行失败", getFileName()));
|
||||||
ErrorHelp.saveError(TAG, "", ALog.getExceptionString(ex));
|
ErrorHelp.saveError(TAG, "", ALog.getExceptionString(ex));
|
||||||
sendFailMsg(null);
|
sendFailMsg(null, needRetry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -365,7 +365,7 @@ public class ThreadTask implements IThreadTask, IThreadTaskObserver {
|
|||||||
boolean isConnected = NetUtils.isConnected(AriaConfig.getInstance().getAPP());
|
boolean isConnected = NetUtils.isConnected(AriaConfig.getInstance().getAPP());
|
||||||
if (!isConnected && !isNotNetRetry) {
|
if (!isConnected && !isNotNetRetry) {
|
||||||
ALog.w(TAG, String.format("ts切片【%s】重试失败,网络未连接", getFileName()));
|
ALog.w(TAG, String.format("ts切片【%s】重试失败,网络未连接", getFileName()));
|
||||||
sendFailMsg(null);
|
sendFailMsg(null, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (mFailTimes < RETRY_NUM && needRetry && (NetUtils.isConnected(
|
if (mFailTimes < RETRY_NUM && needRetry && (NetUtils.isConnected(
|
||||||
@@ -377,7 +377,7 @@ public class ThreadTask implements IThreadTask, IThreadTaskObserver {
|
|||||||
FileUtil.createFile(mConfig.tempFile);
|
FileUtil.createFile(mConfig.tempFile);
|
||||||
ThreadTaskManager.getInstance().retryThread(this);
|
ThreadTaskManager.getInstance().retryThread(this);
|
||||||
} else {
|
} else {
|
||||||
sendFailMsg(null);
|
sendFailMsg(null, needRetry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -389,7 +389,7 @@ public class ThreadTask implements IThreadTask, IThreadTaskObserver {
|
|||||||
private void retryBlockTask(boolean needRetry) {
|
private void retryBlockTask(boolean needRetry) {
|
||||||
if (!NetUtils.isConnected(AriaConfig.getInstance().getAPP()) && !isNotNetRetry) {
|
if (!NetUtils.isConnected(AriaConfig.getInstance().getAPP()) && !isNotNetRetry) {
|
||||||
ALog.w(TAG, String.format("分块【%s】重试失败,网络未连接", getFileName()));
|
ALog.w(TAG, String.format("分块【%s】重试失败,网络未连接", getFileName()));
|
||||||
sendFailMsg(null);
|
sendFailMsg(null, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (mFailTimes < RETRY_NUM && needRetry && (NetUtils.isConnected(
|
if (mFailTimes < RETRY_NUM && needRetry && (NetUtils.isConnected(
|
||||||
@@ -400,7 +400,7 @@ public class ThreadTask implements IThreadTask, IThreadTaskObserver {
|
|||||||
handleBlockRecord();
|
handleBlockRecord();
|
||||||
ThreadTaskManager.getInstance().retryThread(this);
|
ThreadTaskManager.getInstance().retryThread(this);
|
||||||
} else {
|
} else {
|
||||||
sendFailMsg(null);
|
sendFailMsg(null, needRetry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -448,13 +448,14 @@ public class ThreadTask implements IThreadTask, IThreadTaskObserver {
|
|||||||
/**
|
/**
|
||||||
* 发送失败信息
|
* 发送失败信息
|
||||||
*/
|
*/
|
||||||
private void sendFailMsg(@Nullable BaseException e) {
|
private void sendFailMsg(@Nullable BaseException e,boolean needRetry) {
|
||||||
|
Bundle b = new Bundle();
|
||||||
|
b.putBoolean(IThreadState.KEY_RETRY, needRetry);
|
||||||
if (e != null) {
|
if (e != null) {
|
||||||
Bundle b = new Bundle();
|
|
||||||
b.putSerializable(IThreadState.KEY_ERROR_INFO, e);
|
b.putSerializable(IThreadState.KEY_ERROR_INFO, e);
|
||||||
updateState(IThreadState.STATE_FAIL, b);
|
updateState(IThreadState.STATE_FAIL, b);
|
||||||
} else {
|
} else {
|
||||||
updateState(IThreadState.STATE_FAIL, null);
|
updateState(IThreadState.STATE_FAIL, b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,11 +29,6 @@ public class UTaskWrapper extends AbsTaskWrapper<UploadEntity> {
|
|||||||
*/
|
*/
|
||||||
private String tempUrl;
|
private String tempUrl;
|
||||||
|
|
||||||
/**
|
|
||||||
* 如果文件路径被其它任务占用,设置为true时,删除其它任务
|
|
||||||
*/
|
|
||||||
private boolean forceUpload = false;
|
|
||||||
|
|
||||||
public UTaskWrapper(UploadEntity entity) {
|
public UTaskWrapper(UploadEntity entity) {
|
||||||
super(entity);
|
super(entity);
|
||||||
}
|
}
|
||||||
@@ -53,14 +48,6 @@ public class UTaskWrapper extends AbsTaskWrapper<UploadEntity> {
|
|||||||
return getEntity().getKey();
|
return getEntity().getKey();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isForceUpload() {
|
|
||||||
return forceUpload;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setForceUpload(boolean forceUpload) {
|
|
||||||
this.forceUpload = forceUpload;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public UploadConfig getConfig() {
|
@Override public UploadConfig getConfig() {
|
||||||
return Configuration.getInstance().uploadCfg;
|
return Configuration.getInstance().uploadCfg;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ import com.arialyy.aria.core.event.ErrorEvent;
|
|||||||
import com.arialyy.aria.core.inf.IEntity;
|
import com.arialyy.aria.core.inf.IEntity;
|
||||||
import com.arialyy.aria.core.inf.ITaskOption;
|
import com.arialyy.aria.core.inf.ITaskOption;
|
||||||
import com.arialyy.aria.core.upload.UploadEntity;
|
import com.arialyy.aria.core.upload.UploadEntity;
|
||||||
import com.arialyy.aria.util.ALog;
|
|
||||||
import com.arialyy.aria.util.ComponentUtil;
|
import com.arialyy.aria.util.ComponentUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -85,6 +84,19 @@ public abstract class AbsTaskWrapper<ENTITY extends AbsEntity>
|
|||||||
*/
|
*/
|
||||||
private TaskOptionParams optionParams = new TaskOptionParams();
|
private TaskOptionParams optionParams = new TaskOptionParams();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code true}强制下载\上传,不考虑文件路径是否被占用
|
||||||
|
*/
|
||||||
|
private boolean ignoreFilePathOccupy = false;
|
||||||
|
|
||||||
|
public boolean isIgnoreFilePathOccupy() {
|
||||||
|
return ignoreFilePathOccupy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIgnoreFilePathOccupy(boolean ignoreFilePathOccupy) {
|
||||||
|
this.ignoreFilePathOccupy = ignoreFilePathOccupy;
|
||||||
|
}
|
||||||
|
|
||||||
public void setTaskOption(ITaskOption option) {
|
public void setTaskOption(ITaskOption option) {
|
||||||
this.taskOption = option;
|
this.taskOption = option;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ import java.util.Map;
|
|||||||
class DBConfig {
|
class DBConfig {
|
||||||
/*adb pull /mnt/sdcard/Android/data/com.arialyy.simple/files/DB/AriaLyyDb d:/db*/
|
/*adb pull /mnt/sdcard/Android/data/com.arialyy.simple/files/DB/AriaLyyDb d:/db*/
|
||||||
static boolean DEBUG = false;
|
static boolean DEBUG = false;
|
||||||
static Map<String, Class> mapping = new LinkedHashMap<>();
|
static Map<String, Class<? extends DbEntity>> mapping = new LinkedHashMap<>();
|
||||||
static String DB_NAME;
|
static String DB_NAME;
|
||||||
static int VERSION = 56;
|
static int VERSION = 56;
|
||||||
|
|
||||||
@@ -51,8 +51,8 @@ class DBConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static {
|
static {
|
||||||
mapping.put("DownloadGroupEntity", DownloadGroupEntity.class);
|
|
||||||
mapping.put("DownloadEntity", DownloadEntity.class);
|
mapping.put("DownloadEntity", DownloadEntity.class);
|
||||||
|
mapping.put("DownloadGroupEntity", DownloadGroupEntity.class);
|
||||||
mapping.put("UploadEntity", UploadEntity.class);
|
mapping.put("UploadEntity", UploadEntity.class);
|
||||||
mapping.put("ThreadRecord", ThreadRecord.class);
|
mapping.put("ThreadRecord", ThreadRecord.class);
|
||||||
mapping.put("TaskRecord", TaskRecord.class);
|
mapping.put("TaskRecord", TaskRecord.class);
|
||||||
|
|||||||
@@ -221,4 +221,22 @@ class DelegateCommon extends AbsDelegate {
|
|||||||
db.execSQL(str);
|
db.execSQL(str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过class 获取该class的表字段
|
||||||
|
*
|
||||||
|
* @return 表字段列表
|
||||||
|
*/
|
||||||
|
List<String> getColumns(Class<? extends DbEntity> clazz) {
|
||||||
|
List<String> columns = new ArrayList<>();
|
||||||
|
List<Field> fields = CommonUtil.getAllFields(clazz);
|
||||||
|
for (Field field : fields) {
|
||||||
|
field.setAccessible(true);
|
||||||
|
if (SqlUtil.isIgnore(field)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
columns.add(field.getName());
|
||||||
|
}
|
||||||
|
return columns;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,14 +100,14 @@ final class SqlHelper extends SQLiteOpenHelper {
|
|||||||
} else if (oldVersion < 53) {
|
} else if (oldVersion < 53) {
|
||||||
handle366Update(db);
|
handle366Update(db);
|
||||||
} else {
|
} else {
|
||||||
handleDbUpdate(db, null, null);
|
handleDbUpdate(db, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void onDowngrade(SQLiteDatabase db, int oldVersion, int newVersion) {
|
@Override public void onDowngrade(SQLiteDatabase db, int oldVersion, int newVersion) {
|
||||||
if (oldVersion > newVersion) {
|
if (oldVersion > newVersion) {
|
||||||
handleDbUpdate(db, null, null);
|
handleDbUpdate(db, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -145,10 +145,8 @@ final class SqlHelper extends SQLiteOpenHelper {
|
|||||||
*
|
*
|
||||||
* @param modifyColumns 需要修改的表字段的映射,key为表名,
|
* @param modifyColumns 需要修改的表字段的映射,key为表名,
|
||||||
* value{@code Map<String, String>}中的Map的key为老字段名称,value为该老字段对应的新字段名称
|
* value{@code Map<String, String>}中的Map的key为老字段名称,value为该老字段对应的新字段名称
|
||||||
* @param delColumns 需要删除的表字段,key为表名,value{@code List<String>}为需要删除的字段列表
|
|
||||||
*/
|
*/
|
||||||
private void handleDbUpdate(SQLiteDatabase db, Map<String, Map<String, String>> modifyColumns,
|
private void handleDbUpdate(SQLiteDatabase db, Map<String, Map<String, String>> modifyColumns) {
|
||||||
Map<String, List<String>> delColumns) {
|
|
||||||
if (db == null) {
|
if (db == null) {
|
||||||
ALog.e("SqlHelper", "db 为 null");
|
ALog.e("SqlHelper", "db 为 null");
|
||||||
return;
|
return;
|
||||||
@@ -161,7 +159,7 @@ final class SqlHelper extends SQLiteOpenHelper {
|
|||||||
db.beginTransaction();
|
db.beginTransaction();
|
||||||
Set<String> tables = DBConfig.mapping.keySet();
|
Set<String> tables = DBConfig.mapping.keySet();
|
||||||
for (String tableName : tables) {
|
for (String tableName : tables) {
|
||||||
Class clazz = DBConfig.mapping.get(tableName);
|
Class<? extends DbEntity> clazz = DBConfig.mapping.get(tableName);
|
||||||
if (mDelegate.tableExists(db, clazz)) {
|
if (mDelegate.tableExists(db, clazz)) {
|
||||||
//修改表名为中介表名
|
//修改表名为中介表名
|
||||||
String alertSql = String.format("ALTER TABLE %s RENAME TO %s_temp", tableName, tableName);
|
String alertSql = String.format("ALTER TABLE %s RENAME TO %s_temp", tableName, tableName);
|
||||||
@@ -178,46 +176,57 @@ final class SqlHelper extends SQLiteOpenHelper {
|
|||||||
|
|
||||||
// 复制数据
|
// 复制数据
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
// 获取旧表的所有字段名称
|
|
||||||
Cursor columnC =
|
Cursor columnC =
|
||||||
db.rawQuery(String.format("PRAGMA table_info(%s_temp)", tableName), null);
|
db.rawQuery(String.format("PRAGMA table_info(%s_temp)", tableName), null);
|
||||||
StringBuilder params = new StringBuilder();
|
|
||||||
|
// 获取新表的所有字段名称
|
||||||
|
List<String> newTabColumns = mDelegate.getColumns(clazz);
|
||||||
|
// 获取旧表的所有字段名称
|
||||||
|
List<String> oldTabColumns = new ArrayList<>();
|
||||||
|
|
||||||
while (columnC.moveToNext()) {
|
while (columnC.moveToNext()) {
|
||||||
String columnName = columnC.getString(columnC.getColumnIndex("name"));
|
String columnName = columnC.getString(columnC.getColumnIndex("name"));
|
||||||
if (delColumns != null && delColumns.get(tableName) != null) {
|
oldTabColumns.add(columnName);
|
||||||
List<String> delColumn = delColumns.get(tableName);
|
|
||||||
if (delColumn != null && !delColumn.isEmpty()) {
|
|
||||||
if (delColumn.contains(columnName)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
params.append(columnName).append(",");
|
|
||||||
}
|
}
|
||||||
columnC.close();
|
columnC.close();
|
||||||
|
|
||||||
|
// 旧表需要删除的字段,删除旧表有而新表没的字段
|
||||||
|
List<String> diffTab = getDiffColumn(newTabColumns, oldTabColumns);
|
||||||
|
StringBuilder params = new StringBuilder();
|
||||||
|
|
||||||
|
// 需要修改的列名映射表
|
||||||
|
Map<String, String> modifyMap = null;
|
||||||
|
if (modifyColumns != null) {
|
||||||
|
modifyMap = modifyColumns.get(tableName);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (String column : oldTabColumns) {
|
||||||
|
if (!diffTab.isEmpty() && diffTab.contains(column)
|
||||||
|
&& (modifyMap != null && !modifyMap.containsKey(column))) { // 如果旧表字段有修改,忽略这个删除
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
params.append(column).append(",");
|
||||||
|
}
|
||||||
|
|
||||||
String oldParamStr = params.toString();
|
String oldParamStr = params.toString();
|
||||||
oldParamStr = oldParamStr.substring(0, oldParamStr.length() - 1);
|
oldParamStr = oldParamStr.substring(0, oldParamStr.length() - 1);
|
||||||
String newParamStr = oldParamStr;
|
String newParamStr = oldParamStr;
|
||||||
// 处理字段名称改变
|
// 处理字段名称改变
|
||||||
if (modifyColumns != null) {
|
if (modifyMap != null && !modifyMap.isEmpty()) {
|
||||||
Map<String, String> columnMap = modifyColumns.get(tableName);
|
Set<String> keys = modifyMap.keySet();
|
||||||
if (columnMap != null && !columnMap.isEmpty()) {
|
for (String key : keys) {
|
||||||
Set<String> keys = columnMap.keySet();
|
if (newParamStr.contains(key)) {
|
||||||
for (String key : keys) {
|
newParamStr = newParamStr.replace(key, modifyMap.get(key));
|
||||||
if (newParamStr.contains(key)) {
|
|
||||||
newParamStr = newParamStr.replace(key, columnMap.get(key));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//恢复数据
|
//恢复数据
|
||||||
String insertSql =
|
String insertSql =
|
||||||
String.format("INSERT INTO %s (%s) SELECT %s FROM %s_temp", tableName, newParamStr,
|
String.format("INSERT INTO %s (%s) SELECT %s FROM %s_temp", tableName, newParamStr,
|
||||||
oldParamStr, tableName);
|
oldParamStr, tableName);
|
||||||
ALog.d(TAG, "insertSql = " + insertSql);
|
ALog.d(TAG, "insertSql = " + insertSql);
|
||||||
|
|
||||||
db.execSQL(insertSql);
|
db.execSQL(insertSql);
|
||||||
}
|
}
|
||||||
//删除中介表
|
//删除中介表
|
||||||
@@ -234,6 +243,19 @@ final class SqlHelper extends SQLiteOpenHelper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取新表差值(需要删除的字段):旧表有而新表没的字段
|
||||||
|
*
|
||||||
|
* @param newTab 新表字段
|
||||||
|
* @param oldTab 旧表字段
|
||||||
|
* @return 旧表有而新表没的字段
|
||||||
|
*/
|
||||||
|
private List<String> getDiffColumn(List<String> newTab, List<String> oldTab) {
|
||||||
|
List<String> temp = new ArrayList<>(oldTab); // 拷贝旧表字段
|
||||||
|
temp.removeAll(newTab);
|
||||||
|
return temp;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除重复的repeat数据
|
* 删除重复的repeat数据
|
||||||
*/
|
*/
|
||||||
@@ -256,7 +278,7 @@ final class SqlHelper extends SQLiteOpenHelper {
|
|||||||
modifyMap.put("ThreadRecord", threadRecordModify);
|
modifyMap.put("ThreadRecord", threadRecordModify);
|
||||||
|
|
||||||
// 执行升级操作
|
// 执行升级操作
|
||||||
handleDbUpdate(db, modifyMap, null);
|
handleDbUpdate(db, modifyMap);
|
||||||
delRepeatThreadRecord(db);
|
delRepeatThreadRecord(db);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -273,7 +295,7 @@ final class SqlHelper extends SQLiteOpenHelper {
|
|||||||
modifyMap.put("ThreadRecord", threadRecordModify);
|
modifyMap.put("ThreadRecord", threadRecordModify);
|
||||||
|
|
||||||
// 执行升级操作
|
// 执行升级操作
|
||||||
handleDbUpdate(db, modifyMap, null);
|
handleDbUpdate(db, modifyMap);
|
||||||
delRepeatThreadRecord(db);
|
delRepeatThreadRecord(db);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -307,7 +329,7 @@ final class SqlHelper extends SQLiteOpenHelper {
|
|||||||
modifyMap.put("ThreadRecord", threadRecordModify);
|
modifyMap.put("ThreadRecord", threadRecordModify);
|
||||||
|
|
||||||
// 执行升级操作
|
// 执行升级操作
|
||||||
handleDbUpdate(db, modifyMap, null);
|
handleDbUpdate(db, modifyMap);
|
||||||
delRepeatThreadRecord(db);
|
delRepeatThreadRecord(db);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -360,15 +382,6 @@ final class SqlHelper extends SQLiteOpenHelper {
|
|||||||
dGEntityModifyMap.put("groupName", "groupHash");
|
dGEntityModifyMap.put("groupName", "groupHash");
|
||||||
modifyMap.put("DownloadGroupEntity", dGEntityModifyMap);
|
modifyMap.put("DownloadGroupEntity", dGEntityModifyMap);
|
||||||
|
|
||||||
// 删除字段
|
handleDbUpdate(db, modifyMap);
|
||||||
Map<String, List<String>> delColumnMap = new HashMap<>();
|
|
||||||
List<String> dEntityDel = new ArrayList<>();
|
|
||||||
dEntityDel.add("taskKey");
|
|
||||||
delColumnMap.put("DownloadEntity", dEntityDel);
|
|
||||||
List<String> dgEntityDel = new ArrayList<>();
|
|
||||||
dgEntityDel.add("subtask");
|
|
||||||
delColumnMap.put("DownloadGroupEntity", dgEntityDel);
|
|
||||||
|
|
||||||
handleDbUpdate(db, modifyMap, delColumnMap);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -18,6 +18,7 @@ package com.arialyy.aria.util;
|
|||||||
|
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import com.arialyy.aria.core.download.DownloadEntity;
|
import com.arialyy.aria.core.download.DownloadEntity;
|
||||||
|
import com.arialyy.aria.core.download.DownloadGroupEntity;
|
||||||
import com.arialyy.aria.core.inf.IRecordHandler;
|
import com.arialyy.aria.core.inf.IRecordHandler;
|
||||||
import com.arialyy.aria.core.upload.UploadEntity;
|
import com.arialyy.aria.core.upload.UploadEntity;
|
||||||
import com.arialyy.aria.orm.DbEntity;
|
import com.arialyy.aria.orm.DbEntity;
|
||||||
@@ -32,13 +33,13 @@ public class CheckUtil {
|
|||||||
private static final String TAG = "CheckUtil";
|
private static final String TAG = "CheckUtil";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检查和处理路径冲突
|
* 检查和处理下载任务的路径冲突
|
||||||
*
|
*
|
||||||
* @param isForceDownload true,如果路径冲突,将删除其它任务的记录的
|
* @param isForceDownload true,如果路径冲突,将删除其它任务的记录的
|
||||||
* @param filePath 文件保存路径
|
* @param filePath 文件保存路径
|
||||||
* @return false 任务不再执行,true 任务继续执行
|
* @return false 任务不再执行,true 任务继续执行
|
||||||
*/
|
*/
|
||||||
public static boolean checkDownloadPathConflicts(boolean isForceDownload, String filePath) {
|
public static boolean checkDPathConflicts(boolean isForceDownload, String filePath) {
|
||||||
if (DbEntity.checkDataExist(DownloadEntity.class, "downloadPath=?", filePath)) {
|
if (DbEntity.checkDataExist(DownloadEntity.class, "downloadPath=?", filePath)) {
|
||||||
if (!isForceDownload) {
|
if (!isForceDownload) {
|
||||||
ALog.e(TAG, String.format("下载失败,保存路径【%s】已经被其它任务占用,请设置其它保存路径", filePath));
|
ALog.e(TAG, String.format("下载失败,保存路径【%s】已经被其它任务占用,请设置其它保存路径", filePath));
|
||||||
@@ -53,16 +54,16 @@ public class CheckUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检查和处理路径冲突
|
* 检查和处理上传任务的路径冲突
|
||||||
*
|
*
|
||||||
* @param isForceUpload true,如果路径冲突,将删除其它任务的记录的
|
* @param isForceUpload true,如果路径冲突,将删除其它任务的记录的
|
||||||
* @param filePath 文件保存路径
|
* @param filePath 文件保存路径
|
||||||
* @return false 任务不再执行,true 任务继续执行
|
* @return false 任务不再执行,true 任务继续执行
|
||||||
*/
|
*/
|
||||||
public static boolean checkUploadPathConflicts(boolean isForceUpload, String filePath) {
|
public static boolean checkUPathConflicts(boolean isForceUpload, String filePath) {
|
||||||
if (DbEntity.checkDataExist(UploadEntity.class, "filePath=?", filePath)) {
|
if (DbEntity.checkDataExist(UploadEntity.class, "filePath=?", filePath)) {
|
||||||
if (!isForceUpload) {
|
if (!isForceUpload) {
|
||||||
ALog.e(TAG, String.format("上传失败,文件路径【%s】已经被其它任务占用,请设置其它保存路径", filePath));
|
ALog.e(TAG, String.format("上传失败,文件路径【%s】已经被其它任务占用,请设置其它文件路径", filePath));
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
ALog.w(TAG, String.format("文件路径【%s】已经被其它任务占用,当前任务将覆盖该路径的文件", filePath));
|
ALog.w(TAG, String.format("文件路径【%s】已经被其它任务占用,当前任务将覆盖该路径的文件", filePath));
|
||||||
@@ -73,6 +74,27 @@ public class CheckUtil {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查和处理组合任务的路径冲突
|
||||||
|
*
|
||||||
|
* @param isForceDownload true,如果路径冲突,将删除其它任务的记录的
|
||||||
|
* @param dirPath 文件保存路径
|
||||||
|
* @return false 任务不再执行,true 任务继续执行
|
||||||
|
*/
|
||||||
|
public static boolean checkDGPathConflicts(boolean isForceDownload, String dirPath) {
|
||||||
|
if (DbEntity.checkDataExist(DownloadGroupEntity.class, "dirPath=?", dirPath)) {
|
||||||
|
if (!isForceDownload) {
|
||||||
|
ALog.e(TAG, String.format("下载失败,文件夹路径【%s】已经被其它任务占用,请设置其它文件路径", dirPath));
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
ALog.w(TAG, String.format("文件夹路径【%s】已经被其它任务占用,当前任务将覆盖该路径", dirPath));
|
||||||
|
RecordUtil.delGroupTaskRecordByPath(dirPath, false);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检查成员类是否是静态和public
|
* 检查成员类是否是静态和public
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ public class DbDataHelper {
|
|||||||
* @param groupHash 组合任务Hash
|
* @param groupHash 组合任务Hash
|
||||||
* @return 实体不存在,返回null
|
* @return 实体不存在,返回null
|
||||||
*/
|
*/
|
||||||
public static DownloadGroupEntity getDGEntity(String groupHash) {
|
public static DownloadGroupEntity getDGEntityByHash(String groupHash) {
|
||||||
List<DGEntityWrapper> wrapper =
|
List<DGEntityWrapper> wrapper =
|
||||||
DbEntity.findRelationData(DGEntityWrapper.class, "DownloadGroupEntity.groupHash=?",
|
DbEntity.findRelationData(DGEntityWrapper.class, "DownloadGroupEntity.groupHash=?",
|
||||||
groupHash);
|
groupHash);
|
||||||
@@ -60,6 +60,20 @@ public class DbDataHelper {
|
|||||||
return wrapper == null || wrapper.size() == 0 ? null : wrapper.get(0).groupEntity;
|
return wrapper == null || wrapper.size() == 0 ? null : wrapper.get(0).groupEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取组合任务实体、ftpDir任务实体
|
||||||
|
*
|
||||||
|
* @param dirPath 组合任务Hash
|
||||||
|
* @return 实体不存在,返回null
|
||||||
|
*/
|
||||||
|
public static DownloadGroupEntity getDGEntityByPath(String dirPath) {
|
||||||
|
List<DGEntityWrapper> wrapper =
|
||||||
|
DbEntity.findRelationData(DGEntityWrapper.class, "DownloadGroupEntity.dirPath=?",
|
||||||
|
dirPath);
|
||||||
|
|
||||||
|
return wrapper == null || wrapper.size() == 0 ? null : wrapper.get(0).groupEntity;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取组合任务实体、ftpDir任务实体
|
* 获取组合任务实体、ftpDir任务实体
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -38,6 +38,8 @@ import java.io.ObjectInputStream;
|
|||||||
import java.io.ObjectOutputStream;
|
import java.io.ObjectOutputStream;
|
||||||
import java.io.SequenceInputStream;
|
import java.io.SequenceInputStream;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.nio.channels.Channels;
|
import java.nio.channels.Channels;
|
||||||
import java.nio.channels.FileChannel;
|
import java.nio.channels.FileChannel;
|
||||||
@@ -61,6 +63,21 @@ public class FileUtil {
|
|||||||
private static final String EXTERNAL_STORAGE_PATH =
|
private static final String EXTERNAL_STORAGE_PATH =
|
||||||
Environment.getExternalStorageDirectory().getPath();
|
Environment.getExternalStorageDirectory().getPath();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取m3u8 ts文件的缓存目录。
|
||||||
|
* 缓存文件夹格式:父文件夹/.文件名_码率
|
||||||
|
*
|
||||||
|
* @param path m3u8 文件下载路径
|
||||||
|
* @return m3u8 ts文件的缓存目录
|
||||||
|
*/
|
||||||
|
public static String getTsCacheDir(String path, int bandWidth) {
|
||||||
|
if (TextUtils.isEmpty(path)) {
|
||||||
|
throw new NullPointerException("m3u8文保存路径为空");
|
||||||
|
}
|
||||||
|
File file = new File(path);
|
||||||
|
return String.format("%s/.%s_%s", file.getParent(), file.getName(), bandWidth);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建目录 当目录不存在的时候创建文件,否则返回false
|
* 创建目录 当目录不存在的时候创建文件,否则返回false
|
||||||
*/
|
*/
|
||||||
@@ -409,9 +426,19 @@ public class FileUtil {
|
|||||||
* 获取SD卡目录列表
|
* 获取SD卡目录列表
|
||||||
*/
|
*/
|
||||||
public static List<String> getSDPathList(Context context) {
|
public static List<String> getSDPathList(Context context) {
|
||||||
List<String> paths;
|
List<String> paths = null;
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
|
||||||
paths = getVolumeList(context);
|
try {
|
||||||
|
paths = getVolumeList(context);
|
||||||
|
} catch (ClassNotFoundException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (NoSuchMethodException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (IllegalAccessException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (InvocationTargetException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
List<String> mounts = readMountsFile();
|
List<String> mounts = readMountsFile();
|
||||||
List<String> volds = readVoldFile();
|
List<String> volds = readVoldFile();
|
||||||
@@ -471,16 +498,26 @@ public class FileUtil {
|
|||||||
/**
|
/**
|
||||||
* getSDPathList
|
* getSDPathList
|
||||||
*/
|
*/
|
||||||
private static List<String> getVolumeList(final Context context) {
|
private static List<String> getVolumeList(final Context context)
|
||||||
|
throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException,
|
||||||
|
IllegalAccessException {
|
||||||
List<String> pathList = new ArrayList<>();
|
List<String> pathList = new ArrayList<>();
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||||
StorageManager manager = (StorageManager) context.getSystemService(Context.STORAGE_SERVICE);
|
StorageManager manager = (StorageManager) context.getSystemService(Context.STORAGE_SERVICE);
|
||||||
List<StorageVolume> volumes = manager.getStorageVolumes();
|
List<StorageVolume> volumes = manager.getStorageVolumes();
|
||||||
|
|
||||||
|
Class<?> volumeClass = StorageVolume.class;
|
||||||
|
Method getPath = volumeClass.getDeclaredMethod("getPath");
|
||||||
|
//Method isRemovable = volumeClass.getDeclaredMethod("isRemovable");
|
||||||
|
getPath.setAccessible(true);
|
||||||
|
//isRemovable.setAccessible(true);
|
||||||
|
|
||||||
for (StorageVolume volume : volumes) {
|
for (StorageVolume volume : volumes) {
|
||||||
String state = volume.getState();
|
String state = volume.getState();
|
||||||
|
|
||||||
if (state.equals(Environment.MEDIA_MOUNTED)) {
|
if (state.equals(Environment.MEDIA_MOUNTED)) {
|
||||||
pathList.add(volume.toString());
|
pathList.add((String) getPath.invoke(volume));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -42,12 +42,28 @@ public class RecordUtil {
|
|||||||
* @param removeFile {@code true} 无论任务是否完成,都会删除记录和文件;
|
* @param removeFile {@code true} 无论任务是否完成,都会删除记录和文件;
|
||||||
* {@code false} 如果任务已经完成,则只删除记录,不删除文件;任务未完成,记录和文件都会删除。
|
* {@code false} 如果任务已经完成,则只删除记录,不删除文件;任务未完成,记录和文件都会删除。
|
||||||
*/
|
*/
|
||||||
public static void delGroupTaskRecord(String groupHash, boolean removeFile) {
|
public static void delGroupTaskRecordByHash(String groupHash, boolean removeFile) {
|
||||||
if (TextUtils.isEmpty(groupHash)) {
|
if (TextUtils.isEmpty(groupHash)) {
|
||||||
ALog.e(TAG, "删除下载任务组记录失败,groupHash为null");
|
ALog.e(TAG, "删除下载任务组记录失败,groupHash为null");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
DownloadGroupEntity groupEntity = DbDataHelper.getDGEntity(groupHash);
|
DownloadGroupEntity groupEntity = DbDataHelper.getDGEntityByHash(groupHash);
|
||||||
|
|
||||||
|
delGroupTaskRecord(groupEntity, removeFile, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据路径删除组合任务记录
|
||||||
|
*
|
||||||
|
* @param removeFile {@code true} 无论任务是否完成,都会删除记录和文件;
|
||||||
|
* {@code false} 如果任务已经完成,则只删除记录,不删除文件;任务未完成,记录和文件都会删除。
|
||||||
|
*/
|
||||||
|
public static void delGroupTaskRecordByPath(String dirPath, boolean removeFile) {
|
||||||
|
if (TextUtils.isEmpty(dirPath)) {
|
||||||
|
ALog.e(TAG, "删除下载任务组记录失败,组合任务路径为空");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
DownloadGroupEntity groupEntity = DbDataHelper.getDGEntityByPath(dirPath);
|
||||||
|
|
||||||
delGroupTaskRecord(groupEntity, removeFile, true);
|
delGroupTaskRecord(groupEntity, removeFile, true);
|
||||||
}
|
}
|
||||||
|
|||||||
33
README.md
33
README.md
@@ -44,16 +44,16 @@ Aria有以下特点:
|
|||||||
|
|
||||||
## 引入库
|
## 引入库
|
||||||
[](https://github.com/AriaLyy/Aria/blob/master/LICENSE)
|
[](https://github.com/AriaLyy/Aria/blob/master/LICENSE)
|
||||||
[](https://github.com/AriaLyy/Aria)
|
[](https://github.com/AriaLyy/Aria)
|
||||||
[](https://github.com/AriaLyy/Aria)
|
[](https://github.com/AriaLyy/Aria)
|
||||||
[](https://github.com/AriaLyy/Aria)
|
[](https://github.com/AriaLyy/Aria)
|
||||||
[](https://github.com/AriaLyy/Aria)
|
[](https://github.com/AriaLyy/Aria)
|
||||||
|
|
||||||
```java
|
```java
|
||||||
implementation 'com.arialyy.aria:core:3.7.8'
|
implementation 'com.arialyy.aria:core:3.7.10'
|
||||||
annotationProcessor 'com.arialyy.aria:compiler:3.7.8'
|
annotationProcessor 'com.arialyy.aria:compiler:3.7.10'
|
||||||
implementation 'com.arialyy.aria:ftpComponent:3.7.8' # 如果需要使用ftp,请增加该组件
|
implementation 'com.arialyy.aria:ftpComponent:3.7.10' # 如果需要使用ftp,请增加该组件
|
||||||
implementation 'com.arialyy.aria:m3u8Component:3.7.8' # 如果需要使用m3u8下载功能,请增加该组件
|
implementation 'com.arialyy.aria:m3u8Component:3.7.10' # 如果需要使用m3u8下载功能,请增加该组件
|
||||||
```
|
```
|
||||||
如果出现android support依赖错误,请将 `compile 'com.arialyy.aria:core:<last-version>'`替换为
|
如果出现android support依赖错误,请将 `compile 'com.arialyy.aria:core:<last-version>'`替换为
|
||||||
```
|
```
|
||||||
@@ -137,15 +137,14 @@ protected void onCreate(Bundle savedInstanceState) {
|
|||||||
|
|
||||||
|
|
||||||
### 版本日志
|
### 版本日志
|
||||||
+ v_3.7.8 (2019/11/28)
|
+ v_3.7.10 (2019/12/3)
|
||||||
- fix bug https://github.com/AriaLyy/Aria/issues/526
|
- fix bug https://github.com/AriaLyy/Aria/issues/543#issuecomment-559733124
|
||||||
- fix bug https://github.com/AriaLyy/Aria/issues/533
|
- fix bug https://github.com/AriaLyy/Aria/issues/542
|
||||||
- fix bug https://github.com/AriaLyy/Aria/issues/535
|
- fix bug https://github.com/AriaLyy/Aria/issues/547
|
||||||
- 修复ftp无法完成下载的问题
|
- 修复下载失败时,中断重试无效的问题
|
||||||
- 修复一个非分块模式下,调用`updateUrl(newUrl)`后无法恢复下载的问题
|
- 增加忽略权限检查的api,`ignoreCheckPermissions()`
|
||||||
- 增加立即恢复任务的接口,正常来说,当执行队列满时,调用恢复任务接口,只能将任务放到缓存队列中。如果希望调用恢复接口,马上进入执行队列,需要调用`resume(true)`这个重载方法。
|
- 增加通用的的忽略文件路径被占用的api,`isIgnoreFilePathOccupy()`
|
||||||
- 增加M3U8加密密钥的下载地址转换器 https://github.com/AriaLyy/Aria/issues/522
|
|
||||||
|
|
||||||
[更多版本记录](https://github.com/AriaLyy/Aria/blob/master/DEV_LOG.md)
|
[更多版本记录](https://github.com/AriaLyy/Aria/blob/master/DEV_LOG.md)
|
||||||
|
|
||||||
## 混淆配置
|
## 混淆配置
|
||||||
|
|||||||
@@ -72,6 +72,8 @@ dependencies {
|
|||||||
implementation project(':M3U8Component')
|
implementation project(':M3U8Component')
|
||||||
implementation project(':FtpComponent')
|
implementation project(':FtpComponent')
|
||||||
implementation project(path: ':AriaAnnotations')
|
implementation project(path: ':AriaAnnotations')
|
||||||
|
|
||||||
|
debugImplementation 'com.amitshekhar.android:debug-db:1.0.6'
|
||||||
}
|
}
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ public class BaseApplication extends Application {
|
|||||||
super.onCreate();
|
super.onCreate();
|
||||||
INSTANCE = this;
|
INSTANCE = this;
|
||||||
AbsFrame.init(this);
|
AbsFrame.init(this);
|
||||||
Aria.init(this);
|
//Aria.init(this);
|
||||||
if (BuildConfig.DEBUG) {
|
if (BuildConfig.DEBUG) {
|
||||||
//StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
|
//StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
|
||||||
// .detectAll()
|
// .detectAll()
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ public class HttpDownloadModule extends BaseViewModule {
|
|||||||
//"http://202.98.201.103:7000/vrs/TPK/ZTC440402001Z.tpk";
|
//"http://202.98.201.103:7000/vrs/TPK/ZTC440402001Z.tpk";
|
||||||
private final String defFilePath =
|
private final String defFilePath =
|
||||||
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getPath()
|
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getPath()
|
||||||
+ "/tttt.apk";
|
+ "/update.zip";
|
||||||
|
|
||||||
private MutableLiveData<DownloadEntity> liveData = new MutableLiveData<>();
|
private MutableLiveData<DownloadEntity> liveData = new MutableLiveData<>();
|
||||||
private DownloadEntity singDownloadInfo;
|
private DownloadEntity singDownloadInfo;
|
||||||
@@ -51,10 +51,15 @@ public class HttpDownloadModule extends BaseViewModule {
|
|||||||
//String url = AppUtil.getConfigValue(context, HTTP_URL_KEY, defUrl);
|
//String url = AppUtil.getConfigValue(context, HTTP_URL_KEY, defUrl);
|
||||||
//String url =
|
//String url =
|
||||||
// "http://sdkdown.muzhiwan.com/openfile/2019/05/21/com.netease.tom.mzw_5ce3ef8754d05.apk";
|
// "http://sdkdown.muzhiwan.com/openfile/2019/05/21/com.netease.tom.mzw_5ce3ef8754d05.apk";
|
||||||
String url = "http://image.totwoo.com/totwoo-TOTWOO-v3.5.6.apk";
|
//String url = "http://image.totwoo.com/totwoo-TOTWOO-v3.5.6.apk";
|
||||||
|
//String url = "http://fdfs.speedata.cn:9989/group1/M00/00/05/rBGFrl3fdAKAVJwfMtSa9R18wLU139.zip";
|
||||||
|
//String url = "http://9.9.9.28:8088/files/update.zip";
|
||||||
|
String url = "https://ss1.baidu.com/-4o3dSag_xI4khGko9WTAnF6hhy/image/h%3D300/sign=a9e671b9a551f3dedcb2bf64a4eff0ec/4610b912c8fcc3cef70d70409845d688d53f20f7.jpg";
|
||||||
//String url = "https://imtt.dd.qq.com/16891/apk/70BFFDB05AB8686F2A4CF3E07588A377.apk?fsname=com.tencent.tmgp.speedmobile_1.16.0.33877_1160033877.apk&csr=1bbd";
|
//String url = "https://imtt.dd.qq.com/16891/apk/70BFFDB05AB8686F2A4CF3E07588A377.apk?fsname=com.tencent.tmgp.speedmobile_1.16.0.33877_1160033877.apk&csr=1bbd";
|
||||||
//String url = "https://ss1.baidu.com/-4o3dSag_xI4khGko9WTAnF6hhy/image/h%3D300/sign=a9e671b9a551f3dedcb2bf64a4eff0ec/4610b912c8fcc3cef70d70409845d688d53f20f7.jpg";
|
//String url = "https://ss1.baidu.com/-4o3dSag_xI4khGko9WTAnF6hhy/image/h%3D300/sign=a9e671b9a551f3dedcb2bf64a4eff0ec/4610b912c8fcc3cef70d70409845d688d53f20f7.jpg";
|
||||||
String filePath = AppUtil.getConfigValue(context, HTTP_PATH_KEY, defFilePath);
|
//String filePath = AppUtil.getConfigValue(context, HTTP_PATH_KEY, defFilePath);
|
||||||
|
String filePath = "/mnt/sdcard/gg.png";
|
||||||
|
//String filePath = "/mnt/sdcard/update.zip";
|
||||||
|
|
||||||
singDownloadInfo = Aria.download(context).getFirstDownloadEntity(url);
|
singDownloadInfo = Aria.download(context).getFirstDownloadEntity(url);
|
||||||
if (singDownloadInfo == null) {
|
if (singDownloadInfo == null) {
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ import com.arialyy.aria.core.processor.IHttpFileLenAdapter;
|
|||||||
import com.arialyy.aria.core.task.DownloadTask;
|
import com.arialyy.aria.core.task.DownloadTask;
|
||||||
import com.arialyy.aria.util.ALog;
|
import com.arialyy.aria.util.ALog;
|
||||||
import com.arialyy.aria.util.CommonUtil;
|
import com.arialyy.aria.util.CommonUtil;
|
||||||
|
import com.arialyy.aria.util.FileUtil;
|
||||||
import com.arialyy.frame.util.show.T;
|
import com.arialyy.frame.util.show.T;
|
||||||
import com.arialyy.simple.R;
|
import com.arialyy.simple.R;
|
||||||
import com.arialyy.simple.base.BaseActivity;
|
import com.arialyy.simple.base.BaseActivity;
|
||||||
@@ -274,11 +275,13 @@ public class SingleTaskActivity extends BaseActivity<ActivitySingleBinding> {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (Aria.download(this).load(mTaskId).isRunning()) {
|
if (Aria.download(this).load(mTaskId).isRunning()) {
|
||||||
Aria.download(this).load(mTaskId).stop();
|
Aria.download(this)
|
||||||
|
.load(mTaskId)
|
||||||
|
.stop();
|
||||||
} else {
|
} else {
|
||||||
mUrl = "http://sdkdown.muzhiwan.com/openfile/2019/07/11/com.netease.syfz.mzw_5d26f8d9cee27.apk";
|
mUrl = "http://sdkdown.muzhiwan.com/openfile/2019/07/11/com.netease.syfz.mzw_5d26f8d9cee27.apk";
|
||||||
Aria.download(this).load(mTaskId)
|
Aria.download(this).load(mTaskId)
|
||||||
.updateUrl(mUrl)
|
//.updateUrl(mUrl)
|
||||||
.resume();
|
.resume();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -297,6 +300,7 @@ public class SingleTaskActivity extends BaseActivity<ActivitySingleBinding> {
|
|||||||
.load(mUrl)
|
.load(mUrl)
|
||||||
.setFilePath(mFilePath, true)
|
.setFilePath(mFilePath, true)
|
||||||
.option(option)
|
.option(option)
|
||||||
|
.ignoreCheckPermissions()
|
||||||
.create();
|
.create();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -96,11 +96,11 @@ public class DownloadGroupActivity extends BaseActivity<ActivityDownloadGroupBin
|
|||||||
.loadGroup(mUrls)
|
.loadGroup(mUrls)
|
||||||
.setDirPath(
|
.setDirPath(
|
||||||
Environment.getExternalStorageDirectory().getPath() + "/Download/group_imgs")
|
Environment.getExternalStorageDirectory().getPath() + "/Download/group_imgs")
|
||||||
.setGroupAlias("图片测试")
|
|
||||||
//.setSubFileName(getModule(GroupModule.class).getSubName2())
|
//.setSubFileName(getModule(GroupModule.class).getSubName2())
|
||||||
//.setSubFileName(getModule(GroupModule.class).getSubName())
|
//.setSubFileName(getModule(GroupModule.class).getSubName())
|
||||||
.unknownSize()
|
.unknownSize()
|
||||||
.option(getHttpOption())
|
.option(getHttpOption())
|
||||||
|
.ignoreFilePathOccupy()
|
||||||
//.setFileSize(114981416)
|
//.setFileSize(114981416)
|
||||||
//.updateUrls(temp)
|
//.updateUrls(temp)
|
||||||
.create();
|
.create();
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ public class M3U8LiveDLoadActivity extends BaseActivity<ActivityM3u8LiveBinding>
|
|||||||
private String mFilePath;
|
private String mFilePath;
|
||||||
private M3U8LiveModule mModule;
|
private M3U8LiveModule mModule;
|
||||||
private DownloadEntity mEntity;
|
private DownloadEntity mEntity;
|
||||||
|
private long mTaskId;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void init(Bundle savedInstanceState) {
|
protected void init(Bundle savedInstanceState) {
|
||||||
@@ -63,6 +64,7 @@ public class M3U8LiveDLoadActivity extends BaseActivity<ActivityM3u8LiveBinding>
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mEntity = entity;
|
mEntity = entity;
|
||||||
|
mTaskId = mEntity.getId();
|
||||||
getBinding().setStateStr(getString(R.string.start));
|
getBinding().setStateStr(getString(R.string.start));
|
||||||
getBinding().setUrl(entity.getUrl());
|
getBinding().setUrl(entity.getUrl());
|
||||||
getBinding().setFilePath(entity.getFilePath());
|
getBinding().setFilePath(entity.getFilePath());
|
||||||
@@ -213,22 +215,23 @@ public class M3U8LiveDLoadActivity extends BaseActivity<ActivityM3u8LiveBinding>
|
|||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
switch (view.getId()) {
|
switch (view.getId()) {
|
||||||
case R.id.start:
|
case R.id.start:
|
||||||
if (Aria.download(this).load(mEntity.getId()).isRunning()) {
|
if (Aria.download(this).load(mTaskId).isRunning()) {
|
||||||
Aria.download(this).load(mEntity.getId()).stop();
|
Aria.download(this).load(mEntity.getId()).stop();
|
||||||
} else {
|
} else {
|
||||||
startD();
|
startD();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case R.id.cancel:
|
case R.id.cancel:
|
||||||
if (AppUtil.chekEntityValid(mEntity)) {
|
if (mTaskId != -1){
|
||||||
Aria.download(this).load(mEntity.getId()).cancel(true);
|
Aria.download(this).load(mEntity.getId()).cancel(true);
|
||||||
|
mTaskId = -1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void startD() {
|
private void startD() {
|
||||||
Aria.download(M3U8LiveDLoadActivity.this)
|
mTaskId = Aria.download(M3U8LiveDLoadActivity.this)
|
||||||
.load(mUrl)
|
.load(mUrl)
|
||||||
.setFilePath(mFilePath, true)
|
.setFilePath(mFilePath, true)
|
||||||
.m3u8LiveOption(getLiveoption())
|
.m3u8LiveOption(getLiveoption())
|
||||||
|
|||||||
@@ -35,9 +35,9 @@ public class UploadModule extends BaseViewModule {
|
|||||||
* 获取Ftp上传信息
|
* 获取Ftp上传信息
|
||||||
*/
|
*/
|
||||||
LiveData<UploadEntity> getFtpInfo(Context context) {
|
LiveData<UploadEntity> getFtpInfo(Context context) {
|
||||||
String url = AppUtil.getConfigValue(context, FTP_URL_KEY, "ftp://9.9.9.50:2121/aa/你好");
|
String url = AppUtil.getConfigValue(context, FTP_URL_KEY, "ftp://9.9.9.72:2121/aa/你好");
|
||||||
String filePath = AppUtil.getConfigValue(context, FTP_PATH_KEY,
|
String filePath = AppUtil.getConfigValue(context, FTP_PATH_KEY,
|
||||||
Environment.getExternalStorageDirectory().getPath() + "/Download/Folx P58.zip");
|
Environment.getExternalStorageDirectory().getPath() + "/Download/AndroidAria.db");
|
||||||
|
|
||||||
UploadEntity entity = Aria.upload(context).getFirstUploadEntity(filePath);
|
UploadEntity entity = Aria.upload(context).getFirstUploadEntity(filePath);
|
||||||
if (entity != null) {
|
if (entity != null) {
|
||||||
|
|||||||
@@ -44,8 +44,8 @@ task clean(type: Delete) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ext {
|
ext {
|
||||||
versionCode = 378
|
versionCode = 380
|
||||||
versionName = '3.7.8'
|
versionName = '3.7.10'
|
||||||
userOrg = 'arialyy'
|
userOrg = 'arialyy'
|
||||||
groupId = 'com.arialyy.aria'
|
groupId = 'com.arialyy.aria'
|
||||||
publishVersion = versionName
|
publishVersion = versionName
|
||||||
|
|||||||
15
py/.vscode/launch.json
vendored
15
py/.vscode/launch.json
vendored
@@ -1,15 +0,0 @@
|
|||||||
{
|
|
||||||
// 使用 IntelliSense 了解相关属性。
|
|
||||||
// 悬停以查看现有属性的描述。
|
|
||||||
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
|
|
||||||
"version": "0.2.0",
|
|
||||||
"configurations": [
|
|
||||||
{
|
|
||||||
"name": "Python: 当前文件",
|
|
||||||
"type": "python",
|
|
||||||
"request": "launch",
|
|
||||||
"program": "${file}",
|
|
||||||
"console": "integratedTerminal"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
6
py/.vscode/settings.json
vendored
6
py/.vscode/settings.json
vendored
@@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"python.linting.pylintEnabled": false,
|
|
||||||
"python.linting.pep8Enabled": true,
|
|
||||||
"python.linting.enabled": true,
|
|
||||||
"python.pythonPath": "/usr/local/bin/python3.7"
|
|
||||||
}
|
|
||||||
BIN
test/347/AndroidAria.db
Normal file
BIN
test/347/AndroidAria.db
Normal file
Binary file not shown.
Reference in New Issue
Block a user