修复一个数据升级导致的taskType列不存在问题,https://github.com/AriaLyy/Aria/issues/586
pull/617/head
laoyuyu 5 years ago
parent 7c4012c021
commit 90e55a0cee
  1. 17
      Aria/src/main/java/com/arialyy/aria/core/download/m3u8/M3U8Option.java
  2. 3
      Aria/src/main/java/com/arialyy/aria/core/queue/AbsTaskQueue.java
  3. 5
      Aria/src/main/java/com/arialyy/aria/core/queue/DGroupTaskQueue.java
  4. 3
      DEV_LOG.md
  5. 3
      FtpComponent/src/main/java/com/arialyy/aria/ftp/download/FtpDGLoader.java
  6. 3
      HttpComponent/src/main/java/com/arialyy/aria/http/download/HttpDGInfoTask.java
  7. 2
      HttpComponent/src/main/java/com/arialyy/aria/http/download/HttpDGLoader.java
  8. 2
      HttpComponent/src/main/java/com/arialyy/aria/http/download/HttpDThreadTaskAdapter.java
  9. 11
      M3U8Component/src/main/java/com/arialyy/aria/m3u8/M3U8InfoTask.java
  10. 9
      M3U8Component/src/main/java/com/arialyy/aria/m3u8/M3U8TaskOption.java
  11. 84
      M3U8Component/src/main/java/com/arialyy/aria/m3u8/M3U8ThreadTaskAdapter.java
  12. 3
      PublicComponent/src/main/java/com/arialyy/aria/core/common/AbsNormalEntity.java
  13. 36
      PublicComponent/src/main/java/com/arialyy/aria/core/download/DownloadEntity.java
  14. 8
      PublicComponent/src/main/java/com/arialyy/aria/core/group/AbsGroupLoader.java
  15. 4
      PublicComponent/src/main/java/com/arialyy/aria/core/group/AbsGroupLoaderUtil.java
  16. 1
      PublicComponent/src/main/java/com/arialyy/aria/core/inf/IThreadStateManager.java
  17. 5
      PublicComponent/src/main/java/com/arialyy/aria/core/loader/AbsNormalLoaderUtil.java
  18. 14
      PublicComponent/src/main/java/com/arialyy/aria/core/upload/UploadEntity.java
  19. 6
      PublicComponent/src/main/java/com/arialyy/aria/orm/SqlHelper.java
  20. 30
      README.md
  21. 6
      app/src/main/java/com/arialyy/simple/core/download/m3u8/M3U8VodDLoadActivity.java
  22. 4
      app/src/main/java/com/arialyy/simple/core/download/m3u8/M3U8VodModule.java
  23. 1
      app/src/main/java/com/arialyy/simple/core/download/mutil/DownloadAdapter.java
  24. 7
      app/src/main/java/com/arialyy/simple/core/download/mutil/MultiTaskActivity.java
  25. 2
      build.gradle

@ -15,10 +15,12 @@
*/ */
package com.arialyy.aria.core.download.m3u8; package com.arialyy.aria.core.download.m3u8;
import android.text.TextUtils;
import com.arialyy.aria.core.common.BaseOption; import com.arialyy.aria.core.common.BaseOption;
import com.arialyy.aria.core.processor.IBandWidthUrlConverter; import com.arialyy.aria.core.processor.IBandWidthUrlConverter;
import com.arialyy.aria.core.processor.IKeyUrlConverter; import com.arialyy.aria.core.processor.IKeyUrlConverter;
import com.arialyy.aria.core.processor.ITsMergeHandler; import com.arialyy.aria.core.processor.ITsMergeHandler;
import com.arialyy.aria.util.ALog;
import com.arialyy.aria.util.CheckUtil; import com.arialyy.aria.util.CheckUtil;
import com.arialyy.aria.util.ComponentUtil; import com.arialyy.aria.util.ComponentUtil;
@ -34,12 +36,27 @@ public class M3U8Option<OP extends M3U8Option> extends BaseOption {
private IBandWidthUrlConverter bandWidthUrlConverter; private IBandWidthUrlConverter bandWidthUrlConverter;
private IKeyUrlConverter keyUrlConverter; private IKeyUrlConverter keyUrlConverter;
private boolean ignoreFailureTs = false; private boolean ignoreFailureTs = false;
private String keyPath;
M3U8Option() { M3U8Option() {
super(); super();
ComponentUtil.getInstance().checkComponentExist(ComponentUtil.COMPONENT_TYPE_M3U8); ComponentUtil.getInstance().checkComponentExist(ComponentUtil.COMPONENT_TYPE_M3U8);
} }
/**
* 设置密钥文件的保存路径
*
* @param keyPath 密钥文件的保存路径
*/
public OP setKeyPath(String keyPath) {
if (TextUtils.isEmpty(keyPath)) {
ALog.e(TAG, "密钥文件保存路径为空");
return (OP) this;
}
this.keyPath = keyPath;
return (OP) this;
}
/** /**
* 忽略下载失败的ts切片即使有失败的切片下载完成后也要合并所有切片并进入complete回调 * 忽略下载失败的ts切片即使有失败的切片下载完成后也要合并所有切片并进入complete回调
*/ */

@ -33,6 +33,7 @@ import com.arialyy.aria.core.task.DownloadTask;
import com.arialyy.aria.core.task.UploadTask; import com.arialyy.aria.core.task.UploadTask;
import com.arialyy.aria.core.wrapper.AbsTaskWrapper; import com.arialyy.aria.core.wrapper.AbsTaskWrapper;
import com.arialyy.aria.util.ALog; import com.arialyy.aria.util.ALog;
import com.arialyy.aria.util.CommonUtil;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -45,7 +46,7 @@ public abstract class AbsTaskQueue<TASK extends AbsTask, TASK_WRAPPER extends Ab
final int TYPE_DG_QUEUE = 2; final int TYPE_DG_QUEUE = 2;
final int TYPE_U_QUEUE = 3; final int TYPE_U_QUEUE = 3;
private final String TAG = "AbsTaskQueue"; private final String TAG = CommonUtil.getClassName(this);
BaseCachePool<TASK> mCachePool; BaseCachePool<TASK> mCachePool;
BaseExecutePool<TASK> mExecutePool; BaseExecutePool<TASK> mExecutePool;

@ -24,6 +24,7 @@ import com.arialyy.aria.core.event.EventMsgUtil;
import com.arialyy.aria.core.scheduler.TaskSchedulers; import com.arialyy.aria.core.scheduler.TaskSchedulers;
import com.arialyy.aria.core.task.DownloadGroupTask; import com.arialyy.aria.core.task.DownloadGroupTask;
import com.arialyy.aria.util.ALog; import com.arialyy.aria.util.ALog;
import com.arialyy.aria.util.CommonUtil;
/** /**
* Created by AriaL on 2017/6/29. 任务组下载队列 * Created by AriaL on 2017/6/29. 任务组下载队列
@ -32,7 +33,7 @@ public class DGroupTaskQueue
extends AbsTaskQueue<DownloadGroupTask, DGTaskWrapper> { extends AbsTaskQueue<DownloadGroupTask, DGTaskWrapper> {
private static volatile DGroupTaskQueue INSTANCE = null; private static volatile DGroupTaskQueue INSTANCE = null;
private final String TAG = "DownloadGroupTaskQueue"; private final String TAG = CommonUtil.getClassName(this);
public static DGroupTaskQueue getInstance() { public static DGroupTaskQueue getInstance() {
if (INSTANCE == null) { if (INSTANCE == null) {
@ -57,7 +58,7 @@ public class DGroupTaskQueue
} }
@Override public int getMaxTaskNum() { @Override public int getMaxTaskNum() {
return AriaConfig.getInstance().getDConfig().getMaxTaskNum(); return AriaConfig.getInstance().getDGConfig().getMaxTaskNum();
} }
@Override public DownloadGroupTask createTask(DGTaskWrapper wrapper) { @Override public DownloadGroupTask createTask(DGTaskWrapper wrapper) {

@ -1,5 +1,5 @@
## 开发日志 ## 开发日志
+ v_3.8.3 + v_3.8.3 (2020/1/9)
- fix bug https://github.com/AriaLyy/Aria/issues/573 - fix bug https://github.com/AriaLyy/Aria/issues/573
- android P适配 https://github.com/AriaLyy/Aria/issues/581 - android P适配 https://github.com/AriaLyy/Aria/issues/581
- 添加ftp服务器标志 https://github.com/AriaLyy/Aria/issues/580 - 添加ftp服务器标志 https://github.com/AriaLyy/Aria/issues/580
@ -7,6 +7,7 @@
- 修复ftp上传完成后,删除服务器端的文件,无法重新下载的问题 - 修复ftp上传完成后,删除服务器端的文件,无法重新下载的问题
- 增加获取执行中的任务api,详情见:https://aria.laoyuyu.me/aria_doc/api/task_list.html - 增加获取执行中的任务api,详情见:https://aria.laoyuyu.me/aria_doc/api/task_list.html
- 增加获取剩余时间的api,详情见:https://aria.laoyuyu.me/aria_doc/start/task_explain.html - 增加获取剩余时间的api,详情见:https://aria.laoyuyu.me/aria_doc/start/task_explain.html
- fix bug https://github.com/AriaLyy/Aria/issues/595
+ v_3.8.1 (2019/12/22) + v_3.8.1 (2019/12/22)
- 修复一个表创建失败的问题 https://github.com/AriaLyy/Aria/issues/570 - 修复一个表创建失败的问题 https://github.com/AriaLyy/Aria/issues/570
- 修复一个非分块模式下导致下载失败的问题 https://github.com/AriaLyy/Aria/issues/571 - 修复一个非分块模式下导致下载失败的问题 https://github.com/AriaLyy/Aria/issues/571

@ -80,7 +80,8 @@ final class FtpDGLoader extends AbsGroupLoader {
} }
@Override public void onFail(AbsEntity entity, BaseException e, boolean needRetry) { @Override public void onFail(AbsEntity entity, BaseException e, boolean needRetry) {
getListener().onFail(needRetry, e); //getListener().onFail(needRetry, e);
fail(e, needRetry);
} }
}); });
} }

@ -89,6 +89,9 @@ public final class HttpDGInfoTask implements IInfoTask {
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); e.printStackTrace();
} }
if (!mPool.isShutdown()){
mPool.shutdown();
}
} else { } else {
for (DTaskWrapper wrapper : wrapper.getSubTaskWrapper()) { for (DTaskWrapper wrapper : wrapper.getSubTaskWrapper()) {
cloneHeader(wrapper); cloneHeader(wrapper);

@ -66,7 +66,7 @@ final class HttpDGLoader extends AbsGroupLoader {
} }
@Override public void onFail(AbsEntity entity, BaseException e, boolean needRetry) { @Override public void onFail(AbsEntity entity, BaseException e, boolean needRetry) {
getListener().onFail(needRetry, e); fail(e, needRetry);
} }
}); });
} }

@ -24,7 +24,6 @@ import com.arialyy.aria.http.BaseHttpThreadTaskAdapter;
import com.arialyy.aria.http.ConnectionHelp; import com.arialyy.aria.http.ConnectionHelp;
import com.arialyy.aria.util.ALog; import com.arialyy.aria.util.ALog;
import com.arialyy.aria.util.BufferedRandomAccessFile; import com.arialyy.aria.util.BufferedRandomAccessFile;
import com.arialyy.aria.util.FileUtil;
import java.io.BufferedInputStream; import java.io.BufferedInputStream;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
@ -199,6 +198,7 @@ final class HttpDThreadTaskAdapter extends BaseHttpThreadTaskAdapter {
fos = new FileOutputStream(getThreadConfig().tempFile, true); fos = new FileOutputStream(getThreadConfig().tempFile, true);
foc = fos.getChannel(); foc = fos.getChannel();
fic = Channels.newChannel(is); fic = Channels.newChannel(is);
ByteBuffer bf = ByteBuffer.allocate(getTaskConfig().getBuffSize()); ByteBuffer bf = ByteBuffer.allocate(getTaskConfig().getBuffSize());
//如果要通过 Future 的 cancel 方法取消正在运行的任务,那么该任务必定是可以 对线程中断做出响应 的任务。 //如果要通过 Future 的 cancel 方法取消正在运行的任务,那么该任务必定是可以 对线程中断做出响应 的任务。

@ -258,9 +258,14 @@ final public class M3U8InfoTask implements IInfoTask {
m3U8Entity.method = param.split("=")[1]; m3U8Entity.method = param.split("=")[1];
} else if (param.startsWith("URI")) { } else if (param.startsWith("URI")) {
m3U8Entity.keyUrl = param.split("=")[1].replaceAll("\"", ""); m3U8Entity.keyUrl = param.split("=")[1].replaceAll("\"", "");
m3U8Entity.keyPath = String keyPath;
new File(mEntity.getFilePath()).getParent() + "/" + CommonUtil.getStrMd5( if (((M3U8TaskOption) mTaskWrapper.getM3u8Option()).getKeyPath() == null) {
m3U8Entity.keyUrl) + ".key"; keyPath = new File(mEntity.getFilePath()).getParent() + "/"
+ CommonUtil.getStrMd5(m3U8Entity.keyUrl) + ".key";
} else {
keyPath = ((M3U8TaskOption) mTaskWrapper.getM3u8Option()).getKeyPath();
}
m3U8Entity.keyPath = keyPath;
} else if (param.startsWith("IV")) { } else if (param.startsWith("IV")) {
m3U8Entity.iv = param.split("=")[1]; m3U8Entity.iv = param.split("=")[1];
} else if (param.startsWith("KEYFORMAT")) { } else if (param.startsWith("KEYFORMAT")) {

@ -115,6 +115,15 @@ public final class M3U8TaskOption implements ITaskOption {
*/ */
private boolean ignoreFailureTs = false; private boolean ignoreFailureTs = false;
/**
* 密钥文件保存路径
*/
private String keyPath;
public String getKeyPath() {
return keyPath;
}
public boolean isIgnoreFailureTs() { public boolean isIgnoreFailureTs() {
return ignoreFailureTs; return ignoreFailureTs;
} }

@ -15,6 +15,8 @@
*/ */
package com.arialyy.aria.m3u8; package com.arialyy.aria.m3u8;
import android.net.Uri;
import android.text.TextUtils;
import com.arialyy.aria.core.common.RequestEnum; import com.arialyy.aria.core.common.RequestEnum;
import com.arialyy.aria.core.common.SubThreadConfig; import com.arialyy.aria.core.common.SubThreadConfig;
import com.arialyy.aria.core.download.DownloadEntity; import com.arialyy.aria.core.download.DownloadEntity;
@ -24,6 +26,7 @@ import com.arialyy.aria.exception.TaskException;
import com.arialyy.aria.http.ConnectionHelp; import com.arialyy.aria.http.ConnectionHelp;
import com.arialyy.aria.http.HttpTaskOption; import com.arialyy.aria.http.HttpTaskOption;
import com.arialyy.aria.util.ALog; import com.arialyy.aria.util.ALog;
import com.arialyy.aria.util.CheckUtil;
import java.io.BufferedInputStream; import java.io.BufferedInputStream;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
@ -46,6 +49,7 @@ import java.util.Set;
public final class M3U8ThreadTaskAdapter extends AbsThreadTaskAdapter { public final class M3U8ThreadTaskAdapter extends AbsThreadTaskAdapter {
private final String TAG = "M3U8ThreadTask"; private final String TAG = "M3U8ThreadTask";
private HttpTaskOption mHttpTaskOption; private HttpTaskOption mHttpTaskOption;
private BufferedInputStream is = null;
public M3U8ThreadTaskAdapter(SubThreadConfig config) { public M3U8ThreadTaskAdapter(SubThreadConfig config) {
super(config); super(config);
@ -58,19 +62,15 @@ public final class M3U8ThreadTaskAdapter extends AbsThreadTaskAdapter {
return; return;
} }
HttpURLConnection conn = null; HttpURLConnection conn = null;
BufferedInputStream is = null;
try { try {
URL url = ConnectionHelp.handleUrl(getThreadConfig().url, mHttpTaskOption); URL url = ConnectionHelp.handleUrl(getThreadConfig().url, mHttpTaskOption);
conn = ConnectionHelp.handleConnection(url, mHttpTaskOption); conn = ConnectionHelp.handleConnection(url, mHttpTaskOption);
ALog.d(TAG, String.format("分片【%s】开始下载", getThreadRecord().threadId)); ALog.d(TAG, String.format("分片【%s】开始下载", getThreadRecord().threadId));
ConnectionHelp.setConnectParam(mHttpTaskOption, conn);
conn.setConnectTimeout(getTaskConfig().getConnectTimeOut());
conn.setReadTimeout(getTaskConfig().getIOTimeOut()); //设置读取流的等待时间,必须设置该参数
if (mHttpTaskOption.isChunked()) { if (mHttpTaskOption.isChunked()) {
conn.setDoInput(true); conn.setDoInput(true);
conn.setChunkedStreamingMode(0); conn.setChunkedStreamingMode(0);
} }
conn.connect();
// 传递参数 // 传递参数
if (mHttpTaskOption.getRequestEnum() == RequestEnum.POST) { if (mHttpTaskOption.getRequestEnum() == RequestEnum.POST) {
Map<String, String> params = mHttpTaskOption.getParams(); Map<String, String> params = mHttpTaskOption.getParams();
@ -89,20 +89,7 @@ public final class M3U8ThreadTaskAdapter extends AbsThreadTaskAdapter {
} }
} }
int code = conn.getResponseCode(); handleConn(conn);
if (code != HttpURLConnection.HTTP_OK) {
fail(new TaskException(TAG,
String.format("连接错误,http错误码:%s,url:%s", code, getThreadConfig().url)),
false);
return;
}
is = new BufferedInputStream(ConnectionHelp.convertInputStream(conn));
if (mHttpTaskOption.isChunked()) {
readChunked(is);
} else if (getThreadConfig().isBlock) {
readDynamicFile(is);
}
} catch (MalformedURLException e) { } catch (MalformedURLException e) {
fail(new TaskException(TAG, fail(new TaskException(TAG,
String.format("分片【%s】下载失败,filePath: %s, url: %s", getThreadRecord().threadId, String.format("分片【%s】下载失败,filePath: %s, url: %s", getThreadRecord().threadId,
@ -129,6 +116,65 @@ public final class M3U8ThreadTaskAdapter extends AbsThreadTaskAdapter {
} }
} }
private void handleConn(HttpURLConnection conn) throws IOException {
ConnectionHelp.setConnectParam(mHttpTaskOption, conn);
conn.setConnectTimeout(getTaskConfig().getConnectTimeOut());
conn.setReadTimeout(getTaskConfig().getIOTimeOut()); //设置读取流的等待时间,必须设置该参数
conn.connect();
int code = conn.getResponseCode();
if (code == HttpURLConnection.HTTP_OK) {
is = new BufferedInputStream(ConnectionHelp.convertInputStream(conn));
if (mHttpTaskOption.isChunked()) {
readChunked(is);
} else if (getThreadConfig().isBlock) {
readDynamicFile(is);
}
} else if (code == HttpURLConnection.HTTP_MOVED_TEMP
|| code == HttpURLConnection.HTTP_MOVED_PERM
|| code == HttpURLConnection.HTTP_SEE_OTHER
|| code == HttpURLConnection.HTTP_CREATED // 201 跳转
|| code == 307) {
handleUrlReTurn(conn, conn.getHeaderField("Location"));
} else {
fail(new TaskException(TAG,
String.format("连接错误,http错误码:%s,url:%s", code, getThreadConfig().url)),
false);
}
conn.disconnect();
}
/**
* 处理30x跳转
*/
private void handleUrlReTurn(HttpURLConnection conn, String newUrl) throws IOException {
ALog.d(TAG, "30x跳转,新url为【" + newUrl + "】");
if (TextUtils.isEmpty(newUrl) || newUrl.equalsIgnoreCase("null")) {
fail(new AriaIOException(TAG, "下载失败,重定向url为空"), false);
return;
}
if (newUrl.startsWith("/")) {
Uri uri = Uri.parse(getThreadConfig().url);
newUrl = uri.getHost() + newUrl;
}
if (!CheckUtil.checkUrl(newUrl)) {
fail(new AriaIOException(TAG, "下载失败,重定向url错误"), false);
return;
}
String cookies = conn.getHeaderField("Set-Cookie");
conn.disconnect(); // 关闭上一个连接
URL url = ConnectionHelp.handleUrl(newUrl, mHttpTaskOption);
conn = ConnectionHelp.handleConnection(url, mHttpTaskOption);
conn.setRequestProperty("Cookie", cookies);
if (mHttpTaskOption.isChunked()) {
conn.setDoInput(true);
conn.setChunkedStreamingMode(0);
}
handleConn(conn);
}
/** /**
* 读取chunked数据 * 读取chunked数据
*/ */

@ -51,9 +51,6 @@ public abstract class AbsNormalEntity extends AbsEntity implements Parcelable {
*/ */
private int taskType; private int taskType;
@Override public int getTaskType() {
return taskType;
}
public void setTaskType(int taskType) { public void setTaskType(int taskType) {
this.taskType = taskType; this.taskType = taskType;

@ -78,22 +78,26 @@ public class DownloadEntity extends AbsNormalEntity implements Parcelable {
return getUrl(); return getUrl();
} }
//@Override public int getTaskType() { @Override public int getTaskType() {
// int type; int type;
// if (TextUtils.isEmpty(getUrl())) { if (TextUtils.isEmpty(getUrl())) {
// type = ITaskWrapper.ERROR; type = ITaskWrapper.ERROR;
// } else if (getUrl().startsWith("ftp")) { } else if (getUrl().startsWith("http")) {
// type = ITaskWrapper.D_FTP; type = ITaskWrapper.D_HTTP;
// } else { } else if (getUrl().startsWith("ftp")) {
// M3U8Entity temp = getM3U8Entity(); type = ITaskWrapper.D_FTP;
// if (temp == null) { } else if (getUrl().startsWith("sftp")) {
// type = ITaskWrapper.D_HTTP; type = ITaskWrapper.D_SFTP;
// } else { } else {
// type = temp.isLive() ? ITaskWrapper.M3U8_LIVE : ITaskWrapper.M3U8_VOD; M3U8Entity temp = getM3U8Entity();
// } if (temp == null) {
// } type = ITaskWrapper.D_HTTP;
// return type; } else {
//} type = temp.isLive() ? ITaskWrapper.M3U8_LIVE : ITaskWrapper.M3U8_VOD;
}
}
return type;
}
public DownloadEntity() { public DownloadEntity() {
} }

@ -30,6 +30,7 @@ import com.arialyy.aria.core.loader.ILoaderVisitor;
import com.arialyy.aria.core.loader.IRecordHandler; import com.arialyy.aria.core.loader.IRecordHandler;
import com.arialyy.aria.core.loader.IThreadTaskBuilder; import com.arialyy.aria.core.loader.IThreadTaskBuilder;
import com.arialyy.aria.core.wrapper.AbsTaskWrapper; import com.arialyy.aria.core.wrapper.AbsTaskWrapper;
import com.arialyy.aria.exception.BaseException;
import com.arialyy.aria.util.ALog; import com.arialyy.aria.util.ALog;
import com.arialyy.aria.util.CommonUtil; import com.arialyy.aria.util.CommonUtil;
import java.io.File; import java.io.File;
@ -253,8 +254,8 @@ public abstract class AbsGroupLoader implements ILoaderVisitor, ILoader {
mListener.onComplete(); mListener.onComplete();
return; return;
} }
handlerTask(looper);
startTimer(); startTimer();
handlerTask(looper);
Looper.loop(); Looper.loop();
} }
@ -320,6 +321,11 @@ public abstract class AbsGroupLoader implements ILoaderVisitor, ILoader {
} }
} }
protected void fail(BaseException e, boolean needRetry){
closeTimer();
getListener().onFail(needRetry, e);
}
@Override public long getCurrentProgress() { @Override public long getCurrentProgress() {
return mCurrentLocation; return mCurrentLocation;
} }

@ -99,8 +99,6 @@ public abstract class AbsGroupLoaderUtil implements IUtil {
} }
buildLoaderStructure(); buildLoaderStructure();
// MsgEvent 已经是在线程中使用了,不需要重开线程 new Thread(mLoader).start();
mLoader.run();
//new Thread(mLoader).start();
} }
} }

@ -61,6 +61,7 @@ public interface IThreadStateManager extends ILoaderComponent {
/** /**
* 更新当前进度 * 更新当前进度
*
* @param currentProgress 当前进度 * @param currentProgress 当前进度
*/ */
void updateCurrentProgress(long currentProgress); void updateCurrentProgress(long currentProgress);

@ -115,10 +115,7 @@ public abstract class AbsNormalLoaderUtil implements IUtil {
//} //}
BuildLoaderStructure(); BuildLoaderStructure();
// MsgEvent 已经是在线程中使用了,不需要重开线程 new Thread(mLoader).start();
mLoader.run();
//new Thread(mLoader).start();
onStart(); onStart();
} }

@ -17,7 +17,9 @@ package com.arialyy.aria.core.upload;
import android.os.Parcel; import android.os.Parcel;
import android.os.Parcelable; import android.os.Parcelable;
import android.text.TextUtils;
import com.arialyy.aria.core.common.AbsNormalEntity; import com.arialyy.aria.core.common.AbsNormalEntity;
import com.arialyy.aria.core.wrapper.ITaskWrapper;
import com.arialyy.aria.orm.annotation.Primary; import com.arialyy.aria.orm.annotation.Primary;
/** /**
@ -56,12 +58,12 @@ public class UploadEntity extends AbsNormalEntity implements Parcelable {
return filePath; return filePath;
} }
//@Override public int getTaskType() { @Override public int getTaskType() {
// if (TextUtils.isEmpty(getUrl())){ if (TextUtils.isEmpty(getUrl())) {
// return ITaskWrapper.ERROR; return ITaskWrapper.ERROR;
// } }
// return getUrl().startsWith("ftp") ? ITaskWrapper.U_FTP : ITaskWrapper.U_HTTP; return getUrl().startsWith("ftp") ? ITaskWrapper.U_FTP : ITaskWrapper.U_HTTP;
//} }
public UploadEntity() { public UploadEntity() {
} }

@ -200,7 +200,8 @@ final class SqlHelper extends SQLiteOpenHelper {
if (newAddColum.size() > 0) { if (newAddColum.size() > 0) {
String sql = "ALTER TABLE %s ADD COLUMN %s %s"; String sql = "ALTER TABLE %s ADD COLUMN %s %s";
for (String nc : newAddColum) { for (String nc : newAddColum) {
String temp = String.format(sql, tableName, nc, SqlUtil.getColumnTypeByFieldName(clazz, nc)); String temp =
String.format(sql, tableName, nc, SqlUtil.getColumnTypeByFieldName(clazz, nc));
ALog.d(TAG, "添加表字段的sql:" + temp); ALog.d(TAG, "添加表字段的sql:" + temp);
db.execSQL(temp); db.execSQL(temp);
} }
@ -234,7 +235,8 @@ final class SqlHelper extends SQLiteOpenHelper {
for (String column : oldTabColumns) { for (String column : oldTabColumns) {
if (!diffTab.isEmpty() && diffTab.contains(column) if (!diffTab.isEmpty() && diffTab.contains(column)
&& (modifyMap != null && !modifyMap.containsKey(column))) { // 如果旧表字段有修改,忽略这个删除 // 如果旧表字段有修改,忽略这个删除
&& !(modifyMap != null && modifyMap.containsKey(column))) {
continue; continue;
} }
params.append(column).append(","); params.append(column).append(",");

@ -44,16 +44,16 @@ Aria有以下特点:
## 引入库 ## 引入库
[![license](http://img.shields.io/badge/license-Apache2.0-brightgreen.svg?style=flat)](https://github.com/AriaLyy/Aria/blob/master/LICENSE) [![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.1-blue)](https://github.com/AriaLyy/Aria) [![Core](https://img.shields.io/badge/Core-3.8.3-blue)](https://github.com/AriaLyy/Aria)
[![Compiler](https://img.shields.io/badge/Compiler-3.8.1-blue)](https://github.com/AriaLyy/Aria) [![Compiler](https://img.shields.io/badge/Compiler-3.8.3-blue)](https://github.com/AriaLyy/Aria)
[![FtpComponent](https://img.shields.io/badge/FtpComponent-3.8.1-orange)](https://github.com/AriaLyy/Aria) [![FtpComponent](https://img.shields.io/badge/FtpComponent-3.8.3-orange)](https://github.com/AriaLyy/Aria)
[![M3U8Component](https://img.shields.io/badge/M3U8Component-3.8.1-orange)](https://github.com/AriaLyy/Aria) [![M3U8Component](https://img.shields.io/badge/M3U8Component-3.8.3-orange)](https://github.com/AriaLyy/Aria)
```java ```java
implementation 'com.arialyy.aria:core:3.8.1' implementation 'com.arialyy.aria:core:3.8.3'
annotationProcessor 'com.arialyy.aria:compiler:3.8.1' annotationProcessor 'com.arialyy.aria:compiler:3.8.3'
implementation 'com.arialyy.aria:ftpComponent:3.8.1' # 如果需要使用ftp,请增加该组件 implementation 'com.arialyy.aria:ftpComponent:3.8.3' # 如果需要使用ftp,请增加该组件
implementation 'com.arialyy.aria:m3u8Component:3.8.1' # 如果需要使用m3u8下载功能,请增加该组件 implementation 'com.arialyy.aria:m3u8Component:3.8.3' # 如果需要使用m3u8下载功能,请增加该组件
``` ```
如果出现android support依赖错误,请将 `compile 'com.arialyy.aria:core:<last-version>'`替换为 如果出现android support依赖错误,请将 `compile 'com.arialyy.aria:core:<last-version>'`替换为
``` ```
@ -139,12 +139,14 @@ protected void onCreate(Bundle savedInstanceState) {
### 版本日志 ### 版本日志
+ v_3.8.1 (2019/12/22) + v_3.8.3 (2020/1/9)
- 修复一个表创建失败的问题 https://github.com/AriaLyy/Aria/issues/570 - fix bug https://github.com/AriaLyy/Aria/issues/573
- 修复一个非分块模式下导致下载失败的问题 https://github.com/AriaLyy/Aria/issues/571 - android P适配 https://github.com/AriaLyy/Aria/issues/581
- 修复一个服务器端无法创建socket连接,却没有返回码导致客户端卡住的问题 https://github.com/AriaLyy/Aria/issues/569 - 添加ftp服务器标志 https://github.com/AriaLyy/Aria/issues/580
- 修复文件删除后,组合任务没有重新下载的问题 https://github.com/AriaLyy/Aria/issues/574 - 重构loader模块,让loader模块的代码更加清晰,去除一些不必要的线程创建
- 优化缓存队列和执行队列 - 修复ftp上传完成后,删除服务器端的文件,无法重新下载的问题
- 增加获取执行中的任务api,详情见:https://aria.laoyuyu.me/aria_doc/api/task_list.html
- 增加获取剩余时间的api,详情见:https://aria.laoyuyu.me/aria_doc/start/task_explain.html
[更多版本记录](https://github.com/AriaLyy/Aria/blob/master/DEV_LOG.md) [更多版本记录](https://github.com/AriaLyy/Aria/blob/master/DEV_LOG.md)

@ -305,12 +305,13 @@ public class M3U8VodDLoadActivity extends BaseActivity<ActivityM3u8VodBinding> {
private M3U8VodOption getM3U8Option() { private M3U8VodOption getM3U8Option() {
M3U8VodOption option = new M3U8VodOption(); M3U8VodOption option = new M3U8VodOption();
option option
.setBandWidth(200000)
//.generateIndexFile() //.generateIndexFile()
//.merge(true) //.merge(true)
.setVodTsUrlConvert(new VodTsUrlConverter()); .setVodTsUrlConvert(new VodTsUrlConverter());
//.setMergeHandler(new TsMergeHandler()); //.setMergeHandler(new TsMergeHandler());
option.setKeyUrlConverter(new KeyUrlConverter()); option.setKeyUrlConverter(new KeyUrlConverter());
option.setBandWidthUrlConverter(new BandWidthUrlConverter(mUrl)); //option.setBandWidthUrlConverter(new BandWidthUrlConverter(mUrl));
return option; return option;
} }
@ -328,7 +329,8 @@ public class M3U8VodDLoadActivity extends BaseActivity<ActivityM3u8VodBinding> {
Uri uri = Uri.parse(m3u8Url); Uri uri = Uri.parse(m3u8Url);
//String parentUrl = "http://" + uri.getHost() + "/gear1/"; //String parentUrl = "http://" + uri.getHost() + "/gear1/";
int index = m3u8Url.lastIndexOf("/"); int index = m3u8Url.lastIndexOf("/");
String parentUrl = m3u8Url.substring(0, index + 1); //String parentUrl = m3u8Url.substring(0, index + 1);
String parentUrl = "https://cn7.kankia.com/";
//String parentUrl = "http://" + uri.getHost() + "/"; //String parentUrl = "http://" + uri.getHost() + "/";
List<String> newUrls = new ArrayList<>(); List<String> newUrls = new ArrayList<>();
for (String url : tsUrls) { for (String url : tsUrls) {

@ -34,7 +34,9 @@ public class M3U8VodModule extends BaseViewModule {
// m3u8测试集合:http://www.voidcn.com/article/p-snaliarm-ct.html // m3u8测试集合:http://www.voidcn.com/article/p-snaliarm-ct.html
//private final String defUrl = "https://www.gaoya123.cn/2019/1557993797897.m3u8"; //private final String defUrl = "https://www.gaoya123.cn/2019/1557993797897.m3u8";
// 多码率地址: // 多码率地址:
private final String defUrl = "http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8"; //private final String defUrl = "http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8";
private final String defUrl = "https://cn7.kankia.com/hls/20200108/e1eaec074274c64fe46a3bdb5d2ba487/1578488360/index.m3u8";
//private final String defUrl = "https://youku.cdn7-okzy.com/20191213/16167_c3592a02/index.m3u8";
//private final String defUrl = "http://qn.shytong.cn/b83137769ff6b555/11b0c9970f9a3fa0.mp4.m3u8"; //private final String defUrl = "http://qn.shytong.cn/b83137769ff6b555/11b0c9970f9a3fa0.mp4.m3u8";
private final String filePath = private final String filePath =
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getPath() Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getPath()

@ -292,6 +292,7 @@ public class DownloadAdapter extends AbsRVAdapter<AbsEntity, DownloadAdapter.Sim
.cancel(true); .cancel(true);
break; break;
case ITaskWrapper.D_FTP_DIR: case ITaskWrapper.D_FTP_DIR:
Aria.download(getContext()).loadFtpDir(entity.getId()).cancel(true);
break; break;
case ITaskWrapper.D_HTTP: case ITaskWrapper.D_HTTP:
case ITaskWrapper.M3U8_VOD: case ITaskWrapper.M3U8_VOD:

@ -26,6 +26,7 @@ import androidx.recyclerview.widget.RecyclerView;
import com.arialyy.annotations.Download; import com.arialyy.annotations.Download;
import com.arialyy.annotations.DownloadGroup; import com.arialyy.annotations.DownloadGroup;
import com.arialyy.aria.core.Aria; import com.arialyy.aria.core.Aria;
import com.arialyy.aria.core.common.AbsEntity;
import com.arialyy.aria.core.task.DownloadGroupTask; import com.arialyy.aria.core.task.DownloadGroupTask;
import com.arialyy.aria.core.task.DownloadTask; import com.arialyy.aria.core.task.DownloadTask;
import com.arialyy.aria.util.ALog; import com.arialyy.aria.util.ALog;
@ -72,7 +73,11 @@ public class MultiTaskActivity extends BaseActivity<ActivityMultiBinding> {
dialog.show(getSupportFragmentManager(), "download_num"); dialog.show(getSupportFragmentManager(), "download_num");
break; break;
case R.id.stop_all: case R.id.stop_all:
Aria.download(this).stopAllTask(); //Aria.download(this).stopAllTask();
List<AbsEntity> list = Aria.download(this).getTotalTaskList();
for (AbsEntity entity : list){
Aria.download(this).load(entity.getId()).cancel(true);
}
//Aria.download(this).removeAllTask(false); //Aria.download(this).removeAllTask(false);
break; break;
case R.id.turn: case R.id.turn:

@ -45,7 +45,7 @@ task clean(type: Delete) {
ext { ext {
versionCode = 383 versionCode = 383
versionName = '3.8.3_beta_2' versionName = '3.8.3_beta_5'
userOrg = 'arialyy' userOrg = 'arialyy'
groupId = 'com.arialyy.aria' groupId = 'com.arialyy.aria'
publishVersion = versionName publishVersion = versionName

Loading…
Cancel
Save