Skip to content

Commit 89bfb51

Browse files
committed
fix: seeding causing python process to crash
1 parent e1a1136 commit 89bfb51

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "hydralauncher",
3-
"version": "3.1.1",
3+
"version": "3.1.2",
44
"description": "Hydra",
55
"main": "./out/main/index.js",
66
"author": "Los Broxas",

python_rpc/main.py

+12-3
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,27 @@
2727
if initial_download['url'].startswith('magnet'):
2828
torrent_downloader = TorrentDownloader(torrent_session)
2929
downloads[initial_download['game_id']] = torrent_downloader
30-
torrent_downloader.start_download(initial_download['url'], initial_download['save_path'], "")
30+
try:
31+
torrent_downloader.start_download(initial_download['url'], initial_download['save_path'], "")
32+
except Exception as e:
33+
print("Error starting torrent download", e)
3134
else:
3235
http_downloader = HttpDownloader()
3336
downloads[initial_download['game_id']] = http_downloader
34-
http_downloader.start_download(initial_download['url'], initial_download['save_path'], initial_download.get('header'))
37+
try:
38+
http_downloader.start_download(initial_download['url'], initial_download['save_path'], initial_download.get('header'))
39+
except Exception as e:
40+
print("Error starting http download", e)
3541

3642
if start_seeding_payload:
3743
initial_seeding = json.loads(urllib.parse.unquote(start_seeding_payload))
3844
for seed in initial_seeding:
3945
torrent_downloader = TorrentDownloader(torrent_session, lt.torrent_flags.upload_mode)
4046
downloads[seed['game_id']] = torrent_downloader
41-
torrent_downloader.start_download(seed['url'], seed['save_path'], "")
47+
try:
48+
torrent_downloader.start_download(seed['url'], seed['save_path'], "")
49+
except Exception as e:
50+
print("Error starting seeding", e)
4251

4352
def validate_rpc_password():
4453
"""Middleware to validate RPC password."""

src/main/main.ts

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { HydraApi } from "./services/hydra-api";
1010
import { uploadGamesBatch } from "./services/library-sync";
1111
import { Aria2 } from "./services/aria2";
1212
import { Downloader } from "@shared";
13+
import { IsNull, Not } from "typeorm";
1314

1415
const loadState = async (userPreferences: UserPreferences | null) => {
1516
import("./events");
@@ -40,6 +41,7 @@ const loadState = async (userPreferences: UserPreferences | null) => {
4041
shouldSeed: true,
4142
downloader: Downloader.Torrent,
4243
progress: 1,
44+
uri: Not(IsNull()),
4345
},
4446
});
4547

0 commit comments

Comments
 (0)