From 83d47993bb96bf3004362fac8a9e21681a1c548d Mon Sep 17 00:00:00 2001 From: AN1MATEK <15142596+AN1MATEK@users.noreply.github.com> Date: Thu, 21 Mar 2024 13:58:52 +0100 Subject: [PATCH] Update clients.py Simplify adding the torrent to one line / API Call, where it already includes the Tag and the paused state to False. --- src/clients.py | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/src/clients.py b/src/clients.py index c8d5fcba1..5bf4d1f42 100644 --- a/src/clients.py +++ b/src/clients.py @@ -309,18 +309,7 @@ async def qbittorrent(self, path, torrent, local_path, remote_path, client, is_d content_layout = client.get('content_layout', 'Original') - 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) + qbt_client.torrents_add(torrent_files=torrent.dump(), save_path=path, use_auto_torrent_management=auto_management, is_skip_checking=True, is_paused=False, content_layout=content_layout, category=qbt_category, tags=client.get('qbit_tag')) console.print(f"Added to: {path}") @@ -411,4 +400,4 @@ async def remote_path_map(self, meta): if local_path.endswith(os.sep): remote_path = remote_path + os.sep - return local_path, remote_path \ No newline at end of file + return local_path, remote_path