Skip to content

Commit

Permalink
torrent-start: fix MissingRequiredParameters400Error
Browse files Browse the repository at this point in the history
  • Loading branch information
chapmanjacobd committed Dec 11, 2024
1 parent 5105fb5 commit a956331
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions xklb/mediafiles/torrents_start.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ def wait_torrent_loaded(qbt_client, torrent):
v1_info_hash = hashlib.sha1(Bencode.encode(torrent._struct.get("info"))).hexdigest()
v2_info_hash = hashlib.sha256(Bencode.encode(torrent._struct.get("info"))).hexdigest()

attempts = 120
# TODO: sometimes torrentool and qBittorrent come up with different info_hashes...

attempts = 10
attempt = 0
while attempt < attempts:
with suppress(qbittorrentapi.NotFound404Error):
Expand Down Expand Up @@ -117,8 +119,8 @@ def torrents_start():
"max_active_checking_torrents": 3,
"slow_torrent_inactive_timer": 80,
# divide by 10 but also some bps -> kbps BS
"slow_torrent_dl_rate_threshold": (args.dl_limit) // 10000, # type: ignore
"slow_torrent_ul_rate_threshold": (args.up_limit or args.dl_limit) // 10000, # type: ignore
"slow_torrent_dl_rate_threshold": (args.dl_limit) // 10_000, # type: ignore
"slow_torrent_ul_rate_threshold": (args.up_limit or args.dl_limit) // 10_000, # type: ignore
}
)

Expand Down Expand Up @@ -150,7 +152,8 @@ def torrents_start():
)

info_hash = wait_torrent_loaded(qbt_client, torrent)
qbt_client.torrents_start(info_hash)
if info_hash:
qbt_client.torrents_start(info_hash)

if args.delete_torrent:
trash(args, path)

0 comments on commit a956331

Please sign in to comment.