Search in sources :

Example 1 with Torrent

use of com.acgist.snail.pojo.bean.Torrent in project snail by acgist.

the class TorrentController method buildTree.

/**
 * <p>新建文件选择树形菜单</p>
 *
 * @param taskSession 任务信息
 */
public void buildTree(ITaskSession taskSession) {
    Torrent torrent = null;
    final TreeView<HBox> tree = this.buildTree();
    try {
        torrent = TorrentContext.getInstance().newTorrentSession(taskSession.getTorrent()).torrent();
    } catch (DownloadException e) {
        LOGGER.error("种子文件解析异常", e);
        Alerts.warn("下载失败", e.getMessage());
    }
    if (torrent != null) {
        this.taskSession = taskSession;
        this.torrentSelector = TorrentSelector.newInstance(torrent.name(), this.download, tree);
        torrent.getInfo().files().stream().filter(TorrentFile::notPaddingFile).forEach(this.torrentSelector::build);
        this.torrentSelector.select(taskSession);
    }
}
Also used : Torrent(com.acgist.snail.pojo.bean.Torrent) HBox(javafx.scene.layout.HBox) DownloadException(com.acgist.snail.context.exception.DownloadException)

Aggregations

DownloadException (com.acgist.snail.context.exception.DownloadException)1 Torrent (com.acgist.snail.pojo.bean.Torrent)1 HBox (javafx.scene.layout.HBox)1