aldenml / libtorrent4j

libtorrent for java, a swig Java interface for libtorrent
http://libtorrent4j.org
Other
204 stars 31 forks source link

为什么我设置Priority不生效 #221

Closed Jason-wam closed 2 years ago

Jason-wam commented 2 years ago

我已经设置了Priority为IGNORE,但总是下载所有文件

代码如下

        val priorities = arrayOfNulls<Priority>(torrentInfo.numFiles())
        for (i in priorities.indices) {
            priorities[i] = Priority.IGNORE
        }
        priorities[0] = Priority.TOP_PRIORITY
        priorities.forEachIndexed { index, priority ->
            println("MainActivity: ${torrentInfo.files().fileName(index)} >>> $priority")
        }

        val downloadDirectory = FileUtil.getCacheDirectory(this, "download")
        sessionManager.download(torrentInfo, downloadDirectory, null, priorities, emptyList(), TorrentFlags.SEQUENTIAL_DOWNLOAD)
aldenml commented 2 years ago

I just tested with the latest version and it works as intended. What version are you using?

Jason-wam commented 2 years ago

感谢您的回复,我升级到最新版没有再遇到这个问题了