Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update clients.py #324

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 2 additions & 13 deletions src/clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}")


Expand Down Expand Up @@ -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
return local_path, remote_path