This commit is contained in:
@@ -69,7 +69,7 @@ dependencies {
|
||||
// annotationProcessor 'com.arialyy.aria:aria-compiler:3.3.14'
|
||||
api 'com.github.PhilJay:MPAndroidChart:v3.0.3'
|
||||
implementation project(':AppFrame')
|
||||
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5.4'
|
||||
debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.5.4'
|
||||
implementation 'com.github.bumptech.glide:glide:3.7.0'
|
||||
implementation 'com.pddstudio:highlightjs-android:1.5.0'
|
||||
implementation 'org.greenrobot:eventbus:3.1.1'
|
||||
|
||||
@@ -23,6 +23,7 @@ import androidx.lifecycle.Observer;
|
||||
import androidx.lifecycle.ViewModelProviders;
|
||||
import com.arialyy.annotations.Download;
|
||||
import com.arialyy.aria.core.Aria;
|
||||
import com.arialyy.aria.core.common.ProtocolType;
|
||||
import com.arialyy.aria.core.common.controller.ControllerType;
|
||||
import com.arialyy.aria.core.download.DownloadEntity;
|
||||
import com.arialyy.aria.core.download.DownloadTask;
|
||||
@@ -47,6 +48,7 @@ public class FtpDownloadActivity extends BaseActivity<ActivityFtpDownloadBinding
|
||||
private String mUrl, mFilePath;
|
||||
private FtpDownloadModule mModule;
|
||||
private long mTaskId;
|
||||
private String user = "tester", passw = "password";
|
||||
|
||||
@Override protected void init(Bundle savedInstanceState) {
|
||||
super.init(savedInstanceState);
|
||||
@@ -94,7 +96,8 @@ public class FtpDownloadActivity extends BaseActivity<ActivityFtpDownloadBinding
|
||||
mTaskId = Aria.download(this).loadFtp(mUrl)
|
||||
.setFilePath(mFilePath, true)
|
||||
.option()
|
||||
.login("lao", "123456")
|
||||
//.login("lao", "123456")
|
||||
.login(user, passw)
|
||||
.asFtps()
|
||||
.controller(ControllerType.CREATE_CONTROLLER)
|
||||
.create();
|
||||
@@ -108,8 +111,9 @@ public class FtpDownloadActivity extends BaseActivity<ActivityFtpDownloadBinding
|
||||
Aria.download(this)
|
||||
.loadFtp(mTaskId)
|
||||
.option()
|
||||
.login("lao", "123456")
|
||||
.login(user, passw)
|
||||
.asFtps()
|
||||
.setProtocol(ProtocolType.SSL)
|
||||
.controller(ControllerType.TASK_CONTROLLER)
|
||||
.resume();
|
||||
getBinding().setStateStr(getString(R.string.stop));
|
||||
|
||||
@@ -33,7 +33,7 @@ public class FtpDownloadModule extends BaseViewModule {
|
||||
private final String FTP_URL_KEY = "FTP_URL_KEY";
|
||||
private final String FTP_PATH_KEY = "FTP_PATH_KEY";
|
||||
|
||||
private final String ftpDefUrl = "ftp://9.9.9.50:2121/Cyberduck-6.9.4.30164.zip";
|
||||
private final String ftpDefUrl = "ftp://9.9.9.50:22/Cyberduck-6.9.4.30164.zip";
|
||||
private final String ftpDefPath =
|
||||
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getPath();
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.arialyy.simple.core.download.m3u8;
|
||||
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
@@ -29,11 +30,10 @@ import androidx.lifecycle.ViewModelProviders;
|
||||
import com.arialyy.annotations.Download;
|
||||
import com.arialyy.annotations.M3U8;
|
||||
import com.arialyy.aria.core.Aria;
|
||||
import com.arialyy.aria.core.common.controller.ControllerType;
|
||||
import com.arialyy.aria.core.common.controller.BuilderController;
|
||||
import com.arialyy.aria.core.common.controller.ControllerType;
|
||||
import com.arialyy.aria.core.download.DownloadEntity;
|
||||
import com.arialyy.aria.core.download.DownloadTask;
|
||||
import com.arialyy.aria.core.download.m3u8.IBandWidthUrlConverter;
|
||||
import com.arialyy.aria.core.download.m3u8.ITsMergeHandler;
|
||||
import com.arialyy.aria.core.download.m3u8.IVodTsUrlConverter;
|
||||
import com.arialyy.aria.core.download.m3u8.M3U8Entity;
|
||||
@@ -281,16 +281,17 @@ public class M3U8VodDLoadActivity extends BaseActivity<ActivityM3u8VodBinding> {
|
||||
Aria.download(this)
|
||||
.load(mTaskId)
|
||||
.asM3U8()
|
||||
.setBandWidthUrlConverter(new IBandWidthUrlConverter() {
|
||||
@Override public String convert(String bandWidthUrl) {
|
||||
int index = mUrl.lastIndexOf("/");
|
||||
return mUrl.substring(0, index + 1) + bandWidthUrl;
|
||||
}
|
||||
})
|
||||
//.setBandWidthUrlConverter(new IBandWidthUrlConverter() {
|
||||
// @Override public String convert(String bandWidthUrl) {
|
||||
// int index = mUrl.lastIndexOf("/");
|
||||
// return mUrl.substring(0, index + 1) + bandWidthUrl;
|
||||
// }
|
||||
//})
|
||||
.setTsUrlConvert(new IVodTsUrlConverter() {
|
||||
@Override public List<String> convert(String m3u8Url, List<String> tsUrls) {
|
||||
int index = m3u8Url.lastIndexOf("/");
|
||||
String parentUrl = m3u8Url.substring(0, index + 1);
|
||||
|
||||
Uri uri = Uri.parse(m3u8Url);
|
||||
String parentUrl = uri.getAuthority() + "://" + uri.getHost();
|
||||
List<String> newUrls = new ArrayList<>();
|
||||
for (String url : tsUrls) {
|
||||
newUrls.add(parentUrl + url);
|
||||
@@ -316,16 +317,22 @@ public class M3U8VodDLoadActivity extends BaseActivity<ActivityM3u8VodBinding> {
|
||||
.useServerFileName(true)
|
||||
.setFilePath(mFilePath, true)
|
||||
.asM3U8()
|
||||
.setBandWidthUrlConverter(new IBandWidthUrlConverter() {
|
||||
@Override public String convert(String bandWidthUrl) {
|
||||
int index = mUrl.lastIndexOf("/");
|
||||
return mUrl.substring(0, index + 1) + bandWidthUrl;
|
||||
}
|
||||
})
|
||||
//.setBandWidthUrlConverter(new IBandWidthUrlConverter() {
|
||||
// @Override public String convert(String bandWidthUrl) {
|
||||
// int index = mUrl.lastIndexOf("/");
|
||||
// return mUrl.substring(0, index + 1) + bandWidthUrl;
|
||||
// }
|
||||
//})
|
||||
.setTsUrlConvert(new IVodTsUrlConverter() {
|
||||
@Override public List<String> convert(String m3u8Url, List<String> tsUrls) {
|
||||
int index = m3u8Url.lastIndexOf("/");
|
||||
String parentUrl = m3u8Url.substring(0, index + 1);
|
||||
//int index = m3u8Url.lastIndexOf("/");
|
||||
//String parentUrl = m3u8Url.substring(0, index + 1);
|
||||
//List<String> newUrls = new ArrayList<>();
|
||||
//for (String url : tsUrls) {
|
||||
// newUrls.add(parentUrl + url);
|
||||
//}
|
||||
Uri uri = Uri.parse(m3u8Url);
|
||||
String parentUrl = uri.getScheme() + "://" + uri.getHost();
|
||||
List<String> newUrls = new ArrayList<>();
|
||||
for (String url : tsUrls) {
|
||||
newUrls.add(parentUrl + url);
|
||||
|
||||
@@ -34,10 +34,11 @@ public class M3U8VodModule extends BaseViewModule {
|
||||
// m3u8测试集合:http://www.voidcn.com/article/p-snaliarm-ct.html
|
||||
//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://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8";
|
||||
private final String defUrl = "http://cn1.fa1244.cn/hls/20190516/6d271eaa73b2e4cb51d13831b0c1ab4c/1557976262/index.m3u8";
|
||||
private final String filePath =
|
||||
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getPath()
|
||||
+ "/1557993797897.ts";
|
||||
+ "/道士下山.ts";
|
||||
|
||||
private MutableLiveData<DownloadEntity> liveData = new MutableLiveData<>();
|
||||
private DownloadEntity singDownloadInfo;
|
||||
|
||||
@@ -53,6 +53,10 @@ public class MultiDownloadActivity extends BaseActivity<ActivityMultiDownloadBin
|
||||
setTitle("下载列表");
|
||||
List<AbsEntity> temps = Aria.download(this).getTotalTaskList();
|
||||
if (temps != null && !temps.isEmpty()) {
|
||||
|
||||
for (AbsEntity temp : temps){
|
||||
ALog.d(TAG, "state = " + temp.getState());
|
||||
}
|
||||
mData.addAll(temps);
|
||||
}
|
||||
mAdapter = new DownloadAdapter(this, mData);
|
||||
|
||||
Reference in New Issue
Block a user