Java Code Examples for com.xunlei.downloadlib.parameter.GetTaskId

The following examples show how to use com.xunlei.downloadlib.parameter.GetTaskId. These examples are extracted from open source projects. 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 Project: BtPlayer   Source File: XLTaskHelper.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * 添加磁力链任务
 * @param url 磁力链接 magnet:? 开头
 * @param savePath
 * @param fileName
 * @return
 * @throws Exception
 */
public synchronized long addMagentTask(final String url,final String savePath,String fileName) throws Exception {
    if (url.startsWith("magnet:?")) {
        if(TextUtils.isEmpty(fileName)) {
            final GetFileName getFileName = new GetFileName();
            XLDownloadManager.getInstance().getFileNameFromUrl(url, getFileName);
            fileName = getFileName.getFileName();
        }
        MagnetTaskParam magnetTaskParam = new MagnetTaskParam();
        magnetTaskParam.setFileName(fileName);
        magnetTaskParam.setFilePath(savePath);
        magnetTaskParam.setUrl(url);
        final GetTaskId getTaskId = new GetTaskId();
        XLDownloadManager.getInstance().createBtMagnetTask(magnetTaskParam, getTaskId);

        XLDownloadManager.getInstance().setTaskLxState(getTaskId.getTaskId(), 0, 1);
        XLDownloadManager.getInstance().startDcdn(getTaskId.getTaskId(), 0, "", "", "");
        XLDownloadManager.getInstance().startTask(getTaskId.getTaskId(), false);
        return getTaskId.getTaskId();
    } else {
        throw new Exception("url illegal.");
    }
}
 
Example 2
Source Project: AndroidDownload   Source File: XLTaskHelper.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * 添加磁力链任务
 * @param url 磁力链接 magnet:? 开头
 * @param savePath
 * @param fileName
 * @return
 * @throws Exception
 */
public synchronized long addMagentTask(final String url,final String savePath,String fileName) throws Exception {
     if (url.startsWith("magnet:?")) {
        if(TextUtils.isEmpty(fileName)) {
            final GetFileName getFileName = new GetFileName();
            XLDownloadManager.getInstance().getFileNameFromUrl(url, getFileName);
            fileName = getFileName.getFileName();
        }
        MagnetTaskParam magnetTaskParam = new MagnetTaskParam();
        magnetTaskParam.setFileName(fileName);
        magnetTaskParam.setFilePath(savePath);
        magnetTaskParam.setUrl(url);
        final GetTaskId getTaskId = new GetTaskId();
        XLDownloadManager.getInstance().createBtMagnetTask(magnetTaskParam, getTaskId);

        XLDownloadManager.getInstance().setTaskLxState(getTaskId.getTaskId(), 0, 1);
        XLDownloadManager.getInstance().startDcdn(getTaskId.getTaskId(), 0, "", "", "");
        XLDownloadManager.getInstance().startTask(getTaskId.getTaskId(), false);
        return getTaskId.getTaskId();
    } else {
        throw new Exception("url illegal.");
    }
}
 
Example 3
Source Project: MiniThunder   Source File: XLTaskHelper.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * 添加磁力链任务
 * @param url 磁力链接 magnet:? 开头
 * @param savePath
 * @param fileName
 * @return
 * @throws Exception
 */
public synchronized long addMagentTask(final String url,final String savePath,String fileName) throws Exception {
    if (url.startsWith("magnet:?")) {
        if(TextUtils.isEmpty(fileName)) {
            final GetFileName getFileName = new GetFileName();
            XLDownloadManager.getInstance().getFileNameFromUrl(url, getFileName);
            fileName = getFileName.getFileName();
        }
        MagnetTaskParam magnetTaskParam = new MagnetTaskParam();
        magnetTaskParam.setFileName(fileName);
        magnetTaskParam.setFilePath(savePath);
        magnetTaskParam.setUrl(url);
        final GetTaskId getTaskId = new GetTaskId();
        XLDownloadManager.getInstance().createBtMagnetTask(magnetTaskParam, getTaskId);

        XLDownloadManager.getInstance().setTaskLxState(getTaskId.getTaskId(), 0, 1);
        XLDownloadManager.getInstance().startDcdn(getTaskId.getTaskId(), 0, "", "", "");
        XLDownloadManager.getInstance().startTask(getTaskId.getTaskId(), false);
        return getTaskId.getTaskId();
    } else {
        throw new Exception("url illegal.");
    }
}
 
Example 4
Source Project: TVRemoteIME   Source File: XLTaskHelper.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * 添加磁力链任务
 * @param url 磁力链接 magnet:? 开头
 * @param savePath
 * @param fileName
 * @return
 * @throws Exception
 */
public synchronized long addMagentTask(final String url,final String savePath,String fileName) throws Exception {
    if (url.startsWith("magnet:?")) {
        XLDownloadManager instance = XLDownloadManager.getInstance();
        if(TextUtils.isEmpty(fileName)) {
            final GetFileName getFileName = new GetFileName();
            instance.getFileNameFromUrl(url, getFileName);
            fileName = getFileName.getFileName();
        }
        MagnetTaskParam magnetTaskParam = new MagnetTaskParam();
        magnetTaskParam.setFileName(fileName);
        magnetTaskParam.setFilePath(savePath);
        magnetTaskParam.setUrl(url);
        final GetTaskId getTaskId = new GetTaskId();
        int r1 = XLDownloadManager.getInstance().createBtMagnetTask(magnetTaskParam, getTaskId);
        if (r1 != 9000) {
            Log.e(TAG,"create bt_task failed: " + XLDownloadManager.getInstance().getErrorCodeMsg(r1));
        }

        //instance.setDownloadTaskOrigin(getTaskId.getTaskId(), "out_app/out_app_paste");
        //instance.setOriginUserAgent(getTaskId.getTaskId(), "AndroidDownloadManager/5.41.2.4980 (Linux; U; Android 4.4.4; Build/KTU84Q)");
        instance.setTaskLxState(getTaskId.getTaskId(), 0, 1);
        instance.startDcdn(getTaskId.getTaskId(), 0, "", "611", "");
        r1 = instance.startTask(getTaskId.getTaskId(), false);
        if (r1 != 9000) {
            Log.e(TAG,"start bt_task failed: " + XLDownloadManager.getInstance().getErrorCodeMsg(r1));
        }
        return getTaskId.getTaskId();
    } else {
        throw new Exception("url illegal.");
    }
}
 
Example 5
Source Project: TVRemoteIME   Source File: XLTaskHelper.java    License: 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 6
public int createP2spTask(P2spTaskParam p2spTaskParam, GetTaskId getTaskId) {
    int i = 9900;
    if (!(p2spTaskParam == null || getTaskId == null || !p2spTaskParam.checkMemberVar())) {
        increRefCount();
        if (mDownloadManagerState == XLManagerStatus.MANAGER_RUNNING && this.mLoader != null) {
            i = this.mLoader.createP2spTask(p2spTaskParam.mUrl, p2spTaskParam.mRefUrl, p2spTaskParam.mCookie, p2spTaskParam.mUser, p2spTaskParam.mPass, p2spTaskParam.mFilePath, p2spTaskParam.mFileName, p2spTaskParam.mCreateMode, p2spTaskParam.mSeqId, getTaskId);
        }
        decreRefCount();
    }
    return i;
}
 
Example 7
public int createBtMagnetTask(MagnetTaskParam magnetTaskParam, GetTaskId getTaskId) {
    int i = 9900;
    if (!(magnetTaskParam == null || getTaskId == null || !magnetTaskParam.checkMemberVar())) {
        increRefCount();
        if (mDownloadManagerState == XLManagerStatus.MANAGER_RUNNING && this.mLoader != null) {
            i = this.mLoader.createBtMagnetTask(magnetTaskParam.mUrl, magnetTaskParam.mFilePath, magnetTaskParam.mFileName, getTaskId);
        }
        decreRefCount();
    }
    return i;
}
 
Example 8
public int createEmuleTask(EmuleTaskParam emuleTaskParam, GetTaskId getTaskId) {
    int i = 9900;
    if (!(emuleTaskParam == null || getTaskId == null || !emuleTaskParam.checkMemberVar())) {
        increRefCount();
        if (mDownloadManagerState == XLManagerStatus.MANAGER_RUNNING && this.mLoader != null) {
            i = this.mLoader.createEmuleTask(emuleTaskParam.mUrl, emuleTaskParam.mFilePath, emuleTaskParam.mFileName, emuleTaskParam.mCreateMode, emuleTaskParam.mSeqId, getTaskId);
        }
        decreRefCount();
    }
    return i;
}
 
Example 9
public int createBtTask(BtTaskParam btTaskParam, GetTaskId getTaskId) {
    int i = 9900;
    if (!(btTaskParam == null || getTaskId == null || !btTaskParam.checkMemberVar())) {
        increRefCount();
        if (mDownloadManagerState == XLManagerStatus.MANAGER_RUNNING && this.mLoader != null) {
            i = this.mLoader.createBtTask(btTaskParam.mTorrentPath, btTaskParam.mFilePath, btTaskParam.mMaxConcurrent, btTaskParam.mCreateMode, btTaskParam.mSeqId, getTaskId);
        }
        decreRefCount();
    }
    return i;
}
 
Example 10
public int createCIDTask(CIDTaskParam cIDTaskParam, GetTaskId getTaskId) {
    int i = 9900;
    if (!(cIDTaskParam == null || getTaskId == null || !cIDTaskParam.checkMemberVar())) {
        increRefCount();
        if (mDownloadManagerState == XLManagerStatus.MANAGER_RUNNING && this.mLoader != null) {
            i = this.mLoader.createCIDTask(cIDTaskParam.mCid, cIDTaskParam.mGcid, cIDTaskParam.mBcid, cIDTaskParam.mFilePath, cIDTaskParam.mFileName, cIDTaskParam.mFileSize, cIDTaskParam.mCreateMode, cIDTaskParam.mSeqId, getTaskId);
        }
        decreRefCount();
    }
    return i;
}
 
Example 11
Source Project: BtPlayer   Source File: XLTaskHelper.java    License: 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 12
Source Project: BtPlayer   Source File: XLDownloadManager.java    License: Apache License 2.0 5 votes vote down vote up
public int createP2spTask(P2spTaskParam p2spTaskParam, GetTaskId getTaskId) {
    int i = 9900;
    if (!(p2spTaskParam == null || getTaskId == null || !p2spTaskParam.checkMemberVar())) {
        increRefCount();
        if (mDownloadManagerState == XLManagerStatus.MANAGER_RUNNING && this.mLoader != null) {
            i = this.mLoader.createP2spTask(p2spTaskParam.mUrl, p2spTaskParam.mRefUrl, p2spTaskParam.mCookie, p2spTaskParam.mUser, p2spTaskParam.mPass, p2spTaskParam.mFilePath, p2spTaskParam.mFileName, p2spTaskParam.mCreateMode, p2spTaskParam.mSeqId, getTaskId);
        }
        decreRefCount();
    }
    return i;
}
 
Example 13
Source Project: BtPlayer   Source File: XLDownloadManager.java    License: Apache License 2.0 5 votes vote down vote up
public int createBtMagnetTask(MagnetTaskParam magnetTaskParam, GetTaskId getTaskId) {
    int i = 9900;
    if (!(magnetTaskParam == null || getTaskId == null || !magnetTaskParam.checkMemberVar())) {
        increRefCount();
        if (mDownloadManagerState == XLManagerStatus.MANAGER_RUNNING && this.mLoader != null) {
            i = this.mLoader.createBtMagnetTask(magnetTaskParam.mUrl, magnetTaskParam.mFilePath, magnetTaskParam.mFileName, getTaskId);
        }
        decreRefCount();
    }
    return i;
}
 
Example 14
Source Project: BtPlayer   Source File: XLDownloadManager.java    License: Apache License 2.0 5 votes vote down vote up
public int createEmuleTask(EmuleTaskParam emuleTaskParam, GetTaskId getTaskId) {
    int i = 9900;
    if (!(emuleTaskParam == null || getTaskId == null || !emuleTaskParam.checkMemberVar())) {
        increRefCount();
        if (mDownloadManagerState == XLManagerStatus.MANAGER_RUNNING && this.mLoader != null) {
            i = this.mLoader.createEmuleTask(emuleTaskParam.mUrl, emuleTaskParam.mFilePath, emuleTaskParam.mFileName, emuleTaskParam.mCreateMode, emuleTaskParam.mSeqId, getTaskId);
        }
        decreRefCount();
    }
    return i;
}
 
Example 15
Source Project: BtPlayer   Source File: XLDownloadManager.java    License: Apache License 2.0 5 votes vote down vote up
public int createBtTask(BtTaskParam btTaskParam, GetTaskId getTaskId) {
    int i = 9900;
    if (!(btTaskParam == null || getTaskId == null || !btTaskParam.checkMemberVar())) {
        increRefCount();
        if (mDownloadManagerState == XLManagerStatus.MANAGER_RUNNING && this.mLoader != null) {
            i = this.mLoader.createBtTask(btTaskParam.mTorrentPath, btTaskParam.mFilePath, btTaskParam.mMaxConcurrent, btTaskParam.mCreateMode, btTaskParam.mSeqId, getTaskId);
        }
        decreRefCount();
    }
    return i;
}
 
Example 16
Source Project: BtPlayer   Source File: XLDownloadManager.java    License: Apache License 2.0 5 votes vote down vote up
public int createCIDTask(CIDTaskParam cIDTaskParam, GetTaskId getTaskId) {
    int i = 9900;
    if (!(cIDTaskParam == null || getTaskId == null || !cIDTaskParam.checkMemberVar())) {
        increRefCount();
        if (mDownloadManagerState == XLManagerStatus.MANAGER_RUNNING && this.mLoader != null) {
            i = this.mLoader.createCIDTask(cIDTaskParam.mCid, cIDTaskParam.mGcid, cIDTaskParam.mBcid, cIDTaskParam.mFilePath, cIDTaskParam.mFileName, cIDTaskParam.mFileSize, cIDTaskParam.mCreateMode, cIDTaskParam.mSeqId, getTaskId);
        }
        decreRefCount();
    }
    return i;
}
 
Example 17
Source Project: AndroidDownload   Source File: XLTaskHelper.java    License: 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 18
Source Project: AndroidDownload   Source File: XLDownloadManager.java    License: Apache License 2.0 5 votes vote down vote up
public int createP2spTask(P2spTaskParam p2spTaskParam, GetTaskId getTaskId) {
    int i = 9900;
    if (!(p2spTaskParam == null || getTaskId == null || !p2spTaskParam.checkMemberVar())) {
        increRefCount();
        if (mDownloadManagerState == XLManagerStatus.MANAGER_RUNNING && this.mLoader != null) {
            i = this.mLoader.createP2spTask(p2spTaskParam.mUrl, p2spTaskParam.mRefUrl, p2spTaskParam.mCookie, p2spTaskParam.mUser, p2spTaskParam.mPass, p2spTaskParam.mFilePath, p2spTaskParam.mFileName, p2spTaskParam.mCreateMode, p2spTaskParam.mSeqId, getTaskId);
        }
        decreRefCount();
    }
    return i;
}
 
Example 19
Source Project: AndroidDownload   Source File: XLDownloadManager.java    License: Apache License 2.0 5 votes vote down vote up
public int createBtMagnetTask(MagnetTaskParam magnetTaskParam, GetTaskId getTaskId) {
    int i = 9900;
    if (!(magnetTaskParam == null || getTaskId == null || !magnetTaskParam.checkMemberVar())) {
        increRefCount();
        if (mDownloadManagerState == XLManagerStatus.MANAGER_RUNNING && this.mLoader != null) {
            i = this.mLoader.createBtMagnetTask(magnetTaskParam.mUrl, magnetTaskParam.mFilePath, magnetTaskParam.mFileName, getTaskId);
        }
        decreRefCount();
    }
    return i;
}
 
Example 20
Source Project: AndroidDownload   Source File: XLDownloadManager.java    License: Apache License 2.0 5 votes vote down vote up
public int createEmuleTask(EmuleTaskParam emuleTaskParam, GetTaskId getTaskId) {
    int i = 9900;
    if (!(emuleTaskParam == null || getTaskId == null || !emuleTaskParam.checkMemberVar())) {
        increRefCount();
        if (mDownloadManagerState == XLManagerStatus.MANAGER_RUNNING && this.mLoader != null) {
            i = this.mLoader.createEmuleTask(emuleTaskParam.mUrl, emuleTaskParam.mFilePath, emuleTaskParam.mFileName, emuleTaskParam.mCreateMode, emuleTaskParam.mSeqId, getTaskId);
        }
        decreRefCount();
    }
    return i;
}
 
Example 21
Source Project: AndroidDownload   Source File: XLDownloadManager.java    License: Apache License 2.0 5 votes vote down vote up
public int createBtTask(BtTaskParam btTaskParam, GetTaskId getTaskId) {
    int i = 9900;
    if (!(btTaskParam == null || getTaskId == null || !btTaskParam.checkMemberVar())) {
        increRefCount();
        if (mDownloadManagerState == XLManagerStatus.MANAGER_RUNNING && this.mLoader != null) {
            i = this.mLoader.createBtTask(btTaskParam.mTorrentPath, btTaskParam.mFilePath, btTaskParam.mMaxConcurrent, btTaskParam.mCreateMode, btTaskParam.mSeqId, getTaskId);
        }
        decreRefCount();
    }
    return i;
}
 
Example 22
Source Project: AndroidDownload   Source File: XLDownloadManager.java    License: Apache License 2.0 5 votes vote down vote up
public int createCIDTask(CIDTaskParam cIDTaskParam, GetTaskId getTaskId) {
    int i = 9900;
    if (!(cIDTaskParam == null || getTaskId == null || !cIDTaskParam.checkMemberVar())) {
        increRefCount();
        if (mDownloadManagerState == XLManagerStatus.MANAGER_RUNNING && this.mLoader != null) {
            i = this.mLoader.createCIDTask(cIDTaskParam.mCid, cIDTaskParam.mGcid, cIDTaskParam.mBcid, cIDTaskParam.mFilePath, cIDTaskParam.mFileName, cIDTaskParam.mFileSize, cIDTaskParam.mCreateMode, cIDTaskParam.mSeqId, getTaskId);
        }
        decreRefCount();
    }
    return i;
}
 
Example 23
Source Project: MiniThunder   Source File: XLTaskHelper.java    License: 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 24
Source Project: MiniThunder   Source File: XLDownloadManager.java    License: Apache License 2.0 5 votes vote down vote up
public int createP2spTask(P2spTaskParam p2spTaskParam, GetTaskId getTaskId) {
    int i = 9900;
    if (!(p2spTaskParam == null || getTaskId == null || !p2spTaskParam.checkMemberVar())) {
        increRefCount();
        if (mDownloadManagerState == XLManagerStatus.MANAGER_RUNNING && this.mLoader != null) {
            i = this.mLoader.createP2spTask(p2spTaskParam.mUrl, p2spTaskParam.mRefUrl, p2spTaskParam.mCookie, p2spTaskParam.mUser, p2spTaskParam.mPass, p2spTaskParam.mFilePath, p2spTaskParam.mFileName, p2spTaskParam.mCreateMode, p2spTaskParam.mSeqId, getTaskId);
        }
        decreRefCount();
    }
    return i;
}
 
Example 25
Source Project: MiniThunder   Source File: XLDownloadManager.java    License: Apache License 2.0 5 votes vote down vote up
public int createBtMagnetTask(MagnetTaskParam magnetTaskParam, GetTaskId getTaskId) {
    int i = 9900;
    if (!(magnetTaskParam == null || getTaskId == null || !magnetTaskParam.checkMemberVar())) {
        increRefCount();
        if (mDownloadManagerState == XLManagerStatus.MANAGER_RUNNING && this.mLoader != null) {
            i = this.mLoader.createBtMagnetTask(magnetTaskParam.mUrl, magnetTaskParam.mFilePath, magnetTaskParam.mFileName, getTaskId);
        }
        decreRefCount();
    }
    return i;
}
 
Example 26
Source Project: MiniThunder   Source File: XLDownloadManager.java    License: Apache License 2.0 5 votes vote down vote up
public int createEmuleTask(EmuleTaskParam emuleTaskParam, GetTaskId getTaskId) {
    int i = 9900;
    if (!(emuleTaskParam == null || getTaskId == null || !emuleTaskParam.checkMemberVar())) {
        increRefCount();
        if (mDownloadManagerState == XLManagerStatus.MANAGER_RUNNING && this.mLoader != null) {
            i = this.mLoader.createEmuleTask(emuleTaskParam.mUrl, emuleTaskParam.mFilePath, emuleTaskParam.mFileName, emuleTaskParam.mCreateMode, emuleTaskParam.mSeqId, getTaskId);
        }
        decreRefCount();
    }
    return i;
}
 
Example 27
Source Project: MiniThunder   Source File: XLDownloadManager.java    License: Apache License 2.0 5 votes vote down vote up
public int createBtTask(BtTaskParam btTaskParam, GetTaskId getTaskId) {
    int i = 9900;
    if (!(btTaskParam == null || getTaskId == null || !btTaskParam.checkMemberVar())) {
        increRefCount();
        if (mDownloadManagerState == XLManagerStatus.MANAGER_RUNNING && this.mLoader != null) {
            i = this.mLoader.createBtTask(btTaskParam.mTorrentPath, btTaskParam.mFilePath, btTaskParam.mMaxConcurrent, btTaskParam.mCreateMode, btTaskParam.mSeqId, getTaskId);
        }
        decreRefCount();
    }
    return i;
}
 
Example 28
Source Project: MiniThunder   Source File: XLDownloadManager.java    License: Apache License 2.0 5 votes vote down vote up
public int createCIDTask(CIDTaskParam cIDTaskParam, GetTaskId getTaskId) {
    int i = 9900;
    if (!(cIDTaskParam == null || getTaskId == null || !cIDTaskParam.checkMemberVar())) {
        increRefCount();
        if (mDownloadManagerState == XLManagerStatus.MANAGER_RUNNING && this.mLoader != null) {
            i = this.mLoader.createCIDTask(cIDTaskParam.mCid, cIDTaskParam.mGcid, cIDTaskParam.mBcid, cIDTaskParam.mFilePath, cIDTaskParam.mFileName, cIDTaskParam.mFileSize, cIDTaskParam.mCreateMode, cIDTaskParam.mSeqId, getTaskId);
        }
        decreRefCount();
    }
    return i;
}
 
Example 29
Source Project: TVRemoteIME   Source File: XLLoader.java    License: GNU General Public License v2.0 votes vote down vote up
public native int createBtMagnetTask(String str, String str2, String str3, GetTaskId getTaskId); 
Example 30
Source Project: TVRemoteIME   Source File: XLLoader.java    License: GNU General Public License v2.0 votes vote down vote up
public native int createBtTask(String str, String str2, int i, int i2, int i3, GetTaskId getTaskId);