i want to remove specific trackers from all my torrents (they’re discontinued), it’s not doable with a per-torrent method as i would never finish.

I’m using qbittorrent v5.0.3 WebUI, i cannot just select the trackers i wish to remove under the “trackers” pane in the left side as it only allows me to remove all torrents with this tracker (i do not wish to remove the torrents), and not remove the tracker.

how can i remove these trackers from all my torrents easily, while keeping the torrents for seeding?

  • 12510198@lemmy.blahaj.zone
    link
    fedilink
    English
    arrow-up
    8
    ·
    1 day ago

    Heres a python script I made up from just modifying another script I use, it depends on qbittorrent-api, but to use just fill out the connection info and add all the trackers you want to remove in the TRACKERS array, I’ve included 2 rarbg trackers just as an example.

    #!/usr/bin/env python3
    import qbittorrentapi
    import sys
    
    TRACKERS = [
            "udp://9.rarbg.to:2770/announce",
            "udp://9.rarbg.me:2730/announce"
     ]
    
    conn_info = dict(
        host     = "qbittorrent.localhost",
        port     = 80,
        username = "admin",
        password = "PASSWORD"
    )
    
    def main (argv, argc):
        qbt_client = qbittorrentapi.Client(**conn_info)
    
        try:
            qbt_client.auth_log_in()
        except qbittorrentapi.LoginFailed as e:
            print(e)
            return 1
    
        for torrent in qbt_client.torrents_info():
            #urls = []
            #for tracker in torrent.trackers:
                #print(tracker)
                #urls.append(tracker.url)
            
            torrent.remove_trackers(urls=TRACKERS)
    
            #torrent.add_trackers(urls=TRACKERS)
    
        qbt_client.auth_log_out()
        return 0
    
    if __name__ == "__main__":
        sys.exit(main(sys.argv, len(sys.argv)))