From 93712a7f5eca5f1e9c73eb0e0e8f74178b6d7c74 Mon Sep 17 00:00:00 2001 From: Hachi-R Date: Sun, 22 Dec 2024 09:08:36 -0300 Subject: [PATCH] refactor: remove commented-out code for torrent actions in main.py and torrent_downloader.py --- python_rpc/main.py | 7 ------ python_rpc/torrent_downloader.py | 43 -------------------------------- 2 files changed, 50 deletions(-) diff --git a/python_rpc/main.py b/python_rpc/main.py index f7ad4b25..060e01c2 100644 --- a/python_rpc/main.py +++ b/python_rpc/main.py @@ -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 diff --git a/python_rpc/torrent_downloader.py b/python_rpc/torrent_downloader.py index 6573d124..46ee4e33 100644 --- a/python_rpc/torrent_downloader.py +++ b/python_rpc/torrent_downloader.py @@ -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()