Skip to content

Commit

Permalink
fix: seeding causing python process to crash
Browse files Browse the repository at this point in the history
  • Loading branch information
zamitto committed Dec 24, 2024
1 parent e1a1136 commit 89bfb51
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hydralauncher",
"version": "3.1.1",
"version": "3.1.2",
"description": "Hydra",
"main": "./out/main/index.js",
"author": "Los Broxas",
Expand Down
15 changes: 12 additions & 3 deletions python_rpc/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,27 @@
if initial_download['url'].startswith('magnet'):
torrent_downloader = TorrentDownloader(torrent_session)
downloads[initial_download['game_id']] = torrent_downloader
torrent_downloader.start_download(initial_download['url'], initial_download['save_path'], "")
try:
torrent_downloader.start_download(initial_download['url'], initial_download['save_path'], "")
except Exception as e:
print("Error starting torrent download", e)
else:
http_downloader = HttpDownloader()
downloads[initial_download['game_id']] = http_downloader
http_downloader.start_download(initial_download['url'], initial_download['save_path'], initial_download.get('header'))
try:
http_downloader.start_download(initial_download['url'], initial_download['save_path'], initial_download.get('header'))
except Exception as e:
print("Error starting http download", e)

if start_seeding_payload:
initial_seeding = json.loads(urllib.parse.unquote(start_seeding_payload))
for seed in initial_seeding:
torrent_downloader = TorrentDownloader(torrent_session, lt.torrent_flags.upload_mode)
downloads[seed['game_id']] = torrent_downloader
torrent_downloader.start_download(seed['url'], seed['save_path'], "")
try:
torrent_downloader.start_download(seed['url'], seed['save_path'], "")
except Exception as e:
print("Error starting seeding", e)

def validate_rpc_password():
"""Middleware to validate RPC password."""
Expand Down
2 changes: 2 additions & 0 deletions src/main/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { HydraApi } from "./services/hydra-api";
import { uploadGamesBatch } from "./services/library-sync";
import { Aria2 } from "./services/aria2";
import { Downloader } from "@shared";
import { IsNull, Not } from "typeorm";

const loadState = async (userPreferences: UserPreferences | null) => {
import("./events");
Expand Down Expand Up @@ -40,6 +41,7 @@ const loadState = async (userPreferences: UserPreferences | null) => {
shouldSeed: true,
downloader: Downloader.Torrent,
progress: 1,
uri: Not(IsNull()),
},
});

Expand Down

0 comments on commit 89bfb51

Please sign in to comment.