laoyuyu 7 years ago
parent 76bf0a33a9
commit 703078e750
  1. 4
      Aria/src/main/java/com/arialyy/aria/core/download/DownloadReceiver.java
  2. 9
      Aria/src/main/java/com/arialyy/aria/core/download/downloader/HttpFileInfoThread.java
  3. 3
      DEV_LOG.md
  4. 8
      app/src/main/java/com/arialyy/simple/test/AnyRunActivity.java
  5. 2
      app/src/main/java/com/arialyy/simple/test/AnyRunnModule.java

@ -265,7 +265,7 @@ public class DownloadReceiver extends AbsReceiver {
* @return 如果url错误或查找不到数据则返回null * @return 如果url错误或查找不到数据则返回null
*/ */
public DownloadEntity getDownloadEntity(String downloadUrl) { public DownloadEntity getDownloadEntity(String downloadUrl) {
if (CheckUtil.checkUrl(downloadUrl)) { if (!CheckUtil.checkUrl(downloadUrl)) {
return null; return null;
} }
return DbEntity.findFirst(DownloadEntity.class, "url=? and isGroupChild='false'", downloadUrl); return DbEntity.findFirst(DownloadEntity.class, "url=? and isGroupChild='false'", downloadUrl);
@ -278,7 +278,7 @@ public class DownloadReceiver extends AbsReceiver {
* @return 如果url错误或查找不到数据则返回null * @return 如果url错误或查找不到数据则返回null
*/ */
public DownloadTaskEntity getDownloadTask(String downloadUrl) { public DownloadTaskEntity getDownloadTask(String downloadUrl) {
if (CheckUtil.checkUrl(downloadUrl)) { if (!CheckUtil.checkUrl(downloadUrl)) {
return null; return null;
} }
return TEManager.getInstance().getTEntity(DownloadTaskEntity.class, downloadUrl); return TEManager.getInstance().getTEntity(DownloadTaskEntity.class, downloadUrl);

@ -133,7 +133,11 @@ class HttpFileInfoThread implements Runnable {
mTaskEntity.setSupportBP(true); mTaskEntity.setSupportBP(true);
end = true; end = true;
} else if (code == HttpURLConnection.HTTP_OK) { } else if (code == HttpURLConnection.HTTP_OK) {
if (conn.getHeaderField("Content-Type").equals("text/html")) { String contentType = conn.getHeaderField("Content-Type");
if (TextUtils.isEmpty(contentType)) {
return;
}
if (contentType.equals("text/html")) {
BufferedReader reader = BufferedReader reader =
new BufferedReader(new InputStreamReader(ConnectionHelp.convertInputStream(conn))); new BufferedReader(new InputStreamReader(ConnectionHelp.convertInputStream(conn)));
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
@ -155,7 +159,8 @@ class HttpFileInfoThread implements Runnable {
failDownload("任务【" + mEntity.getUrl() + "】下载失败,错误码:404", true); failDownload("任务【" + mEntity.getUrl() + "】下载失败,错误码:404", true);
} else if (code == HttpURLConnection.HTTP_MOVED_TEMP } else if (code == HttpURLConnection.HTTP_MOVED_TEMP
|| code == HttpURLConnection.HTTP_MOVED_PERM || code == HttpURLConnection.HTTP_MOVED_PERM
|| code == HttpURLConnection.HTTP_SEE_OTHER) { || code == HttpURLConnection.HTTP_SEE_OTHER
|| code == 307) {
handleUrlReTurn(conn, conn.getHeaderField("Location")); handleUrlReTurn(conn, conn.getHeaderField("Location"));
} else { } else {
failDownload("任务【" + mEntity.getUrl() + "】下载失败,错误码:" + code, true); failDownload("任务【" + mEntity.getUrl() + "】下载失败,错误码:" + code, true);

@ -1,4 +1,7 @@
## 开发日志 ## 开发日志
+ v_3.4.2
- fix bug https://github.com/AriaLyy/Aria/issues/248
- fix bug https://github.com/AriaLyy/Aria/issues/247
+ v_3.4.1 + v_3.4.1
- 移除记录配置文件,改用数据库记录任务记录 - 移除记录配置文件,改用数据库记录任务记录
- 上传配置添加io超时时间、缓存大小配置 - 上传配置添加io超时时间、缓存大小配置

@ -1,8 +1,11 @@
package com.arialyy.simple.test; package com.arialyy.simple.test;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log;
import android.view.View; import android.view.View;
import com.arialyy.aria.core.Aria; import com.arialyy.aria.core.Aria;
import com.arialyy.aria.core.download.DownloadEntity;
import com.arialyy.aria.core.download.DownloadTaskEntity;
import com.arialyy.simple.R; import com.arialyy.simple.R;
import com.arialyy.simple.base.BaseActivity; import com.arialyy.simple.base.BaseActivity;
import com.arialyy.simple.databinding.ActivityTestBinding; import com.arialyy.simple.databinding.ActivityTestBinding;
@ -15,7 +18,8 @@ public class AnyRunActivity extends BaseActivity<ActivityTestBinding> {
AnyRunnModule module; AnyRunnModule module;
String[] urls; String[] urls;
int index = 0; int index = 0;
String URL = "http://static.gaoshouyou.com/d/12/0d/7f120f50c80d2e7b8c4ba24ece4f9cdd.apk"; //String URL = "http://static.gaoshouyou.com/d/12/0d/7f120f50c80d2e7b8c4ba24ece4f9cdd.apk";
String URL = "http://d1.showself.com/download/showself_android-s236279_release.apk";
//String URL = "http://static.gaoshouyou.com/d/22/94/822260b849944492caadd2983f9bb624.apk"; //String URL = "http://static.gaoshouyou.com/d/22/94/822260b849944492caadd2983f9bb624.apk";
//private final String URL = "ftp://192.168.29.140:21/download/AriaPrj.rar"; //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 = "https://dl.genymotion.com/releases/genymotion-2.12.1/genymotion-2.12.1-vbox.exe";
@ -30,6 +34,8 @@ public class AnyRunActivity extends BaseActivity<ActivityTestBinding> {
mBar.setVisibility(View.GONE); mBar.setVisibility(View.GONE);
module = new AnyRunnModule(this); module = new AnyRunnModule(this);
urls = getResources().getStringArray(R.array.group_urls); urls = getResources().getStringArray(R.array.group_urls);
DownloadTaskEntity entity = Aria.download(this).getDownloadTask(URL);
Log.d(TAG, entity + "");
} }
public void onClick(View view) { public void onClick(View view) {

@ -68,7 +68,7 @@ public class AnyRunnModule {
.load(url) .load(url)
//.addHeader("Accept-Encoding", "gzip") //.addHeader("Accept-Encoding", "gzip")
.setRequestMode(RequestEnum.GET) .setRequestMode(RequestEnum.GET)
.setFilePath(Environment.getExternalStorageDirectory().getPath() + "/ggsg1234567.apk") .setFilePath(Environment.getExternalStorageDirectory().getPath() + "/ggsg12345678.apk")
//.resetState() //.resetState()
.start(); .start();
//String[] urls = new String[] { //String[] urls = new String[] {

Loading…
Cancel
Save