- 修复设置了cancel(false),文件还是被删除的问题 https://github.com/AriaLyy/Aria/issues/686
- 修复错误url的下载任务,无法删除的问题 https://github.com/AriaLyy/Aria/issues/684
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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()) {
|
||||
|
||||
@@ -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()));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user