'Update the trackers for a download.
:param infohash: infohash of the torrent that needs to be updated
:param trackers: A list of tracker urls.'

def update_trackers(self, infohash, trackers):

    dl = self.get_download(infohash)
    old_def = (dl.get_def() if dl else None)
    if old_def:
        old_trackers = old_def.get_trackers_as_single_tuple()
        new_trackers = list((set(trackers) - set(old_trackers)))
        all_trackers = (list(old_trackers) + new_trackers)
        if new_trackers:
            dl.add_trackers(new_trackers)
            if isinstance(old_def, TorrentDefNoMetainfo):
                new_def = TorrentDefNoMetainfo(old_def.get_infohash(), old_def.get_name(), dl.get_magnet_link())
            else:
                metainfo = old_def.get_metainfo()
                if (len(all_trackers) > 1):
                    metainfo['announce-list'] = [all_trackers]
                else:
                    metainfo['announce'] = all_trackers[0]
                new_def = TorrentDef.load_from_dict(metainfo)
            dl.set_def(new_def)
            dl.checkpoint()
            if isinstance(old_def, TorrentDefNoMetainfo):
                @forceDBThread
                def update_trackers_db(infohash, new_trackers):
                    torrent_id = self.torrent_db.getTorrentID(infohash)
                    if (torrent_id is not None):
                        self.torrent_db.addTorrentTrackerMappingInBatch(torrent_id, new_trackers)
                        self.session.notifier.notify(NTFY_TORRENTS, NTFY_UPDATE, infohash)
                if self.session.config.get_megacache_enabled():
                    update_trackers_db(infohash, new_trackers)
            elif ((not isinstance(old_def, TorrentDefNoMetainfo)) and self.rtorrent_handler):
                self.rtorrent_handler.save_torrent(new_def)
