From 418ec74b7bef8879be6cdf30f86cef566314880e Mon Sep 17 00:00:00 2001 From: laoyuyu <511455842@qq.com> Date: Sun, 14 Jun 2020 15:03:15 +0800 Subject: [PATCH] =?UTF-8?q?fix=20bug=20https://github.com/AriaLyy/Aria/iss?= =?UTF-8?q?ues/688=20fix=20bug=20https://github.com/AriaLyy/Aria/issues/69?= =?UTF-8?q?0=20m3u8=E4=BB=BB=E5=8A=A1=E5=A2=9E=E5=8A=A0`setUseDefConvert()?= =?UTF-8?q?`=E6=96=B9=E6=B3=95=EF=BC=8C=E7=94=A8=E4=BA=8E=E5=A4=84?= =?UTF-8?q?=E7=90=86=E9=BB=98=E8=AE=A4=E7=9A=84m3u8=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../aria/core/download/m3u8/M3U8Option.java | 11 ++++++ DEV_LOG.md | 4 +++ .../aria/m3u8/BandWidthDefConverter.java | 29 +++++++++++++++ .../com/arialyy/aria/m3u8/M3U8InfoTask.java | 5 +-- .../com/arialyy/aria/m3u8/M3U8TaskOption.java | 13 +++++++ .../aria/m3u8/live/LiveTsDefConverter.java | 29 +++++++++++++++ .../aria/m3u8/live/M3U8LiveLoader.java | 6 ++-- .../arialyy/aria/m3u8/vod/M3U8VodLoader.java | 4 ++- .../aria/m3u8/vod/VodTsDefConverter.java | 36 +++++++++++++++++++ .../aria/core/group/SimpleSchedulers.java | 8 +++-- .../arialyy/aria/core/loader/SubLoader.java | 5 +++ .../processor/IBandWidthUrlConverter.java | 3 +- .../core/processor/ILiveTsUrlConverter.java | 2 +- .../java/com/arialyy/aria/orm/SqlHelper.java | 7 ++-- README.md | 27 +++++++------- .../download/m3u8/M3U8LiveDLoadActivity.java | 11 ++---- .../download/m3u8/M3U8VodDLoadActivity.java | 24 ++++++------- .../core/download/m3u8/M3U8VodModule.java | 2 ++ build.gradle | 4 +-- 19 files changed, 181 insertions(+), 49 deletions(-) create mode 100644 M3U8Component/src/main/java/com/arialyy/aria/m3u8/BandWidthDefConverter.java create mode 100644 M3U8Component/src/main/java/com/arialyy/aria/m3u8/live/LiveTsDefConverter.java create mode 100644 M3U8Component/src/main/java/com/arialyy/aria/m3u8/vod/VodTsDefConverter.java 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 e20635c7..e419a1d0 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 @@ -37,12 +37,23 @@ public class M3U8Option extends BaseOption { private IKeyUrlConverter keyUrlConverter; private boolean ignoreFailureTs = false; private String keyPath; + private boolean useDefConvert = true; M3U8Option() { super(); ComponentUtil.getInstance().checkComponentExist(ComponentUtil.COMPONENT_TYPE_M3U8); } + /** + * 设置使用默认的码率转换器和TS转换器,默认打开 + * @param useDefConvert true 使用默认的转换器,false 关闭默认的转换器 + */ + public OP setUseDefConvert(boolean useDefConvert) { + this.useDefConvert = true; + 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 642879fb..b3891b9b 100644 --- a/DEV_LOG.md +++ b/DEV_LOG.md @@ -1,4 +1,8 @@ ## 开发日志 + + 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 + - m3u8任务增加`setUseDefConvert()`方法,用于处理默认的m3u8任务 + v_3.8.8 (2020/6/7) - 修复设置了cancel(false),文件还是被删除的问题 https://github.com/AriaLyy/Aria/issues/686 - 修复错误url的下载任务,无法删除的问题 https://github.com/AriaLyy/Aria/issues/684 diff --git a/M3U8Component/src/main/java/com/arialyy/aria/m3u8/BandWidthDefConverter.java b/M3U8Component/src/main/java/com/arialyy/aria/m3u8/BandWidthDefConverter.java new file mode 100644 index 00000000..d931a75e --- /dev/null +++ b/M3U8Component/src/main/java/com/arialyy/aria/m3u8/BandWidthDefConverter.java @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2016 AriaLyy(https://github.com/AriaLyy/Aria) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.arialyy.aria.m3u8; + +import com.arialyy.aria.core.processor.IBandWidthUrlConverter; + +/** + * 点播文件默认的码率转换器 + */ +class BandWidthDefConverter implements IBandWidthUrlConverter { + + @Override public String convert(String m3u8Url, String bandWidthUrl) { + int index = m3u8Url.lastIndexOf("/"); + return m3u8Url.substring(0, index + 1) + bandWidthUrl; + } +} 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 0dad0e95..8d3a80f6 100644 --- a/M3U8Component/src/main/java/com/arialyy/aria/m3u8/M3U8InfoTask.java +++ b/M3U8Component/src/main/java/com/arialyy/aria/m3u8/M3U8InfoTask.java @@ -328,9 +328,10 @@ final public class M3U8InfoTask implements IInfoTask { * 处理码率 */ private void handleBandWidth(HttpURLConnection conn, String bandWidthM3u8Url) throws IOException { - IBandWidthUrlConverter converter = mM3U8Option.getBandWidthUrlConverter(); + IBandWidthUrlConverter converter = mM3U8Option.isUseDefConvert() ? new BandWidthDefConverter() + : mM3U8Option.getBandWidthUrlConverter(); if (converter != null) { - bandWidthM3u8Url = converter.convert(bandWidthM3u8Url); + bandWidthM3u8Url = converter.convert(mEntity.getUrl(), bandWidthM3u8Url); if (!bandWidthM3u8Url.startsWith("http")) { failDownload(String.format("码率转换器转换后的url地址无效,转换后的url:%s", bandWidthM3u8Url), false); return; diff --git a/M3U8Component/src/main/java/com/arialyy/aria/m3u8/M3U8TaskOption.java b/M3U8Component/src/main/java/com/arialyy/aria/m3u8/M3U8TaskOption.java index 28573d69..79be6aae 100644 --- a/M3U8Component/src/main/java/com/arialyy/aria/m3u8/M3U8TaskOption.java +++ b/M3U8Component/src/main/java/com/arialyy/aria/m3u8/M3U8TaskOption.java @@ -120,6 +120,19 @@ public final class M3U8TaskOption implements ITaskOption { */ private String keyPath; + /** + * 是否使用默认的码率转换器和Ts转换器 + */ + private boolean useDefConvert = false; + + public boolean isUseDefConvert() { + return useDefConvert; + } + + public void setUseDefConvert(boolean useDefConvert) { + this.useDefConvert = useDefConvert; + } + public String getKeyPath() { return keyPath; } diff --git a/M3U8Component/src/main/java/com/arialyy/aria/m3u8/live/LiveTsDefConverter.java b/M3U8Component/src/main/java/com/arialyy/aria/m3u8/live/LiveTsDefConverter.java new file mode 100644 index 00000000..ca74432e --- /dev/null +++ b/M3U8Component/src/main/java/com/arialyy/aria/m3u8/live/LiveTsDefConverter.java @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2016 AriaLyy(https://github.com/AriaLyy/Aria) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.arialyy.aria.m3u8.live; + +import com.arialyy.aria.core.processor.ILiveTsUrlConverter; + +/** + * 默认的m3u8 ts转换器 + */ +class LiveTsDefConverter implements ILiveTsUrlConverter { + @Override public String convert(String m3u8Url, String tsUrl) { + int index = m3u8Url.lastIndexOf("/"); + String parentUrl = m3u8Url.substring(0, index + 1); + return parentUrl + tsUrl; + } +} 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 51ad32d9..d46a1f89 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 @@ -32,8 +32,8 @@ import com.arialyy.aria.core.processor.ILiveTsUrlConverter; import com.arialyy.aria.core.processor.ITsMergeHandler; import com.arialyy.aria.core.task.ThreadTask; import com.arialyy.aria.core.wrapper.ITaskWrapper; -import com.arialyy.aria.exception.AriaM3U8Exception; import com.arialyy.aria.exception.AriaException; +import com.arialyy.aria.exception.AriaM3U8Exception; import com.arialyy.aria.m3u8.BaseM3U8Loader; import com.arialyy.aria.m3u8.IdGenerator; import com.arialyy.aria.m3u8.M3U8InfoTask; @@ -265,7 +265,9 @@ final class M3U8LiveLoader extends BaseM3U8Loader { return; } mPeerUrls.add(url); - ILiveTsUrlConverter converter = mM3U8Option.getLiveTsUrlConverter(); + ILiveTsUrlConverter converter = mM3U8Option.isUseDefConvert() ? + new LiveTsDefConverter() : + mM3U8Option.getLiveTsUrlConverter(); if (converter != null) { if (TextUtils.isEmpty(mM3U8Option.getBandWidthUrl())) { url = converter.convert(getEntity().getUrl(), url); 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 84b5524c..c2f8547f 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 @@ -504,7 +504,9 @@ final class M3U8VodLoader extends BaseM3U8Loader { final List urls = new ArrayList<>(); mInfoTask.setCallback(new IInfoTask.Callback() { @Override public void onSucceed(String key, CompleteInfo info) { - IVodTsUrlConverter converter = mM3U8Option.getVodUrlConverter(); + IVodTsUrlConverter converter = mM3U8Option.isUseDefConvert() ? + new VodTsDefConverter() : + mM3U8Option.getVodUrlConverter(); if (converter != null) { if (TextUtils.isEmpty(mM3U8Option.getBandWidthUrl())) { urls.addAll( diff --git a/M3U8Component/src/main/java/com/arialyy/aria/m3u8/vod/VodTsDefConverter.java b/M3U8Component/src/main/java/com/arialyy/aria/m3u8/vod/VodTsDefConverter.java new file mode 100644 index 00000000..617f78d8 --- /dev/null +++ b/M3U8Component/src/main/java/com/arialyy/aria/m3u8/vod/VodTsDefConverter.java @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2016 AriaLyy(https://github.com/AriaLyy/Aria) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.arialyy.aria.m3u8.vod; + +import com.arialyy.aria.core.processor.IVodTsUrlConverter; +import java.util.ArrayList; +import java.util.List; + +/** + * 默认的m3u8 ts转换器 + */ +class VodTsDefConverter implements IVodTsUrlConverter { + @Override public List convert(String m3u8Url, List tsUrls) { + int index = m3u8Url.lastIndexOf("/"); + List convertedTsUrl = new ArrayList<>(); + + String parentUrl = m3u8Url.substring(0, index + 1); + for (String temp : tsUrls) { + convertedTsUrl.add(parentUrl + temp); + } + return convertedTsUrl; + } +} 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 9daa5765..fe06ab46 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 @@ -20,6 +20,7 @@ import android.os.Bundle; import android.os.Handler; import android.os.Message; 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; @@ -169,10 +170,11 @@ final class SimpleSchedulers implements Handler.Callback { */ private synchronized void handleComplete(AbsSubDLoadUtil loader) { ALog.d(TAG, String.format("子任务【%s】完成", loader.getEntity().getFileName())); - if (loader.getRecord().isBlock) { + TaskRecord record = loader.getRecord(); + if (record != null && record.isBlock) { File partFile = - new File(String.format(IRecordHandler.SUB_PATH, loader.getRecord().filePath, 0)); - partFile.renameTo(new File(loader.getRecord().filePath)); + new File(String.format(IRecordHandler.SUB_PATH, record.filePath, 0)); + partFile.renameTo(new File(record.filePath)); } ThreadTaskManager.getInstance().removeTaskThread(loader.getKey()); mGState.listener.onSubComplete(loader.getEntity()); diff --git a/PublicComponent/src/main/java/com/arialyy/aria/core/loader/SubLoader.java b/PublicComponent/src/main/java/com/arialyy/aria/core/loader/SubLoader.java index b9144d5a..81232ac0 100644 --- a/PublicComponent/src/main/java/com/arialyy/aria/core/loader/SubLoader.java +++ b/PublicComponent/src/main/java/com/arialyy/aria/core/loader/SubLoader.java @@ -106,6 +106,11 @@ public final class SubLoader implements ILoader, ILoaderVisitor { } record = recordHandler.getRecord(wrapper.getEntity().getFileSize()); + if (record == null){ + ALog.d(TAG, "子任务记录为空"); + sendFailState(false); + return; + } if (record.threadRecords != null && !TextUtils.isEmpty(record.filePath) && new File(record.filePath).exists() diff --git a/PublicComponent/src/main/java/com/arialyy/aria/core/processor/IBandWidthUrlConverter.java b/PublicComponent/src/main/java/com/arialyy/aria/core/processor/IBandWidthUrlConverter.java index 21fab034..fee4df66 100644 --- a/PublicComponent/src/main/java/com/arialyy/aria/core/processor/IBandWidthUrlConverter.java +++ b/PublicComponent/src/main/java/com/arialyy/aria/core/processor/IBandWidthUrlConverter.java @@ -27,8 +27,9 @@ public interface IBandWidthUrlConverter extends IEventHandler { * 转换码率地址为可用的http地址,对于某些服务器,返回的切片信息有可能是相对地址,也可能是处理过的, * 对于这种情况,你需要使用url转换器将地址转换为可正常访问的http地址 * + * @param m3u8Url m3u8url地址 * @param bandWidthUrl 原始码率地址 * @return 可正常访问的http地址 */ - String convert(String bandWidthUrl); + String convert(String m3u8Url, String bandWidthUrl); } diff --git a/PublicComponent/src/main/java/com/arialyy/aria/core/processor/ILiveTsUrlConverter.java b/PublicComponent/src/main/java/com/arialyy/aria/core/processor/ILiveTsUrlConverter.java index bfd06ceb..473e5208 100644 --- a/PublicComponent/src/main/java/com/arialyy/aria/core/processor/ILiveTsUrlConverter.java +++ b/PublicComponent/src/main/java/com/arialyy/aria/core/processor/ILiveTsUrlConverter.java @@ -30,5 +30,5 @@ public interface ILiveTsUrlConverter extends IEventHandler { * @param tsUrl ts文件下载地址 * @return 转换后的http地址 */ - public String convert(String m3u8Url, String tsUrl); + String convert(String m3u8Url, String tsUrl); } diff --git a/PublicComponent/src/main/java/com/arialyy/aria/orm/SqlHelper.java b/PublicComponent/src/main/java/com/arialyy/aria/orm/SqlHelper.java index 2bd2e65a..7690d152 100644 --- a/PublicComponent/src/main/java/com/arialyy/aria/orm/SqlHelper.java +++ b/PublicComponent/src/main/java/com/arialyy/aria/orm/SqlHelper.java @@ -171,8 +171,11 @@ final class SqlHelper extends SQLiteOpenHelper { private void createDbCacheDir() { String cacheDir = mContext.getCacheDir().getPath() + "/AriaDbCacheDir"; - boolean rs = new File(cacheDir).mkdir(); - ALog.d(TAG, rs + ""); + File cacheFile = new File(cacheDir); + if (!cacheFile.exists()){ + boolean rs = cacheFile.mkdirs(); + ALog.d(TAG, rs + ""); + } super.getReadableDatabase() .execSQL("PRAGMA temp_store_directory = '" + cacheDir + "'"); mainTmpDirSet = true; diff --git a/README.md b/README.md index e6aafa66..975f8c68 100644 --- a/README.md +++ b/README.md @@ -45,19 +45,19 @@ Aria有以下特点: ## 引入库 [![license](http://img.shields.io/badge/license-Apache2.0-brightgreen.svg?style=flat)](https://github.com/AriaLyy/Aria/blob/master/LICENSE) -[![Core](https://img.shields.io/badge/Core-3.8.8-blue)](https://github.com/AriaLyy/Aria) -[![Compiler](https://img.shields.io/badge/Compiler-3.8.8-blue)](https://github.com/AriaLyy/Aria) -[![FtpComponent](https://img.shields.io/badge/FtpComponent-3.8.8-orange)](https://github.com/AriaLyy/Aria) -[![FtpComponent](https://img.shields.io/badge/SFtpComponent-3.8.8-orange)](https://github.com/AriaLyy/Aria) -[![M3U8Component](https://img.shields.io/badge/M3U8Component-3.8.8-orange)](https://github.com/AriaLyy/Aria) +[![Core](https://img.shields.io/badge/Core-3.8.9-blue)](https://github.com/AriaLyy/Aria) +[![Compiler](https://img.shields.io/badge/Compiler-3.8.9-blue)](https://github.com/AriaLyy/Aria) +[![FtpComponent](https://img.shields.io/badge/FtpComponent-3.8.9-orange)](https://github.com/AriaLyy/Aria) +[![FtpComponent](https://img.shields.io/badge/SFtpComponent-3.8.9-orange)](https://github.com/AriaLyy/Aria) +[![M3U8Component](https://img.shields.io/badge/M3U8Component-3.8.9-orange)](https://github.com/AriaLyy/Aria) ```java -implementation 'com.arialyy.aria:core:3.8.8' -annotationProcessor 'com.arialyy.aria:compiler:3.8.8' -implementation 'com.arialyy.aria:ftpComponent:3.8.8' # 如果需要使用ftp,请增加该组件 -implementation 'com.arialyy.aria:sftpComponent:3.8.8' # 如果需要使用ftp,请增加该组件 -implementation 'com.arialyy.aria:m3u8Component:3.8.8' # 如果需要使用m3u8下载功能,请增加该组件 +implementation 'com.arialyy.aria:core:3.8.9' +annotationProcessor 'com.arialyy.aria:compiler:3.8.9' +implementation 'com.arialyy.aria:ftpComponent:3.8.9' # 如果需要使用ftp,请增加该组件 +implementation 'com.arialyy.aria:sftpComponent:3.8.9' # 如果需要使用ftp,请增加该组件 +implementation 'com.arialyy.aria:m3u8Component:3.8.9' # 如果需要使用m3u8下载功能,请增加该组件 ``` 如果你使用的是kotlin,请使用kotlin官方提供的方法配置apt,[kotlin kapt官方配置传送门](https://www.kotlincn.net/docs/reference/kapt.html) @@ -138,9 +138,10 @@ protected void onCreate(Bundle savedInstanceState) { ### 版本日志 - + v_3.8.8 (2020/6/7) - - 修复设置了cancel(false),文件还是被删除的问题 https://github.com/AriaLyy/Aria/issues/686 - - 修复错误url的下载任务,无法删除的问题 https://github.com/AriaLyy/Aria/issues/684 + + 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 + - m3u8任务增加`setUseDefConvert()`方法,用于处理默认的m3u8任务 [更多版本记录](https://github.com/AriaLyy/Aria/blob/master/DEV_LOG.md) diff --git a/app/src/main/java/com/arialyy/simple/core/download/m3u8/M3U8LiveDLoadActivity.java b/app/src/main/java/com/arialyy/simple/core/download/m3u8/M3U8LiveDLoadActivity.java index 1773d07a..256f946e 100644 --- a/app/src/main/java/com/arialyy/simple/core/download/m3u8/M3U8LiveDLoadActivity.java +++ b/app/src/main/java/com/arialyy/simple/core/download/m3u8/M3U8LiveDLoadActivity.java @@ -266,15 +266,10 @@ public class M3U8LiveDLoadActivity extends BaseActivity } static class BandWidthUrlConverter implements IBandWidthUrlConverter { - String url; - BandWidthUrlConverter(String url) { - this.url = url; - } - - @Override public String convert(String bandWidthUrl) { - int peerIndex = url.lastIndexOf("/"); - return url.substring(0, peerIndex + 1) + bandWidthUrl; + @Override public String convert(String m3u8Url, String bandWidthUrl) { + int peerIndex = m3u8Url.lastIndexOf("/"); + return m3u8Url.substring(0, peerIndex + 1) + bandWidthUrl; } } } \ No newline at end of file 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 ee0c8426..474b1365 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 @@ -304,14 +304,14 @@ public class M3U8VodDLoadActivity extends BaseActivity { private M3U8VodOption getM3U8Option() { M3U8VodOption option = new M3U8VodOption(); - option - .setBandWidth(200000) + //option.setBandWidth(200000); //.generateIndexFile() //.merge(true) - .setVodTsUrlConvert(new VodTsUrlConverter()); + //.setVodTsUrlConvert(new VodTsUrlConverter()); //.setMergeHandler(new TsMergeHandler()); - option.setKeyUrlConverter(new KeyUrlConverter()); - option.setBandWidthUrlConverter(new BandWidthUrlConverter(mUrl)); + //option.setKeyUrlConverter(new KeyUrlConverter()); + //option.setBandWidthUrlConverter(new BandWidthUrlConverter()); + //option.setUseDefConvert(true); return option; } @@ -327,7 +327,8 @@ public class M3U8VodDLoadActivity extends BaseActivity { static class VodTsUrlConverter implements IVodTsUrlConverter { @Override public List convert(String m3u8Url, List tsUrls) { Uri uri = Uri.parse(m3u8Url); - String parentUrl = "http://devimages.apple.com/iphone/samples/bipbop/gear1/"; + //String parentUrl = "http://devimages.apple.com/iphone/samples/bipbop/gear1/"; + String parentUrl = "http://youku.cdn7-okzy.com/20200123/16815_fbe419ed/1000k/hls/"; //String parentUrl = "http://" + uri.getHost() + "/gear1/"; //int index = m3u8Url.lastIndexOf("/"); //String parentUrl = m3u8Url.substring(0, index + 1); @@ -351,15 +352,10 @@ public class M3U8VodDLoadActivity extends BaseActivity { static class BandWidthUrlConverter implements IBandWidthUrlConverter { - private String url; - BandWidthUrlConverter(String url) { - this.url = url; - } - - @Override public String convert(String bandWidthUrl) { - int index = url.lastIndexOf("/"); - return url.substring(0, index + 1) + bandWidthUrl; + @Override public String convert(String m3u8Url, String bandWidthUrl) { + int index = m3u8Url.lastIndexOf("/"); + return m3u8Url.substring(0, index + 1) + bandWidthUrl; } } 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 92337b2e..f2199622 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 @@ -35,6 +35,8 @@ 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 = "http://youku.cdn7-okzy.com/20200123/16815_fbe419ed/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"; diff --git a/build.gradle b/build.gradle index 3c00ba6d..6c41b4b0 100644 --- a/build.gradle +++ b/build.gradle @@ -44,8 +44,8 @@ task clean(type: Delete) { } ext { - versionCode = 388 - versionName = '3.8.8' + versionCode = 389 + versionName = '3.8.9' userOrg = 'arialyy' groupId = 'com.arialyy.aria' publishVersion = versionName