laoyuyu 5 years ago
parent e015c2a2f7
commit 2f2d783655
  1. 5
      DEV_LOG.md
  2. 12
      HttpComponent/src/main/java/com/arialyy/aria/http/download/HttpDLoaderUtil.java
  3. 27
      PublicComponent/src/main/java/com/arialyy/aria/core/AriaConfig.java
  4. 14
      PublicComponent/src/main/java/com/arialyy/aria/core/download/DownloadEntity.java
  5. 2
      app/src/main/assets/aria_config.xml
  6. 3
      app/src/main/java/com/arialyy/simple/core/download/HttpDownloadModule.java
  7. 4
      app/src/main/java/com/arialyy/simple/core/download/m3u8/M3U8VodDLoadActivity.java
  8. 3
      app/src/main/java/com/arialyy/simple/core/download/m3u8/M3U8VodModule.java

@ -1,6 +1,9 @@
## 开发日志
+ v_3.8.6
+ v_3.8.6 (2020/2/17)
- fix bug https://github.com/AriaLyy/Aria/issues/608
- fix bug https://github.com/AriaLyy/Aria/issues/579#issuecomment-586665035
- fix bug https://github.com/AriaLyy/Aria/issues/610
- fix bug https://github.com/AriaLyy/Aria/issues/614
- 优化异常提示
+ v_3.8.5 (2020/1/18)
- fix bug https://github.com/AriaLyy/Aria/issues/599

@ -15,27 +15,17 @@
*/
package com.arialyy.aria.http.download;
import com.arialyy.aria.core.TaskRecord;
import com.arialyy.aria.core.common.SubThreadConfig;
import com.arialyy.aria.core.download.DTaskWrapper;
import com.arialyy.aria.core.listener.IEventListener;
import com.arialyy.aria.core.loader.AbsNormalLoader;
import com.arialyy.aria.core.loader.AbsNormalLoaderUtil;
import com.arialyy.aria.core.loader.AbsNormalTTBuilderAdapter;
import com.arialyy.aria.core.loader.IRecordHandler;
import com.arialyy.aria.core.loader.LoaderStructure;
import com.arialyy.aria.core.loader.NormalLoader;
import com.arialyy.aria.core.loader.NormalTTBuilder;
import com.arialyy.aria.core.loader.NormalThreadStateManager;
import com.arialyy.aria.core.task.IThreadTaskAdapter;
import com.arialyy.aria.core.wrapper.AbsTaskWrapper;
import com.arialyy.aria.http.HttpRecordHandler;
import com.arialyy.aria.http.HttpTaskOption;
import com.arialyy.aria.util.ALog;
import com.arialyy.aria.util.BufferedRandomAccessFile;
import com.arialyy.aria.util.FileUtil;
import java.io.File;
import java.io.IOException;
/**
* @Author lyy
@ -60,6 +50,4 @@ public final class HttpDLoaderUtil extends AbsNormalLoaderUtil {
structure.accept(getLoader());
return structure;
}
}

@ -21,6 +21,7 @@ import android.content.Context;
import android.net.ConnectivityManager;
import android.net.Network;
import android.net.NetworkCapabilities;
import android.net.NetworkInfo;
import android.net.NetworkRequest;
import android.os.Build;
import android.os.Handler;
@ -120,6 +121,7 @@ public class AriaConfig {
* 注册网络监听只有配置了检查网络{@link AppConfig#isNetCheck()}才会注册事件
*/
private void regNetCallBack(Context context) {
isConnectedNet = isNetworkAvailable();
if (!getAConfig().isNetCheck()) {
return;
}
@ -155,6 +157,31 @@ public class AriaConfig {
}
}
public boolean isNetworkAvailable() {
// 获取手机所有连接管理对象(包括对wi-fi,net等连接的管理)
ConnectivityManager connectivityManager =
(ConnectivityManager) getAPP().getSystemService(Context.CONNECTIVITY_SERVICE);
if (connectivityManager == null) {
return false;
} else {
// 获取NetworkInfo对象
NetworkInfo[] networkInfo = connectivityManager.getAllNetworkInfo();
if (networkInfo != null && networkInfo.length > 0) {
for (NetworkInfo info : networkInfo) {
// 判断当前网络状态是否为连接状态
if (info.getState() == NetworkInfo.State.CONNECTED) {
return true;
}
}
}
}
return false;
}
public boolean isConnectedNet() {
return isConnectedNet;
}

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

@ -9,7 +9,7 @@
<!--设置Aria的日志级别,{@link ALog#LOG_LEVEL_VERBOSE}-->
<logLevel value="2"/>
<!-- 是否检查网络 true: 检查网络,false: 不检查网络-->
<netCheck value="false"/>
<netCheck value="true"/>
<!--除非无法使用注解,否则不建议使用广播来接受任务状态,true:使用广播接收任务状态,false:不适用广播接收状态 -->
<!-- http://aria.laoyuyu.me/aria_doc/api/use_broadcast.html -->
<useBroadcast value="false"/>

@ -59,6 +59,7 @@ public class HttpDownloadModule extends BaseViewModule {
//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 = "http://donuts.aigauss.com/doc_fPhW2DBGj3_1578932414.png";
String filePath = "/mnt/sdcard/update.zip";
//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";
@ -67,7 +68,7 @@ public class HttpDownloadModule extends BaseViewModule {
if (singDownloadInfo == null) {
singDownloadInfo = new DownloadEntity();
singDownloadInfo.setUrl(url);
File file = new File(defFilePath);
File file = new File(filePath);
singDownloadInfo.setFilePath(filePath);
singDownloadInfo.setFileName(file.getName());
} else {

@ -269,7 +269,7 @@ public class M3U8VodDLoadActivity extends BaseActivity<ActivityM3u8VodBinding> {
@Download.onTaskFail
void taskFail(DownloadTask task, Exception e) {
if (task.getKey().equals(mUrl)) {
if (task != null && task.getKey().equals(mUrl)) {
Toast.makeText(M3U8VodDLoadActivity.this, getString(R.string.download_fail),
Toast.LENGTH_SHORT)
.show();
@ -330,7 +330,7 @@ public class M3U8VodDLoadActivity extends BaseActivity<ActivityM3u8VodBinding> {
//String parentUrl = "http://" + uri.getHost() + "/gear1/";
int index = m3u8Url.lastIndexOf("/");
//String parentUrl = m3u8Url.substring(0, index + 1);
String parentUrl = "https://cn7.kankia.com/";
String parentUrl = "https://135zyv5.xw0371.com/2018/10/29/X05c7CG3VB91gi1M/";
//String parentUrl = "http://" + uri.getHost() + "/";
List<String> newUrls = new ArrayList<>();
for (String url : tsUrls) {

@ -35,9 +35,10 @@ public class M3U8VodModule extends BaseViewModule {
//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 = "https://cn7.kankia.com/hls/20200108/e1eaec074274c64fe46a3bdb5d2ba487/1578488360/index.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 = "https://135zyv5.xw0371.com/2018/10/29/X05c7CG3VB91gi1M/playlist.m3u8";
private final String filePath =
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getPath()
//+ "/道士下山.ts";

Loading…
Cancel
Save