m3u8使用`ignoreFailureTs`后将不会自动重试失败的切片 https://github.com/AriaLyy/Aria/issues/662
pull/789/head
laoyuyu 4 years ago
parent ff0796c580
commit 86aeac0ad8
  1. 2
      .github/stale.yml
  2. 2
      DEV_LOG.md
  3. 4
      HttpComponent/src/main/java/com/arialyy/aria/http/upload/HttpUThreadTaskAdapter.java
  4. 5
      M3U8Component/src/main/java/com/arialyy/aria/m3u8/M3U8InfoTask.java
  5. 1
      M3U8Component/src/main/java/com/arialyy/aria/m3u8/live/M3U8LiveLoader.java
  6. 1
      M3U8Component/src/main/java/com/arialyy/aria/m3u8/vod/M3U8VodLoader.java
  7. 2
      PublicComponent/src/main/java/com/arialyy/aria/core/common/SubThreadConfig.java
  8. 5
      PublicComponent/src/main/java/com/arialyy/aria/core/task/ThreadTask.java
  9. 17
      app/src/main/java/com/arialyy/simple/core/download/HttpDownloadModule.java
  10. 4
      app/src/main/java/com/arialyy/simple/core/download/SingleTaskActivity.java

@ -1,5 +1,5 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 30
daysUntilStale: 7
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 7
# Issues with these labels will never be considered stale

@ -4,9 +4,11 @@
- 修复一个匿名内部类中的内存溢出的问题 https://github.com/AriaLyy/Aria/issues/705
- 修复同一个url地址的任务提示路径冲突的问题
- 修复m3u8任务地址错误时,无法删除实体的问题 https://github.com/AriaLyy/Aria/issues/712
- 修复m3u8gzip的问题,https://github.com/AriaLyy/Aria/issues/639
- 增加m3u8密钥下载地址转换器增加ts列表的url地址 https://github.com/AriaLyy/Aria/issues/718
- 增加现在http文件下载将使用HEAD请求获取文件大小,配置文件增加 <useHeadRequest value="true"/>
- 增加允许不使用apt直接通过实现监听器来回调下载进度更新,该功能由[chenfei0928](https://github.com/chenfei0928)提交,感谢他的pr。如果注解不生效,只需要实现`DownloadListener`接口便可
- m3u8使用`ignoreFailureTs`后将不会自动重试失败的切片 https://github.com/AriaLyy/Aria/issues/662
+ v_3.8.10 (2020/6/26)
- fix bug https://github.com/AriaLyy/Aria/issues/703
- fix bug https://github.com/AriaLyy/Aria/issues/702

@ -20,6 +20,7 @@ import com.arialyy.aria.core.common.SubThreadConfig;
import com.arialyy.aria.core.upload.UploadEntity;
import com.arialyy.aria.exception.AriaHTTPException;
import com.arialyy.aria.http.BaseHttpThreadTaskAdapter;
import com.arialyy.aria.http.ConnectionHelp;
import com.arialyy.aria.util.ALog;
import com.arialyy.aria.util.CommonUtil;
import java.io.BufferedReader;
@ -209,7 +210,8 @@ final class HttpUThreadTaskAdapter extends BaseHttpThreadTaskAdapter {
int status = mHttpConn.getResponseCode();
if (status == HttpURLConnection.HTTP_OK) {
BufferedReader reader = new BufferedReader(new InputStreamReader(mHttpConn.getInputStream()));
BufferedReader reader =
new BufferedReader(new InputStreamReader(ConnectionHelp.convertInputStream(mHttpConn)));
String line;
while (getThreadTask().isLive() && (line = reader.readLine()) != null) {
response.append(line);

@ -118,7 +118,8 @@ final public class M3U8InfoTask implements IInfoTask {
private void handleConnect(String tsListUrl, HttpURLConnection conn) throws IOException {
int code = conn.getResponseCode();
if (code == HttpURLConnection.HTTP_OK) {
BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
BufferedReader reader =
new BufferedReader(new InputStreamReader(ConnectionHelp.convertInputStream(conn)));
String line = reader.readLine();
if (TextUtils.isEmpty(line) || !line.equalsIgnoreCase("#EXTM3U")) {
failDownload("读取M3U8信息失败,读取不到#EXTM3U标签", false);
@ -394,7 +395,7 @@ final public class M3U8InfoTask implements IInfoTask {
ConnectionHelp.setConnectParam(mHttpOption, conn);
conn.setConnectTimeout(mConnectTimeOut);
conn.connect();
InputStream is = conn.getInputStream();
InputStream is = ConnectionHelp.convertInputStream(conn);
fos = new FileOutputStream(keyF);
byte[] buffer = new byte[1024];
int len;

@ -196,6 +196,7 @@ final class M3U8LiveLoader extends BaseM3U8Loader {
config.peerIndex = indexId;
config.threadType = SubThreadConfig.getThreadType(ITaskWrapper.M3U8_LIVE);
config.updateInterval = SubThreadConfig.getUpdateInterval(ITaskWrapper.M3U8_LIVE);
config.ignoreFailure = mM3U8Option.isIgnoreFailureTs();
if (!config.tempFile.exists()) {
FileUtil.createFile(config.tempFile);
}

@ -486,6 +486,7 @@ final class M3U8VodLoader extends BaseM3U8Loader {
config.peerIndex = index;
config.threadType = SubThreadConfig.getThreadType(ITaskWrapper.M3U8_LIVE);
config.updateInterval = SubThreadConfig.getUpdateInterval(ITaskWrapper.M3U8_LIVE);
config.ignoreFailure = mM3U8Option.isIgnoreFailureTs();
if (!config.tempFile.exists()) {
FileUtil.createFile(config.tempFile);
}

@ -51,6 +51,8 @@ public class SubThreadConfig {
public long updateInterval = 1000;
// 扩展数据
public Object obj;
// 忽略失败
public boolean ignoreFailure = false;
/**
* 转换线程任务类型

@ -420,6 +420,11 @@ public class ThreadTask implements IThreadTask, IThreadTaskObserver {
* 重试ts分片
*/
private void retryM3U8Peer(boolean needRetry) {
if (mConfig.ignoreFailure){
ALog.d(TAG, "忽略失败的切片");
sendFailMsg(null, false);
return;
}
boolean isConnected = NetUtils.isConnected(AriaConfig.getInstance().getAPP());
if (!isConnected && !isNotNetRetry) {
ALog.w(TAG, String.format("ts切片【%s】重试失败,网络未连接", getFileName()));

@ -49,21 +49,12 @@ public class HttpDownloadModule extends BaseViewModule {
*/
LiveData<DownloadEntity> getHttpDownloadInfo(Context context) {
//String url = AppUtil.getConfigValue(context, HTTP_URL_KEY, defUrl);
//String url =
// "http://sdkdown.muzhiwan.com/openfile/2019/05/21/com.netease.tom.mzw_5ce3ef8754d05.apk";
//String url = "http://image.totwoo.com/totwoo-TOTWOO-v3.5.6.apk";
//String url = "http://fdfs.speedata.cn:9989/group1/M00/00/05/rBGFrl3fdAKAVJwfMtSa9R18wLU139.zip";
//String url = "http://9.9.9.28:8088/files/update.zip";
//String url = "https://ss1.baidu.com/-4o3dSag_xI4khGko9WTAnF6hhy/image/h%3D300/sign=a9e671b9a551f3dedcb2bf64a4eff0ec/4610b912c8fcc3cef70d70409845d688d53f20f7.jpg";
//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 filePath = AppUtil.getConfigValue(context, HTTP_PATH_KEY, defFilePath);
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 = "http://donuts.aigauss.com/doc_fPhW2DBGj3_1578932414.png";
String filePath = "/mnt/sdcard/update.mp4";
//String url = "https://dhfspace.360drm.com/1_12809_1543904946_VID_20180808_212829.vep?e=1578554567&token=gUBmfZgZS5wy4wdQIDZG8UVxlNCyVSjvksIb13K5:WYSZRgmLbH1_9hjgqOAGmqR27JM=";
//String filePath = "/mnt/sdcard/sssss.zip";
//String url = "https://y.qq.com/download/import/QQMusic-import-1.2.1.zip";
String url = "https://static.runoob.com/images/demo/demo2.jpg";
//String filePath = "/mnt/sdcard/update.mp4";
String filePath = "/mnt/sdcard/update.jpg";
singDownloadInfo = Aria.download(context).getFirstDownloadEntity(url);
if (singDownloadInfo == null) {

@ -161,6 +161,7 @@ public class SingleTaskActivity extends BaseActivity<ActivitySingleBinding> {
if (speed > -1) {
msg = item.getTitle().toString();
T.showShort(this, msg);
Aria.get(this).getDownloadConfig().setMaxSpeed(speed);
}
return true;
}
@ -244,7 +245,8 @@ public class SingleTaskActivity extends BaseActivity<ActivitySingleBinding> {
if (task.getKey().equals(mUrl)) {
Toast.makeText(SingleTaskActivity.this, getString(R.string.download_success),
Toast.LENGTH_SHORT).show();
ALog.d(TAG, "md5: " + CommonUtil.getFileMD5(new File(task.getFilePath())));
ALog.d(TAG, "文件md5: 9886e90f014d462b560dcec9c327bdb7");
ALog.d(TAG, "下载完成的文件md5: " + CommonUtil.getFileMD5(new File(task.getFilePath())));
getBinding().pl.setInfo(task.getEntity());
}
}

Loading…
Cancel
Save