Feature request: download files alphabetically

Suggestions and discussion of future versions
Frosty
Member
Member
Posts: 27
Joined: Fri Nov 16, 2007 4:28 am

Feature request: download files alphabetically

Postby Frosty » Sat Aug 30, 2008 1:45 pm

When we download torrent with many files sometimes we need to download some of them first and we set higher priority for them. But it is not always effective and makes us to pay large attention to it. For example when you download a new serial... everyone want to download first episode, then second, then third, not 5th, 17th, 32th and 48th. How to do this? set highest priority to first and high to 2nd-4th, looks simple? But what will happen, when they are downloaded? Right, you want next 5th-10th episodes, but their priority is normal, like for all other 50 episodes and you have to repeat priority changing again and again.

The solution for this problem is todownload files alphabetically. I don't think, that implementation will be hard and i've got an opinion how it shoud be made. It's not an any programming language, just algorithm near to sh language.

Code: Select all

for  i in * ; do
   while [ file_downloaded = false ]; do
      set_priority($i;highest);
   done
done
set_priority($i;normal);

loki
Compulsive Poster
Compulsive Poster
Posts: 787
Joined: Tue Dec 04, 2007 3:27 pm
Location: MI, USA
Contact:

Re: Feature request: download files alphabetically

Postby loki » Sat Aug 30, 2008 5:38 pm

Not a bad idea actually.

mvoncken
Developer
Developer
Posts: 225
Joined: Mon Sep 03, 2007 9:38 pm

Re: Feature request: download files alphabetically

Postby mvoncken » Sat Aug 30, 2008 8:15 pm

Here's a client script.
This script is not complete, think about setting high prio for the next [n] files, or files marked "do not download"
I'm making simple client scripts to show that the uiclient api is pretty easy to use, And a good client script is halfway to a plugin.
But I won't make that plugin , we need other people/users to complete these example scripts or make plugins out of them.

Code: Select all

#demo script for setting prio.
#finds first non-downloaded file alphabetically ; sets prio to high, all other files to normal.
#assumes the order of torrent["files"] is non-alphabetical, but in all torrents i tested it is alphabetical,
#so the script could be simpler.
from deluge.ui.client import sclient
sclient.set_core_uri()

PRIO_NORMAL = 1
PRIO_MAX = 5

def get_first_index(torrent):
    filenames = [f["path"] for f in torrent["files"]]
    for filename in sorted(filenames):
        index = filenames.index(filename)
        progress = torrent["file_progress"][index]
        if progress < 1: #not completed:
            print "Hi prio for torrent:%s \nindex: %s \nfile: %s" % (torrent["name"], index, filename)
            return index
    raise Exception("impossible, there should be non-downloaded files")

torrents = sclient.get_torrents_status({"state":"Downloading"}, ["name", "file_progress", "files"])
for torrent_id, torrent in torrents.iteritems():
    index = get_first_index(torrent)
    priorities = [PRIO_NORMAL for f in torrent["files"]]
    priorities[index] = PRIO_MAX
    sclient.set_torrent_file_priorities(torrent_id, priorities)

http://dev.deluge-torrent.org/wiki/Development/UiClient
dev: webui, core, labels | irc:vonck7 |


Return to “Development”

Who is online

Users browsing this forum: No registered users and 1 guest