python-qBittorrent
python-qBittorrent copied to clipboard
In set_file_priority, how to get the file_id?
Or I am doing something wrong, or the library isn't working?
qb = Client('http://127.0.0.1:8080/')
qb.login('name', 'pass')
for torrent in qb.torrents():
arqs = qb.get_torrent_files(torrent['hash'])
for arq in arqs:
qb.set_file_priority(torrent['hash'], file_id=arq['index'], priority=1) #or 0 or any value
I don't see the changes with this code. How do I get the file_id
? Is the index
data? There is no other obvious value.
What am I doing wrong? Some values change, but it is a little random. So I think the index
isn't the correct number.
I discovery the problem! I am making a lot of requests so fast that the program don't have time to change the value. So, I need to put an delay
for arq in arqs:
qb.set_file_priority(torrent['hash'], file_id=arq['index'], priority=1) #or 0 or any value
import time
time.sleep(0.2)
Even this can sometime don't work, so I need to run various for to check if it saved the value! Or make the delay bigger. This bug is not in the python layer, but in the program itself. Where does it process in the program? I didn't find it! If the developer want to open a new bug in the qBittorent, it will help a lot.
Please close the issue, if there is a solution.
ok