Checking out the code, I can see that the tag is added after adding the torrent:
qbt_client.torrents_add(torrent_files=torrent.dump(), save_path=path, use_auto_torrent_management=auto_management, is_skip_checking=True, content_layout=content_layout, category=qbt_category)
# Wait for up to 30 seconds for qbit to actually return the download
# there's an async race conditiion within qbt that it will return ok before the torrent is actually added
for _ in range(0, 30):
if len(qbt_client.torrents_info(torrent_hashes=torrent.infohash)) > 0:
break
await asyncio.sleep(1)
qbt_client.torrents_resume(torrent.infohash)
if client.get('qbit_tag', None) != None:
qbt_client.torrents_add_tags(tags=client.get('qbit_tag'), torrent_hashes=torrent.infohash)
if meta.get('qbit_tag') != None:
qbt_client.torrents_add_tags(tags=meta.get('qbit_tag'), torrent_hashes=torrent.infohash)
console.print(f"Added to: {path}")
Why just don't add the tag in the torrents_add call as the API specifies it? From their docs:
I know it is not that important. I just would like to have to scripting when adding a torrent with a particular Tag. I checked the code and I wondered why? Is there a reason or should I just do a PR?
Checking out the code, I can see that the tag is added after adding the torrent:
Why just don't add the tag in the
torrents_add
call as the API specifies it? From their docs:I know it is not that important. I just would like to have to scripting when adding a torrent with a particular Tag. I checked the code and I wondered why? Is there a reason or should I just do a PR?