ManiMatter / decluttarr

Watches radarr, sonarr, lidarr, readarr and whisparr download queues and removes downloads if they become stalled or no longer needed.
GNU General Public License v3.0
99 stars 15 forks source link

sort private torrents into categories #110

Closed wieluk closed 1 month ago

wieluk commented 1 month ago

I have something like this (really quick and dirty):

from qbittorrent import Client
qbt_client = qbittorrentapi.Client(host=qbithost, username=qbitusername, password=qbitpw)

private_tracker_list =['trackerA', 'trackerB'] #has to appear somewhere like this in the announceurl
categories = ["movies-radarr", "tv-sonarr", "music-lidarr"]

def sort_private_torrents():
    for category in categories:
        for torrent in qbt_client.torrents.info(category=category):
            if torrent.state_enum.is_complete or torrent.state_enum.is_uploading or torrent.state_enum.is_paused:
                for tracker in private_tracker_list:
                    if tracker.lower() in torrent.tracker.lower():
                        torrent.setCategory(f'seeding_{tracker.lower()}')

running in the background. Do you think it could be a good addition? Not exactly like this but more polished and with automatically creating the categories before?

ManiMatter commented 1 month ago

I dont get it. What problem are you trying to solve please?

wieluk commented 1 month ago

I am sorting private torrents into different categories.

ManiMatter commented 1 month ago

Sure but what do you win by doing so?

wieluk commented 1 month ago

Not having hundreds of unsorted torrents in one category?

ManiMatter commented 1 month ago

What is your goal? You want to differentiate between private tracker torrents and non-private tracker ones? That would be a feature request to qbit that you can filter in their UI (by isPrivate attribute; no need to add that to category)

wieluk commented 1 month ago

No I just want to have them in their own categories to have a oversight but it doesn't seem like this is something you want so I a will just let my script run.

ManiMatter commented 1 month ago

I simply don‘t understand the benefit you are aiming for. If it‘s about the ability that you can differentiate in qbit between private and public trackers, I still think categories are the wrong approach; use the isPrivate attribute instead. It‘s not shown on the UI currently, but you may request that from qbit or even do a PR yourself.

In addition, if you split the sonarr category into sonarr-public and sonarr-private, I am not sure how that would not break sonarr, since in the torrent client settings sonarr to my knowledge can only look for one category to know which torrents are relevant to sonarr.

wieluk commented 1 month ago

No I am sorting each private tracker into into its own category. There is one category per private tracker.

ManiMatter commented 1 month ago

Let‘s say you have done that, and now you have several categories. How do you link sonarr/radarr to these categories? They only support one category (eg „radarr-category“, „sonarr“ or whatever you have defined in these apps) but not multiple ones

wieluk commented 1 month ago

This is done post import so I do not need to link it