newspaint

Documenting Problems That Were Difficult To Find The Answer To

Deluge BitTorrent Client Refusing To Set File Priority

The Deluge BitTorrent client will sometimes appear to completely ignore an instruction to change file priority in a torrent. Perhaps you want to set a file to “Do Not Download” yet Deluge won’t allow you to, it will refuse the request silently.

You find yourself in this situation, you right click on a file, and choose a different priority, such as “Do Not Download” as in the following screenshot of the webui:

Attempting to change file priority in Deluge

Attempting to change file priority in Deluge

Nothing happens. Why not? Well when you right-click on the file and set a priority a JSON request is made to the WebUI with the following payload:

{"method":"core.set_torrent_file_priorities","params":["406ce341e375e984527ddc6dee24cbf7a7aff032",[1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1]],"id":71}

This call is found to be translated in /usr/lib/python2.7/dist-packages/deluge/core/core.py:

    @export
    def set_torrent_file_priorities(self, torrent_id, priorities):
        """Sets a torrents file priorities"""
        return self.torrentmanager[torrent_id].set_file_priorities(priorities)

The corresponding call to set_file_priorities is in /usr/lib/python2.7/dist-packages/deluge/core/torrent.py:

    def set_file_priorities(self, file_priorities):
        if len(file_priorities) != len(self.get_files()):
            log.debug("file_priorities len != num_files")
            self.options["file_priorities"] = self.handle.file_priorities()
            return

        if self.options["compact_allocation"]:
            log.debug("setting file priority with compact allocation does not work!")
            self.options["file_priorities"] = self.handle.file_priorities()
            return

This, then, has the answer. You cannot set file priorities if you set file allocation to “compact” when you added the torrent.

If you set file allocation to compact in Deluge then you cannot set file download priority

If you set file allocation to compact in Deluge then you cannot set file download priority

Solution

If you want to be able to set download priorities (including not downloading) then you must set file allocation to “full” when adding a torrent.

One response to “Deluge BitTorrent Client Refusing To Set File Priority

  1. Rune Megara September 10, 2017 at 7:18 am

    Or perhaps this isn’t the solution at all, because if “full allocation” is the default setting of Deluge (or you have specifically set it in the preferences) then any torrent added is therefore already set to “full” and this problem is being ignored because nobody seems to know how to actually fix it.

    I’ve been through several versions of Deluge over the years and this continues to pop up from time to time until eventually I just delete the torrent and re-add it. It is especially vexing when everything works fine one minute and then the next time you check it the priority will not change. However, it appears to happen most often when the torrent is finished regardless if seeding or not.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: