'Dynamically enable/disable mining source.'

def set_enable_mining(self, source, mining_bool=True, force_restart=False):

    for ihash in list(self.torrents):
        tor = self.torrents.get(ihash)
        if (tor['source'] == source_to_string(source)):
            self.torrents[ihash]['enabled'] = mining_bool
            if (not mining_bool):
                self.stop_download(tor)
    self.boosting_sources[string_to_source(source)].enabled = mining_bool
    self._logger.info('Set    mining    source    %s    %s', source, mining_bool)
    if force_restart:
        self._select_torrent()
