修复加密的m3u8下载,并且使用索引模式时,key的uri没有使用双引号的问题 https://github.com/AriaLyy/Aria/issues/731

修复删除m3u8索引文件后,下载完成回调无法触发的问题
pull/789/head
laoyuyu 4 years ago
parent 07a1f45f1e
commit 428fbab9d2
  1. 4
      DEV_LOG.md
  2. 2
      M3U8Component/src/main/java/com/arialyy/aria/m3u8/BaseM3U8Loader.java
  3. 2
      M3U8Component/src/main/java/com/arialyy/aria/m3u8/M3U8InfoTask.java
  4. 6
      M3U8Component/src/main/java/com/arialyy/aria/m3u8/vod/M3U8VodLoader.java
  5. 31
      M3U8Component/src/main/java/com/arialyy/aria/m3u8/vod/VodStateManager.java
  6. 3
      README.md
  7. 7
      app/src/main/java/com/arialyy/simple/core/download/m3u8/M3U8VodDLoadActivity.java

@ -7,8 +7,10 @@
- 修复m3u8gzip的问题,https://github.com/AriaLyy/Aria/issues/639 - 修复m3u8gzip的问题,https://github.com/AriaLyy/Aria/issues/639
- 修复http表单上传,本地md5和上传的服务的的文件md5不一致的问题 https://github.com/AriaLyy/Aria/issues/730 - 修复http表单上传,本地md5和上传的服务的的文件md5不一致的问题 https://github.com/AriaLyy/Aria/issues/730
- 修复0kb的文件不可下载的问题 https://github.com/AriaLyy/Aria/issues/711 - 修复0kb的文件不可下载的问题 https://github.com/AriaLyy/Aria/issues/711
- 修复加密的m3u8下载,并且使用索引模式时,key的uri没有使用双引号的问题 https://github.com/AriaLyy/Aria/issues/731
- 修复删除m3u8索引文件后,下载完成回调无法触发的问题
- 增加m3u8密钥下载地址转换器增加ts列表的url地址 https://github.com/AriaLyy/Aria/issues/718 - 增加m3u8密钥下载地址转换器增加ts列表的url地址 https://github.com/AriaLyy/Aria/issues/718
- 增加现在http文件下载将使用HEAD请求获取文件大小,配置文件增加 <useHeadRequest value="true"/> - 增加现在http文件下载将使用HEAD请求获取文件大小,配置文件增加 <useHeadRequest value="true"/>。慎用,并不是所有服务器都支持head请求
- 增加允许不使用apt直接通过实现监听器来回调下载进度更新,该功能由[chenfei0928](https://github.com/chenfei0928)提交,感谢他的pr。如果注解不生效,只需要实现`DownloadListener`接口便可 - 增加允许不使用apt直接通过实现监听器来回调下载进度更新,该功能由[chenfei0928](https://github.com/chenfei0928)提交,感谢他的pr。如果注解不生效,只需要实现`DownloadListener`接口便可
- m3u8使用`ignoreFailureTs`后将不会自动重试失败的切片 https://github.com/AriaLyy/Aria/issues/662 - m3u8使用`ignoreFailureTs`后将不会自动重试失败的切片 https://github.com/AriaLyy/Aria/issues/662
+ v_3.8.10 (2020/6/26) + v_3.8.10 (2020/6/26)

@ -95,7 +95,7 @@ public abstract class BaseM3U8Loader extends AbsNormalLoader<DTaskWrapper> {
i++; i++;
} else if (line.startsWith("#EXT-X-KEY")) { } else if (line.startsWith("#EXT-X-KEY")) {
M3U8Entity m3U8Entity = getEntity().getM3U8Entity(); M3U8Entity m3U8Entity = getEntity().getM3U8Entity();
String keyInfo = String.format("#EXT-X-KEY:METHOD=%s,URI=%s,IV=%s\r\n", m3U8Entity.method, String keyInfo = String.format("#EXT-X-KEY:METHOD=%s,URI=\"%s\",IV=%s\r\n", m3U8Entity.method,
m3U8Entity.keyPath, m3U8Entity.iv); m3U8Entity.keyPath, m3U8Entity.iv);
bytes = keyInfo.getBytes(Charset.forName("UTF-8")); bytes = keyInfo.getBytes(Charset.forName("UTF-8"));
} else { } else {

@ -141,7 +141,7 @@ final public class M3U8InfoTask implements IInfoTask {
} }
fos = new FileOutputStream(indexFile); fos = new FileOutputStream(indexFile);
ALog.d(TAG, line); ALog.d(TAG, line);
addIndexInfo(isGenerateIndexFile, fos, line); addIndexInfo(true, fos, line);
} }
while ((line = reader.readLine()) != null) { while ((line = reader.readLine()) != null) {
if (isStop) { if (isStop) {

@ -18,6 +18,7 @@ package com.arialyy.aria.m3u8.vod;
import android.os.Handler; import android.os.Handler;
import android.os.Looper; import android.os.Looper;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log;
import android.util.SparseArray; import android.util.SparseArray;
import com.arialyy.aria.core.ThreadRecord; import com.arialyy.aria.core.ThreadRecord;
import com.arialyy.aria.core.common.AbsEntity; import com.arialyy.aria.core.common.AbsEntity;
@ -160,6 +161,11 @@ final class M3U8VodLoader extends BaseM3U8Loader {
// 启动定时器 // 启动定时器
startTimer(); startTimer();
if (getStateManager().isComplete()){
Log.d(TAG, "任务已完成");
getStateManager().handleTaskComplete();
return;
}
// 启动线程开始下载ts切片 // 启动线程开始下载ts切片
Thread th = new Thread(new Runnable() { Thread th = new Thread(new Runnable() {

@ -139,6 +139,25 @@ public final class VodStateManager implements IThreadStateManager {
loader.notifyWaitLock(true); loader.notifyWaitLock(true);
} }
if (isComplete()) { if (isComplete()) {
handleTaskComplete();
}
break;
case STATE_RUNNING:
Bundle b = msg.getData();
if (b != null) {
long len = b.getLong(IThreadStateManager.DATA_ADD_LEN, 0);
progress += len;
}
break;
}
return true;
}
};
/**
* 处理m3u8以完成
*/
void handleTaskComplete() {
ALog.d(TAG, String.format( ALog.d(TAG, String.format(
"startThreadNum = %s, stopNum = %s, cancelNum = %s, failNum = %s, completeNum = %s, flagQueueSize = %s", "startThreadNum = %s, stopNum = %s, cancelNum = %s, failNum = %s, completeNum = %s, flagQueueSize = %s",
startThreadNum, stopNum, cancelNum, failNum, loader.getCompleteNum(), startThreadNum, stopNum, cancelNum, failNum, loader.getCompleteNum(),
@ -162,18 +181,6 @@ public final class VodStateManager implements IThreadStateManager {
} }
quitLooper(); quitLooper();
} }
break;
case STATE_RUNNING:
Bundle b = msg.getData();
if (b != null) {
long len = b.getLong(IThreadStateManager.DATA_ADD_LEN, 0);
progress += len;
}
break;
}
return true;
}
};
void updateStateCount() { void updateStateCount() {
cancelNum.set(0); cancelNum.set(0);

@ -171,7 +171,8 @@ protected void onCreate(Bundle savedInstanceState) {
有任何问题,可以在[issues](https://github.com/AriaLyy/Aria/issues)给我留言反馈。</br> 有任何问题,可以在[issues](https://github.com/AriaLyy/Aria/issues)给我留言反馈。</br>
在提交问题前,希望你已经查看过[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>
## 请我喝瓶快乐水 ## 捐赠
Aria是作业利用业余时间开发的一个项目,如果你喜欢我写的软件,可以考虑给我捐赠以支持我的工作</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/>

@ -311,9 +311,10 @@ public class M3U8VodDLoadActivity extends BaseActivity<ActivityM3u8VodBinding> {
//.setVodTsUrlConvert(new VodTsUrlConverter()); //.setVodTsUrlConvert(new VodTsUrlConverter());
//.setMergeHandler(new TsMergeHandler()); //.setMergeHandler(new TsMergeHandler());
option.setUseDefConvert(true); option.setUseDefConvert(true);
option.setKeyUrlConverter(new KeyUrlConverter()); option.generateIndexFile();
option.setVodTsUrlConvert(new VodTsUrlConverter()); //option.setKeyUrlConverter(new KeyUrlConverter());
option.setBandWidthUrlConverter(new BandWidthUrlConverter()); //option.setVodTsUrlConvert(new VodTsUrlConverter());
//option.setBandWidthUrlConverter(new BandWidthUrlConverter());
//option.setUseDefConvert(true); //option.setUseDefConvert(true);
return option; return option;
} }

Loading…
Cancel
Save