Created
March 14, 2021 21:28
-
-
Save cobrce/f5a2f70291f5beef801c547fedf0b11e to your computer and use it in GitHub Desktop.
Script for qbittorrent, monitors a category of torrents (in this case tv-sonarr) and put them at the top of the queue, it uses python-qbittorrent module
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from time import sleep | |
from qbittorrent import Client #pip3 install python-qbittorrent | |
link = "http://127.0.0.1:8080" | |
username = "admin" | |
password = "admin" | |
category = "tv-sonarr" | |
def main(): | |
while True: | |
try: | |
qb = Client(link) | |
qb.login(username,password) | |
while True: | |
torrents =qb.torrents(category=category) | |
hash_priority = {t["hash"]:t["priority"] for t in torrents if t['progress']!=1.0} | |
if not hash_priority or (1 in hash_priority.values()): | |
break | |
qb.increase_priority(list(hash_priority.keys())) | |
sleep(0.5) | |
qb.logout() | |
except: | |
pass | |
sleep(30) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment