+
+ if new_download:
+ logger.log_msg('download of torrent "%s" started' % torrent)
+ #else:
+ #logger.log_msg('download of torrent "%s" already started' \
+ #% torrent, logger.LOG_LEVEL_DEBUG)
+
+ 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
+
+ def get_torrent_list(self):
+ """
+ Returns a list of all torrents started.
+ """
+
+ downloads = self.session.get_downloads()
+ torrent_list = []
+
+ for dl in downloads:
+ tdef = dl.get_def()
+ torrent_list.append(tdef.get_name() + '.tstream')
+
+ return torrent_list