fix bug https://github.com/AriaLyy/Aria/issues/690 m3u8任务增加`setUseDefConvert()`方法,用于处理默认的m3u8任务
This commit is contained in:
@@ -20,6 +20,7 @@ import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import com.arialyy.aria.core.AriaConfig;
|
||||
import com.arialyy.aria.core.TaskRecord;
|
||||
import com.arialyy.aria.core.config.Configuration;
|
||||
import com.arialyy.aria.core.inf.IThreadStateManager;
|
||||
import com.arialyy.aria.core.loader.IRecordHandler;
|
||||
@@ -169,10 +170,11 @@ final class SimpleSchedulers implements Handler.Callback {
|
||||
*/
|
||||
private synchronized void handleComplete(AbsSubDLoadUtil loader) {
|
||||
ALog.d(TAG, String.format("子任务【%s】完成", loader.getEntity().getFileName()));
|
||||
if (loader.getRecord().isBlock) {
|
||||
TaskRecord record = loader.getRecord();
|
||||
if (record != null && record.isBlock) {
|
||||
File partFile =
|
||||
new File(String.format(IRecordHandler.SUB_PATH, loader.getRecord().filePath, 0));
|
||||
partFile.renameTo(new File(loader.getRecord().filePath));
|
||||
new File(String.format(IRecordHandler.SUB_PATH, record.filePath, 0));
|
||||
partFile.renameTo(new File(record.filePath));
|
||||
}
|
||||
ThreadTaskManager.getInstance().removeTaskThread(loader.getKey());
|
||||
mGState.listener.onSubComplete(loader.getEntity());
|
||||
|
||||
@@ -106,6 +106,11 @@ public final class SubLoader implements ILoader, ILoaderVisitor {
|
||||
}
|
||||
|
||||
record = recordHandler.getRecord(wrapper.getEntity().getFileSize());
|
||||
if (record == null){
|
||||
ALog.d(TAG, "子任务记录为空");
|
||||
sendFailState(false);
|
||||
return;
|
||||
}
|
||||
if (record.threadRecords != null
|
||||
&& !TextUtils.isEmpty(record.filePath)
|
||||
&& new File(record.filePath).exists()
|
||||
|
||||
@@ -27,8 +27,9 @@ public interface IBandWidthUrlConverter extends IEventHandler {
|
||||
* 转换码率地址为可用的http地址,对于某些服务器,返回的切片信息有可能是相对地址,也可能是处理过的,
|
||||
* 对于这种情况,你需要使用url转换器将地址转换为可正常访问的http地址
|
||||
*
|
||||
* @param m3u8Url m3u8url地址
|
||||
* @param bandWidthUrl 原始码率地址
|
||||
* @return 可正常访问的http地址
|
||||
*/
|
||||
String convert(String bandWidthUrl);
|
||||
String convert(String m3u8Url, String bandWidthUrl);
|
||||
}
|
||||
|
||||
@@ -30,5 +30,5 @@ public interface ILiveTsUrlConverter extends IEventHandler {
|
||||
* @param tsUrl ts文件下载地址
|
||||
* @return 转换后的http地址
|
||||
*/
|
||||
public String convert(String m3u8Url, String tsUrl);
|
||||
String convert(String m3u8Url, String tsUrl);
|
||||
}
|
||||
|
||||
@@ -171,8 +171,11 @@ final class SqlHelper extends SQLiteOpenHelper {
|
||||
|
||||
private void createDbCacheDir() {
|
||||
String cacheDir = mContext.getCacheDir().getPath() + "/AriaDbCacheDir";
|
||||
boolean rs = new File(cacheDir).mkdir();
|
||||
ALog.d(TAG, rs + "");
|
||||
File cacheFile = new File(cacheDir);
|
||||
if (!cacheFile.exists()){
|
||||
boolean rs = cacheFile.mkdirs();
|
||||
ALog.d(TAG, rs + "");
|
||||
}
|
||||
super.getReadableDatabase()
|
||||
.execSQL("PRAGMA temp_store_directory = '" + cacheDir + "'");
|
||||
mainTmpDirSet = true;
|
||||
|
||||
Reference in New Issue
Block a user