#!/usr/bin/python3

# Needs to have
#pip3 install qbittorrent-api

from qbittorrentapi import Client
client = Client(host='localhost:8080', username='user', password='password')

torrent_list = client.torrents.info()

for torrent in torrent_list:
    for x in torrent.trackers:
        if 'awesome-hd.me' in x.url:
            newurl = x.url.replace('awesome-hd.me','awesome-hd.club')
            print(torrent.name,' Original URL:',x.url, ' Modified URL:',newurl)
            torrent.remove_trackers(hash=(torrent.hash),urls=(x.url))
            torrent.add_trackers(hash=(torrent.hash),urls=(newurl))
