refactor: remove commented-out code for torrent actions in main.py and torrent_downloader.py

This commit is contained in:
Hachi-R 2024-12-22 09:08:36 -03:00
parent abb3db4e30
commit 93712a7f5e
2 changed files with 0 additions and 50 deletions

View File

@ -131,13 +131,6 @@ def action():
if downloader:
downloader.cancel_download()
# elif action == 'kill-torrent':
# torrent_downloader.abort_session()
# torrent_downloader = None
# elif action == 'pause-seeding':
# torrent_downloader.pause_seeding(game_id)
# elif action == 'resume-seeding':
# torrent_downloader.resume_seeding(game_id, data['url'], data['save_path'])
else:
return jsonify({"error": "Invalid action"}), 400

View File

@ -147,46 +147,3 @@ class TorrentDownloader:
}
return response
# def get_seed_status(self):
# response = []
# for game_id, torrent_handle in self.torrent_handles.items():
# if game_id == self.downloading_game_id:
# continue
# status = torrent_handle.status()
# info = torrent_handle.torrent_file()
# torrent_info = {
# 'folderName': info.name() if info else "",
# 'fileSize': info.total_size() if info else 0,
# 'gameId': game_id,
# 'progress': status.progress,
# 'downloadSpeed': status.download_rate,
# 'uploadSpeed': status.upload_rate,
# 'numPeers': status.num_peers,
# 'numSeeds': status.num_seeds,
# 'status': status.state,
# 'bytesDownloaded': status.progress * info.total_size() if info else status.all_time_download,
# }
# if status.state == 5:
# response.append(torrent_info)
# return response
# def pause_seeding(self, game_id: int):
# torrent_handle = self.torrent_handles.get(game_id)
# if torrent_handle:
# torrent_handle.pause()
# torrent_handle.unset_flags(lt.torrent_flags.auto_managed)
# self.session.remove_torrent(torrent_handle)
# self.torrent_handles.pop(game_id, None)
# def resume_seeding(self, game_id: int, magnet: str, save_path: str):
# params = {'url': magnet, 'save_path': save_path, 'trackers': self.trackers}
# torrent_handle = self.session.add_torrent(params)
# self.torrent_handles[game_id] = torrent_handle
# torrent_handle.set_flags(lt.torrent_flags.auto_managed)
# torrent_handle.resume()