Mircea Stanciu
2016-08-29 11:36:20 UTC
Continuing from here,
https://sourceforge.net/p/libtorrent/mailman/message/35312277/
My Raspberry can't handle download speeds higher than 300kbps. Here is
the client code I am using:
import libtorrent as lt
import time, os
torrent_path = '/home/torrent'
ses = lt.session()
ses.listen_on(6881, 6891)
session_settings = ses.settings()
session_settings.download_rate_limit = 300 * 1000
ses.set_settings(session_settings)
for file in os.listdir(torrent_path):
le_file = torrent_path + '/' + file
print le_file
e = lt.bdecode(open(le_file, 'rb').read())
info = lt.torrent_info(e)
h = ses.add_torrent(info, "/home/Downloads")
while (not h.is_seed()):
s = h.status()
state_str = ['queued', 'checking', 'downloading metadata', \
'downloading', 'finished', 'seeding',
'allocating', 'checking fastresume']
print '%.2f%% complete (down: %.1f kb/s up: %.1f kB/s
peers: %d) %s' % \
(s.progress * 100, s.download_rate / 1000,
s.upload_rate / 1000, \
s.num_peers, state_str[s.state])
time.sleep(1)
print 'end of while, moving to next torrent in folder'
My problem now is with the "download_rate_limit" setting. If I run the
script the first torrent downloads at the set rate, but the next ones
will ignore this setting, reaching 10 MB/s and overwhelming the disk.
Why is "session_settings.download_rate_limit = 300 * 1000" affecting
only the first torrent? I tried moving the "ses.set_settings" inside the
for loop and even deleting the "ses" object at the end of the while loop
and declaring a new one with every pass trough the for loop, but nothing
changed.
Any suggestions?
Kind regards,
Mircea
---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
------------------------------------------------------------------------------
https://sourceforge.net/p/libtorrent/mailman/message/35312277/
My Raspberry can't handle download speeds higher than 300kbps. Here is
the client code I am using:
import libtorrent as lt
import time, os
torrent_path = '/home/torrent'
ses = lt.session()
ses.listen_on(6881, 6891)
session_settings = ses.settings()
session_settings.download_rate_limit = 300 * 1000
ses.set_settings(session_settings)
for file in os.listdir(torrent_path):
le_file = torrent_path + '/' + file
print le_file
e = lt.bdecode(open(le_file, 'rb').read())
info = lt.torrent_info(e)
h = ses.add_torrent(info, "/home/Downloads")
while (not h.is_seed()):
s = h.status()
state_str = ['queued', 'checking', 'downloading metadata', \
'downloading', 'finished', 'seeding',
'allocating', 'checking fastresume']
print '%.2f%% complete (down: %.1f kb/s up: %.1f kB/s
peers: %d) %s' % \
(s.progress * 100, s.download_rate / 1000,
s.upload_rate / 1000, \
s.num_peers, state_str[s.state])
time.sleep(1)
print 'end of while, moving to next torrent in folder'
My problem now is with the "download_rate_limit" setting. If I run the
script the first torrent downloads at the set rate, but the next ones
will ignore this setting, reaching 10 MB/s and overwhelming the disk.
Why is "session_settings.download_rate_limit = 300 * 1000" affecting
only the first torrent? I tried moving the "ses.set_settings" inside the
for loop and even deleting the "ses" object at the end of the while loop
and declaring a new one with every pass trough the for loop, but nothing
changed.
Any suggestions?
Kind regards,
Mircea
---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
------------------------------------------------------------------------------