From b8f5f90929269631b134109f2bb0b87eb6b100a6 Mon Sep 17 00:00:00 2001 From: Hachi-R Date: Mon, 23 Dec 2024 14:53:35 -0300 Subject: [PATCH] feat: enhance download handling for magnet and HTTP links in action function --- python_rpc/main.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/python_rpc/main.py b/python_rpc/main.py index 10633423..54e5038f 100644 --- a/python_rpc/main.py +++ b/python_rpc/main.py @@ -131,14 +131,16 @@ def action(): existing_downloader = downloads.get(game_id) - if existing_downloader: - # This will resume the download - existing_downloader.start_download(url, data['save_path'], data.get('header')) - else: - if url.startswith('magnet'): + if url.startswith('magnet'): + if existing_downloader and isinstance(existing_downloader, TorrentDownloader): + existing_downloader.start_download(url, data['save_path'], "") + else: torrent_downloader = TorrentDownloader(torrent_session) downloads[game_id] = torrent_downloader torrent_downloader.start_download(url, data['save_path'], "") + else: + if existing_downloader and isinstance(existing_downloader, HttpDownloader): + existing_downloader.start_download(url, data['save_path'], data.get('header')) else: http_downloader = HttpDownloader() downloads[game_id] = http_downloader