diff --git a/DEV_LOG.md b/DEV_LOG.md index 33b7ae68..1f6a928e 100644 --- a/DEV_LOG.md +++ b/DEV_LOG.md @@ -9,6 +9,7 @@ - 修复0kb的文件不可下载的问题 https://github.com/AriaLyy/Aria/issues/711 - 修复加密的m3u8下载,并且使用索引模式时,key的uri没有使用双引号的问题 https://github.com/AriaLyy/Aria/issues/731 - 修复删除m3u8索引文件后,下载完成回调无法触发的问题 + - 修复删除加密的m3u8文件时,key没有被删除的问题 https://github.com/AriaLyy/Aria/issues/735#issuecomment-673958845 - 增加m3u8密钥下载地址转换器增加ts列表的url地址 https://github.com/AriaLyy/Aria/issues/718 - 增加现在http文件下载将使用HEAD请求获取文件大小,配置文件增加 。慎用,并不是所有服务器都支持head请求 - 增加允许不使用apt直接通过实现监听器来回调下载进度更新,该功能由[chenfei0928](https://github.com/chenfei0928)提交,感谢他的pr。如果注解不生效,只需要实现`DownloadListener`接口便可 diff --git a/HttpComponent/src/main/java/com/arialyy/aria/http/upload/HttpUThreadTaskAdapter.java b/HttpComponent/src/main/java/com/arialyy/aria/http/upload/HttpUThreadTaskAdapter.java index 5c69904d..bb0605d9 100644 --- a/HttpComponent/src/main/java/com/arialyy/aria/http/upload/HttpUThreadTaskAdapter.java +++ b/HttpComponent/src/main/java/com/arialyy/aria/http/upload/HttpUThreadTaskAdapter.java @@ -219,6 +219,7 @@ final class HttpUThreadTaskAdapter extends BaseHttpThreadTaskAdapter { String msg = "response msg: " + mHttpConn.getResponseMessage() + ",code: " + status; ALog.e(TAG, msg); fail(new AriaHTTPException(msg), false); + response.append(status); } writer.flush(); writer.close(); diff --git a/PublicComponent/src/main/java/com/arialyy/aria/core/common/AbsEntity.java b/PublicComponent/src/main/java/com/arialyy/aria/core/common/AbsEntity.java index 4df5008b..653a8562 100644 --- a/PublicComponent/src/main/java/com/arialyy/aria/core/common/AbsEntity.java +++ b/PublicComponent/src/main/java/com/arialyy/aria/core/common/AbsEntity.java @@ -86,6 +86,17 @@ public abstract class AbsEntity extends DbEntity implements IEntity, Parcelable, */ private long stopTime = 0; + @Ignore + private int netCode = 200; + + public int getNetCode() { + return netCode; + } + + public void setNetCode(int netCode) { + this.netCode = netCode; + } + /** * 获取剩余时间,单位:s * 如果是m3u8任务,无法获取剩余时间;m2u8任务如果需要获取剩余时间,请设置文件长度{@link #setFileSize(long)} 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 3b697b1f..919eeb70 100644 --- a/PublicComponent/src/main/java/com/arialyy/aria/util/DeleteM3u8Record.java +++ b/PublicComponent/src/main/java/com/arialyy/aria/util/DeleteM3u8Record.java @@ -80,26 +80,26 @@ public class DeleteM3u8Record implements IDeleteRecord { TaskRecord record = DbDataHelper.getTaskRecord(filePath, entity.getTaskType()); if (record == null) { ALog.e(TAG, "删除下载记录失败,记录为空,将删除实体记录,filePath:" + entity.getFilePath()); - deleteEntity(needRemoveEntity, filePath); + deleteEntity(entity.getTaskType(), needRemoveEntity, 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())); - DbEntity.deleteData(M3U8Entity.class, "filePath=?", filePath); - if (needRemoveFile || !entity.isComplete()) { removeTsCache(new File(filePath), record.bandWidth); FileUtil.deleteFile(filePath); } - deleteEntity(needRemoveEntity, filePath); + deleteEntity(entity.getTaskType(), needRemoveEntity, filePath); } - private void deleteEntity(boolean needRemoveEntity, String filePath){ + private void deleteEntity(int taskType, boolean needRemoveEntity, String filePath){ + // 删除下载的线程记录和任务记录 + DbEntity.deleteData(ThreadRecord.class, "taskKey=? AND threadType=?", filePath, + String.valueOf(taskType)); + DbEntity.deleteData(TaskRecord.class, "filePath=? AND taskType=?", filePath, + String.valueOf(taskType)); + DbEntity.deleteData(M3U8Entity.class, "filePath=?", filePath); + if (needRemoveEntity) { DbEntity.deleteData(DownloadEntity.class, "downloadPath=?", filePath); } @@ -110,6 +110,14 @@ public class DeleteM3u8Record implements IDeleteRecord { */ private static void removeTsCache(File targetFile, long bandWidth) { + // 删除key + M3U8Entity entity = DbEntity.findFirst(M3U8Entity.class, "filePath=?", targetFile.getPath()); + if (entity != null && !TextUtils.isEmpty(entity.keyPath)){ + File keyFile = new File(entity.keyPath); + FileUtil.deleteFile(keyFile); + } + + // 删除ts String cacheDir = null; if (!targetFile.isDirectory()) { cacheDir = @@ -138,5 +146,6 @@ public class DeleteM3u8Record implements IDeleteRecord { if (indexFile.exists()) { indexFile.delete(); } + } } diff --git a/app/src/main/java/com/arialyy/simple/core/download/m3u8/M3U8VodDLoadActivity.java b/app/src/main/java/com/arialyy/simple/core/download/m3u8/M3U8VodDLoadActivity.java index 25ac01d2..af3b15f2 100644 --- a/app/src/main/java/com/arialyy/simple/core/download/m3u8/M3U8VodDLoadActivity.java +++ b/app/src/main/java/com/arialyy/simple/core/download/m3u8/M3U8VodDLoadActivity.java @@ -120,7 +120,7 @@ public class M3U8VodDLoadActivity extends BaseActivity { } @Override public void cancel(View v, AbsEntity entity) { - Aria.download(this).load(mTaskId).cancel(); + Aria.download(this).load(mTaskId).cancel(true); mTaskId = -1; } }); diff --git a/build.gradle b/build.gradle index 758e7adf..b2584018 100644 --- a/build.gradle +++ b/build.gradle @@ -45,7 +45,7 @@ task clean(type: Delete) { ext { versionCode = 390 - versionName = '3.8.11-beta' + versionName = '3.8.11-beta-1' userOrg = 'arialyy' groupId = 'com.arialyy.aria' publishVersion = versionName