From 9a174311d9dce21e4da0e6f7900c66e6658bd119 Mon Sep 17 00:00:00 2001 From: laoyuyu <511455842@qq.com> Date: Fri, 26 Jun 2020 13:32:50 +0800 Subject: [PATCH] =?UTF-8?q?fix=20bug=20https://github.com/AriaLyy/Aria/iss?= =?UTF-8?q?ues/703=20fix=20bug=20https://github.com/AriaLyy/Aria/issues/70?= =?UTF-8?q?2=20=E4=BC=98=E5=8C=96=E5=BC=82=E5=B8=B8=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/FUNDING.yml | 2 +- .../aria/core/download/m3u8/M3U8Option.java | 2 +- DEV_LOG.md | 2 + .../com/arialyy/aria/ftp/AbsFtpInfoTask.java | 2 +- .../aria/ftp/BaseFtpThreadTaskAdapter.java | 2 +- .../aria/ftp/download/FtpDFileInfoTask.java | 2 +- .../ftp/download/FtpDThreadTaskAdapter.java | 14 ++-- .../ftp/upload/FtpUThreadTaskAdapter.java | 14 ++-- .../aria/http/download/HttpDFileInfoTask.java | 17 +++-- .../aria/http/download/HttpDGInfoTask.java | 6 +- .../http/download/HttpDThreadTaskAdapter.java | 25 +++---- .../arialyy/aria/http/upload/HttpULoader.java | 2 +- .../http/upload/HttpUThreadTaskAdapter.java | 6 +- .../com/arialyy/aria/m3u8/M3U8InfoTask.java | 4 +- .../aria/m3u8/M3U8ThreadTaskAdapter.java | 16 ++--- .../aria/m3u8/live/M3U8LiveLoader.java | 6 +- .../arialyy/aria/m3u8/vod/M3U8VodLoader.java | 4 +- .../aria/m3u8/vod/VodStateManager.java | 2 +- .../aria/core/group/SimpleSchedulers.java | 65 +++++++++++-------- .../aria/core/group/SimpleSubQueue.java | 34 +++++----- .../aria/core/listener/BaseListener.java | 3 +- .../core/listener/DownloadGroupListener.java | 2 +- .../arialyy/aria/core/task/ThreadTask.java | 20 +++--- .../arialyy/aria/exception/AriaException.java | 14 +--- .../aria/exception/AriaFTPException.java | 8 +-- .../aria/exception/AriaGroupException.java | 28 ++++++++ .../aria/exception/AriaHTTPException.java | 8 +-- .../aria/exception/AriaM3U8Exception.java | 8 +-- .../aria/exception/AriaSFTPException.java | 8 +-- .../aria/exception/ExceptionFactory.java | 45 +++++++++++++ .../arialyy/aria/util/AriaCrashHandler.java | 2 +- .../java/com/arialyy/aria/util/ErrorHelp.java | 9 +-- .../arialyy/aria/sftp/AbsSFtpInfoTask.java | 6 +- .../aria/sftp/download/SFtpDInfoTask.java | 2 +- .../sftp/download/SFtpDThreadTaskAdapter.java | 10 +-- .../sftp/upload/SFtpUThreadTaskAdapter.java | 10 +-- .../core/download/SingleTaskActivity.java | 1 - .../download/group/DownloadGroupActivity.java | 2 + .../core/download/group/GroupModule.java | 22 ++----- .../download/m3u8/M3U8VodDLoadActivity.java | 7 +- 40 files changed, 252 insertions(+), 190 deletions(-) create mode 100644 PublicComponent/src/main/java/com/arialyy/aria/exception/AriaGroupException.java create mode 100644 PublicComponent/src/main/java/com/arialyy/aria/exception/ExceptionFactory.java diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 8eb84f5e..af3c2759 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -3,5 +3,5 @@ # github: ["AriaLyy"] # patreon: AriaLyy # liberapay: Aria -custom: ["https://afdian.net/@arialyy/plan", "paypal.me/arialyy"] +custom: ["https://afdian.net/@arialyy/plan", "https://paypal.me/arialyy"] diff --git a/Aria/src/main/java/com/arialyy/aria/core/download/m3u8/M3U8Option.java b/Aria/src/main/java/com/arialyy/aria/core/download/m3u8/M3U8Option.java index e419a1d0..7bc57a10 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/download/m3u8/M3U8Option.java +++ b/Aria/src/main/java/com/arialyy/aria/core/download/m3u8/M3U8Option.java @@ -49,7 +49,7 @@ public class M3U8Option extends BaseOption { * @param useDefConvert true 使用默认的转换器,false 关闭默认的转换器 */ public OP setUseDefConvert(boolean useDefConvert) { - this.useDefConvert = true; + this.useDefConvert = useDefConvert; ALog.d(TAG, "使用默认的码率转换器和TS转换器,如果无法下载,请参考:https://github.com/AriaLyy/Aria/issues/597 定制转换器"); return (OP) this; } diff --git a/DEV_LOG.md b/DEV_LOG.md index b3891b9b..bc2e16bc 100644 --- a/DEV_LOG.md +++ b/DEV_LOG.md @@ -1,4 +1,6 @@ ## 开发日志 + + v_3.8.10 + - fix bug https://github.com/AriaLyy/Aria/issues/703 + v_3.8.9 (2020/6/14) - fix bug https://github.com/AriaLyy/Aria/issues/688 - fix bug https://github.com/AriaLyy/Aria/issues/690 diff --git a/FtpComponent/src/main/java/com/arialyy/aria/ftp/AbsFtpInfoTask.java b/FtpComponent/src/main/java/com/arialyy/aria/ftp/AbsFtpInfoTask.java index 145453aa..3f09ac0d 100644 --- a/FtpComponent/src/main/java/com/arialyy/aria/ftp/AbsFtpInfoTask.java +++ b/FtpComponent/src/main/java/com/arialyy/aria/ftp/AbsFtpInfoTask.java @@ -328,7 +328,7 @@ public abstract class AbsFtpInfoTask 0) { @@ -65,7 +65,7 @@ final class FtpDThreadTaskAdapter extends BaseFtpThreadTaskAdapter { //发送第二次指令时,还需要再做一次判断 int reply = client.getReplyCode(); if (!FTPReply.isPositivePreliminary(reply) && reply != FTPReply.COMMAND_OK) { - fail(new AriaFTPException(TAG, + fail(new AriaFTPException( String.format("获取文件信息错误,错误码为:%s,msg:%s", reply, client.getReplyString())), false); client.disconnect(); return; @@ -76,7 +76,7 @@ final class FtpDThreadTaskAdapter extends BaseFtpThreadTaskAdapter { is = client.retrieveFileStream(remotePath); reply = client.getReplyCode(); if (!FTPReply.isPositivePreliminary(reply)) { - fail(new AriaFTPException(TAG, + fail(new AriaFTPException( String.format("获取流失败,错误码为:%s,msg:%s", reply, client.getReplyString())), true); client.disconnect(); return; @@ -89,9 +89,9 @@ final class FtpDThreadTaskAdapter extends BaseFtpThreadTaskAdapter { handleComplete(); } } catch (IOException e) { - fail(new AriaFTPException(TAG, String.format("下载失败【%s】", getThreadConfig().url), e), true); + fail(new AriaFTPException(String.format("下载失败【%s】", getThreadConfig().url), e), true); } catch (Exception e) { - fail(new AriaFTPException(TAG, String.format("下载失败【%s】", getThreadConfig().url), e), false); + fail(new AriaFTPException(String.format("下载失败【%s】", getThreadConfig().url), e), false); } finally { try { if (is != null) { @@ -153,7 +153,7 @@ final class FtpDThreadTaskAdapter extends BaseFtpThreadTaskAdapter { } handleComplete(); } catch (IOException e) { - fail(new AriaFTPException(TAG, String.format("下载失败【%s】", getThreadConfig().url), e), true); + fail(new AriaFTPException(String.format("下载失败【%s】", getThreadConfig().url), e), true); } finally { try { if (fos != null) { @@ -203,7 +203,7 @@ final class FtpDThreadTaskAdapter extends BaseFtpThreadTaskAdapter { } } } catch (IOException e) { - fail(new AriaFTPException(TAG, String.format("下载失败【%s】", getThreadConfig().url), e), true); + fail(new AriaFTPException(String.format("下载失败【%s】", getThreadConfig().url), e), true); } finally { try { if (file != null) { diff --git a/FtpComponent/src/main/java/com/arialyy/aria/ftp/upload/FtpUThreadTaskAdapter.java b/FtpComponent/src/main/java/com/arialyy/aria/ftp/upload/FtpUThreadTaskAdapter.java index ecb34d15..5d30d4a8 100644 --- a/FtpComponent/src/main/java/com/arialyy/aria/ftp/upload/FtpUThreadTaskAdapter.java +++ b/FtpComponent/src/main/java/com/arialyy/aria/ftp/upload/FtpUThreadTaskAdapter.java @@ -67,7 +67,7 @@ final class FtpUThreadTaskAdapter extends BaseFtpThreadTaskAdapter { client.setRestartOffset(getThreadRecord().startLocation); int reply = client.getReplyCode(); if (!FTPReply.isPositivePreliminary(reply) && reply != FTPReply.FILE_ACTION_OK) { - fail(new AriaFTPException(TAG, + fail(new AriaFTPException( String.format("文件上传错误,错误码为:%s, msg:%s, filePath: %s", reply, client.getReplyString(), getEntity().getFilePath())), false); client.disconnect(); @@ -85,7 +85,7 @@ final class FtpUThreadTaskAdapter extends BaseFtpThreadTaskAdapter { return; } if (!complete) { - fail(new AriaFTPException(TAG, "ftp文件上传失败"), false); + fail(new AriaFTPException("ftp文件上传失败"), false); return; } ALog.i(TAG, @@ -93,11 +93,11 @@ final class FtpUThreadTaskAdapter extends BaseFtpThreadTaskAdapter { complete(); } catch (IOException e) { e.printStackTrace(); - fail(new AriaFTPException(TAG, + fail(new AriaFTPException( String.format("上传失败,filePath: %s, uploadUrl: %s", getEntity().getFilePath(), getThreadConfig().url)), true); } catch (Exception e) { - fail(new AriaFTPException(TAG, null, e), false); + fail(new AriaFTPException(null, e), false); } finally { try { if (file != null) { @@ -136,7 +136,7 @@ final class FtpUThreadTaskAdapter extends BaseFtpThreadTaskAdapter { @Override public void run() { try { if (isTimeOut) { - fail(new AriaFTPException(TAG, "socket连接失败,该问题一般出现于网络断开,客户端重新连接," + fail(new AriaFTPException("socket连接失败,该问题一般出现于网络断开,客户端重新连接," + "但是服务器端无法创建socket缺没有返回错误码的情况。"), false); if (fa != null) { fa.close(); @@ -199,7 +199,7 @@ final class FtpUThreadTaskAdapter extends BaseFtpThreadTaskAdapter { if (e.getMessage().contains("AriaIOException caught while copying")) { e.printStackTrace(); } else { - fail(new AriaFTPException(TAG, msg, e), !storeSuccess); + fail(new AriaFTPException(msg, e), !storeSuccess); } return false; } finally { @@ -208,7 +208,7 @@ final class FtpUThreadTaskAdapter extends BaseFtpThreadTaskAdapter { int reply = client.getReplyCode(); if (!FTPReply.isPositiveCompletion(reply)) { if (reply != FTPReply.TRANSFER_ABORTED) { - fail(new AriaFTPException(TAG, + fail(new AriaFTPException( String.format("文件上传错误,错误码为:%s, msg:%s, filePath: %s", reply, client.getReplyString(), getEntity().getFilePath())), false); } diff --git a/HttpComponent/src/main/java/com/arialyy/aria/http/download/HttpDFileInfoTask.java b/HttpComponent/src/main/java/com/arialyy/aria/http/download/HttpDFileInfoTask.java index ed26d1c5..9834c217 100644 --- a/HttpComponent/src/main/java/com/arialyy/aria/http/download/HttpDFileInfoTask.java +++ b/HttpComponent/src/main/java/com/arialyy/aria/http/download/HttpDFileInfoTask.java @@ -84,7 +84,7 @@ final class HttpDFileInfoTask implements IInfoTask, Runnable { conn.connect(); handleConnect(conn); } catch (IOException e) { - failDownload(new AriaHTTPException(TAG, + failDownload(new AriaHTTPException( String.format("下载失败,filePath: %s, url: %s", mEntity.getFilePath(), mEntity.getUrl()), e), true); } finally { @@ -133,7 +133,7 @@ final class HttpDFileInfoTask implements IInfoTask, Runnable { long len = lenAdapter.handleFileLen(conn.getHeaderFields()); if (!FileUtil.checkMemorySpace(mEntity.getFilePath(), len)) { - failDownload(new AriaHTTPException(TAG, + failDownload(new AriaHTTPException( String.format("下载失败,内存空间不足;filePath: %s, url: %s", mEntity.getFilePath(), mEntity.getUrl())), false); return; @@ -183,8 +183,7 @@ final class HttpDFileInfoTask implements IInfoTask, Runnable { if (!checkLen(len) && !isChunked) { if (len < 0) { failDownload( - new AriaHTTPException(TAG, - String.format("任务下载失败,文件长度小于0, url: %s", mEntity.getUrl())), + new AriaHTTPException(String.format("任务下载失败,文件长度小于0, url: %s", mEntity.getUrl())), false); } return; @@ -211,7 +210,7 @@ final class HttpDFileInfoTask implements IInfoTask, Runnable { } else if (!checkLen(len) && !isChunked) { if (len < 0) { failDownload( - new AriaHTTPException(TAG, + new AriaHTTPException( String.format("任务下载失败,文件长度小于0, url: %s", mEntity.getUrl())), false); } @@ -229,10 +228,10 @@ final class HttpDFileInfoTask implements IInfoTask, Runnable { || code == 307) { handleUrlReTurn(conn, conn.getHeaderField("Location")); } else if (code >= HttpURLConnection.HTTP_BAD_REQUEST) { - failDownload(new AriaHTTPException(TAG, + failDownload(new AriaHTTPException( String.format("任务下载失败,errorCode:%s, url: %s", code, mEntity.getUrl())), false); } else { - failDownload(new AriaHTTPException(TAG, + failDownload(new AriaHTTPException( String.format("任务下载失败,errorCode:%s, errorMsg: %s, url: %s", code, conn.getResponseMessage(), mEntity.getUrl())), !CheckUtil.httpIsBadRequest(code)); } @@ -311,7 +310,7 @@ final class HttpDFileInfoTask implements IInfoTask, Runnable { ALog.d(TAG, "30x跳转,新url为【" + newUrl + "】"); if (TextUtils.isEmpty(newUrl) || newUrl.equalsIgnoreCase("null")) { if (callback != null) { - callback.onFail(mEntity, new AriaHTTPException(TAG, "获取重定向链接失败"), false); + callback.onFail(mEntity, new AriaHTTPException("获取重定向链接失败"), false); } return; } @@ -321,7 +320,7 @@ final class HttpDFileInfoTask implements IInfoTask, Runnable { } if (!CheckUtil.checkUrl(newUrl)) { - failDownload(new AriaHTTPException(TAG, "下载失败,重定向url错误"), false); + failDownload(new AriaHTTPException("下载失败,重定向url错误"), false); return; } taskOption.setRedirectUrl(newUrl); diff --git a/HttpComponent/src/main/java/com/arialyy/aria/http/download/HttpDGInfoTask.java b/HttpComponent/src/main/java/com/arialyy/aria/http/download/HttpDGInfoTask.java index 619c1a0d..b02e1b44 100644 --- a/HttpComponent/src/main/java/com/arialyy/aria/http/download/HttpDGInfoTask.java +++ b/HttpComponent/src/main/java/com/arialyy/aria/http/download/HttpDGInfoTask.java @@ -60,7 +60,7 @@ public final class HttpDGInfoTask implements IInfoTask { ALog.e(TAG, String.format("获取文件信息失败,url:%s", ((DownloadEntity) entity).getUrl())); count.getAndIncrement(); failCount.getAndIncrement(); - listener.onSubFail((DownloadEntity) entity, new AriaHTTPException(TAG, + listener.onSubFail((DownloadEntity) entity, new AriaHTTPException( String.format("子任务获取文件长度失败,url:%s", ((DownloadEntity) entity).getUrl()))); checkGetSizeComplete(count.get(), failCount.get()); } @@ -111,7 +111,7 @@ public final class HttpDGInfoTask implements IInfoTask { DownloadEntity subEntity = dTaskWrapper.getEntity(); if (subEntity.getFileSize() > 0) { count.getAndIncrement(); - if (subEntity.getCurrentProgress() < subEntity.getFileSize()){ + if (subEntity.getCurrentProgress() < subEntity.getFileSize()) { // 如果没有完成需要拷贝一份数据 cloneHeader(dTaskWrapper); } @@ -132,7 +132,7 @@ public final class HttpDGInfoTask implements IInfoTask { */ private void checkGetSizeComplete(int count, int failCount) { if (failCount == wrapper.getSubTaskWrapper().size()) { - callback.onFail(wrapper.getEntity(), new AriaHTTPException(TAG, "获取子任务长度失败"), false); + callback.onFail(wrapper.getEntity(), new AriaHTTPException("获取子任务长度失败"), false); notifyLock(); return; } diff --git a/HttpComponent/src/main/java/com/arialyy/aria/http/download/HttpDThreadTaskAdapter.java b/HttpComponent/src/main/java/com/arialyy/aria/http/download/HttpDThreadTaskAdapter.java index 4ec147b4..676c38c3 100644 --- a/HttpComponent/src/main/java/com/arialyy/aria/http/download/HttpDThreadTaskAdapter.java +++ b/HttpComponent/src/main/java/com/arialyy/aria/http/download/HttpDThreadTaskAdapter.java @@ -117,21 +117,17 @@ final class HttpDThreadTaskAdapter extends BaseHttpThreadTaskAdapter { handleComplete(); } } catch (MalformedURLException e) { - fail(new AriaHTTPException(TAG, - String.format("任务【%s】下载失败,filePath: %s, url: %s", getFileName(), - getEntity().getFilePath(), getEntity().getUrl()), e), false); + fail(new AriaHTTPException(String.format("任务【%s】下载失败,filePath: %s, url: %s", getFileName(), + getEntity().getFilePath(), getEntity().getUrl()), e), false); } catch (IOException e) { - fail(new AriaHTTPException(TAG, - String.format("任务【%s】下载失败,filePath: %s, url: %s", getFileName(), - getEntity().getFilePath(), getEntity().getUrl()), e), true); + fail(new AriaHTTPException(String.format("任务【%s】下载失败,filePath: %s, url: %s", getFileName(), + getEntity().getFilePath(), getEntity().getUrl()), e), true); } catch (ArrayIndexOutOfBoundsException e) { - fail(new AriaHTTPException(TAG, - String.format("任务【%s】下载失败,filePath: %s, url: %s", getFileName(), - getEntity().getFilePath(), getEntity().getUrl()), e), false); + fail(new AriaHTTPException(String.format("任务【%s】下载失败,filePath: %s, url: %s", getFileName(), + getEntity().getFilePath(), getEntity().getUrl()), e), false); } catch (Exception e) { - fail(new AriaHTTPException(TAG, - String.format("任务【%s】下载失败,filePath: %s, url: %s", getFileName(), - getEntity().getFilePath(), getEntity().getUrl()), e), false); + fail(new AriaHTTPException(String.format("任务【%s】下载失败,filePath: %s, url: %s", getFileName(), + getEntity().getFilePath(), getEntity().getUrl()), e), false); } finally { try { if (file != null) { @@ -171,7 +167,7 @@ final class HttpDThreadTaskAdapter extends BaseHttpThreadTaskAdapter { } handleComplete(); } catch (IOException e) { - fail(new AriaHTTPException(TAG, + fail(new AriaHTTPException( String.format("文件下载失败,savePath: %s, url: %s", getEntity().getFilePath(), getThreadConfig().url), e), true); } finally { @@ -224,8 +220,7 @@ final class HttpDThreadTaskAdapter extends BaseHttpThreadTaskAdapter { } handleComplete(); } catch (IOException e) { - fail(new AriaHTTPException(TAG, - String.format("文件下载失败,savePath: %s, url: %s", getEntity().getFilePath(), + fail(new AriaHTTPException(String.format("文件下载失败,savePath: %s, url: %s", getEntity().getFilePath(), getThreadConfig().url), e), true); } finally { try { diff --git a/HttpComponent/src/main/java/com/arialyy/aria/http/upload/HttpULoader.java b/HttpComponent/src/main/java/com/arialyy/aria/http/upload/HttpULoader.java index fbddde7b..986a599a 100644 --- a/HttpComponent/src/main/java/com/arialyy/aria/http/upload/HttpULoader.java +++ b/HttpComponent/src/main/java/com/arialyy/aria/http/upload/HttpULoader.java @@ -62,7 +62,7 @@ final class HttpULoader extends AbsNormalLoader { new Handler(looper, mStateManager.getHandlerCallback())); if (tt == null || tt.isEmpty()) { ALog.e(TAG, "创建线程任务失败"); - getListener().onFail(false, new AriaHTTPException(TAG, "创建线程任务失败")); + getListener().onFail(false, new AriaHTTPException("创建线程任务失败")); return; } diff --git a/HttpComponent/src/main/java/com/arialyy/aria/http/upload/HttpUThreadTaskAdapter.java b/HttpComponent/src/main/java/com/arialyy/aria/http/upload/HttpUThreadTaskAdapter.java index 4fb10d50..77104a91 100644 --- a/HttpComponent/src/main/java/com/arialyy/aria/http/upload/HttpUThreadTaskAdapter.java +++ b/HttpComponent/src/main/java/com/arialyy/aria/http/upload/HttpUThreadTaskAdapter.java @@ -54,7 +54,7 @@ final class HttpUThreadTaskAdapter extends BaseHttpThreadTaskAdapter { @Override protected void handlerThreadTask() { File uploadFile = new File(getEntity().getFilePath()); if (!uploadFile.exists()) { - fail(new AriaHTTPException(TAG, + fail(new AriaHTTPException( String.format("上传失败,文件不存在;filePath: %s, url: %s", getEntity().getFilePath(), getEntity().getUrl()))); return; @@ -104,7 +104,7 @@ final class HttpUThreadTaskAdapter extends BaseHttpThreadTaskAdapter { getEntity().setResponseStr(finish(writer)); } catch (Exception e) { e.printStackTrace(); - fail(new AriaHTTPException(TAG, + fail(new AriaHTTPException( String.format("上传失败,filePath: %s, url: %s", getEntity().getFilePath(), getEntity().getUrl()), e)); } @@ -220,7 +220,7 @@ final class HttpUThreadTaskAdapter extends BaseHttpThreadTaskAdapter { } else { String msg = "response msg: " + mHttpConn.getResponseMessage() + ",code: " + status; ALog.e(TAG, msg); - fail(new AriaHTTPException(TAG, msg), false); + fail(new AriaHTTPException(msg), false); } writer.flush(); writer.close(); diff --git a/M3U8Component/src/main/java/com/arialyy/aria/m3u8/M3U8InfoTask.java b/M3U8Component/src/main/java/com/arialyy/aria/m3u8/M3U8InfoTask.java index 8d3a80f6..b7189778 100644 --- a/M3U8Component/src/main/java/com/arialyy/aria/m3u8/M3U8InfoTask.java +++ b/M3U8Component/src/main/java/com/arialyy/aria/m3u8/M3U8InfoTask.java @@ -295,7 +295,7 @@ final public class M3U8InfoTask implements IInfoTask { ALog.d(TAG, "30x跳转,新url为【" + newUrl + "】"); if (TextUtils.isEmpty(newUrl) || newUrl.equalsIgnoreCase("null")) { if (mCallback != null) { - mCallback.onFail(mEntity, new AriaM3U8Exception(TAG, "获取重定向链接失败"), false); + mCallback.onFail(mEntity, new AriaM3U8Exception("获取重定向链接失败"), false); } return; } @@ -354,7 +354,7 @@ final public class M3U8InfoTask implements IInfoTask { } private void failDownload(String errorInfo, boolean needRetry) { - mCallback.onFail(mEntity, new AriaM3U8Exception(TAG, errorInfo), needRetry); + mCallback.onFail(mEntity, new AriaM3U8Exception(errorInfo), needRetry); } /** diff --git a/M3U8Component/src/main/java/com/arialyy/aria/m3u8/M3U8ThreadTaskAdapter.java b/M3U8Component/src/main/java/com/arialyy/aria/m3u8/M3U8ThreadTaskAdapter.java index 496cf2c1..6e30ab2b 100644 --- a/M3U8Component/src/main/java/com/arialyy/aria/m3u8/M3U8ThreadTaskAdapter.java +++ b/M3U8Component/src/main/java/com/arialyy/aria/m3u8/M3U8ThreadTaskAdapter.java @@ -91,15 +91,15 @@ public final class M3U8ThreadTaskAdapter extends AbsThreadTaskAdapter { handleConn(conn); } catch (MalformedURLException e) { - fail(new AriaM3U8Exception(TAG, + fail(new AriaM3U8Exception( String.format("分片【%s】下载失败,filePath: %s, url: %s", getThreadRecord().threadId, getThreadConfig().tempFile.getPath(), getEntity().getUrl()), e), false); } catch (IOException e) { - fail(new AriaM3U8Exception(TAG, + fail(new AriaM3U8Exception( String.format("分片【%s】下载失败,filePath: %s, url: %s", getThreadRecord().threadId, getThreadConfig().tempFile.getPath(), getEntity().getUrl()), e), true); } catch (Exception e) { - fail(new AriaM3U8Exception(TAG, + fail(new AriaM3U8Exception( String.format("分片【%s】下载失败,filePath: %s, url: %s", getThreadRecord().threadId, getThreadConfig().tempFile.getPath(), getEntity().getUrl()), e), false); } finally { @@ -137,7 +137,7 @@ public final class M3U8ThreadTaskAdapter extends AbsThreadTaskAdapter { || code == 307) { handleUrlReTurn(conn, conn.getHeaderField("Location")); } else { - fail(new AriaM3U8Exception(TAG, + fail(new AriaM3U8Exception( String.format("连接错误,http错误码:%s,url:%s", code, getThreadConfig().url)), false); } @@ -150,7 +150,7 @@ public final class M3U8ThreadTaskAdapter extends AbsThreadTaskAdapter { private void handleUrlReTurn(HttpURLConnection conn, String newUrl) throws IOException { ALog.d(TAG, "30x跳转,新url为【" + newUrl + "】"); if (TextUtils.isEmpty(newUrl) || newUrl.equalsIgnoreCase("null")) { - fail(new AriaM3U8Exception(TAG, "下载失败,重定向url为空"), false); + fail(new AriaM3U8Exception("下载失败,重定向url为空"), false); return; } @@ -160,7 +160,7 @@ public final class M3U8ThreadTaskAdapter extends AbsThreadTaskAdapter { } if (!CheckUtil.checkUrl(newUrl)) { - fail(new AriaM3U8Exception(TAG, "下载失败,重定向url错误"), false); + fail(new AriaM3U8Exception("下载失败,重定向url错误"), false); return; } String cookies = conn.getHeaderField("Set-Cookie"); @@ -198,7 +198,7 @@ public final class M3U8ThreadTaskAdapter extends AbsThreadTaskAdapter { } handleComplete(); } catch (IOException e) { - fail(new AriaM3U8Exception(TAG, + fail(new AriaM3U8Exception( String.format("文件下载失败,savePath: %s, url: %s", getThreadConfig().tempFile.getPath(), getThreadConfig().url), e), true); } finally { @@ -241,7 +241,7 @@ public final class M3U8ThreadTaskAdapter extends AbsThreadTaskAdapter { } handleComplete(); } catch (IOException e) { - fail(new AriaM3U8Exception(TAG, + fail(new AriaM3U8Exception( String.format("文件下载失败,savePath: %s, url: %s", getThreadConfig().tempFile.getPath(), getThreadConfig().url), e), true); } finally { diff --git a/M3U8Component/src/main/java/com/arialyy/aria/m3u8/live/M3U8LiveLoader.java b/M3U8Component/src/main/java/com/arialyy/aria/m3u8/live/M3U8LiveLoader.java index d46a1f89..85363a74 100644 --- a/M3U8Component/src/main/java/com/arialyy/aria/m3u8/live/M3U8LiveLoader.java +++ b/M3U8Component/src/main/java/com/arialyy/aria/m3u8/live/M3U8LiveLoader.java @@ -276,7 +276,7 @@ final class M3U8LiveLoader extends BaseM3U8Loader { } } if (TextUtils.isEmpty(url) || !url.startsWith("http")) { - fail(new AriaM3U8Exception(TAG, String.format("ts地址错误,url:%s", url)), false); + fail(new AriaM3U8Exception(String.format("ts地址错误,url:%s", url)), false); return; } offerPeer(new M3U8LiveLoader.ExtInfo(url, extInf)); @@ -297,13 +297,13 @@ final class M3U8LiveLoader extends BaseM3U8Loader { if (generateIndexFile(true)) { getListener().onComplete(); } else { - getListener().onFail(false, new AriaM3U8Exception(TAG, "创建索引文件失败")); + getListener().onFail(false, new AriaM3U8Exception("创建索引文件失败")); } } else if (mM3U8Option.isMergeFile()) { if (mergeFile()) { getListener().onComplete(); } else { - getListener().onFail(false, new AriaM3U8Exception(TAG, "合并文件失败")); + getListener().onFail(false, new AriaM3U8Exception("合并文件失败")); } } else { getListener().onComplete(); diff --git a/M3U8Component/src/main/java/com/arialyy/aria/m3u8/vod/M3U8VodLoader.java b/M3U8Component/src/main/java/com/arialyy/aria/m3u8/vod/M3U8VodLoader.java index c2f8547f..14e0e1dc 100644 --- a/M3U8Component/src/main/java/com/arialyy/aria/m3u8/vod/M3U8VodLoader.java +++ b/M3U8Component/src/main/java/com/arialyy/aria/m3u8/vod/M3U8VodLoader.java @@ -519,10 +519,10 @@ final class M3U8VodLoader extends BaseM3U8Loader { urls.addAll((Collection) info.obj); } if (urls.isEmpty()) { - fail(new AriaM3U8Exception(TAG, "获取地址失败"), false); + fail(new AriaM3U8Exception("获取地址失败"), false); return; } else if (!urls.get(0).startsWith("http")) { - fail(new AriaM3U8Exception(TAG, "地址错误,请使用IVodTsUrlConverter处理你的url信息"), false); + fail(new AriaM3U8Exception("地址错误,请使用IVodTsUrlConverter处理你的url信息"), false); return; } mM3U8Option.setUrls(urls); diff --git a/M3U8Component/src/main/java/com/arialyy/aria/m3u8/vod/VodStateManager.java b/M3U8Component/src/main/java/com/arialyy/aria/m3u8/vod/VodStateManager.java index f5dc952c..44f22549 100644 --- a/M3U8Component/src/main/java/com/arialyy/aria/m3u8/vod/VodStateManager.java +++ b/M3U8Component/src/main/java/com/arialyy/aria/m3u8/vod/VodStateManager.java @@ -149,7 +149,7 @@ public final class VodStateManager implements IThreadStateManager { if (loader.generateIndexFile(false)) { listener.onComplete(); } else { - listener.onFail(false, new AriaM3U8Exception(TAG, "创建索引文件失败")); + listener.onFail(false, new AriaM3U8Exception("创建索引文件失败")); } } else if (m3U8Option.isMergeFile()) { if (mergeFile()) { diff --git a/PublicComponent/src/main/java/com/arialyy/aria/core/group/SimpleSchedulers.java b/PublicComponent/src/main/java/com/arialyy/aria/core/group/SimpleSchedulers.java index fe06ab46..2c232f06 100644 --- a/PublicComponent/src/main/java/com/arialyy/aria/core/group/SimpleSchedulers.java +++ b/PublicComponent/src/main/java/com/arialyy/aria/core/group/SimpleSchedulers.java @@ -19,13 +19,14 @@ package com.arialyy.aria.core.group; import android.os.Bundle; import android.os.Handler; import android.os.Message; +import android.util.Log; import com.arialyy.aria.core.AriaConfig; import com.arialyy.aria.core.TaskRecord; import com.arialyy.aria.core.config.Configuration; import com.arialyy.aria.core.inf.IThreadStateManager; import com.arialyy.aria.core.loader.IRecordHandler; import com.arialyy.aria.core.manager.ThreadTaskManager; -import com.arialyy.aria.exception.AriaException; +import com.arialyy.aria.exception.ExceptionFactory; import com.arialyy.aria.util.ALog; import com.arialyy.aria.util.CommonUtil; import com.arialyy.aria.util.NetUtils; @@ -72,7 +73,7 @@ final class SimpleSchedulers implements Handler.Callback { mGState.listener.onSubRunning(loaderUtil.getEntity(), range); break; case IThreadStateManager.STATE_PRE: - mGState.listener.onSubPre(loaderUtil.getEntity( )); + mGState.listener.onSubPre(loaderUtil.getEntity()); mGState.updateCount(loaderUtil.getKey()); break; case IThreadStateManager.STATE_START: @@ -104,8 +105,11 @@ final class SimpleSchedulers implements Handler.Callback { * @param needRetry true 需要重试,false 不需要重试 */ private synchronized void handleFail(final AbsSubDLoadUtil loaderUtil, boolean needRetry) { - Configuration config = Configuration.getInstance(); + Log.d(TAG, String.format("handleFail, size = %s, completeNum = %s, failNum = %s, stopNum = %s", + mGState.getSubSize(), mGState.getCompleteNum(), mGState.getFailNum(), + mGState.getSubSize())); + Configuration config = Configuration.getInstance(); int num = config.dGroupCfg.getSubReTryNum(); boolean isNotNetRetry = config.appCfg.isNotNetRetry(); @@ -114,25 +118,27 @@ final class SimpleSchedulers implements Handler.Callback { || loaderUtil.getLoader() == null // 如果获取不到文件信息,loader为空 || loaderUtil.getEntity().getFailNum() > num) { mQueue.removeTaskFromExecQ(loaderUtil); - mGState.listener.onSubFail(loaderUtil.getEntity(), new AriaException(TAG, - String.format("任务组子任务【%s】下载失败,下载地址【%s】", loaderUtil.getEntity().getFileName(), - loaderUtil.getEntity().getUrl()))); + mGState.listener.onSubFail(loaderUtil.getEntity(), + ExceptionFactory.getException(ExceptionFactory.TYPE_GROUP, + String.format("任务组子任务【%s】下载失败,下载地址【%s】", loaderUtil.getEntity().getFileName(), + loaderUtil.getEntity().getUrl()), null)); mGState.countFailNum(loaderUtil.getKey()); if (mGState.getFailNum() == mGState.getSubSize() || mGState.getStopNum() + mGState.getFailNum() + mGState.getCompleteNum() == mGState.getSubSize()) { - mQueue.clear(); mGState.isRunning.set(false); - if (mGState.getCompleteNum() > 0&&Configuration.getInstance().dGroupCfg.isSubFailAsStop()) { + if (mGState.getCompleteNum() > 0 + && Configuration.getInstance().dGroupCfg.isSubFailAsStop()) { ALog.e(TAG, String.format("任务组【%s】停止", mGState.getGroupHash())); mGState.listener.onStop(mGState.getProgress()); - } else { - mGState.listener.onFail(false, new AriaException(TAG, - String.format("任务组【%s】下载失败", mGState.getGroupHash()))); + return; } - } else { - startNext(); + mGState.listener.onFail(false, + ExceptionFactory.getException(ExceptionFactory.TYPE_GROUP, + String.format("任务组【%s】下载失败", mGState.getGroupHash()), null)); + return; } + startNext(); return; } SimpleSubRetryQueue.getInstance().offer(loaderUtil); @@ -144,6 +150,10 @@ final class SimpleSchedulers implements Handler.Callback { * 2、completeNum + failNum + stopNum = subSize,则认为组合任务停止 */ private synchronized void handleStop(AbsSubDLoadUtil loadUtil, long curLocation) { + Log.d(TAG, String.format("handleStop, size = %s, completeNum = %s, failNum = %s, stopNum = %s", + mGState.getSubSize(), mGState.getCompleteNum(), mGState.getFailNum(), + mGState.getSubSize())); + mGState.listener.onSubStop(loadUtil.getEntity(), curLocation); mGState.countStopNum(loadUtil.getKey()); if (mGState.getStopNum() == mGState.getSubSize() @@ -152,12 +162,11 @@ final class SimpleSchedulers implements Handler.Callback { + mGState.getFailNum() + mQueue.getCacheSize() == mGState.getSubSize()) { - mQueue.clear(); mGState.isRunning.set(false); mGState.listener.onStop(mGState.getProgress()); - } else { - startNext(); + return; } + startNext(); } /** @@ -170,6 +179,11 @@ final class SimpleSchedulers implements Handler.Callback { */ private synchronized void handleComplete(AbsSubDLoadUtil loader) { ALog.d(TAG, String.format("子任务【%s】完成", loader.getEntity().getFileName())); + Log.d(TAG, + String.format("handleComplete, size = %s, completeNum = %s, failNum = %s, stopNum = %s", + mGState.getSubSize(), mGState.getCompleteNum(), mGState.getFailNum(), + mGState.getSubSize())); + TaskRecord record = loader.getRecord(); if (record != null && record.isBlock) { File partFile = @@ -180,23 +194,22 @@ final class SimpleSchedulers implements Handler.Callback { mGState.listener.onSubComplete(loader.getEntity()); mQueue.removeTaskFromExecQ(loader); mGState.updateCompleteNum(); - ALog.d(TAG, String.format("总任务数:%s,完成的任务数:%s,失败的任务数:%s,停止的任务数:%s", mGState.getSubSize(), - mGState.getCompleteNum(), mGState.getFailNum(), mGState.getStopNum())); if (mGState.getCompleteNum() + mGState.getFailNum() + mGState.getStopNum() == mGState.getSubSize()) { if (mGState.getStopNum() == 0 && mGState.getFailNum() == 0) { mGState.listener.onComplete(); - } else if(mGState.getStopNum() == 0&&!Configuration.getInstance().dGroupCfg.isSubFailAsStop() ){ - mGState.listener.onFail(false, new AriaException(TAG, - String.format("任务组【%s】下载失败", mGState.getGroupHash()))); + } else if (mGState.getStopNum() == 0 + && !Configuration.getInstance().dGroupCfg.isSubFailAsStop()) { + mGState.listener.onFail(false, + ExceptionFactory.getException(ExceptionFactory.TYPE_GROUP, + String.format("任务组【%s】下载失败", mGState.getGroupHash()), null)); } else { mGState.listener.onStop(mGState.getProgress()); } - mQueue.clear(); mGState.isRunning.set(false); - } else { - startNext(); + return; } + startNext(); } /** @@ -210,8 +223,8 @@ final class SimpleSchedulers implements Handler.Callback { if (next != null) { ALog.d(TAG, String.format("启动任务:%s", next.getEntity().getFileName())); mQueue.startTask(next); - } else { - ALog.i(TAG, "没有下一子任务"); + return; } + ALog.i(TAG, "没有下一子任务"); } } diff --git a/PublicComponent/src/main/java/com/arialyy/aria/core/group/SimpleSubQueue.java b/PublicComponent/src/main/java/com/arialyy/aria/core/group/SimpleSubQueue.java index 3a6dae12..3ce35f9b 100644 --- a/PublicComponent/src/main/java/com/arialyy/aria/core/group/SimpleSubQueue.java +++ b/PublicComponent/src/main/java/com/arialyy/aria/core/group/SimpleSubQueue.java @@ -21,10 +21,10 @@ import com.arialyy.aria.util.CommonUtil; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; -import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; /** * 组合任务队列,该队列生命周期和{@link AbsGroupLoaderUtil}生命周期一致 @@ -34,11 +34,11 @@ final class SimpleSubQueue implements ISubQueue { /** * 缓存下载器 */ - private Map mCache = new LinkedHashMap<>(); + private Map mCache = new ConcurrentHashMap<>(); /** * 执行中的下载器 */ - private Map mExec = new LinkedHashMap<>(); + private Map mExec = new ConcurrentHashMap<>(); /** * 最大执行任务数 @@ -85,12 +85,13 @@ final class SimpleSubQueue implements ISubQueue { if (mExec.size() < mExecSize) { mCache.remove(fileer.getKey()); mExec.put(fileer.getKey(), fileer); - ALog.d(TAG, String.format("开始执行子任务:%s", fileer.getEntity().getFileName())); + ALog.d(TAG, + String.format("开始执行子任务:%s,key: %s", fileer.getEntity().getFileName(), fileer.getKey())); fileer.run(); - } else { - ALog.d(TAG, String.format("执行队列已满,任务进入缓存器中,key: %s", fileer.getKey())); - addTask(fileer); + return; } + ALog.d(TAG, String.format("执行队列已满,任务进入缓存器中,key: %s", fileer.getKey())); + addTask(fileer); } @Override public void stopTask(AbsSubDLoadUtil fileer) { @@ -144,15 +145,16 @@ final class SimpleSubQueue implements ISubQueue { addTask(t); } } - } else { // 处理队列变大的情况,该情况下将增加任务 - if (mExec.size() < num) { - for (int i = 0; i < diff; i++) { - AbsSubDLoadUtil next = getNextTask(); - if (next != null) { - startTask(next); - } else { - ALog.d(TAG, "子任务中没有缓存任务"); - } + return; + } + // 处理队列变大的情况,该情况下将增加任务 + if (mExec.size() < num) { + for (int i = 0; i < diff; i++) { + AbsSubDLoadUtil next = getNextTask(); + if (next != null) { + startTask(next); + } else { + ALog.d(TAG, "子任务中没有缓存任务"); } } } diff --git a/PublicComponent/src/main/java/com/arialyy/aria/core/listener/BaseListener.java b/PublicComponent/src/main/java/com/arialyy/aria/core/listener/BaseListener.java index fa7c98e3..077dffc0 100644 --- a/PublicComponent/src/main/java/com/arialyy/aria/core/listener/BaseListener.java +++ b/PublicComponent/src/main/java/com/arialyy/aria/core/listener/BaseListener.java @@ -16,7 +16,6 @@ package com.arialyy.aria.core.listener; import android.os.Handler; -import android.util.Log; import com.arialyy.aria.core.common.AbsEntity; import com.arialyy.aria.core.inf.IEntity; import com.arialyy.aria.core.inf.TaskSchedulerType; @@ -125,7 +124,7 @@ public abstract class BaseListener implements IInf } getFileInfo(session); } catch (JSchException e) { - fail(new AriaSFTPException(TAG, "jsch错误", e), false); + fail(new AriaSFTPException("jsch错误", e), false); } catch (UnsupportedEncodingException e) { - fail(new AriaSFTPException(TAG, "字符编码错误", e), false); + fail(new AriaSFTPException("字符编码错误", e), false); } catch (SftpException e) { - fail(new AriaSFTPException(TAG, "sftp错误,错误类型:" + e.id, e), false); + fail(new AriaSFTPException("sftp错误,错误类型:" + e.id, e), false); } } diff --git a/SFtpComponent/src/main/java/com/arialyy/aria/sftp/download/SFtpDInfoTask.java b/SFtpComponent/src/main/java/com/arialyy/aria/sftp/download/SFtpDInfoTask.java index dddfac55..bfbe342f 100644 --- a/SFtpComponent/src/main/java/com/arialyy/aria/sftp/download/SFtpDInfoTask.java +++ b/SFtpComponent/src/main/java/com/arialyy/aria/sftp/download/SFtpDInfoTask.java @@ -63,7 +63,7 @@ final class SFtpDInfoTask extends AbsSFtpInfoTask { callback.onSucceed(getWrapper().getKey(), info); } else { callback.onFail(getWrapper().getEntity(), - new AriaSFTPException(TAG, String.format("文件不存在,remotePath:%s", remotePath)), false); + new AriaSFTPException(String.format("文件不存在,remotePath:%s", remotePath)), false); } channel.disconnect(); } diff --git a/SFtpComponent/src/main/java/com/arialyy/aria/sftp/download/SFtpDThreadTaskAdapter.java b/SFtpComponent/src/main/java/com/arialyy/aria/sftp/download/SFtpDThreadTaskAdapter.java index a139fec3..c64c99c4 100644 --- a/SFtpComponent/src/main/java/com/arialyy/aria/sftp/download/SFtpDThreadTaskAdapter.java +++ b/SFtpComponent/src/main/java/com/arialyy/aria/sftp/download/SFtpDThreadTaskAdapter.java @@ -53,7 +53,7 @@ final class SFtpDThreadTaskAdapter extends AbsThreadTaskAdapter { @Override protected void handlerThreadTask() { if (session == null) { - fail(new AriaSFTPException(TAG, "session 为空"), false); + fail(new AriaSFTPException("session 为空"), false); return; } try { @@ -74,13 +74,13 @@ final class SFtpDThreadTaskAdapter extends AbsThreadTaskAdapter { CommonUtil.convertSFtpChar(charSet, option.getUrlEntity().remotePath); download(remotePath); } catch (SftpException e) { - fail(new AriaSFTPException(TAG, "sftp错误,错误类型:" + e.id, e), false); + fail(new AriaSFTPException("sftp错误,错误类型:" + e.id, e), false); } catch (UnsupportedEncodingException e) { - fail(new AriaSFTPException(TAG, "字符编码错误", e), false); + fail(new AriaSFTPException("字符编码错误", e), false); } catch (IOException e) { - fail(new AriaSFTPException(TAG, "", e), true); + fail(new AriaSFTPException("", e), true); } catch (JSchException e) { - fail(new AriaSFTPException(TAG, "jsch 错误", e), false); + fail(new AriaSFTPException("jsch 错误", e), false); } finally { channelSftp.disconnect(); } diff --git a/SFtpComponent/src/main/java/com/arialyy/aria/sftp/upload/SFtpUThreadTaskAdapter.java b/SFtpComponent/src/main/java/com/arialyy/aria/sftp/upload/SFtpUThreadTaskAdapter.java index 1edcfbf1..9910d0a3 100644 --- a/SFtpComponent/src/main/java/com/arialyy/aria/sftp/upload/SFtpUThreadTaskAdapter.java +++ b/SFtpComponent/src/main/java/com/arialyy/aria/sftp/upload/SFtpUThreadTaskAdapter.java @@ -50,7 +50,7 @@ final class SFtpUThreadTaskAdapter extends AbsThreadTaskAdapter { @Override protected void handlerThreadTask() { if (session == null) { - fail(new AriaSFTPException(TAG, "session 为空"), false); + fail(new AriaSFTPException("session 为空"), false); return; } try { @@ -75,13 +75,13 @@ final class SFtpUThreadTaskAdapter extends AbsThreadTaskAdapter { channelSftp.cd(remotePath); upload(remotePath); } catch (SftpException e) { - fail(new AriaSFTPException(TAG, "sftp错误,错误类型:" + e.id, e), false); + fail(new AriaSFTPException("sftp错误,错误类型:" + e.id, e), false); } catch (UnsupportedEncodingException e) { - fail(new AriaSFTPException(TAG, "字符编码错误", e), false); + fail(new AriaSFTPException("字符编码错误", e), false); } catch (IOException e) { - fail(new AriaSFTPException(TAG, "", e), true); + fail(new AriaSFTPException("", e), true); } catch (JSchException e) { - fail(new AriaSFTPException(TAG, "jsch 错误", e), false); + fail(new AriaSFTPException("jsch 错误", e), false); } finally { channelSftp.disconnect(); } diff --git a/app/src/main/java/com/arialyy/simple/core/download/SingleTaskActivity.java b/app/src/main/java/com/arialyy/simple/core/download/SingleTaskActivity.java index 88885606..07dfa81b 100644 --- a/app/src/main/java/com/arialyy/simple/core/download/SingleTaskActivity.java +++ b/app/src/main/java/com/arialyy/simple/core/download/SingleTaskActivity.java @@ -159,7 +159,6 @@ public class SingleTaskActivity extends BaseActivity { } if (speed > -1) { msg = item.getTitle().toString(); - Aria.download(this).setMaxSpeed(speed); T.showShort(this, msg); } return true; diff --git a/app/src/main/java/com/arialyy/simple/core/download/group/DownloadGroupActivity.java b/app/src/main/java/com/arialyy/simple/core/download/group/DownloadGroupActivity.java index 0b2072cf..6620f35a 100644 --- a/app/src/main/java/com/arialyy/simple/core/download/group/DownloadGroupActivity.java +++ b/app/src/main/java/com/arialyy/simple/core/download/group/DownloadGroupActivity.java @@ -17,6 +17,7 @@ package com.arialyy.simple.core.download.group; import android.os.Bundle; import android.os.Environment; +import android.util.Log; import android.view.View; import com.arialyy.annotations.DownloadGroup; import com.arialyy.aria.core.Aria; @@ -82,6 +83,7 @@ public class DownloadGroupActivity extends BaseActivity getUrls1() { @@ -60,9 +50,9 @@ public class GroupModule extends BaseModule { List names = new ArrayList<>(); //String[] str = getContext().getResources().getStringArray(R.array.group_names); //Collections.addAll(names, str); - names.add("1.mp4"); - names.add("2.png"); - names.add("3.png"); + names.add("末日血战.apk"); + names.add("开黑三国.apk"); + names.add("放置奇兵.apk"); //names.add("4.png"); //names.add("5.png"); return names; diff --git a/app/src/main/java/com/arialyy/simple/core/download/m3u8/M3U8VodDLoadActivity.java b/app/src/main/java/com/arialyy/simple/core/download/m3u8/M3U8VodDLoadActivity.java index 474b1365..97b10bc7 100644 --- a/app/src/main/java/com/arialyy/simple/core/download/m3u8/M3U8VodDLoadActivity.java +++ b/app/src/main/java/com/arialyy/simple/core/download/m3u8/M3U8VodDLoadActivity.java @@ -309,9 +309,10 @@ public class M3U8VodDLoadActivity extends BaseActivity { //.merge(true) //.setVodTsUrlConvert(new VodTsUrlConverter()); //.setMergeHandler(new TsMergeHandler()); - //option.setKeyUrlConverter(new KeyUrlConverter()); - //option.setBandWidthUrlConverter(new BandWidthUrlConverter()); - //option.setUseDefConvert(true); + option.setUseDefConvert(false); + option.setKeyUrlConverter(new KeyUrlConverter()); + option.setBandWidthUrlConverter(new BandWidthUrlConverter()); + option.setUseDefConvert(true); return option; }