com.xunlei.downloadlib.parameter.BtIndexSet Java Examples

The following examples show how to use com.xunlei.downloadlib.parameter.BtIndexSet. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: XLDownloadManager.java    From TVRemoteIME with GNU General Public License v2.0 5 votes vote down vote up
public int selectBtSubTask(long j, BtIndexSet btIndexSet) {
    int i = 9900;
    increRefCount();
    if (!(mDownloadManagerState != XLManagerStatus.MANAGER_RUNNING || this.mLoader == null || btIndexSet == null)) {
        i = this.mLoader.selectBtSubTask(j, btIndexSet);
    }
    decreRefCount();
    return i;
}
 
Example #2
Source File: XLDownloadManager.java    From MiniThunder with Apache License 2.0 5 votes vote down vote up
public int deselectBtSubTask(long j, BtIndexSet btIndexSet) {
    int i = 9900;
    increRefCount();
    if (!(mDownloadManagerState != XLManagerStatus.MANAGER_RUNNING || this.mLoader == null || btIndexSet == null)) {
        i = this.mLoader.deselectBtSubTask(j, btIndexSet);
    }
    decreRefCount();
    return i;
}
 
Example #3
Source File: XLDownloadManager.java    From MiniThunder with Apache License 2.0 5 votes vote down vote up
public int selectBtSubTask(long j, BtIndexSet btIndexSet) {
    int i = 9900;
    increRefCount();
    if (!(mDownloadManagerState != XLManagerStatus.MANAGER_RUNNING || this.mLoader == null || btIndexSet == null)) {
        i = this.mLoader.selectBtSubTask(j, btIndexSet);
    }
    decreRefCount();
    return i;
}
 
Example #4
Source File: XLTaskHelper.java    From MiniThunder with Apache License 2.0 5 votes vote down vote up
/**
     * 添加种子下载任务,如果是磁力链需要先通过addMagentTask将种子下载下来
     * @param torrentPath 种子地址
     * @param savePath 保存路径
     * @param indexs 需要下载的文件索引
     * @return
     * @throws Exception
     */
    public synchronized long addTorrentTask(String torrentPath,String savePath,int []indexs) throws Exception {
        TorrentInfo torrentInfo = new TorrentInfo();
        XLDownloadManager.getInstance().getTorrentInfo(torrentPath,torrentInfo);
        TorrentFileInfo[] fileInfos = torrentInfo.mSubFileInfo;
        BtTaskParam taskParam = new BtTaskParam();
        taskParam.setCreateMode(1);
        taskParam.setFilePath(savePath);
        taskParam.setMaxConcurrent(3);
        taskParam.setSeqId(seq.incrementAndGet());
        taskParam.setTorrentPath(torrentPath);
        GetTaskId getTaskId = new GetTaskId();
        XLDownloadManager.getInstance().createBtTask(taskParam,getTaskId);
        if(fileInfos.length > 1 && indexs != null && indexs.length > 0) {
            BtIndexSet btIndexSet = new BtIndexSet(indexs.length);
            int i = 0;
            for(int index : indexs) {
                btIndexSet.mIndexSet[i++] = index;
            }
            XLDownloadManager.getInstance().selectBtSubTask(getTaskId.getTaskId(),btIndexSet);
        }
        XLDownloadManager.getInstance().setTaskLxState(getTaskId.getTaskId(), 0, 1);
//        XLDownloadManager.getInstance().startDcdn(getTaskId.getTaskId(), currentFileInfo.mRealIndex, "", "", "");
        XLDownloadManager.getInstance().startTask(getTaskId.getTaskId(), false);
//        XLDownloadManager.getInstance().setBtPriorSubTask(getTaskId.getTaskId(),currentFileInfo.mRealIndex);
//        XLTaskLocalUrl localUrl = new XLTaskLocalUrl();
//        XLDownloadManager.getInstance().getLocalUrl(savePath+"/" +(TextUtils.isEmpty(currentFileInfo.mSubPath) ? "" : currentFileInfo.mSubPath+"/")+ currentFileInfo.mFileName,localUrl);
//        currentFileInfo.playUrl = localUrl.mStrUrl;
//        currentFileInfo.hash = torrentInfo.mInfoHash;
//        return currentFileInfo;
        return getTaskId.getTaskId();
    }
 
Example #5
Source File: XLDownloadManager.java    From AndroidDownload with Apache License 2.0 5 votes vote down vote up
public int deselectBtSubTask(long j, BtIndexSet btIndexSet) {
    int i = 9900;
    increRefCount();
    if (!(mDownloadManagerState != XLManagerStatus.MANAGER_RUNNING || this.mLoader == null || btIndexSet == null)) {
        i = this.mLoader.deselectBtSubTask(j, btIndexSet);
    }
    decreRefCount();
    return i;
}
 
Example #6
Source File: XLDownloadManager.java    From AndroidDownload with Apache License 2.0 5 votes vote down vote up
public int selectBtSubTask(long j, BtIndexSet btIndexSet) {
    int i = 9900;
    increRefCount();
    if (!(mDownloadManagerState != XLManagerStatus.MANAGER_RUNNING || this.mLoader == null || btIndexSet == null)) {
        i = this.mLoader.selectBtSubTask(j, btIndexSet);
    }
    decreRefCount();
    return i;
}
 
Example #7
Source File: XLTaskHelper.java    From AndroidDownload with Apache License 2.0 5 votes vote down vote up
/**
     * 添加种子下载任务,如果是磁力链需要先通过addMagentTask将种子下载下来
     * @param torrentPath 种子地址
     * @param savePath 保存路径
     * @param indexs 需要下载的文件索引
     * @return
     * @throws Exception
     */
    public synchronized long addTorrentTask(String torrentPath,String savePath,int []indexs) throws Exception {
        TorrentInfo torrentInfo = new TorrentInfo();
        XLDownloadManager.getInstance().getTorrentInfo(torrentPath,torrentInfo);
        TorrentFileInfo[] fileInfos = torrentInfo.mSubFileInfo;
        BtTaskParam taskParam = new BtTaskParam();
        taskParam.setCreateMode(1);
        taskParam.setFilePath(savePath);
        taskParam.setMaxConcurrent(3);
        taskParam.setSeqId(seq.incrementAndGet());
        taskParam.setTorrentPath(torrentPath);
        GetTaskId getTaskId = new GetTaskId();
        XLDownloadManager.getInstance().createBtTask(taskParam,getTaskId);
        if(fileInfos.length > 1 && indexs != null && indexs.length > 0) {
            BtIndexSet btIndexSet = new BtIndexSet(indexs.length);
            int i = 0;
            for(int index : indexs) {
                btIndexSet.mIndexSet[i++] = index;
            }
            XLDownloadManager.getInstance().selectBtSubTask(getTaskId.getTaskId(),btIndexSet);
        }
        XLDownloadManager.getInstance().setTaskLxState(getTaskId.getTaskId(), 0, 1);
//        XLDownloadManager.getInstance().startDcdn(getTaskId.getTaskId(), currentFileInfo.mRealIndex, "", "", "");
        XLDownloadManager.getInstance().startTask(getTaskId.getTaskId(), false);
//        XLDownloadManager.getInstance().setBtPriorSubTask(getTaskId.getTaskId(),currentFileInfo.mRealIndex);
//        XLTaskLocalUrl localUrl = new XLTaskLocalUrl();
//        XLDownloadManager.getInstance().getLocalUrl(savePath+"/" +(TextUtils.isEmpty(currentFileInfo.mSubPath) ? "" : currentFileInfo.mSubPath+"/")+ currentFileInfo.mFileName,localUrl);
//        currentFileInfo.playUrl = localUrl.mStrUrl;
//        currentFileInfo.hash = torrentInfo.mInfoHash;
//        return currentFileInfo;
        return getTaskId.getTaskId();
    }
 
Example #8
Source File: XLDownloadManager.java    From BtPlayer with Apache License 2.0 5 votes vote down vote up
public int deselectBtSubTask(long j, BtIndexSet btIndexSet) {
    int i = 9900;
    increRefCount();
    if (!(mDownloadManagerState != XLManagerStatus.MANAGER_RUNNING || this.mLoader == null || btIndexSet == null)) {
        i = this.mLoader.deselectBtSubTask(j, btIndexSet);
    }
    decreRefCount();
    return i;
}
 
Example #9
Source File: XLDownloadManager.java    From BtPlayer with Apache License 2.0 5 votes vote down vote up
public int selectBtSubTask(long j, BtIndexSet btIndexSet) {
    int i = 9900;
    increRefCount();
    if (!(mDownloadManagerState != XLManagerStatus.MANAGER_RUNNING || this.mLoader == null || btIndexSet == null)) {
        i = this.mLoader.selectBtSubTask(j, btIndexSet);
    }
    decreRefCount();
    return i;
}
 
Example #10
Source File: XLTaskHelper.java    From BtPlayer with Apache License 2.0 5 votes vote down vote up
/**
     * 添加种子下载任务,如果是磁力链需要先通过addMagentTask将种子下载下来
     * @param torrentPath 种子地址
     * @param savePath 保存路径
     * @param indexs 需要下载的文件索引
     * @return
     * @throws Exception
     */
    public synchronized long addTorrentTask(String torrentPath,String savePath,int []indexs) throws Exception {
        TorrentInfo torrentInfo = new TorrentInfo();
        XLDownloadManager.getInstance().getTorrentInfo(torrentPath,torrentInfo);
        TorrentFileInfo[] fileInfos = torrentInfo.mSubFileInfo;
        BtTaskParam taskParam = new BtTaskParam();
        taskParam.setCreateMode(1);
        taskParam.setFilePath(savePath);
        taskParam.setMaxConcurrent(3);
        taskParam.setSeqId(seq.incrementAndGet());
        taskParam.setTorrentPath(torrentPath);
        GetTaskId getTaskId = new GetTaskId();
        XLDownloadManager.getInstance().createBtTask(taskParam,getTaskId);
        if(fileInfos.length > 1 && indexs != null && indexs.length > 0) {
            BtIndexSet btIndexSet = new BtIndexSet(indexs.length);
            int i = 0;
            for(int index : indexs) {
                btIndexSet.mIndexSet[i++] = index;
            }
            XLDownloadManager.getInstance().selectBtSubTask(getTaskId.getTaskId(),btIndexSet);
        }
        XLDownloadManager.getInstance().setTaskLxState(getTaskId.getTaskId(), 0, 1);
//        XLDownloadManager.getInstance().startDcdn(getTaskId.getTaskId(), currentFileInfo.mRealIndex, "", "", "");
        XLDownloadManager.getInstance().startTask(getTaskId.getTaskId(), false);
//        XLDownloadManager.getInstance().setBtPriorSubTask(getTaskId.getTaskId(),currentFileInfo.mRealIndex);
//        XLTaskLocalUrl localUrl = new XLTaskLocalUrl();
//        XLDownloadManager.getInstance().getLocalUrl(savePath+"/" +(TextUtils.isEmpty(currentFileInfo.mSubPath) ? "" : currentFileInfo.mSubPath+"/")+ currentFileInfo.mFileName,localUrl);
//        currentFileInfo.playUrl = localUrl.mStrUrl;
//        currentFileInfo.hash = torrentInfo.mInfoHash;
//        return currentFileInfo;
        return getTaskId.getTaskId();
    }
 
Example #11
Source File: XLDownloadManager.java    From TVRemoteIME with GNU General Public License v2.0 5 votes vote down vote up
public int deselectBtSubTask(long j, BtIndexSet btIndexSet) {
    int i = 9900;
    increRefCount();
    if (!(mDownloadManagerState != XLManagerStatus.MANAGER_RUNNING || this.mLoader == null || btIndexSet == null)) {
        i = this.mLoader.deselectBtSubTask(j, btIndexSet);
    }
    decreRefCount();
    return i;
}
 
Example #12
Source File: XLTaskHelper.java    From TVRemoteIME with GNU General Public License v2.0 5 votes vote down vote up
/**
     * 添加种子下载任务,如果是磁力链需要先通过addMagentTask将种子下载下来
     * @param torrentPath 种子地址
     * @param savePath 保存路径
     * @param deselectIndexs 不需要下载的文件索引
     * @return
     * @throws Exception
     */
    public synchronized long addTorrentTask(String torrentPath,String savePath,int []deselectIndexs) throws Exception {
        TorrentInfo torrentInfo = new TorrentInfo();
        XLDownloadManager.getInstance().getTorrentInfo(torrentPath,torrentInfo);
        TorrentFileInfo[] fileInfos = torrentInfo.mSubFileInfo;
        BtTaskParam taskParam = new BtTaskParam();
        taskParam.setCreateMode(1);
        taskParam.setFilePath(savePath);
        taskParam.setMaxConcurrent(3);
        taskParam.setSeqId(seq.incrementAndGet());
        taskParam.setTorrentPath(torrentPath);
        GetTaskId getTaskId = new GetTaskId();
        XLDownloadManager.getInstance().createBtTask(taskParam,getTaskId);
        if(fileInfos.length > 1 && deselectIndexs != null && deselectIndexs.length > 0) {
            BtIndexSet btIndexSet = new BtIndexSet(deselectIndexs.length);
            int i = 0;
            for(int index : deselectIndexs) {
                btIndexSet.mIndexSet[i++] = index;
            }
            long r = XLDownloadManager.getInstance().deselectBtSubTask(getTaskId.getTaskId(),btIndexSet);
            Log.d(TAG, "selectBtSubTask return = " + r);
        }
        XLDownloadManager.getInstance().setTaskLxState(getTaskId.getTaskId(), 0, 1);
//        XLDownloadManager.getInstance().startDcdn(getTaskId.getTaskId(), currentFileInfo.mRealIndex, "", "", "");
        XLDownloadManager.getInstance().startTask(getTaskId.getTaskId(), false);
//        XLDownloadManager.getInstance().setBtPriorSubTask(getTaskId.getTaskId(),currentFileInfo.mRealIndex);
//        XLTaskLocalUrl localUrl = new XLTaskLocalUrl();
//        XLDownloadManager.getInstance().getLocalUrl(savePath+"/" +(TextUtils.isEmpty(currentFileInfo.mSubPath) ? "" : currentFileInfo.mSubPath+"/")+ currentFileInfo.mFileName,localUrl);
//        currentFileInfo.playUrl = localUrl.mStrUrl;
//        currentFileInfo.hash = torrentInfo.mInfoHash;
//        return currentFileInfo;
        return getTaskId.getTaskId();
    }
 
Example #13
Source File: XLLoader.java    From BtPlayer with Apache License 2.0 votes vote down vote up
public native int deselectBtSubTask(long j, BtIndexSet btIndexSet); 
Example #14
Source File: XLLoader.java    From BtPlayer with Apache License 2.0 votes vote down vote up
public native int selectBtSubTask(long j, BtIndexSet btIndexSet); 
Example #15
Source File: XLLoader.java    From TVRemoteIME with GNU General Public License v2.0 votes vote down vote up
public native int selectBtSubTask(long j, BtIndexSet btIndexSet); 
Example #16
Source File: XLLoader.java    From AndroidDownload with Apache License 2.0 votes vote down vote up
public native int deselectBtSubTask(long j, BtIndexSet btIndexSet); 
Example #17
Source File: XLLoader.java    From AndroidDownload with Apache License 2.0 votes vote down vote up
public native int selectBtSubTask(long j, BtIndexSet btIndexSet); 
Example #18
Source File: XLLoader.java    From TVRemoteIME with GNU General Public License v2.0 votes vote down vote up
public native int deselectBtSubTask(long j, BtIndexSet btIndexSet); 
Example #19
Source File: XLLoader.java    From MiniThunder with Apache License 2.0 votes vote down vote up
public native int deselectBtSubTask(long j, BtIndexSet btIndexSet); 
Example #20
Source File: XLLoader.java    From MiniThunder with Apache License 2.0 votes vote down vote up
public native int selectBtSubTask(long j, BtIndexSet btIndexSet);