Page 1 of 4

Sequential download script/plugin

Posted: Sun Dec 28, 2008 10:38 am
by DaVince
NOTE: No longer being developed by me, but there are others actively maintaining the script. :D
PROGRESS: currently making and improving the script version.
DOWNLOAD: http://davince.tengudev.com/code/python ... -setter.py

========
I was thinking of creating a plugin that will let you download files in torrents one by one, in a "completely download file #1 and then continue on to file #2, and so on" style. I'm planning to use the priority system for this (set the next file to be downloaded fully to the highest priority).

Before I'm going to try this though, I need to know if there's any interest in such a plugin; I see myself using it to slowly watch a series from a slow torrent as it's downloading, but would anyone else use it? Also, are there any bad sides to this way of downloading?

Re: [Suggestion] One-by-one download plugin

Posted: Tue Dec 30, 2008 7:56 am
by johnnyg
this idea has already been raised: http://forum.deluge-torrent.org/viewtop ... 775#p41775
there's a partial ui client script there, I would suggest you first try finishing it before starting on a plugin.
as for the downside: downloading files sequentially would destroy the random distribution of pieces; everybody would be after the same pieces (of the first few files). this means that torrents could suddenly become unavailable to complete if enough seeders left (not to mention you would probably have slower speeds due to less interaction between the peers). this is why other bittorrent clients don't implement this feature.
That said you would need a widespread use of sequential downloading to 'cause these problems, so writing the plugin would probably be harmless :P
As for if people would use it, I think there is a demand.

Re: [Suggestion] One-by-one download plugin

Posted: Tue Dec 30, 2008 11:31 pm
by DaVince
Thanks for the info. I kind of realized the sequential thing, but the upside is that if there's low availability on a torrent, it'll still at least be able to deliver some completed files rather than all incomplete files. Of course, this still isn't good for stuff like series.

Anyway, thanks for the script. I was only planning to create a plugin if there was some interest shown in it as I'm kind of reluctant to learn to create a plugin for Deluge (I know, it sounds weird right?), but since there is already an incomplete script that should really get me on my way. :)

Re: [Suggestion] One-by-one download plugin

Posted: Fri Jan 16, 2009 7:57 am
by Case
I've been thinking about writing something similar, so if you do make something I'd be glad to help test it. I watch a lot of old tv shows, so this would be a great feature for me. I usually set first file to "highest" prio, the next to "High", and the rest to "Normal", then step up the prios as the files arrive. A nice extra would be adding the finished files to the (VLC) playlist as they become available :)

Re: [Suggestion] One-by-one download plugin

Posted: Fri Jan 16, 2009 1:29 pm
by DaVince
Great to hear. I'm a pretty novice Python developer so for the time being I'll be picking the script apart and modifying it first. Testing and even help when it comes to development would be appreciated, if you'd like. :)

My initial plans are to add options for how many files you'd like to have set to "highest" and how many you'd like to set to "high", so the script could, say, set the first undownloaded file to highest and the two after that to high. After that I'll migrate the whole thing to a plugin (somehow :roll: I'm a PyNovice after all) and try to add options to have it launch programs when a file is finished.

Re: [Suggestion] One-by-one download plugin

Posted: Fri Jan 16, 2009 2:17 pm
by Case
Sounds good. I have planned to learn Python in my ample free time, so don't hold your breath :P BTW, how do I install/use the script under http://forum.deluge-torrent.org/viewtop ... f=8&t=8955 ? If you have updates versions you want tested just let me know.

Re: [Suggestion] One-by-one download plugin

Posted: Fri Jan 16, 2009 3:00 pm
by DaVince
Windows or Linux? Under Linux I can just run it as a normal Python script/program and Deluge will react to whatever the script does... For Windows I have no clue (I wonder if it works when you install standalone Python and run it from there?), the site FAQ doesn't seem to answer this question...

Re: [Suggestion] One-by-one download plugin

Posted: Fri Jan 16, 2009 3:28 pm
by Case
Thanks, I have Linux (Mandriva)

Re: [In progress] One-by-one download plugin

Posted: Fri Jan 16, 2009 6:06 pm
by DaVince
Right, I now made a script that sets the priorities. I based my script on the one that was there, but changed things a bit for some flexibility and simply so that I can understand what's going on a bit better. :mrgreen:

Version 0.1 of the SCRIPT is here: http://davince.tengudev.com/code/python ... -setter.py
Extra command line options are --high [value] and --highest [value] which let you set the amount of files per torrent that will be set to high and highest priority. Default for both is 1.

If you're trying this out, please give feedback! Anything about its functionality, efficiency, improvements, my code style... Suggestions about what could be in the actual plugin are also appreciated, even though I'm not developing the actual plugin just yet at this point.

Edit: now that I think of it, anyone have ideas for a nice name? It's difficult to find an appropiate one that quickly identifies what it does...

Re: [In progress] One-by-one download plugin

Posted: Sat Jan 17, 2009 5:02 am
by johnnyg
For the name: I would call it "Sequential Downloader" plugin rather than alphabetical (as alphabetical is only a certain type of sequence).

As for your code style: I don't really see the point of making AMOUNT_HIGHEST and AMOUNT_HIGH global variables, you could just as easily pass them into set_priorities (in fact if you did this you wouldn't need the temporary variable "counter"). Generally, I avoid using global variables unless I have to (but that's just me).

I like the idea of being able to set the number of highest and high priorities, but why not extend this to also include normal? For instance a user may want to have 1 highest, 2 high, 3 normal and the rest on do not download.

You may also want to consider obeying any "do not downloads" on the initial run of set_priorities (for say people who only want to download the first season of a 10 season torrent).

I think you should have no problems migrating this to a plugin, but post here again if you need any help (you'll need to learn glade to be able to make the GTK UI).

Good work and good luck!