Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improving "priority_thread.py" #11

Open
blueskyleaf opened this issue Mar 24, 2015 · 2 comments
Open

Improving "priority_thread.py" #11

blueskyleaf opened this issue Mar 24, 2015 · 2 comments

Comments

@blueskyleaf
Copy link

I am working on improving the priority_thread.py code, so that when selecting "Select priority of first un-downloaded piece to High" 2,5% of the first un-downloaded pieces are set to Highest, 2,5% of the next un-downloaded pieces are set to Higher and 2,5% of the next un-downloaded pieces after that is set to High.

That way any torrent will stream very efficiently. Because just setting High priority on 1 single piece doesn't work well, as is the default in the current code.

But I am unable to change the priority of an amount of pieces relative to the total amount of pieces in the torrent. So currently I have a set amount of pieces that is changed.
Which doesn't work so well when the torrent either have very few or very many of pieces.

Here is what I have done so far.
I have changed this:

__target_priority = 5

(...)

# lf is now the first un-downloaded, desired piece of this torrent
if (tor.handle.piece_priority(lf) < __target_priority):
tor.handle.piece_priority(lf,__target_priority)
__last_first[t] = lf

into this:

__target_priority = 7
__target_priority2 = 5
__target_priority3 = 2

(...)

# lf is now the first un-downloaded, desired piece of this torrent
if (tor.handle.piece_priority(lf) < __target_priority):
    for e in range(0, 25):
        tor.handle.piece_priority(lf+e,__target_priority)
    for e2 in range(25, 51):
        tor.handle.piece_priority(lf+e2,__target_priority2)
    for e3 in range(51, 77):
        tor.handle.piece_priority(lf+e3,__target_priority3)
__last_first[t] = lf

What is the variable for the total amount of pieces, so that I can dynamically calculate the ranges of the for loops?

@tgharib
Copy link

tgharib commented Feb 1, 2016

For an alternative, check out https://github.com/JohnDoee/deluge-streaming

It supports sequential downloading and it even supports seeking. Once you seek forward, it will sequentially download from that seek point.

@blueskyleaf
Copy link
Author

Great, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants