laoyuyu 4 years ago
parent 3edf40f533
commit 9a174311d9
  1. 2
      .github/FUNDING.yml
  2. 2
      Aria/src/main/java/com/arialyy/aria/core/download/m3u8/M3U8Option.java
  3. 2
      DEV_LOG.md
  4. 2
      FtpComponent/src/main/java/com/arialyy/aria/ftp/AbsFtpInfoTask.java
  5. 2
      FtpComponent/src/main/java/com/arialyy/aria/ftp/BaseFtpThreadTaskAdapter.java
  6. 2
      FtpComponent/src/main/java/com/arialyy/aria/ftp/download/FtpDFileInfoTask.java
  7. 14
      FtpComponent/src/main/java/com/arialyy/aria/ftp/download/FtpDThreadTaskAdapter.java
  8. 14
      FtpComponent/src/main/java/com/arialyy/aria/ftp/upload/FtpUThreadTaskAdapter.java
  9. 17
      HttpComponent/src/main/java/com/arialyy/aria/http/download/HttpDFileInfoTask.java
  10. 4
      HttpComponent/src/main/java/com/arialyy/aria/http/download/HttpDGInfoTask.java
  11. 17
      HttpComponent/src/main/java/com/arialyy/aria/http/download/HttpDThreadTaskAdapter.java
  12. 2
      HttpComponent/src/main/java/com/arialyy/aria/http/upload/HttpULoader.java
  13. 6
      HttpComponent/src/main/java/com/arialyy/aria/http/upload/HttpUThreadTaskAdapter.java
  14. 4
      M3U8Component/src/main/java/com/arialyy/aria/m3u8/M3U8InfoTask.java
  15. 16
      M3U8Component/src/main/java/com/arialyy/aria/m3u8/M3U8ThreadTaskAdapter.java
  16. 6
      M3U8Component/src/main/java/com/arialyy/aria/m3u8/live/M3U8LiveLoader.java
  17. 4
      M3U8Component/src/main/java/com/arialyy/aria/m3u8/vod/M3U8VodLoader.java
  18. 2
      M3U8Component/src/main/java/com/arialyy/aria/m3u8/vod/VodStateManager.java
  19. 61
      PublicComponent/src/main/java/com/arialyy/aria/core/group/SimpleSchedulers.java
  20. 18
      PublicComponent/src/main/java/com/arialyy/aria/core/group/SimpleSubQueue.java
  21. 3
      PublicComponent/src/main/java/com/arialyy/aria/core/listener/BaseListener.java
  22. 2
      PublicComponent/src/main/java/com/arialyy/aria/core/listener/DownloadGroupListener.java
  23. 14
      PublicComponent/src/main/java/com/arialyy/aria/core/task/ThreadTask.java
  24. 14
      PublicComponent/src/main/java/com/arialyy/aria/exception/AriaException.java
  25. 8
      PublicComponent/src/main/java/com/arialyy/aria/exception/AriaFTPException.java
  26. 28
      PublicComponent/src/main/java/com/arialyy/aria/exception/AriaGroupException.java
  27. 8
      PublicComponent/src/main/java/com/arialyy/aria/exception/AriaHTTPException.java
  28. 8
      PublicComponent/src/main/java/com/arialyy/aria/exception/AriaM3U8Exception.java
  29. 8
      PublicComponent/src/main/java/com/arialyy/aria/exception/AriaSFTPException.java
  30. 45
      PublicComponent/src/main/java/com/arialyy/aria/exception/ExceptionFactory.java
  31. 2
      PublicComponent/src/main/java/com/arialyy/aria/util/AriaCrashHandler.java
  32. 9
      PublicComponent/src/main/java/com/arialyy/aria/util/ErrorHelp.java
  33. 6
      SFtpComponent/src/main/java/com/arialyy/aria/sftp/AbsSFtpInfoTask.java
  34. 2
      SFtpComponent/src/main/java/com/arialyy/aria/sftp/download/SFtpDInfoTask.java
  35. 10
      SFtpComponent/src/main/java/com/arialyy/aria/sftp/download/SFtpDThreadTaskAdapter.java
  36. 10
      SFtpComponent/src/main/java/com/arialyy/aria/sftp/upload/SFtpUThreadTaskAdapter.java
  37. 1
      app/src/main/java/com/arialyy/simple/core/download/SingleTaskActivity.java
  38. 2
      app/src/main/java/com/arialyy/simple/core/download/group/DownloadGroupActivity.java
  39. 22
      app/src/main/java/com/arialyy/simple/core/download/group/GroupModule.java
  40. 7
      app/src/main/java/com/arialyy/simple/core/download/m3u8/M3U8VodDLoadActivity.java

@ -3,5 +3,5 @@
# github: ["AriaLyy"]
# patreon: AriaLyy
# liberapay: Aria
custom: ["https://afdian.net/@arialyy/plan", "paypal.me/arialyy"]
custom: ["https://afdian.net/@arialyy/plan", "https://paypal.me/arialyy"]

@ -49,7 +49,7 @@ public class M3U8Option<OP extends M3U8Option> extends BaseOption {
* @param useDefConvert true 使用默认的转换器false 关闭默认的转换器
*/
public OP setUseDefConvert(boolean useDefConvert) {
this.useDefConvert = true;
this.useDefConvert = useDefConvert;
ALog.d(TAG, "使用默认的码率转换器和TS转换器,如果无法下载,请参考:https://github.com/AriaLyy/Aria/issues/597 定制转换器");
return (OP) this;
}

@ -1,4 +1,6 @@
## 开发日志
+ v_3.8.10
- fix bug https://github.com/AriaLyy/Aria/issues/703
+ 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

@ -328,7 +328,7 @@ public abstract class AbsFtpInfoTask<ENTITY extends AbsEntity, TASK_WRAPPER exte
needRetry = needRetry && !CheckUtil.ftpIsBadRequest(client.getReplyCode());
}
callback.onFail(mEntity, new AriaFTPException(TAG, msg), needRetry);
callback.onFail(mEntity, new AriaFTPException(msg), needRetry);
}
}

@ -105,7 +105,7 @@ public abstract class BaseFtpThreadTaskAdapter extends AbsThreadTaskAdapter {
int reply = client.getReplyCode();
if (!FTPReply.isPositiveCompletion(reply)) {
client.disconnect();
fail(new AriaFTPException(TAG,
fail(new AriaFTPException(
String.format("无法连接到ftp服务器,错误码为:%s,msg:%s", reply, client.getReplyString())), false);
return null;
}

@ -41,7 +41,7 @@ final class FtpDFileInfoTask extends AbsFtpInfoTask<DownloadEntity, DTaskWrapper
@Override protected void handleFile(String remotePath, FTPFile ftpFile) {
super.handleFile(remotePath, ftpFile);
if (!FileUtil.checkMemorySpace(mEntity.getFilePath(), ftpFile.getSize())) {
callback.onFail(mEntity, new AriaFTPException(TAG,
callback.onFail(mEntity, new AriaFTPException(
String.format("获取ftp文件信息失败,内存空间不足, filePath: %s", mEntity.getFilePath())),
false);
}

@ -56,7 +56,7 @@ final class FtpDThreadTaskAdapter extends BaseFtpThreadTaskAdapter {
getThreadRecord().endLocation));
client = createClient();
if (client == null) {
fail(new AriaFTPException(TAG, "ftp client 创建失败"), false);
fail(new AriaFTPException("ftp client 创建失败"), false);
return;
}
if (getThreadRecord().startLocation > 0) {
@ -65,7 +65,7 @@ final class FtpDThreadTaskAdapter extends BaseFtpThreadTaskAdapter {
//发送第二次指令时,还需要再做一次判断
int reply = client.getReplyCode();
if (!FTPReply.isPositivePreliminary(reply) && reply != FTPReply.COMMAND_OK) {
fail(new AriaFTPException(TAG,
fail(new AriaFTPException(
String.format("获取文件信息错误,错误码为:%s,msg:%s", reply, client.getReplyString())), false);
client.disconnect();
return;
@ -76,7 +76,7 @@ final class FtpDThreadTaskAdapter extends BaseFtpThreadTaskAdapter {
is = client.retrieveFileStream(remotePath);
reply = client.getReplyCode();
if (!FTPReply.isPositivePreliminary(reply)) {
fail(new AriaFTPException(TAG,
fail(new AriaFTPException(
String.format("获取流失败,错误码为:%s,msg:%s", reply, client.getReplyString())), true);
client.disconnect();
return;
@ -89,9 +89,9 @@ final class FtpDThreadTaskAdapter extends BaseFtpThreadTaskAdapter {
handleComplete();
}
} catch (IOException e) {
fail(new AriaFTPException(TAG, String.format("下载失败【%s】", getThreadConfig().url), e), true);
fail(new AriaFTPException(String.format("下载失败【%s】", getThreadConfig().url), e), true);
} catch (Exception e) {
fail(new AriaFTPException(TAG, String.format("下载失败【%s】", getThreadConfig().url), e), false);
fail(new AriaFTPException(String.format("下载失败【%s】", getThreadConfig().url), e), false);
} finally {
try {
if (is != null) {
@ -153,7 +153,7 @@ final class FtpDThreadTaskAdapter extends BaseFtpThreadTaskAdapter {
}
handleComplete();
} catch (IOException e) {
fail(new AriaFTPException(TAG, String.format("下载失败【%s】", getThreadConfig().url), e), true);
fail(new AriaFTPException(String.format("下载失败【%s】", getThreadConfig().url), e), true);
} finally {
try {
if (fos != null) {
@ -203,7 +203,7 @@ final class FtpDThreadTaskAdapter extends BaseFtpThreadTaskAdapter {
}
}
} catch (IOException e) {
fail(new AriaFTPException(TAG, String.format("下载失败【%s】", getThreadConfig().url), e), true);
fail(new AriaFTPException(String.format("下载失败【%s】", getThreadConfig().url), e), true);
} finally {
try {
if (file != null) {

@ -67,7 +67,7 @@ final class FtpUThreadTaskAdapter extends BaseFtpThreadTaskAdapter {
client.setRestartOffset(getThreadRecord().startLocation);
int reply = client.getReplyCode();
if (!FTPReply.isPositivePreliminary(reply) && reply != FTPReply.FILE_ACTION_OK) {
fail(new AriaFTPException(TAG,
fail(new AriaFTPException(
String.format("文件上传错误,错误码为:%s, msg:%s, filePath: %s", reply,
client.getReplyString(), getEntity().getFilePath())), false);
client.disconnect();
@ -85,7 +85,7 @@ final class FtpUThreadTaskAdapter extends BaseFtpThreadTaskAdapter {
return;
}
if (!complete) {
fail(new AriaFTPException(TAG, "ftp文件上传失败"), false);
fail(new AriaFTPException("ftp文件上传失败"), false);
return;
}
ALog.i(TAG,
@ -93,11 +93,11 @@ final class FtpUThreadTaskAdapter extends BaseFtpThreadTaskAdapter {
complete();
} catch (IOException e) {
e.printStackTrace();
fail(new AriaFTPException(TAG,
fail(new AriaFTPException(
String.format("上传失败,filePath: %s, uploadUrl: %s", getEntity().getFilePath(),
getThreadConfig().url)), true);
} catch (Exception e) {
fail(new AriaFTPException(TAG, null, e), false);
fail(new AriaFTPException(null, e), false);
} finally {
try {
if (file != null) {
@ -136,7 +136,7 @@ final class FtpUThreadTaskAdapter extends BaseFtpThreadTaskAdapter {
@Override public void run() {
try {
if (isTimeOut) {
fail(new AriaFTPException(TAG, "socket连接失败,该问题一般出现于网络断开,客户端重新连接,"
fail(new AriaFTPException("socket连接失败,该问题一般出现于网络断开,客户端重新连接,"
+ "但是服务器端无法创建socket缺没有返回错误码的情况。"), false);
if (fa != null) {
fa.close();
@ -199,7 +199,7 @@ final class FtpUThreadTaskAdapter extends BaseFtpThreadTaskAdapter {
if (e.getMessage().contains("AriaIOException caught while copying")) {
e.printStackTrace();
} else {
fail(new AriaFTPException(TAG, msg, e), !storeSuccess);
fail(new AriaFTPException(msg, e), !storeSuccess);
}
return false;
} finally {
@ -208,7 +208,7 @@ final class FtpUThreadTaskAdapter extends BaseFtpThreadTaskAdapter {
int reply = client.getReplyCode();
if (!FTPReply.isPositiveCompletion(reply)) {
if (reply != FTPReply.TRANSFER_ABORTED) {
fail(new AriaFTPException(TAG,
fail(new AriaFTPException(
String.format("文件上传错误,错误码为:%s, msg:%s, filePath: %s", reply, client.getReplyString(),
getEntity().getFilePath())), false);
}

@ -84,7 +84,7 @@ final class HttpDFileInfoTask implements IInfoTask, Runnable {
conn.connect();
handleConnect(conn);
} catch (IOException e) {
failDownload(new AriaHTTPException(TAG,
failDownload(new AriaHTTPException(
String.format("下载失败,filePath: %s, url: %s", mEntity.getFilePath(), mEntity.getUrl()),
e), true);
} finally {
@ -133,7 +133,7 @@ final class HttpDFileInfoTask implements IInfoTask, Runnable {
long len = lenAdapter.handleFileLen(conn.getHeaderFields());
if (!FileUtil.checkMemorySpace(mEntity.getFilePath(), len)) {
failDownload(new AriaHTTPException(TAG,
failDownload(new AriaHTTPException(
String.format("下载失败,内存空间不足;filePath: %s, url: %s", mEntity.getFilePath(),
mEntity.getUrl())), false);
return;
@ -183,8 +183,7 @@ final class HttpDFileInfoTask implements IInfoTask, Runnable {
if (!checkLen(len) && !isChunked) {
if (len < 0) {
failDownload(
new AriaHTTPException(TAG,
String.format("任务下载失败,文件长度小于0, url: %s", mEntity.getUrl())),
new AriaHTTPException(String.format("任务下载失败,文件长度小于0, url: %s", mEntity.getUrl())),
false);
}
return;
@ -211,7 +210,7 @@ final class HttpDFileInfoTask implements IInfoTask, Runnable {
} else if (!checkLen(len) && !isChunked) {
if (len < 0) {
failDownload(
new AriaHTTPException(TAG,
new AriaHTTPException(
String.format("任务下载失败,文件长度小于0, url: %s", mEntity.getUrl())),
false);
}
@ -229,10 +228,10 @@ final class HttpDFileInfoTask implements IInfoTask, Runnable {
|| code == 307) {
handleUrlReTurn(conn, conn.getHeaderField("Location"));
} else if (code >= HttpURLConnection.HTTP_BAD_REQUEST) {
failDownload(new AriaHTTPException(TAG,
failDownload(new AriaHTTPException(
String.format("任务下载失败,errorCode:%s, url: %s", code, mEntity.getUrl())), false);
} else {
failDownload(new AriaHTTPException(TAG,
failDownload(new AriaHTTPException(
String.format("任务下载失败,errorCode:%s, errorMsg: %s, url: %s", code,
conn.getResponseMessage(), mEntity.getUrl())), !CheckUtil.httpIsBadRequest(code));
}
@ -311,7 +310,7 @@ final class HttpDFileInfoTask implements IInfoTask, Runnable {
ALog.d(TAG, "30x跳转,新url为【" + newUrl + "】");
if (TextUtils.isEmpty(newUrl) || newUrl.equalsIgnoreCase("null")) {
if (callback != null) {
callback.onFail(mEntity, new AriaHTTPException(TAG, "获取重定向链接失败"), false);
callback.onFail(mEntity, new AriaHTTPException("获取重定向链接失败"), false);
}
return;
}
@ -321,7 +320,7 @@ final class HttpDFileInfoTask implements IInfoTask, Runnable {
}
if (!CheckUtil.checkUrl(newUrl)) {
failDownload(new AriaHTTPException(TAG, "下载失败,重定向url错误"), false);
failDownload(new AriaHTTPException("下载失败,重定向url错误"), false);
return;
}
taskOption.setRedirectUrl(newUrl);

@ -60,7 +60,7 @@ public final class HttpDGInfoTask implements IInfoTask {
ALog.e(TAG, String.format("获取文件信息失败,url:%s", ((DownloadEntity) entity).getUrl()));
count.getAndIncrement();
failCount.getAndIncrement();
listener.onSubFail((DownloadEntity) entity, new AriaHTTPException(TAG,
listener.onSubFail((DownloadEntity) entity, new AriaHTTPException(
String.format("子任务获取文件长度失败,url:%s", ((DownloadEntity) entity).getUrl())));
checkGetSizeComplete(count.get(), failCount.get());
}
@ -132,7 +132,7 @@ public final class HttpDGInfoTask implements IInfoTask {
*/
private void checkGetSizeComplete(int count, int failCount) {
if (failCount == wrapper.getSubTaskWrapper().size()) {
callback.onFail(wrapper.getEntity(), new AriaHTTPException(TAG, "获取子任务长度失败"), false);
callback.onFail(wrapper.getEntity(), new AriaHTTPException("获取子任务长度失败"), false);
notifyLock();
return;
}

@ -117,20 +117,16 @@ final class HttpDThreadTaskAdapter extends BaseHttpThreadTaskAdapter {
handleComplete();
}
} catch (MalformedURLException e) {
fail(new AriaHTTPException(TAG,
String.format("任务【%s】下载失败,filePath: %s, url: %s", getFileName(),
fail(new AriaHTTPException(String.format("任务【%s】下载失败,filePath: %s, url: %s", getFileName(),
getEntity().getFilePath(), getEntity().getUrl()), e), false);
} catch (IOException e) {
fail(new AriaHTTPException(TAG,
String.format("任务【%s】下载失败,filePath: %s, url: %s", getFileName(),
fail(new AriaHTTPException(String.format("任务【%s】下载失败,filePath: %s, url: %s", getFileName(),
getEntity().getFilePath(), getEntity().getUrl()), e), true);
} catch (ArrayIndexOutOfBoundsException e) {
fail(new AriaHTTPException(TAG,
String.format("任务【%s】下载失败,filePath: %s, url: %s", getFileName(),
fail(new AriaHTTPException(String.format("任务【%s】下载失败,filePath: %s, url: %s", getFileName(),
getEntity().getFilePath(), getEntity().getUrl()), e), false);
} catch (Exception e) {
fail(new AriaHTTPException(TAG,
String.format("任务【%s】下载失败,filePath: %s, url: %s", getFileName(),
fail(new AriaHTTPException(String.format("任务【%s】下载失败,filePath: %s, url: %s", getFileName(),
getEntity().getFilePath(), getEntity().getUrl()), e), false);
} finally {
try {
@ -171,7 +167,7 @@ final class HttpDThreadTaskAdapter extends BaseHttpThreadTaskAdapter {
}
handleComplete();
} catch (IOException e) {
fail(new AriaHTTPException(TAG,
fail(new AriaHTTPException(
String.format("文件下载失败,savePath: %s, url: %s", getEntity().getFilePath(),
getThreadConfig().url), e), true);
} finally {
@ -224,8 +220,7 @@ final class HttpDThreadTaskAdapter extends BaseHttpThreadTaskAdapter {
}
handleComplete();
} catch (IOException e) {
fail(new AriaHTTPException(TAG,
String.format("文件下载失败,savePath: %s, url: %s", getEntity().getFilePath(),
fail(new AriaHTTPException(String.format("文件下载失败,savePath: %s, url: %s", getEntity().getFilePath(),
getThreadConfig().url), e), true);
} finally {
try {

@ -62,7 +62,7 @@ final class HttpULoader extends AbsNormalLoader<UTaskWrapper> {
new Handler(looper, mStateManager.getHandlerCallback()));
if (tt == null || tt.isEmpty()) {
ALog.e(TAG, "创建线程任务失败");
getListener().onFail(false, new AriaHTTPException(TAG, "创建线程任务失败"));
getListener().onFail(false, new AriaHTTPException("创建线程任务失败"));
return;
}

@ -54,7 +54,7 @@ final class HttpUThreadTaskAdapter extends BaseHttpThreadTaskAdapter {
@Override protected void handlerThreadTask() {
File uploadFile = new File(getEntity().getFilePath());
if (!uploadFile.exists()) {
fail(new AriaHTTPException(TAG,
fail(new AriaHTTPException(
String.format("上传失败,文件不存在;filePath: %s, url: %s", getEntity().getFilePath(),
getEntity().getUrl())));
return;
@ -104,7 +104,7 @@ final class HttpUThreadTaskAdapter extends BaseHttpThreadTaskAdapter {
getEntity().setResponseStr(finish(writer));
} catch (Exception e) {
e.printStackTrace();
fail(new AriaHTTPException(TAG,
fail(new AriaHTTPException(
String.format("上传失败,filePath: %s, url: %s", getEntity().getFilePath(),
getEntity().getUrl()), e));
}
@ -220,7 +220,7 @@ final class HttpUThreadTaskAdapter extends BaseHttpThreadTaskAdapter {
} else {
String msg = "response msg: " + mHttpConn.getResponseMessage() + ",code: " + status;
ALog.e(TAG, msg);
fail(new AriaHTTPException(TAG, msg), false);
fail(new AriaHTTPException(msg), false);
}
writer.flush();
writer.close();

@ -295,7 +295,7 @@ final public class M3U8InfoTask implements IInfoTask {
ALog.d(TAG, "30x跳转,新url为【" + newUrl + "】");
if (TextUtils.isEmpty(newUrl) || newUrl.equalsIgnoreCase("null")) {
if (mCallback != null) {
mCallback.onFail(mEntity, new AriaM3U8Exception(TAG, "获取重定向链接失败"), false);
mCallback.onFail(mEntity, new AriaM3U8Exception("获取重定向链接失败"), false);
}
return;
}
@ -354,7 +354,7 @@ final public class M3U8InfoTask implements IInfoTask {
}
private void failDownload(String errorInfo, boolean needRetry) {
mCallback.onFail(mEntity, new AriaM3U8Exception(TAG, errorInfo), needRetry);
mCallback.onFail(mEntity, new AriaM3U8Exception(errorInfo), needRetry);
}
/**

@ -91,15 +91,15 @@ public final class M3U8ThreadTaskAdapter extends AbsThreadTaskAdapter {
handleConn(conn);
} catch (MalformedURLException e) {
fail(new AriaM3U8Exception(TAG,
fail(new AriaM3U8Exception(
String.format("分片【%s】下载失败,filePath: %s, url: %s", getThreadRecord().threadId,
getThreadConfig().tempFile.getPath(), getEntity().getUrl()), e), false);
} catch (IOException e) {
fail(new AriaM3U8Exception(TAG,
fail(new AriaM3U8Exception(
String.format("分片【%s】下载失败,filePath: %s, url: %s", getThreadRecord().threadId,
getThreadConfig().tempFile.getPath(), getEntity().getUrl()), e), true);
} catch (Exception e) {
fail(new AriaM3U8Exception(TAG,
fail(new AriaM3U8Exception(
String.format("分片【%s】下载失败,filePath: %s, url: %s", getThreadRecord().threadId,
getThreadConfig().tempFile.getPath(), getEntity().getUrl()), e), false);
} finally {
@ -137,7 +137,7 @@ public final class M3U8ThreadTaskAdapter extends AbsThreadTaskAdapter {
|| code == 307) {
handleUrlReTurn(conn, conn.getHeaderField("Location"));
} else {
fail(new AriaM3U8Exception(TAG,
fail(new AriaM3U8Exception(
String.format("连接错误,http错误码:%s,url:%s", code, getThreadConfig().url)),
false);
}
@ -150,7 +150,7 @@ public final class M3U8ThreadTaskAdapter extends AbsThreadTaskAdapter {
private void handleUrlReTurn(HttpURLConnection conn, String newUrl) throws IOException {
ALog.d(TAG, "30x跳转,新url为【" + newUrl + "】");
if (TextUtils.isEmpty(newUrl) || newUrl.equalsIgnoreCase("null")) {
fail(new AriaM3U8Exception(TAG, "下载失败,重定向url为空"), false);
fail(new AriaM3U8Exception("下载失败,重定向url为空"), false);
return;
}
@ -160,7 +160,7 @@ public final class M3U8ThreadTaskAdapter extends AbsThreadTaskAdapter {
}
if (!CheckUtil.checkUrl(newUrl)) {
fail(new AriaM3U8Exception(TAG, "下载失败,重定向url错误"), false);
fail(new AriaM3U8Exception("下载失败,重定向url错误"), false);
return;
}
String cookies = conn.getHeaderField("Set-Cookie");
@ -198,7 +198,7 @@ public final class M3U8ThreadTaskAdapter extends AbsThreadTaskAdapter {
}
handleComplete();
} catch (IOException e) {
fail(new AriaM3U8Exception(TAG,
fail(new AriaM3U8Exception(
String.format("文件下载失败,savePath: %s, url: %s", getThreadConfig().tempFile.getPath(),
getThreadConfig().url), e), true);
} finally {
@ -241,7 +241,7 @@ public final class M3U8ThreadTaskAdapter extends AbsThreadTaskAdapter {
}
handleComplete();
} catch (IOException e) {
fail(new AriaM3U8Exception(TAG,
fail(new AriaM3U8Exception(
String.format("文件下载失败,savePath: %s, url: %s", getThreadConfig().tempFile.getPath(),
getThreadConfig().url), e), true);
} finally {

@ -276,7 +276,7 @@ final class M3U8LiveLoader extends BaseM3U8Loader {
}
}
if (TextUtils.isEmpty(url) || !url.startsWith("http")) {
fail(new AriaM3U8Exception(TAG, String.format("ts地址错误,url:%s", url)), false);
fail(new AriaM3U8Exception(String.format("ts地址错误,url:%s", url)), false);
return;
}
offerPeer(new M3U8LiveLoader.ExtInfo(url, extInf));
@ -297,13 +297,13 @@ final class M3U8LiveLoader extends BaseM3U8Loader {
if (generateIndexFile(true)) {
getListener().onComplete();
} else {
getListener().onFail(false, new AriaM3U8Exception(TAG, "创建索引文件失败"));
getListener().onFail(false, new AriaM3U8Exception("创建索引文件失败"));
}
} else if (mM3U8Option.isMergeFile()) {
if (mergeFile()) {
getListener().onComplete();
} else {
getListener().onFail(false, new AriaM3U8Exception(TAG, "合并文件失败"));
getListener().onFail(false, new AriaM3U8Exception("合并文件失败"));
}
} else {
getListener().onComplete();

@ -519,10 +519,10 @@ final class M3U8VodLoader extends BaseM3U8Loader {
urls.addAll((Collection<? extends String>) info.obj);
}
if (urls.isEmpty()) {
fail(new AriaM3U8Exception(TAG, "获取地址失败"), false);
fail(new AriaM3U8Exception("获取地址失败"), false);
return;
} else if (!urls.get(0).startsWith("http")) {
fail(new AriaM3U8Exception(TAG, "地址错误,请使用IVodTsUrlConverter处理你的url信息"), false);
fail(new AriaM3U8Exception("地址错误,请使用IVodTsUrlConverter处理你的url信息"), false);
return;
}
mM3U8Option.setUrls(urls);

@ -149,7 +149,7 @@ public final class VodStateManager implements IThreadStateManager {
if (loader.generateIndexFile(false)) {
listener.onComplete();
} else {
listener.onFail(false, new AriaM3U8Exception(TAG, "创建索引文件失败"));
listener.onFail(false, new AriaM3U8Exception("创建索引文件失败"));
}
} else if (m3U8Option.isMergeFile()) {
if (mergeFile()) {

@ -19,13 +19,14 @@ package com.arialyy.aria.core.group;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
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;
import com.arialyy.aria.core.manager.ThreadTaskManager;
import com.arialyy.aria.exception.AriaException;
import com.arialyy.aria.exception.ExceptionFactory;
import com.arialyy.aria.util.ALog;
import com.arialyy.aria.util.CommonUtil;
import com.arialyy.aria.util.NetUtils;
@ -104,8 +105,11 @@ final class SimpleSchedulers implements Handler.Callback {
* @param needRetry true 需要重试false 不需要重试
*/
private synchronized void handleFail(final AbsSubDLoadUtil loaderUtil, boolean needRetry) {
Configuration config = Configuration.getInstance();
Log.d(TAG, String.format("handleFail, size = %s, completeNum = %s, failNum = %s, stopNum = %s",
mGState.getSubSize(), mGState.getCompleteNum(), mGState.getFailNum(),
mGState.getSubSize()));
Configuration config = Configuration.getInstance();
int num = config.dGroupCfg.getSubReTryNum();
boolean isNotNetRetry = config.appCfg.isNotNetRetry();
@ -114,25 +118,27 @@ final class SimpleSchedulers implements Handler.Callback {
|| loaderUtil.getLoader() == null // 如果获取不到文件信息,loader为空
|| loaderUtil.getEntity().getFailNum() > num) {
mQueue.removeTaskFromExecQ(loaderUtil);
mGState.listener.onSubFail(loaderUtil.getEntity(), new AriaException(TAG,
mGState.listener.onSubFail(loaderUtil.getEntity(),
ExceptionFactory.getException(ExceptionFactory.TYPE_GROUP,
String.format("任务组子任务【%s】下载失败,下载地址【%s】", loaderUtil.getEntity().getFileName(),
loaderUtil.getEntity().getUrl())));
loaderUtil.getEntity().getUrl()), null));
mGState.countFailNum(loaderUtil.getKey());
if (mGState.getFailNum() == mGState.getSubSize()
|| mGState.getStopNum() + mGState.getFailNum() + mGState.getCompleteNum()
== mGState.getSubSize()) {
mQueue.clear();
mGState.isRunning.set(false);
if (mGState.getCompleteNum() > 0&&Configuration.getInstance().dGroupCfg.isSubFailAsStop()) {
if (mGState.getCompleteNum() > 0
&& Configuration.getInstance().dGroupCfg.isSubFailAsStop()) {
ALog.e(TAG, String.format("任务组【%s】停止", mGState.getGroupHash()));
mGState.listener.onStop(mGState.getProgress());
} else {
mGState.listener.onFail(false, new AriaException(TAG,
String.format("任务组【%s】下载失败", mGState.getGroupHash())));
return;
}
} else {
startNext();
mGState.listener.onFail(false,
ExceptionFactory.getException(ExceptionFactory.TYPE_GROUP,
String.format("任务组【%s】下载失败", mGState.getGroupHash()), null));
return;
}
startNext();
return;
}
SimpleSubRetryQueue.getInstance().offer(loaderUtil);
@ -144,6 +150,10 @@ final class SimpleSchedulers implements Handler.Callback {
* 2completeNum + failNum + stopNum = subSize则认为组合任务停止
*/
private synchronized void handleStop(AbsSubDLoadUtil loadUtil, long curLocation) {
Log.d(TAG, String.format("handleStop, size = %s, completeNum = %s, failNum = %s, stopNum = %s",
mGState.getSubSize(), mGState.getCompleteNum(), mGState.getFailNum(),
mGState.getSubSize()));
mGState.listener.onSubStop(loadUtil.getEntity(), curLocation);
mGState.countStopNum(loadUtil.getKey());
if (mGState.getStopNum() == mGState.getSubSize()
@ -152,12 +162,11 @@ final class SimpleSchedulers implements Handler.Callback {
+ mGState.getFailNum()
+ mQueue.getCacheSize()
== mGState.getSubSize()) {
mQueue.clear();
mGState.isRunning.set(false);
mGState.listener.onStop(mGState.getProgress());
} else {
startNext();
return;
}
startNext();
}
/**
@ -170,6 +179,11 @@ final class SimpleSchedulers implements Handler.Callback {
*/
private synchronized void handleComplete(AbsSubDLoadUtil loader) {
ALog.d(TAG, String.format("子任务【%s】完成", loader.getEntity().getFileName()));
Log.d(TAG,
String.format("handleComplete, size = %s, completeNum = %s, failNum = %s, stopNum = %s",
mGState.getSubSize(), mGState.getCompleteNum(), mGState.getFailNum(),
mGState.getSubSize()));
TaskRecord record = loader.getRecord();
if (record != null && record.isBlock) {
File partFile =
@ -180,23 +194,22 @@ final class SimpleSchedulers implements Handler.Callback {
mGState.listener.onSubComplete(loader.getEntity());
mQueue.removeTaskFromExecQ(loader);
mGState.updateCompleteNum();
ALog.d(TAG, String.format("总任务数:%s,完成的任务数:%s,失败的任务数:%s,停止的任务数:%s", mGState.getSubSize(),
mGState.getCompleteNum(), mGState.getFailNum(), mGState.getStopNum()));
if (mGState.getCompleteNum() + mGState.getFailNum() + mGState.getStopNum()
== mGState.getSubSize()) {
if (mGState.getStopNum() == 0 && mGState.getFailNum() == 0) {
mGState.listener.onComplete();
} else if(mGState.getStopNum() == 0&&!Configuration.getInstance().dGroupCfg.isSubFailAsStop() ){
mGState.listener.onFail(false, new AriaException(TAG,
String.format("任务组【%s】下载失败", mGState.getGroupHash())));
} else if (mGState.getStopNum() == 0
&& !Configuration.getInstance().dGroupCfg.isSubFailAsStop()) {
mGState.listener.onFail(false,
ExceptionFactory.getException(ExceptionFactory.TYPE_GROUP,
String.format("任务组【%s】下载失败", mGState.getGroupHash()), null));
} else {
mGState.listener.onStop(mGState.getProgress());
}
mQueue.clear();
mGState.isRunning.set(false);
} else {
startNext();
return;
}
startNext();
}
/**
@ -210,8 +223,8 @@ final class SimpleSchedulers implements Handler.Callback {
if (next != null) {
ALog.d(TAG, String.format("启动任务:%s", next.getEntity().getFileName()));
mQueue.startTask(next);
} else {
ALog.i(TAG, "没有下一子任务");
return;
}
ALog.i(TAG, "没有下一子任务");
}
}

@ -21,10 +21,10 @@ import com.arialyy.aria.util.CommonUtil;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
/**
* 组合任务队列该队列生命周期和{@link AbsGroupLoaderUtil}生命周期一致
@ -34,11 +34,11 @@ final class SimpleSubQueue implements ISubQueue<AbsSubDLoadUtil> {
/**
* 缓存下载器
*/
private Map<String, AbsSubDLoadUtil> mCache = new LinkedHashMap<>();
private Map<String, AbsSubDLoadUtil> mCache = new ConcurrentHashMap<>();
/**
* 执行中的下载器
*/
private Map<String, AbsSubDLoadUtil> mExec = new LinkedHashMap<>();
private Map<String, AbsSubDLoadUtil> mExec = new ConcurrentHashMap<>();
/**
* 最大执行任务数
@ -85,13 +85,14 @@ final class SimpleSubQueue implements ISubQueue<AbsSubDLoadUtil> {
if (mExec.size() < mExecSize) {
mCache.remove(fileer.getKey());
mExec.put(fileer.getKey(), fileer);
ALog.d(TAG, String.format("开始执行子任务:%s", fileer.getEntity().getFileName()));
ALog.d(TAG,
String.format("开始执行子任务:%s,key: %s", fileer.getEntity().getFileName(), fileer.getKey()));
fileer.run();
} else {
return;
}
ALog.d(TAG, String.format("执行队列已满,任务进入缓存器中,key: %s", fileer.getKey()));
addTask(fileer);
}
}
@Override public void stopTask(AbsSubDLoadUtil fileer) {
fileer.stop();
@ -144,7 +145,9 @@ final class SimpleSubQueue implements ISubQueue<AbsSubDLoadUtil> {
addTask(t);
}
}
} else { // 处理队列变大的情况,该情况下将增加任务
return;
}
// 处理队列变大的情况,该情况下将增加任务
if (mExec.size() < num) {
for (int i = 0; i < diff; i++) {
AbsSubDLoadUtil next = getNextTask();
@ -156,7 +159,6 @@ final class SimpleSubQueue implements ISubQueue<AbsSubDLoadUtil> {
}
}
}
}
@Override public void removeTaskFromExecQ(AbsSubDLoadUtil fileer) {
mExec.remove(fileer.getKey());

@ -16,7 +16,6 @@
package com.arialyy.aria.core.listener;
import android.os.Handler;
import android.util.Log;
import com.arialyy.aria.core.common.AbsEntity;
import com.arialyy.aria.core.inf.IEntity;
import com.arialyy.aria.core.inf.TaskSchedulerType;
@ -125,7 +124,7 @@ public abstract class BaseListener<ENTITY extends AbsEntity, TASK_WRAPPER extend
if (e != null) {
String error = ALog.getExceptionString(e);
ALog.e(TAG, error);
ErrorHelp.saveError(e.getTag(), e.getMessage(), error);
ErrorHelp.saveError(e.getMessage(), error);
}
}

@ -91,7 +91,7 @@ public class DownloadGroupListener
sendInState2Target(ISchedulers.SUB_FAIL, subEntity);
if (e != null) {
e.printStackTrace();
ErrorHelp.saveError(e.getTag(), "", ALog.getExceptionString(e));
ErrorHelp.saveError("", ALog.getExceptionString(e));
}
}

@ -20,7 +20,6 @@ import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.os.Process;
import android.util.Log;
import com.arialyy.aria.core.AriaConfig;
import com.arialyy.aria.core.ThreadRecord;
import com.arialyy.aria.core.common.AbsEntity;
@ -259,16 +258,15 @@ public class ThreadTask implements IThreadTask, IThreadTaskObserver {
if (mTaskWrapper.getRequestType() == ITaskWrapper.M3U8_VOD) {
writeConfig(false, getConfig().tempFile.length());
ALog.i(TAG, String.format("任务【%s】已停止", getFileName()));
} else {
return;
}
if (mTaskWrapper.isSupportBP()) {
ALog.d(TAG,
String.format("任务【%s】thread__%s__停止【当前线程停止位置:%s】", getFileName(),
ALog.d(TAG, String.format("任务【%s】thread__%s__停止【当前线程停止位置:%s】", getFileName(),
mRecord.threadId, stopLocation));
writeConfig(false, stopLocation);
} else {
ALog.i(TAG, String.format("任务【%s】已停止", getFileName()));
}
return;
}
ALog.i(TAG, String.format("任务【%s】已停止", getFileName()));
}
/**
@ -410,7 +408,7 @@ public class ThreadTask implements IThreadTask, IThreadTaskObserver {
retryBlockTask(needRetry && mConfig.startThreadNum != 1);
} else {
ALog.e(TAG, String.format("任务【%s】执行失败", getFileName()));
ErrorHelp.saveError(TAG, "", ALog.getExceptionString(ex));
ErrorHelp.saveError("", ALog.getExceptionString(ex));
sendFailMsg(null, needRetry);
}
}

@ -17,20 +17,12 @@ package com.arialyy.aria.exception;
public class AriaException extends Exception {
private String tag;
public AriaException(String tag, String message) {
public AriaException(String message) {
super(message);
this.tag = tag;
}
public AriaException(String tag, String message, Exception e) {
super(String.format("%s, %s\n%s", tag, message == null ? "" : message,
public AriaException(String message, Exception e) {
super(String.format("%s\n%s", message == null ? "" : message,
e == null ? "" : e.getMessage()));
this.tag = tag;
}
public String getTag() {
return tag;
}
}

@ -18,11 +18,11 @@ package com.arialyy.aria.exception;
public class AriaFTPException extends AriaException {
private static final String FTP_EXCEPTION = "Aria FTP Exception:";
public AriaFTPException(String tag, String message) {
super(tag, String.format("%s\n%s", FTP_EXCEPTION, message));
public AriaFTPException(String message) {
super(String.format("%s\n%s", FTP_EXCEPTION, message));
}
public AriaFTPException(String tag, String message, Exception e) {
super(tag, message, e);
public AriaFTPException(String message, Exception e) {
super(message, e);
}
}

@ -0,0 +1,28 @@
/*
* 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.exception;
public class AriaGroupException extends AriaException {
private static final String FTP_EXCEPTION = "Aria Group Exception:";
public AriaGroupException(String message) {
super(String.format("%s\n%s", FTP_EXCEPTION, message));
}
public AriaGroupException(String message, Exception e) {
super(message, e);
}
}

@ -18,11 +18,11 @@ package com.arialyy.aria.exception;
public class AriaHTTPException extends AriaException {
private static final String HTTP_EXCEPTION = "Aria HTTP Exception:";
public AriaHTTPException(String tag, String message) {
super(tag, String.format("%s\n%s", HTTP_EXCEPTION, message));
public AriaHTTPException( String message) {
super(String.format("%s\n%s", HTTP_EXCEPTION, message));
}
public AriaHTTPException(String tag, String message, Exception e) {
super(tag, message, e);
public AriaHTTPException(String message, Exception e) {
super(message, e);
}
}

@ -18,11 +18,11 @@ package com.arialyy.aria.exception;
public class AriaM3U8Exception extends AriaException {
private static final String M3U8_EXCEPTION = "Aria M3U8 Exception:";
public AriaM3U8Exception(String tag, String message) {
super(tag, String.format("%s\n%s", M3U8_EXCEPTION, message));
public AriaM3U8Exception(String message) {
super(String.format("%s\n%s", M3U8_EXCEPTION, message));
}
public AriaM3U8Exception(String tag, String message, Exception e){
super(tag, message, e);
public AriaM3U8Exception(String message, Exception e) {
super(message, e);
}
}

@ -18,11 +18,11 @@ package com.arialyy.aria.exception;
public class AriaSFTPException extends AriaException {
private static final String SFTP_EXCEPTION = "Aria SFTP Exception:";
public AriaSFTPException(String tag, String message) {
super(tag, String.format("%s\n%s", SFTP_EXCEPTION, message));
public AriaSFTPException(String message) {
super(String.format("%s\n%s", SFTP_EXCEPTION, message));
}
public AriaSFTPException(String tag, String message, Exception e) {
super(tag, message, e);
public AriaSFTPException(String message, Exception e) {
super(message, e);
}
}

@ -0,0 +1,45 @@
/*
* 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.exception;
public class ExceptionFactory {
public static final int TYPE_FTP = 1;
public static final int TYPE_HTTP = 2;
public static final int TYPE_M3U8 = 3;
public static final int TYPE_SFTP = 4;
public static final int TYPE_GROUP = 5;
public static AriaException getException(int type, String msg, Exception e) {
switch (type) {
case TYPE_FTP: {
return e == null ? new AriaFTPException(msg) : new AriaFTPException(msg, e);
}
case TYPE_HTTP: {
return e == null ? new AriaHTTPException(msg) : new AriaHTTPException(msg, e);
}
case TYPE_M3U8: {
return e == null ? new AriaM3U8Exception(msg) : new AriaM3U8Exception(msg, e);
}
case TYPE_SFTP: {
return e == null ? new AriaSFTPException(msg) : new AriaSFTPException(msg, e);
}
case TYPE_GROUP: {
return e == null ? new AriaGroupException(msg) : new AriaGroupException(msg, e);
}
}
return e == null ? new AriaException(msg) : new AriaException(msg, e);
}
}

@ -59,7 +59,7 @@ public class AriaCrashHandler implements Thread.UncaughtExceptionHandler {
mExecutorService.execute(new Runnable() {
@Override
public void run() {
ErrorHelp.saveError(name, "", ALog.getExceptionString(ex));
ErrorHelp.saveError("", ALog.getExceptionString(ex));
}
});
}

@ -19,7 +19,6 @@ import android.annotation.SuppressLint;
import com.arialyy.aria.core.AriaConfig;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.text.SimpleDateFormat;
import java.util.Date;
@ -36,8 +35,8 @@ public class ErrorHelp {
* @param msg 错误提示
* @param ex 异常
*/
public static void saveError(String tag, String msg, String ex) {
writeLogToFile(tag, String.format("\nmsg【%s】\nException:%s", msg, ex));
public static void saveError(String msg, String ex) {
writeLogToFile(String.format("\nmsg【%s】\nException:%s", msg, ex));
}
/**
@ -57,12 +56,10 @@ public class ErrorHelp {
/**
* 把日志记录到文件
*/
private static int writeLogToFile(String tag, String message) {
private static int writeLogToFile(String message) {
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append(getData("yyyy-MM-dd HH:mm:ss"));
stringBuffer.append(" ");
stringBuffer.append(tag);
stringBuffer.append(" ");
stringBuffer.append(message);
stringBuffer.append("\n\n");
PrintWriter writer = null;

@ -54,11 +54,11 @@ public abstract class AbsSFtpInfoTask<WP extends AbsTaskWrapper> implements IInf
}
getFileInfo(session);
} catch (JSchException e) {
fail(new AriaSFTPException(TAG, "jsch错误", e), false);
fail(new AriaSFTPException("jsch错误", e), false);
} catch (UnsupportedEncodingException e) {
fail(new AriaSFTPException(TAG, "字符编码错误", e), false);
fail(new AriaSFTPException("字符编码错误", e), false);
} catch (SftpException e) {
fail(new AriaSFTPException(TAG, "sftp错误,错误类型:" + e.id, e), false);
fail(new AriaSFTPException("sftp错误,错误类型:" + e.id, e), false);
}
}

@ -63,7 +63,7 @@ final class SFtpDInfoTask extends AbsSFtpInfoTask<DTaskWrapper> {
callback.onSucceed(getWrapper().getKey(), info);
} else {
callback.onFail(getWrapper().getEntity(),
new AriaSFTPException(TAG, String.format("文件不存在,remotePath:%s", remotePath)), false);
new AriaSFTPException(String.format("文件不存在,remotePath:%s", remotePath)), false);
}
channel.disconnect();
}

@ -53,7 +53,7 @@ final class SFtpDThreadTaskAdapter extends AbsThreadTaskAdapter {
@Override protected void handlerThreadTask() {
if (session == null) {
fail(new AriaSFTPException(TAG, "session 为空"), false);
fail(new AriaSFTPException("session 为空"), false);
return;
}
try {
@ -74,13 +74,13 @@ final class SFtpDThreadTaskAdapter extends AbsThreadTaskAdapter {
CommonUtil.convertSFtpChar(charSet, option.getUrlEntity().remotePath);
download(remotePath);
} catch (SftpException e) {
fail(new AriaSFTPException(TAG, "sftp错误,错误类型:" + e.id, e), false);
fail(new AriaSFTPException("sftp错误,错误类型:" + e.id, e), false);
} catch (UnsupportedEncodingException e) {
fail(new AriaSFTPException(TAG, "字符编码错误", e), false);
fail(new AriaSFTPException("字符编码错误", e), false);
} catch (IOException e) {
fail(new AriaSFTPException(TAG, "", e), true);
fail(new AriaSFTPException("", e), true);
} catch (JSchException e) {
fail(new AriaSFTPException(TAG, "jsch 错误", e), false);
fail(new AriaSFTPException("jsch 错误", e), false);
} finally {
channelSftp.disconnect();
}

@ -50,7 +50,7 @@ final class SFtpUThreadTaskAdapter extends AbsThreadTaskAdapter {
@Override protected void handlerThreadTask() {
if (session == null) {
fail(new AriaSFTPException(TAG, "session 为空"), false);
fail(new AriaSFTPException("session 为空"), false);
return;
}
try {
@ -75,13 +75,13 @@ final class SFtpUThreadTaskAdapter extends AbsThreadTaskAdapter {
channelSftp.cd(remotePath);
upload(remotePath);
} catch (SftpException e) {
fail(new AriaSFTPException(TAG, "sftp错误,错误类型:" + e.id, e), false);
fail(new AriaSFTPException("sftp错误,错误类型:" + e.id, e), false);
} catch (UnsupportedEncodingException e) {
fail(new AriaSFTPException(TAG, "字符编码错误", e), false);
fail(new AriaSFTPException("字符编码错误", e), false);
} catch (IOException e) {
fail(new AriaSFTPException(TAG, "", e), true);
fail(new AriaSFTPException("", e), true);
} catch (JSchException e) {
fail(new AriaSFTPException(TAG, "jsch 错误", e), false);
fail(new AriaSFTPException("jsch 错误", e), false);
} finally {
channelSftp.disconnect();
}

@ -159,7 +159,6 @@ public class SingleTaskActivity extends BaseActivity<ActivitySingleBinding> {
}
if (speed > -1) {
msg = item.getTitle().toString();
Aria.download(this).setMaxSpeed(speed);
T.showShort(this, msg);
}
return true;

@ -17,6 +17,7 @@ package com.arialyy.simple.core.download.group;
import android.os.Bundle;
import android.os.Environment;
import android.util.Log;
import android.view.View;
import com.arialyy.annotations.DownloadGroup;
import com.arialyy.aria.core.Aria;
@ -82,6 +83,7 @@ public class DownloadGroupActivity extends BaseActivity<ActivityDownloadGroupBin
//.setFileSize(114981416)
//.updateUrls(temp)
.create();
Log.d(TAG, "taskId = " + mTaskId);
}
@Override public void stop(View v, AbsEntity entity) {

@ -32,19 +32,9 @@ public class GroupModule extends BaseModule {
public List<String> getUrls() {
List<String> urls = new ArrayList<>();
//String[] str = getContext().getResources().getStringArray(R.array.group_urls_1);
//Collections.addAll(urls, str);
//urls.add("https://scontent-hkt1-1.xx.fbcdn.net/v/t1.0-9/fr/cp0/e15/q65/85148967_168821394550033_6164348723502514176_n.jpg?_nc_cat=105&_nc_sid=110474&efg=eyJpIjoidCJ9&_nc_oc=AQni9wIDOcxkQGfqH7jFwLuRWV3cIi0We11MXp1V0_vfrQ3-SBV4Ue034aJXzzIzdNI&_nc_ht=scontent-hkt1-1.xx&_nc_tp=14&oh=37829bbfd4f7179fcc3527a7a7971f53&oe=5F00FC35");
//urls.add("https://scontent-hkt1-1.xx.fbcdn.net/v/t1.0-0/cp0/e15/q65/p480x480/84206444_168821471216692_7979166053252988928_n.jpg?_nc_cat=106&_nc_sid=110474&efg=eyJpIjoidCJ9&_nc_oc=AQny1ZTkxw-sq4mSH2TThaQNRJB89uKG2cW9e3DgcI78qXE7b8Jlyox749lXkcngYBs&_nc_ht=scontent-hkt1-1.xx&_nc_tp=3&oh=6714e2c9b3d76e12eff960b6aa22cdfb&oe=5EEE640F");
//urls.add("https://scontent-hkt1-1.xx.fbcdn.net/v/t1.0-0/cp0/e15/q65/p480x480/86702402_168821534550019_6064732312896012288_n.jpg?_nc_cat=101&_nc_sid=110474&efg=eyJpIjoidCJ9&_nc_oc=AQnfJfW55cqVfs0lzZOjEa8kGoxvrA--\\brjaelZgcf8MzqQUhjH3moqGoekMQlATXRM&_nc_ht=scontent-hkt1-1.xx&_nc_tp=3&oh=96f4f776c05b2c200cfb720fa36f938b&oe=5EFA310D");
//urls.add("https://scontent-hkt1-1.xx.fbcdn.net/v/t1.0-0/cp0/e15/q65/p480x480/85236032_168821577883348_2800973234302877696_n.jpg?_nc_cat=106&_nc_sid=110474&efg=eyJpIjoidCJ9&_nc_oc=AQlNvaTlYUspquMWBLnkgVOHdzG4pX2XW3NSHYxvVYsaJF8Ehy9tGn6R6Ned5UwcwAM&_nc_ht=scontent-hkt1-1.xx&_nc_tp=3&oh=6fd5e6442712e4da111d09e8902c68c5&oe=5EFE1528");
//urls.add("https://scontent-hkt1-1.xx.fbcdn.net/v/t1.0-1/cp0/e15/q65/p120x120/80398195_141232180642288_3692820603451998208_n.jpg?_nc_cat=109&_nc_sid=dbb9e7&efg=eyJpIjoidCJ9&_nc_oc=AQmsZxgvLgoObkqHbcKS8qIZ3w_QhssRwLSF5o-8P6q_kf962w32kmjLqcg6lH9qxWI&_nc_ht=scontent-hkt1-1.xx&_nc_tp=3&oh=269e655e7b901e8d07d9362142a0fdda&oe=5EF43734");
urls.add(
"https://video-hkt1-1.xx.fbcdn.net/v/t42.9040-2/89465702_658301101378505_5469280744218034176_n.mp4?_nc_cat=107&_nc_sid=985c63&efg=eyJ2ZW5jb2RlX3RhZyI6ImxlZ2FjeV9zZCJ9&_nc_oc=AQmzYwQG9vccyqr7S44-cfHc4wJ9010O1nvspG2DPV4cTct1pLrjKl1e1UmOJV99bJw&_nc_ht=video-hkt1-1.xx&oh=49bd04435aaa8b4459b8d5cb7d1e7c79&oe=5E672E37");
urls.add(
"https://scontent-hkt1-1.xx.fbcdn.net/v/t15.5256-10/fr/cp0/e15/q65/83913248_211240646743277_4802581788427812864_n.jpg?_nc_cat=103&_nc_sid=f2c4d5&_nc_oc=AQkT-0QmghK66vtY6tfr01niqxjePFuU-6JAYcAW7MKJoC8MgQDSRXg_iXW6FUZZa3A&_nc_ht=scontent-hkt1-1.xx&_nc_tp=14&oh=6f020a513d181256b98edc3896b1c3c7&oe=5E8FE498");
urls.add(
"https://scontent-hkt1-1.xx.fbcdn.net/v/t1.0-1/cp0/e15/q65/p480x480/75642413_2805764969481542_7020281898245029888_n.jpg?_nc_cat=1&_nc_sid=dbb9e7&_nc_oc=AQmgACYknk9eS0cgeReiSuYuB2qfybLSQwqH98trPB1AFh9dSKXHn7cCcKcKO6YDKdM&_nc_ht=scontent-hkt1-1.xx&_nc_tp=3&oh=78e0717a056391e1f9c917f290f74aab&oe=5E9433B8");
urls.add("http://61.155.99.75:88/sdkdown.muzhiwan.com/openfile/2019/10/26/com.mrxz.mzw_5db3eeef782b1.apk");
urls.add("http://cpsdown.muzhiwan.com/2020/05/07/com.kaihei.wufan.mars_5eb3947b4341b.apk");
urls.add("http://113.143.35.118:88/sdkdown.muzhiwan.com/openfile/2019/11/27/com.droidhang.ad.mzw_5dde4ffe2b2e5.apk");
return urls;
}
List<String> getUrls1() {
@ -60,9 +50,9 @@ public class GroupModule extends BaseModule {
List<String> names = new ArrayList<>();
//String[] str = getContext().getResources().getStringArray(R.array.group_names);
//Collections.addAll(names, str);
names.add("1.mp4");
names.add("2.png");
names.add("3.png");
names.add("末日血战.apk");
names.add("开黑三国.apk");
names.add("放置奇兵.apk");
//names.add("4.png");
//names.add("5.png");
return names;

@ -309,9 +309,10 @@ public class M3U8VodDLoadActivity extends BaseActivity<ActivityM3u8VodBinding> {
//.merge(true)
//.setVodTsUrlConvert(new VodTsUrlConverter());
//.setMergeHandler(new TsMergeHandler());
//option.setKeyUrlConverter(new KeyUrlConverter());
//option.setBandWidthUrlConverter(new BandWidthUrlConverter());
//option.setUseDefConvert(true);
option.setUseDefConvert(false);
option.setKeyUrlConverter(new KeyUrlConverter());
option.setBandWidthUrlConverter(new BandWidthUrlConverter());
option.setUseDefConvert(true);
return option;
}

Loading…
Cancel
Save