+
+ def stop_torrent(self, torrent, remove_content=False):
+ """
+ Stop leeching or seeding a file via BitTorrent.
+
+ !!! Only tested with torrents started with .tstream files. Not tested
+ for torrents started with URLs.
+
+ @param torrent .torrent file or URL
+ @param remove_content removes downloaded file
+ """
+
+ downloads = self.session.get_downloads()
+
+ for dl in downloads:
+ tdef = dl.get_def()
+ if torrent.find(tdef.get_name()) == 0:
+ self.session.remove_download(dl, remove_content)
+ logger.log_msg('torrent "%s" stopped' % torrent)
+ break