修复了字符串中有特殊字符导致的路径冲突问题;修复ftp分块下载失败问题

This commit is contained in:
laoyuyu
2018-06-29 19:56:41 +08:00
parent 0a85477da3
commit 1d116f71b7
18 changed files with 73 additions and 203 deletions

View File

@@ -59,7 +59,7 @@ public class FtpDownloadActivity extends BaseActivity<ActivityFtpDownloadBinding
public void onClick(View view) {
switch (view.getId()) {
case R.id.start:
Aria.download(this).loadFtp(URL, true)
Aria.download(this).loadFtp(URL)
.login("sxf", "B34VdGsJ")
//.login("lao", "123456")
.login("lao", "123456")

View File

@@ -1,6 +1,7 @@
package com.arialyy.simple.test;
import android.os.Bundle;
import android.os.Environment;
import android.util.Log;
import android.view.View;
import com.arialyy.aria.core.Aria;
@@ -26,10 +27,10 @@ public class AnyRunActivity extends BaseActivity<ActivityTestBinding> {
//String URL = "http://static.gaoshouyou.com/d/22/94/822260b849944492caadd2983f9bb624.apk";
//private final String URL = "ftp://192.168.29.140:21/download/AriaPrj.rar";
//String URL = "https://dl.genymotion.com/releases/genymotion-2.12.1/genymotion-2.12.1-vbox.exe";
//String URL = "ftp://192.168.29.140:21/download/SDK_Demo-release.apk";
String URL = "ftp://192.168.29.140:21/download/SDK_Demo-release.apk";
//String URL = "ftp://z:z@dygod18.com:21211/[电影天堂www.dy2018.com]猩球崛起3终极之战BD国英双语中英双字.mkv";
//private String URL = "https://www.bilibili.com/bangumi/play/ep77693";
private String URL = "http://cn-hbsjz-cmcc-v-03.acgvideo.com/upgcxcode/63/82/5108263/5108263-1-80.flv?expires=1530178500&platform=pc&ssig=vr7gLl0duyqWqSMnIpzaDA&oi=3746029570&nfa=BpfiWF+i4mNW8KzjZFHzBQ==&dynamic=1&hfa=2030547937&hfb=Yjk5ZmZjM2M1YzY4ZjAwYTMzMTIzYmIyNWY4ODJkNWI=&trid=3476be01a9254115b15f8cc7198600fe&nfc=1";
//private String URL = "http://cn-hbsjz-cmcc-v-03.acgvideo.com/upgcxcode/63/82/5108263/5108263-1-80.flv?expires=1530178500&platform=pc&ssig=vr7gLl0duyqWqSMnIpzaDA&oi=3746029570&nfa=BpfiWF+i4mNW8KzjZFHzBQ==&dynamic=1&hfa=2030547937&hfb=Yjk5ZmZjM2M1YzY4ZjAwYTMzMTIzYmIyNWY4ODJkNWI=&trid=3476be01a9254115b15f8cc7198600fe&nfc=1";
@Override protected int setLayoutId() {
return R.layout.activity_test;
@@ -48,28 +49,21 @@ public class AnyRunActivity extends BaseActivity<ActivityTestBinding> {
public void onClick(View view) {
switch (view.getId()) {
case R.id.start:
//module.start();
//if (index < urls.length) {
// module.start(urls[index]);
// index++;
//}
//for (int i = 0; i < 10; i++) {
//module.startFtp(URL);
module.start(URL);
//}
//List<AbsEntity> list = Aria.download(this).getTotalTaskList();
//ALog.d(TAG, "size ==> " + list.size());
//module.start(URL);
module.startFtp(URL);
break;
case R.id.stop:
//List<AbsEntity> list = Aria.download(this).getTotalTaskList();
//
module.stop(URL);
break;
case R.id.cancel:
module.cancel(URL);
//module.cancel();
//String newUrl = "ftp://192.168.29.140:21/download/11SDK_Demo-release.apk";
//Aria.download(this)
// .loadFtp(URL)
// .updateUrl(newUrl)
// .login("lao", "123456")
// .setFilePath(Environment.getExternalStorageDirectory().getPath() + "/")
// .start();
break;
}
}

View File

@@ -66,36 +66,12 @@ public class AnyRunnModule {
void start(String url) {
mUrl = url;
String path = Environment.getExternalStorageDirectory().getPath() + "/aaas.apk";
//File file = new File(path);
//if (file.exists()) {
// file.delete();
//}
Aria.download(this)
.load(url)
//.addHeader("Accept-Encoding", "gzip")
.addHeader("Referer", "http://www.bilibili.com/")
.addHeader("user-agent", "Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36")
.setRequestMode(RequestEnum.GET)
//.setUrlProxy(Proxy.NO_PROXY)
.setFilePath(path)
.resetState()
.start();
//String[] urls = new String[] {
// "http://cdn-s1.touchfound.net/1526449199142_3617.png",
// "http://cdn-s1.touchfound.net/mtVmResources/1526287158571.zip",
// "http://cdn-s1.touchfound.net/1526450206960_2186.png",
// "http://cdn-s1.touchfound.net/1526449199025_1476.png"
//};
//for (int i = 0, len = urls.length; i < len; i++){
//
// Aria.download(this)
// .load(urls[i])
// //.addHeader("Accept-Encoding", "gzip")
// .setRequestMode(RequestEnum.GET)
// .setFilePath(Environment.getExternalStorageDirectory().getPath() + "/ggsg123456.apk" + i)
// //.resetState()
// .start();
//}
}
void startFtp(String url) {
@@ -103,26 +79,8 @@ public class AnyRunnModule {
Aria.download(this)
.loadFtp(url)
.login("lao", "123456")
//.addHeader("Accept-Encoding", "gzip")
.setFilePath(Environment.getExternalStorageDirectory().getPath() + "/")
//.resetState()
.start();
//String[] urls = new String[] {
// "http://cdn-s1.touchfound.net/1526449199142_3617.png",
// "http://cdn-s1.touchfound.net/mtVmResources/1526287158571.zip",
// "http://cdn-s1.touchfound.net/1526450206960_2186.png",
// "http://cdn-s1.touchfound.net/1526449199025_1476.png"
//};
//for (int i = 0, len = urls.length; i < len; i++){
//
// Aria.download(this)
// .load(urls[i])
// //.addHeader("Accept-Encoding", "gzip")
// .setRequestMode(RequestEnum.GET)
// .setFilePath(Environment.getExternalStorageDirectory().getPath() + "/ggsg123456.apk" + i)
// //.resetState()
// .start();
//}
}
void stop(String url) {