增加立即恢复任务的接口,正常来说,当执行队列满时,调用恢复任务接口,只能将任务放到缓存队列中。如果希望调用恢复接口,马上进入执行队列,需要调用resume(true)这个重载方法。

修复一个非分块模式下,无法恢复下载的问题
增加M3U8加密密钥的下载地址转换器 https://github.com/AriaLyy/Aria/issues/522
This commit is contained in:
laoyuyu
2019-11-27 21:38:16 +08:00
parent c9c00c38c6
commit c4cc804c67
19 changed files with 151 additions and 38 deletions

View File

@@ -63,7 +63,8 @@ public class RecordHelper {
fileExists = true;
}
// 处理文件被删除的情况
if (fileExists) {
if (!fileExists) {
ALog.w(TAG, String.format("文件【%s】被删除重新分配线程区间", mTaskRecord.filePath));
for (int i = 0; i < mTaskRecord.threadNum; i++) {
long startL = i * blockSize, endL = (i + 1) * blockSize;
ThreadRecord tr = mTaskRecord.threadRecords.get(i);

View File

@@ -0,0 +1,32 @@
/*
* 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.processor;
import com.arialyy.aria.core.inf.IEventHandler;
/**
* M3U8 密钥下载地址处理器,可用于解密被加密的密钥的下载地址
*/
public interface IKeyUrlConverter extends IEventHandler {
/**
* 将被加密的密钥下载地址转换为可使用的http下载地址
*
* @param keyUrl 加密的url地址
* @return 可正常访问的http地址
*/
String convert(String keyUrl);
}

View File

@@ -71,15 +71,15 @@ public class CommonUtil {
ALog.e(TAG, "sql语句表达式不能为null");
return false;
}
if (expression.length == 1) {
ALog.e(TAG, String.format("表达式需要写入参数,参数信息:%s", Arrays.toString(expression)));
return false;
}
//if (expression.length == 1) {
// ALog.e(TAG, String.format("表达式需要写入参数,参数信息:%s", Arrays.toString(expression)));
// return false;
//}
String where = expression[0];
if (!where.contains("?")) {
ALog.e(TAG, String.format("请在where语句的'='后编写?,参数信息:%s", Arrays.toString(expression)));
return false;
}
//if (!where.contains("?")) {
// ALog.e(TAG, String.format("请在where语句的'='后编写?,参数信息:%s", Arrays.toString(expression)));
// return false;
//}
Pattern pattern = Pattern.compile("\\?");
Matcher matcher = pattern.matcher(where);
int count = 0;