From 622fc393fca91e732b6caa7ba9e081fa1806adc8 Mon Sep 17 00:00:00 2001 From: Chubby Granny Chaser Date: Wed, 9 Apr 2025 17:06:35 +0100 Subject: [PATCH] fix: vibe coding --- python_rpc/http_downloader.py | 61 ----------------------------------- 1 file changed, 61 deletions(-) delete mode 100644 python_rpc/http_downloader.py diff --git a/python_rpc/http_downloader.py b/python_rpc/http_downloader.py deleted file mode 100644 index 60c63ce7..00000000 --- a/python_rpc/http_downloader.py +++ /dev/null @@ -1,61 +0,0 @@ -import aria2p - -class HttpDownloader: - def __init__(self): - self.download = None - self.aria2 = aria2p.API( - aria2p.Client( - host="http://localhost", - port=6800, - secret="" - ) - ) - - def start_download(self, url: str, save_path: str, header: str, out: str = None, allow_multiple_connections: bool = False): - if self.download: - self.aria2.resume([self.download]) - else: - options = { - "header": header, - "dir": save_path, - "out": out - } - - if allow_multiple_connections: - options.update({ - "split": "4", - "max-connection-per-server": "16", - "min-split-size": "2M" - }) - - downloads = self.aria2.add(url, options=options) - - self.download = downloads[0] - - def pause_download(self): - if self.download: - self.aria2.pause([self.download]) - - def cancel_download(self): - if self.download: - self.aria2.remove([self.download]) - self.download = None - - def get_download_status(self): - if self.download == None: - return None - - download = self.aria2.get_download(self.download.gid) - - response = { - 'folderName': download.name, - 'fileSize': download.total_length, - 'progress': download.completed_length / download.total_length if download.total_length else 0, - 'downloadSpeed': download.download_speed, - 'numPeers': 0, - 'numSeeds': 0, - 'status': download.status, - 'bytesDownloaded': download.completed_length, - } - - return response