From ea2e27f3e95d18a252e05447d2141602a5e53dc1 Mon Sep 17 00:00:00 2001 From: laoyuyu <511455842@qq.com> Date: Thu, 20 Feb 2020 22:01:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D40x=E9=94=99=E8=AF=AF?= =?UTF-8?q?=EF=BC=8C=E4=BC=9A=E7=BB=A7=E7=BB=AD=E9=87=8D=E8=AF=95=E5=B9=B6?= =?UTF-8?q?=E4=B8=94=E6=97=A0=E6=B3=95=E9=87=8D=E8=AF=95=E6=88=90=E5=8A=9F?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98=20https://github.com/AriaLyy/Aria/i?= =?UTF-8?q?ssues/619?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/arialyy/aria/http/download/HttpDFileInfoTask.java | 8 ++++---- .../src/main/java/com/arialyy/aria/m3u8/M3U8InfoTask.java | 4 ++-- .../java/com/arialyy/aria/m3u8/vod/M3U8VodLoader.java | 4 ---- .../arialyy/simple/core/download/m3u8/M3U8VodModule.java | 3 ++- 4 files changed, 8 insertions(+), 11 deletions(-) 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 a4e85d24..aefadede 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 @@ -228,15 +228,15 @@ final class HttpDFileInfoTask implements IInfoTask, Runnable { mTaskWrapper.setNewTask(true); mTaskWrapper.setSupportBP(false); end = true; - } else if (code == HttpURLConnection.HTTP_NOT_FOUND) { - failDownload(new AriaHTTPException(TAG, - String.format("任务下载失败,errorCode:404, url: %s", mEntity.getUrl())), false); - } else if (code == HttpURLConnection.HTTP_MOVED_TEMP + } else if (code == HttpURLConnection.HTTP_MOVED_TEMP || code == HttpURLConnection.HTTP_MOVED_PERM || code == HttpURLConnection.HTTP_SEE_OTHER || code == HttpURLConnection.HTTP_CREATED // 201 跳转 || code == 307) { handleUrlReTurn(conn, conn.getHeaderField("Location")); + } else if (code >= HttpURLConnection.HTTP_BAD_REQUEST) { + failDownload(new AriaHTTPException(TAG, + String.format("任务下载失败,errorCode:%s, url: %s", code, mEntity.getUrl())), false); } else { failDownload(new AriaHTTPException(TAG, String.format("任务下载失败,errorCode:%s, errorMsg: %s, url: %s", code, 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 2d986cd8..df76f8a8 100644 --- a/M3U8Component/src/main/java/com/arialyy/aria/m3u8/M3U8InfoTask.java +++ b/M3U8Component/src/main/java/com/arialyy/aria/m3u8/M3U8InfoTask.java @@ -208,8 +208,8 @@ final public class M3U8InfoTask implements IInfoTask { || code == HttpURLConnection.HTTP_CREATED // 201 跳转 || code == 307) { handleUrlReTurn(conn, conn.getHeaderField("Location")); - } else if (code == HttpURLConnection.HTTP_NOT_FOUND) { - failDownload("404错误", false); + } else if (code >= HttpURLConnection.HTTP_BAD_REQUEST) { + failDownload("下载失败错误,错误码:" + code, false); } else { failDownload(String.format("不支持的响应,code: %s", code), true); } 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 fa3fb634..3ed9275a 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 @@ -135,10 +135,6 @@ final class M3U8VodLoader extends BaseM3U8Loader { } } - @Override public boolean isBreak() { - return super.isBreak() || isDestroy; - } - @Override protected void handleTask(Looper looper) { if (isBreak()) { return; diff --git a/app/src/main/java/com/arialyy/simple/core/download/m3u8/M3U8VodModule.java b/app/src/main/java/com/arialyy/simple/core/download/m3u8/M3U8VodModule.java index cf1859b9..ce39e0ce 100644 --- a/app/src/main/java/com/arialyy/simple/core/download/m3u8/M3U8VodModule.java +++ b/app/src/main/java/com/arialyy/simple/core/download/m3u8/M3U8VodModule.java @@ -38,7 +38,8 @@ public class M3U8VodModule extends BaseViewModule { //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 defUrl = "https://135zyv5.xw0371.com/2018/10/29/X05c7CG3VB91gi1M/playlist.m3u8"; + private final String defUrl = "https://fangao.qfxmj.com/video/20191111/dbf7e2aa0c5f42a8b040442b54c13e3a/cloudv-transfer/555555556nr593o75556r165q86n82n0_eb3da35b8f4442808756a6ddc8ec1372_0_3.m3u8?wsSecret=d5fb403512d4cd427f18858086b35ce4&wsTime=1582197537"; private final String filePath = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getPath() //+ "/道士下山.ts";