L4GSP1KE / Upload-Assistant

301 stars 93 forks source link

Question: Why are not torrents added directly with the Tag? #314

Open AN1MATEK opened 4 months ago

AN1MATEK commented 4 months ago

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:

torrents_add(urls=None, torrent_files=None, save_path=None, cookie=None, category=None, is_skip_checking=None, is_paused=None, is_root_folder=None, rename=None, upload_limit=None, download_limit=None, use_auto_torrent_management=None, is_sequential_download=None, is_first_last_piece_priority=None, tags=None, content_layout=None, ratio_limit=None, seeding_time_limit=None, download_path=None, use_download_path=None, stop_condition=None, **kwargs) → [str](https://docs.python.org/3/library/stdtypes.html#str)

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?

AN1MATEK commented 3 months ago

Nobody? This hinders automation :(