修复组任务中,其中一个子任务是30x地址,导致调度器无法出现该子任务状态的问题
增加组任务groupHash冲突检查 https://github.com/AriaLyy/Aria/issues/635
This commit is contained in:
@@ -36,6 +36,7 @@ public class SubThreadConfig {
|
||||
public boolean isBlock = false;
|
||||
// 启动的线程
|
||||
public int startThreadNum;
|
||||
// 真正的下载地址,如果是30x,则是30x后的地址
|
||||
public String url;
|
||||
public File tempFile;
|
||||
// 线程记录
|
||||
|
||||
@@ -32,4 +32,17 @@ public abstract class AbsGroupTaskWrapper<ENTITY extends AbsEntity, SUB extends
|
||||
public abstract List<SUB> getSubTaskWrapper();
|
||||
|
||||
public abstract void setSubTaskWrapper(List<SUB> subTaskWrapper);
|
||||
|
||||
/**
|
||||
* {@code true} 忽略任务冲突,不考虑组任务hash冲突的情况
|
||||
*/
|
||||
private boolean ignoreTaskOccupy = false;
|
||||
|
||||
public boolean isIgnoreTaskOccupy() {
|
||||
return ignoreTaskOccupy;
|
||||
}
|
||||
|
||||
public void setIgnoreTaskOccupy(boolean ignoreTaskOccupy) {
|
||||
this.ignoreTaskOccupy = ignoreTaskOccupy;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,13 +74,16 @@ public class DownloadEntity extends AbsNormalEntity implements Parcelable {
|
||||
return m3U8Entity;
|
||||
}
|
||||
|
||||
/**
|
||||
* 如果是30x,则是30x后的地址
|
||||
*/
|
||||
@Override public String getKey() {
|
||||
return getUrl();
|
||||
return isRedirect() ? getRedirectUrl() : getUrl();
|
||||
}
|
||||
|
||||
@Override public int getTaskType() {
|
||||
int type;
|
||||
if (getUrl() == null){
|
||||
if (getUrl() == null) {
|
||||
type = ITaskWrapper.ERROR;
|
||||
} else if (getUrl().startsWith("http")) {
|
||||
M3U8Entity temp = getM3U8Entity();
|
||||
|
||||
@@ -71,7 +71,7 @@ final class SimpleSchedulers implements Handler.Callback {
|
||||
mGState.listener.onSubRunning(loaderUtil.getEntity(), range);
|
||||
break;
|
||||
case IThreadStateManager.STATE_PRE:
|
||||
mGState.listener.onSubPre(loaderUtil.getEntity());
|
||||
mGState.listener.onSubPre(loaderUtil.getEntity( ));
|
||||
mGState.updateCount(loaderUtil.getKey());
|
||||
break;
|
||||
case IThreadStateManager.STATE_START:
|
||||
|
||||
@@ -115,7 +115,7 @@ public final class NormalTTBuilder implements IThreadTaskBuilder {
|
||||
b = new Bundle();
|
||||
}
|
||||
b.putString(IThreadStateManager.DATA_THREAD_NAME,
|
||||
CommonUtil.getThreadName(getEntity().getUrl(), tr.threadId));
|
||||
CommonUtil.getThreadName(getEntity().getKey(), tr.threadId));
|
||||
msg.setData(b);
|
||||
msg.sendToTarget();
|
||||
continue;
|
||||
|
||||
@@ -22,8 +22,8 @@ import android.os.Message;
|
||||
import android.os.Process;
|
||||
import com.arialyy.aria.core.AriaConfig;
|
||||
import com.arialyy.aria.core.ThreadRecord;
|
||||
import com.arialyy.aria.core.common.AbsEntity;
|
||||
import com.arialyy.aria.core.common.SubThreadConfig;
|
||||
import com.arialyy.aria.core.inf.IEntity;
|
||||
import com.arialyy.aria.core.inf.IThreadStateManager;
|
||||
import com.arialyy.aria.core.listener.ISchedulers;
|
||||
import com.arialyy.aria.core.manager.ThreadTaskManager;
|
||||
@@ -50,7 +50,7 @@ public class ThreadTask implements IThreadTask, IThreadTaskObserver {
|
||||
*/
|
||||
private final int RETRY_NUM = 2;
|
||||
private final String TAG = CommonUtil.getClassName(getClass());
|
||||
private IEntity mEntity;
|
||||
private AbsEntity mEntity;
|
||||
protected AbsTaskWrapper mTaskWrapper;
|
||||
private int mFailTimes = 0;
|
||||
private long mLastSaveTime, mLastSendProgressTime;
|
||||
@@ -147,7 +147,7 @@ public class ThreadTask implements IThreadTask, IThreadTaskObserver {
|
||||
/**
|
||||
* 获取实体
|
||||
*/
|
||||
protected IEntity getEntity() {
|
||||
protected AbsEntity getEntity() {
|
||||
return mEntity;
|
||||
}
|
||||
|
||||
@@ -244,7 +244,7 @@ public class ThreadTask implements IThreadTask, IThreadTaskObserver {
|
||||
|
||||
@Override public String getThreadName() {
|
||||
return mThreadName == null ? (mThreadName =
|
||||
CommonUtil.getThreadName(getConfig().url, getThreadId())) : mThreadName;
|
||||
CommonUtil.getThreadName(getEntity().getKey(), getThreadId())) : mThreadName;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -60,6 +60,18 @@ public class FileUtil {
|
||||
private static final String EXTERNAL_STORAGE_PATH =
|
||||
Environment.getExternalStorageDirectory().getPath();
|
||||
|
||||
/**
|
||||
* 获取文件后缀名
|
||||
* @return 获取不到文件名后缀,返回null
|
||||
*/
|
||||
public static String getFileExtensionName(String fileName) {
|
||||
if (TextUtils.isEmpty(fileName)) {
|
||||
return null;
|
||||
}
|
||||
int endP = fileName.lastIndexOf(".");
|
||||
return endP > -1 ? fileName.substring(endP + 1) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过流创建文件
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user