mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-02-03 00:33:49 +03:00
fix: keeping last status available on rpc
This commit is contained in:
parent
c1c06c2d20
commit
c26315219e
@ -74,7 +74,7 @@ export class DownloadManager {
|
|||||||
if (game.downloader === Downloader.RealDebrid) {
|
if (game.downloader === Downloader.RealDebrid) {
|
||||||
throw new Error();
|
throw new Error();
|
||||||
} else {
|
} else {
|
||||||
TorrentDownloader.resumeDownload(game);
|
TorrentDownloader.startDownload(game);
|
||||||
this.currentDownloader = Downloader.Torrent;
|
this.currentDownloader = Downloader.Torrent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -123,10 +123,6 @@ export class TorrentDownloader {
|
|||||||
this.downloadingGameId = -1;
|
this.downloadingGameId = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static resumeDownload(game: Game) {
|
|
||||||
this.startDownload(game);
|
|
||||||
}
|
|
||||||
|
|
||||||
static async startDownload(game: Game) {
|
static async startDownload(game: Game) {
|
||||||
if (!this.torrentClient) this.spawn();
|
if (!this.torrentClient) this.spawn();
|
||||||
|
|
||||||
|
@ -36,7 +36,6 @@ def pause_download(game_id: int):
|
|||||||
torrent_handle.pause()
|
torrent_handle.pause()
|
||||||
torrent_handle.unset_flags(lt.torrent_flags.auto_managed)
|
torrent_handle.unset_flags(lt.torrent_flags.auto_managed)
|
||||||
downloading_game_id = -1
|
downloading_game_id = -1
|
||||||
Handler.current_status = None
|
|
||||||
|
|
||||||
def cancel_download(game_id: int):
|
def cancel_download(game_id: int):
|
||||||
global torrent_handles
|
global torrent_handles
|
||||||
@ -48,7 +47,6 @@ def cancel_download(game_id: int):
|
|||||||
session.remove_torrent(torrent_handle)
|
session.remove_torrent(torrent_handle)
|
||||||
torrent_handles[game_id] = None
|
torrent_handles[game_id] = None
|
||||||
downloading_game_id =-1
|
downloading_game_id =-1
|
||||||
Handler.current_status = None
|
|
||||||
|
|
||||||
def get_download_updates():
|
def get_download_updates():
|
||||||
global torrent_handles
|
global torrent_handles
|
||||||
@ -78,8 +76,6 @@ def get_download_updates():
|
|||||||
|
|
||||||
if status.progress == 1:
|
if status.progress == 1:
|
||||||
cancel_download(downloading_game_id)
|
cancel_download(downloading_game_id)
|
||||||
downloading_game_id = -1
|
|
||||||
Handler.current_status = None
|
|
||||||
|
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
|
|
||||||
@ -105,8 +101,10 @@ class Handler(BaseHTTPRequestHandler):
|
|||||||
start_download(data['game_id'], data['magnet'], data['save_path'])
|
start_download(data['game_id'], data['magnet'], data['save_path'])
|
||||||
elif data['action'] == 'pause':
|
elif data['action'] == 'pause':
|
||||||
pause_download(data['game_id'])
|
pause_download(data['game_id'])
|
||||||
|
self.current_status = None
|
||||||
elif data['action'] == 'cancel':
|
elif data['action'] == 'cancel':
|
||||||
cancel_download(data['game_id'])
|
cancel_download(data['game_id'])
|
||||||
|
self.current_status = None
|
||||||
|
|
||||||
self.send_response(200)
|
self.send_response(200)
|
||||||
self.end_headers()
|
self.end_headers()
|
||||||
|
Loading…
Reference in New Issue
Block a user