laoyuyu 4 years ago
parent 9a174311d9
commit 023f648d07
  1. 2
      Aria/src/main/java/com/arialyy/aria/core/manager/SubTaskManager.java
  2. 4
      DEV_LOG.md
  3. 8
      PublicComponent/src/main/java/com/arialyy/aria/core/loader/SubLoader.java
  4. 24
      PublicComponent/src/main/java/com/arialyy/aria/core/task/ThreadTask.java
  5. 30
      README.md
  6. 2
      app/src/main/assets/aria_config.xml
  7. 2
      app/src/main/java/com/arialyy/simple/core/download/HttpDownloadModule.java
  8. 2
      app/src/main/java/com/arialyy/simple/core/download/SingleTaskActivity.java
  9. 2
      app/src/main/java/com/arialyy/simple/widget/ProgressLayout.java
  10. 4
      build.gradle

@ -28,7 +28,7 @@ import java.util.List;
* 子任务管理器 * 子任务管理器
*/ */
public class SubTaskManager { public class SubTaskManager {
private String TAG = "SubTaskManager"; private final String TAG = getClass().getSimpleName();
private DGTaskWrapper mEntity; private DGTaskWrapper mEntity;
public SubTaskManager(DGTaskWrapper entity) { public SubTaskManager(DGTaskWrapper entity) {

@ -1,6 +1,8 @@
## 开发日志 ## 开发日志
+ v_3.8.10 + v_3.8.10 (2020/6/26)
- fix bug https://github.com/AriaLyy/Aria/issues/703 - fix bug https://github.com/AriaLyy/Aria/issues/703
- fix bug https://github.com/AriaLyy/Aria/issues/702
- fix bug https://github.com/AriaLyy/Aria/issues/695
+ v_3.8.9 (2020/6/14) + v_3.8.9 (2020/6/14)
- fix bug https://github.com/AriaLyy/Aria/issues/688 - fix bug https://github.com/AriaLyy/Aria/issues/688
- fix bug https://github.com/AriaLyy/Aria/issues/690 - fix bug https://github.com/AriaLyy/Aria/issues/690

@ -168,9 +168,9 @@ public final class SubLoader implements ILoader, ILoaderVisitor {
for (IThreadTask iThreadTask : mTask) { for (IThreadTask iThreadTask : mTask) {
iThreadTask.call(); iThreadTask.call();
} }
} else { return;
ALog.e(TAG, "子任务的线程任务为空");
} }
ALog.e(TAG, "子任务的线程任务为空");
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -263,9 +263,9 @@ public final class SubLoader implements ILoader, ILoaderVisitor {
} }
if (needGetInfo) { if (needGetInfo) {
infoTask.run(); infoTask.run();
} else { return;
handlerTask();
} }
handlerTask();
} }
/** /**

@ -402,17 +402,19 @@ public class ThreadTask implements IThreadTask, IThreadTaskObserver {
if (mTaskWrapper.getRequestType() == ITaskWrapper.M3U8_VOD) { if (mTaskWrapper.getRequestType() == ITaskWrapper.M3U8_VOD) {
writeConfig(false, 0); writeConfig(false, 0);
retryM3U8Peer(needRetry); retryM3U8Peer(needRetry);
} else { return;
}
if (mTaskWrapper.isSupportBP()) { if (mTaskWrapper.isSupportBP()) {
writeConfig(false, subCurrentLocation); writeConfig(false, subCurrentLocation);
retryBlockTask(needRetry && mConfig.startThreadNum != 1); retryBlockTask(needRetry);
} else { return;
}
ALog.e(TAG, String.format("任务【%s】执行失败", getFileName())); ALog.e(TAG, String.format("任务【%s】执行失败", getFileName()));
ErrorHelp.saveError("", ALog.getExceptionString(ex)); ErrorHelp.saveError("", ALog.getExceptionString(ex));
sendFailMsg(null, needRetry); sendFailMsg(null, needRetry);
} }
}
}
/** /**
* 重试ts分片 * 重试ts分片
@ -432,9 +434,9 @@ public class ThreadTask implements IThreadTask, IThreadTaskObserver {
FileUtil.deleteFile(mConfig.tempFile); FileUtil.deleteFile(mConfig.tempFile);
FileUtil.createFile(mConfig.tempFile); FileUtil.createFile(mConfig.tempFile);
ThreadTaskManager.getInstance().retryThread(this); ThreadTaskManager.getInstance().retryThread(this);
} else { return;
sendFailMsg(null, false);
} }
sendFailMsg(null, false);
} }
/** /**
@ -454,11 +456,11 @@ public class ThreadTask implements IThreadTask, IThreadTaskObserver {
mFailTimes++; mFailTimes++;
handleBlockRecord(); handleBlockRecord();
ThreadTaskManager.getInstance().retryThread(this); ThreadTaskManager.getInstance().retryThread(this);
} else { return;
}
ALog.e(TAG, String.format("任务【%s】执行失败", getFileName())); ALog.e(TAG, String.format("任务【%s】执行失败", getFileName()));
sendFailMsg(null, needRetry); sendFailMsg(null, needRetry);
} }
}
/** /**
* 处理线程重试的分块记录只有多线程任务才会执行 * 处理线程重试的分块记录只有多线程任务才会执行
@ -509,10 +511,8 @@ public class ThreadTask implements IThreadTask, IThreadTaskObserver {
b.putBoolean(IThreadStateManager.DATA_RETRY, needRetry); b.putBoolean(IThreadStateManager.DATA_RETRY, needRetry);
if (e != null) { if (e != null) {
b.putSerializable(IThreadStateManager.DATA_ERROR_INFO, e); b.putSerializable(IThreadStateManager.DATA_ERROR_INFO, e);
updateState(IThreadStateManager.STATE_FAIL, b);
} else {
updateState(IThreadStateManager.STATE_FAIL, b);
} }
updateState(IThreadStateManager.STATE_FAIL, b);
} }
/** /**

@ -45,19 +45,19 @@ 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.9-blue)](https://github.com/AriaLyy/Aria) [![Core](https://img.shields.io/badge/Core-3.8.10-blue)](https://github.com/AriaLyy/Aria)
[![Compiler](https://img.shields.io/badge/Compiler-3.8.9-blue)](https://github.com/AriaLyy/Aria) [![Compiler](https://img.shields.io/badge/Compiler-3.8.10-blue)](https://github.com/AriaLyy/Aria)
[![FtpComponent](https://img.shields.io/badge/FtpComponent-3.8.9-orange)](https://github.com/AriaLyy/Aria) [![FtpComponent](https://img.shields.io/badge/FtpComponent-3.8.10-orange)](https://github.com/AriaLyy/Aria)
[![FtpComponent](https://img.shields.io/badge/SFtpComponent-3.8.9-orange)](https://github.com/AriaLyy/Aria) [![FtpComponent](https://img.shields.io/badge/SFtpComponent-3.8.10-orange)](https://github.com/AriaLyy/Aria)
[![M3U8Component](https://img.shields.io/badge/M3U8Component-3.8.9-orange)](https://github.com/AriaLyy/Aria) [![M3U8Component](https://img.shields.io/badge/M3U8Component-3.8.10-orange)](https://github.com/AriaLyy/Aria)
```java ```java
implementation 'com.arialyy.aria:core:3.8.9' implementation 'com.arialyy.aria:core:3.8.10'
annotationProcessor 'com.arialyy.aria:compiler:3.8.9' annotationProcessor 'com.arialyy.aria:compiler:3.8.10'
implementation 'com.arialyy.aria:ftpComponent:3.8.9' # 如果需要使用ftp,请增加该组件 implementation 'com.arialyy.aria:ftpComponent:3.8.10' # 如果需要使用ftp,请增加该组件
implementation 'com.arialyy.aria:sftpComponent:3.8.9' # 如果需要使用ftp,请增加该组件 implementation 'com.arialyy.aria:sftpComponent:3.8.10' # 如果需要使用ftp,请增加该组件
implementation 'com.arialyy.aria:m3u8Component:3.8.9' # 如果需要使用m3u8下载功能,请增加该组件 implementation 'com.arialyy.aria:m3u8Component:3.8.10' # 如果需要使用m3u8下载功能,请增加该组件
``` ```
如果你使用的是kotlin,请使用kotlin官方提供的方法配置apt,[kotlin kapt官方配置传送门](https://www.kotlincn.net/docs/reference/kapt.html) 如果你使用的是kotlin,请使用kotlin官方提供的方法配置apt,[kotlin kapt官方配置传送门](https://www.kotlincn.net/docs/reference/kapt.html)
@ -138,10 +138,10 @@ protected void onCreate(Bundle savedInstanceState) {
### 版本日志 ### 版本日志
+ v_3.8.9 (2020/6/14) + v_3.8.10 (2020/6/26)
- fix bug https://github.com/AriaLyy/Aria/issues/688 - fix bug https://github.com/AriaLyy/Aria/issues/703
- fix bug https://github.com/AriaLyy/Aria/issues/690 - fix bug https://github.com/AriaLyy/Aria/issues/702
- m3u8任务增加`setUseDefConvert()`方法,用于处理默认的m3u8任务 - fix bug https://github.com/AriaLyy/Aria/issues/695
[更多版本记录](https://github.com/AriaLyy/Aria/blob/master/DEV_LOG.md) [更多版本记录](https://github.com/AriaLyy/Aria/blob/master/DEV_LOG.md)
@ -171,7 +171,7 @@ protected void onCreate(Bundle savedInstanceState) {
在提交问题前,希望你已经查看过[wiki](https://aria.laoyuyu.me/aria_doc/)或搜索过[issues](https://github.com/AriaLyy/Aria/issues)。</br> 在提交问题前,希望你已经查看过[wiki](https://aria.laoyuyu.me/aria_doc/)或搜索过[issues](https://github.com/AriaLyy/Aria/issues)。</br>
## 打赏 ## 打赏
如果觉得框架写的不错并且帮助到了你,可以请我喝杯热茶。`^_^`</br> 如果觉得框架写的不错并且帮助到了你,可以请我瓶快乐水。`^_^`</br>
<img src="https://raw.githubusercontent.com/AriaLyy/Aria/master/img/ali_pay.png" width=336 height=336/> <img src="https://raw.githubusercontent.com/AriaLyy/Aria/master/img/ali_pay.png" width=336 height=336/>
<img src="https://raw.githubusercontent.com/AriaLyy/Aria/master/img/wx_pay.png" width=336 height=336/> <img src="https://raw.githubusercontent.com/AriaLyy/Aria/master/img/wx_pay.png" width=336 height=336/>

@ -41,7 +41,7 @@
3、从3.4.1开始,如果线程数为1,文件初始化时将不再预占用对应长度的空间,下载多少byte,则占多大的空间; 3、从3.4.1开始,如果线程数为1,文件初始化时将不再预占用对应长度的空间,下载多少byte,则占多大的空间;
对于采用多线程的任务或旧任务,依然采用原来的文件空间占用方式; 对于采用多线程的任务或旧任务,依然采用原来的文件空间占用方式;
--> -->
<threadNum value="3"/> <threadNum value="1"/>
<!--设置下载队列最大任务数, 默认为2--> <!--设置下载队列最大任务数, 默认为2-->
<maxTaskNum value="1"/> <maxTaskNum value="1"/>

@ -58,7 +58,7 @@ public class HttpDownloadModule extends BaseViewModule {
//String url = "https://imtt.dd.qq.com/16891/apk/70BFFDB05AB8686F2A4CF3E07588A377.apk?fsname=com.tencent.tmgp.speedmobile_1.16.0.33877_1160033877.apk&csr=1bbd"; //String url = "https://imtt.dd.qq.com/16891/apk/70BFFDB05AB8686F2A4CF3E07588A377.apk?fsname=com.tencent.tmgp.speedmobile_1.16.0.33877_1160033877.apk&csr=1bbd";
//String url = "https://ss1.baidu.com/-4o3dSag_xI4khGko9WTAnF6hhy/image/h%3D300/sign=a9e671b9a551f3dedcb2bf64a4eff0ec/4610b912c8fcc3cef70d70409845d688d53f20f7.jpg"; //String url = "https://ss1.baidu.com/-4o3dSag_xI4khGko9WTAnF6hhy/image/h%3D300/sign=a9e671b9a551f3dedcb2bf64a4eff0ec/4610b912c8fcc3cef70d70409845d688d53f20f7.jpg";
//String filePath = AppUtil.getConfigValue(context, HTTP_PATH_KEY, defFilePath); //String filePath = AppUtil.getConfigValue(context, HTTP_PATH_KEY, defFilePath);
String url = "https://y.qq.com/download/import/QQMusic-import-1.2.1.zip1"; String url = "https://y.qq.com/download/import/QQMusic-import-1.2.1.zip";
//String url = "https://video-hkt1-1.xx.fbcdn.net/v/t42.9040-2/89465702_658301101378505_5469280744218034176_n.mp4?_nc_cat=107&_nc_sid=985c63&efg=eyJ2ZW5jb2RlX3RhZyI6ImxlZ2FjeV9zZCJ9&_nc_oc=AQmzYwQG9vccyqr7S44-cfHc4wJ9010O1nvspG2DPV4cTct1pLrjKl1e1UmOJV99bJw&_nc_ht=video-hkt1-1.xx&oh=49bd04435aaa8b4459b8d5cb7d1e7c79&oe=5E672E37"; //String url = "https://video-hkt1-1.xx.fbcdn.net/v/t42.9040-2/89465702_658301101378505_5469280744218034176_n.mp4?_nc_cat=107&_nc_sid=985c63&efg=eyJ2ZW5jb2RlX3RhZyI6ImxlZ2FjeV9zZCJ9&_nc_oc=AQmzYwQG9vccyqr7S44-cfHc4wJ9010O1nvspG2DPV4cTct1pLrjKl1e1UmOJV99bJw&_nc_ht=video-hkt1-1.xx&oh=49bd04435aaa8b4459b8d5cb7d1e7c79&oe=5E672E37";
//String url = "http://donuts.aigauss.com/doc_fPhW2DBGj3_1578932414.png"; //String url = "http://donuts.aigauss.com/doc_fPhW2DBGj3_1578932414.png";
String filePath = "/mnt/sdcard/update.mp4"; String filePath = "/mnt/sdcard/update.mp4";

@ -190,7 +190,7 @@ public class SingleTaskActivity extends BaseActivity<ActivitySingleBinding> {
@Download.onTaskRunning @Download.onTaskRunning
protected void running(DownloadTask task) { protected void running(DownloadTask task) {
if (task.getKey().equals(mUrl)) { if (task.getKey().equals(mUrl)) {
ALog.d(TAG, "isRunning" + "; state = " + task.getEntity().getState()); //ALog.d(TAG, "isRunning" + "; state = " + task.getEntity().getState());
getBinding().pl.setInfo(task.getEntity()); getBinding().pl.setInfo(task.getEntity());
} }
} }

@ -157,7 +157,7 @@ public class ProgressLayout extends RelativeLayout implements View.OnClickListen
this.currentState = entity.getState(); this.currentState = entity.getState();
if (entity instanceof AbsNormalEntity) { if (entity instanceof AbsNormalEntity) {
AbsNormalEntity normalEntity = (AbsNormalEntity) entity; AbsNormalEntity normalEntity = (AbsNormalEntity) entity;
ALog.d(TAG, "fileName = " + ((AbsNormalEntity) entity).getFileName()); //ALog.d(TAG, "fileName = " + ((AbsNormalEntity) entity).getFileName());
fileName.setText(normalEntity.getFileName()); fileName.setText(normalEntity.getFileName());
} else if (entity instanceof AbsGroupEntity) { } else if (entity instanceof AbsGroupEntity) {
AbsGroupEntity groupEntity = (AbsGroupEntity) entity; AbsGroupEntity groupEntity = (AbsGroupEntity) entity;

@ -44,8 +44,8 @@ task clean(type: Delete) {
} }
ext { ext {
versionCode = 389 versionCode = 390
versionName = '3.8.9' versionName = '3.8.10'
userOrg = 'arialyy' userOrg = 'arialyy'
groupId = 'com.arialyy.aria' groupId = 'com.arialyy.aria'
publishVersion = versionName publishVersion = versionName

Loading…
Cancel
Save