From 29f9bdcdbd002362e04cd3431afc14bd173e25d0 Mon Sep 17 00:00:00 2001 From: laoyuyu <511455842@qq.com> Date: Sun, 7 Jun 2020 10:35:20 +0800 Subject: [PATCH] =?UTF-8?q?-=20=E4=BF=AE=E5=A4=8D=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E4=BA=86cancel(false)=EF=BC=8C=E6=96=87=E4=BB=B6=E8=BF=98?= =?UTF-8?q?=E6=98=AF=E8=A2=AB=E5=88=A0=E9=99=A4=E7=9A=84=E9=97=AE=E9=A2=98?= =?UTF-8?q?=20https://github.com/AriaLyy/Aria/issues/686=20-=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E9=94=99=E8=AF=AFurl=E7=9A=84=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=EF=BC=8C=E6=97=A0=E6=B3=95=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98=20https://github.com/AriaLyy/Aria/i?= =?UTF-8?q?ssues/684?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DEV_LOG.md | 3 ++ .../com/arialyy/aria/util/DeleteDRecord.java | 18 ++++++---- .../arialyy/aria/util/DeleteM3u8Record.java | 6 ++++ .../com/arialyy/aria/util/DeleteURecord.java | 5 +++ README.md | 34 +++++++------------ app/src/main/assets/aria_config.xml | 6 ++-- .../core/download/HttpDownloadModule.java | 4 +-- .../core/download/SingleTaskActivity.java | 2 +- build.gradle | 4 +-- 9 files changed, 47 insertions(+), 35 deletions(-) diff --git a/DEV_LOG.md b/DEV_LOG.md index 8875ef3c..642879fb 100644 --- a/DEV_LOG.md +++ b/DEV_LOG.md @@ -1,4 +1,7 @@ ## 开发日志 + + v_3.8.8 (2020/6/7) + - 修复设置了cancel(false),文件还是被删除的问题 https://github.com/AriaLyy/Aria/issues/686 + - 修复错误url的下载任务,无法删除的问题 https://github.com/AriaLyy/Aria/issues/684 + v_3.8.7 (2020/5/25) - 修复组合任务单个子任务失败后,重新恢复组合任务,组合任务状态变为完成的问题 - 修复40x错误,会继续重试并且无法重试成功的问题 https://github.com/AriaLyy/Aria/issues/619 diff --git a/PublicComponent/src/main/java/com/arialyy/aria/util/DeleteDRecord.java b/PublicComponent/src/main/java/com/arialyy/aria/util/DeleteDRecord.java index 478ab2b0..c2bbd4ea 100644 --- a/PublicComponent/src/main/java/com/arialyy/aria/util/DeleteDRecord.java +++ b/PublicComponent/src/main/java/com/arialyy/aria/util/DeleteDRecord.java @@ -32,14 +32,14 @@ public class DeleteDRecord implements IDeleteRecord { private String TAG = CommonUtil.getClassName(this); private static volatile DeleteDRecord INSTANCE = null; - private DeleteDRecord(){ + private DeleteDRecord() { } public static DeleteDRecord getInstance() { - if (INSTANCE == null){ - synchronized (DeleteDRecord.class){ - if (INSTANCE == null){ + if (INSTANCE == null) { + synchronized (DeleteDRecord.class) { + if (INSTANCE == null) { INSTANCE = new DeleteDRecord(); } } @@ -84,7 +84,8 @@ public class DeleteDRecord implements IDeleteRecord { File targetFile = new File(filePath); // 兼容以前版本 - if (entity.getTaskType() == ITaskWrapper.M3U8_VOD || entity.getTaskType() == ITaskWrapper.M3U8_LIVE){ + if (entity.getTaskType() == ITaskWrapper.M3U8_VOD + || entity.getTaskType() == ITaskWrapper.M3U8_LIVE) { DeleteM3u8Record.getInstance().deleteRecord(entity, needRemoveFile, needRemoveEntity); return; } @@ -92,13 +93,18 @@ public class DeleteDRecord implements IDeleteRecord { TaskRecord record = DbDataHelper.getTaskRecord(entity.getFilePath(), entity.getTaskType()); if (record == null) { ALog.e(TAG, "删除下载记录失败,记录为空,filePath:" + entity.getFilePath()); + FileUtil.deleteFile(targetFile); + DbEntity.deleteData(DownloadEntity.class, "downloadPath=?", filePath); return; } + // 删除下载的线程记录和任务记录 DbEntity.deleteData(ThreadRecord.class, "taskKey=? AND threadType=?", filePath, String.valueOf(entity.getTaskType())); + DbEntity.deleteData(TaskRecord.class, "filePath=? AND taskType=?", filePath, + String.valueOf(entity.getTaskType())); - if (needRemoveEntity || !entity.isComplete()) { + if (needRemoveFile || !entity.isComplete()) { FileUtil.deleteFile(targetFile); if (record.isBlock) { removeBlockFile(record); diff --git a/PublicComponent/src/main/java/com/arialyy/aria/util/DeleteM3u8Record.java b/PublicComponent/src/main/java/com/arialyy/aria/util/DeleteM3u8Record.java index e9bbe4c7..48a897c0 100644 --- a/PublicComponent/src/main/java/com/arialyy/aria/util/DeleteM3u8Record.java +++ b/PublicComponent/src/main/java/com/arialyy/aria/util/DeleteM3u8Record.java @@ -17,6 +17,7 @@ package com.arialyy.aria.util; import android.text.TextUtils; import com.arialyy.aria.core.TaskRecord; +import com.arialyy.aria.core.ThreadRecord; import com.arialyy.aria.core.common.AbsEntity; import com.arialyy.aria.core.download.DownloadEntity; import com.arialyy.aria.core.download.M3U8Entity; @@ -82,6 +83,11 @@ public class DeleteM3u8Record implements IDeleteRecord { } final String filePath = entity.getFilePath(); + // 删除下载的线程记录和任务记录 + DbEntity.deleteData(ThreadRecord.class, "taskKey=? AND threadType=?", filePath, + String.valueOf(entity.getTaskType())); + DbEntity.deleteData(TaskRecord.class, "filePath=? AND taskType=?", filePath, + String.valueOf(entity.getTaskType())); DbEntity.deleteData(M3U8Entity.class, "filePath=?", filePath); if (needRemoveFile || !entity.isComplete()) { diff --git a/PublicComponent/src/main/java/com/arialyy/aria/util/DeleteURecord.java b/PublicComponent/src/main/java/com/arialyy/aria/util/DeleteURecord.java index d414b19e..2afe8fcb 100644 --- a/PublicComponent/src/main/java/com/arialyy/aria/util/DeleteURecord.java +++ b/PublicComponent/src/main/java/com/arialyy/aria/util/DeleteURecord.java @@ -17,6 +17,7 @@ package com.arialyy.aria.util; import android.text.TextUtils; import com.arialyy.aria.core.TaskRecord; +import com.arialyy.aria.core.ThreadRecord; import com.arialyy.aria.core.common.AbsEntity; import com.arialyy.aria.core.upload.UploadEntity; import com.arialyy.aria.orm.DbEntity; @@ -76,6 +77,10 @@ public class DeleteURecord implements IDeleteRecord { } UploadEntity entity = (UploadEntity) absEntity; + + // 删除下载的线程记录和任务记录 + DbEntity.deleteData(ThreadRecord.class, "taskKey=? AND threadType=?", entity.getFilePath(), + String.valueOf(entity.getTaskType())); DbEntity.deleteData(TaskRecord.class, "filePath=? AND taskType=?", entity.getFilePath(), String.valueOf(entity.getTaskType())); diff --git a/README.md b/README.md index 9f999ce7..e6aafa66 100644 --- a/README.md +++ b/README.md @@ -45,19 +45,19 @@ Aria有以下特点: ## 引入库 [![license](http://img.shields.io/badge/license-Apache2.0-brightgreen.svg?style=flat)](https://github.com/AriaLyy/Aria/blob/master/LICENSE) -[![Core](https://img.shields.io/badge/Core-3.8.7-blue)](https://github.com/AriaLyy/Aria) -[![Compiler](https://img.shields.io/badge/Compiler-3.8.7-blue)](https://github.com/AriaLyy/Aria) -[![FtpComponent](https://img.shields.io/badge/FtpComponent-3.8.7-orange)](https://github.com/AriaLyy/Aria) -[![FtpComponent](https://img.shields.io/badge/SFtpComponent-3.8.7-orange)](https://github.com/AriaLyy/Aria) -[![M3U8Component](https://img.shields.io/badge/M3U8Component-3.8.7-orange)](https://github.com/AriaLyy/Aria) +[![Core](https://img.shields.io/badge/Core-3.8.8-blue)](https://github.com/AriaLyy/Aria) +[![Compiler](https://img.shields.io/badge/Compiler-3.8.8-blue)](https://github.com/AriaLyy/Aria) +[![FtpComponent](https://img.shields.io/badge/FtpComponent-3.8.8-orange)](https://github.com/AriaLyy/Aria) +[![FtpComponent](https://img.shields.io/badge/SFtpComponent-3.8.8-orange)](https://github.com/AriaLyy/Aria) +[![M3U8Component](https://img.shields.io/badge/M3U8Component-3.8.8-orange)](https://github.com/AriaLyy/Aria) ```java -implementation 'com.arialyy.aria:core:3.8.7' -annotationProcessor 'com.arialyy.aria:compiler:3.8.7' -implementation 'com.arialyy.aria:ftpComponent:3.8.7' # 如果需要使用ftp,请增加该组件 -implementation 'com.arialyy.aria:sftpComponent:3.8.7' # 如果需要使用ftp,请增加该组件 -implementation 'com.arialyy.aria:m3u8Component:3.8.7' # 如果需要使用m3u8下载功能,请增加该组件 +implementation 'com.arialyy.aria:core:3.8.8' +annotationProcessor 'com.arialyy.aria:compiler:3.8.8' +implementation 'com.arialyy.aria:ftpComponent:3.8.8' # 如果需要使用ftp,请增加该组件 +implementation 'com.arialyy.aria:sftpComponent:3.8.8' # 如果需要使用ftp,请增加该组件 +implementation 'com.arialyy.aria:m3u8Component:3.8.8' # 如果需要使用m3u8下载功能,请增加该组件 ``` 如果你使用的是kotlin,请使用kotlin官方提供的方法配置apt,[kotlin kapt官方配置传送门](https://www.kotlincn.net/docs/reference/kapt.html) @@ -138,17 +138,9 @@ protected void onCreate(Bundle savedInstanceState) { ### 版本日志 -+ v_3.8.7 (2020/5/25) - - 修复组合任务单个子任务失败后,重新恢复组合任务,组合任务状态变为完成的问题 - - 修复40x错误,会继续重试并且无法重试成功的问题 https://github.com/AriaLyy/Aria/issues/619 - - 修复wait模式下,resume(true)无效问题 - - 修复now模式下的一些问题 https://github.com/AriaLyy/Aria/issues/620 - - 修复组任务,其中一个子任务在获取文件长度失败后,重新恢复组合任务,组合任务状态变为完成的问题 https://github.com/AriaLyy/Aria/issues/628 - - 修复组任务中,其中一个子任务是30x地址,导致调度器无法出现该子任务状态的问题 - - 增加组任务groupHash冲突检查 https://github.com/AriaLyy/Aria/issues/635 - - 修复task.cancel(false)还是把本地文件删除的问题 https://github.com/AriaLyy/Aria/issues/646 - - fix bug https://github.com/AriaLyy/Aria/issues/670 - - fix bug https://github.com/AriaLyy/Aria/issues/664 + + v_3.8.8 (2020/6/7) + - 修复设置了cancel(false),文件还是被删除的问题 https://github.com/AriaLyy/Aria/issues/686 + - 修复错误url的下载任务,无法删除的问题 https://github.com/AriaLyy/Aria/issues/684 [更多版本记录](https://github.com/AriaLyy/Aria/blob/master/DEV_LOG.md) diff --git a/app/src/main/assets/aria_config.xml b/app/src/main/assets/aria_config.xml index 54ef2e54..06b96f8a 100644 --- a/app/src/main/assets/aria_config.xml +++ b/app/src/main/assets/aria_config.xml @@ -22,7 +22,7 @@ - + - + @@ -68,7 +68,7 @@ - + diff --git a/app/src/main/java/com/arialyy/simple/core/download/HttpDownloadModule.java b/app/src/main/java/com/arialyy/simple/core/download/HttpDownloadModule.java index c77ce7c8..153f280d 100644 --- a/app/src/main/java/com/arialyy/simple/core/download/HttpDownloadModule.java +++ b/app/src/main/java/com/arialyy/simple/core/download/HttpDownloadModule.java @@ -55,10 +55,10 @@ public class HttpDownloadModule extends BaseViewModule { //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 filePath = AppUtil.getConfigValue(context, HTTP_PATH_KEY, defFilePath); - //String url = "https://y.qq.com/download/import/QQMusic-import-1.2.1.zip"; + String url = "https://y.qq.com/download/import/QQMusic-import-1.2.1.zip1"; //String url = "https://video-hkt1-1.xx.fbcdn.net/v/t42.9040-2/89465702_658301101378505_5469280744218034176_n.mp4?_nc_cat=107&_nc_sid=985c63&efg=eyJ2ZW5jb2RlX3RhZyI6ImxlZ2FjeV9zZCJ9&_nc_oc=AQmzYwQG9vccyqr7S44-cfHc4wJ9010O1nvspG2DPV4cTct1pLrjKl1e1UmOJV99bJw&_nc_ht=video-hkt1-1.xx&oh=49bd04435aaa8b4459b8d5cb7d1e7c79&oe=5E672E37"; //String url = "http://donuts.aigauss.com/doc_fPhW2DBGj3_1578932414.png"; String filePath = "/mnt/sdcard/update.mp4"; diff --git a/app/src/main/java/com/arialyy/simple/core/download/SingleTaskActivity.java b/app/src/main/java/com/arialyy/simple/core/download/SingleTaskActivity.java index efd7ddd8..88885606 100644 --- a/app/src/main/java/com/arialyy/simple/core/download/SingleTaskActivity.java +++ b/app/src/main/java/com/arialyy/simple/core/download/SingleTaskActivity.java @@ -118,7 +118,7 @@ public class SingleTaskActivity extends BaseActivity { } @Override public void cancel(View v, AbsEntity entity) { - Aria.download(this).load(mTaskId).cancel(true); + Aria.download(this).load(mTaskId).cancel(false); } }); } diff --git a/build.gradle b/build.gradle index 53e056f3..3c00ba6d 100644 --- a/build.gradle +++ b/build.gradle @@ -44,8 +44,8 @@ task clean(type: Delete) { } ext { - versionCode = 387 - versionName = '3.8.7' + versionCode = 388 + versionName = '3.8.8' userOrg = 'arialyy' groupId = 'com.arialyy.aria' publishVersion = versionName