mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-29 05:41:03 +00:00
Compare commits
4 Commits
v3.4.0
...
fix/fixing
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fc4043c2c4 | ||
|
|
97cf02577a | ||
|
|
fbce53d61a | ||
|
|
1835adf8b4 |
@@ -11,11 +11,24 @@ class HttpDownloader:
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
def start_download(self, url: str, save_path: str, header: str, out: str = None):
|
def start_download(self, url: str, save_path: str, header: str, out: str = None, allow_multiple_connections: bool = False):
|
||||||
if self.download:
|
if self.download:
|
||||||
self.aria2.resume([self.download])
|
self.aria2.resume([self.download])
|
||||||
else:
|
else:
|
||||||
downloads = self.aria2.add(url, options={"header": header, "dir": save_path, "out": out})
|
options = {
|
||||||
|
"header": header,
|
||||||
|
"dir": save_path,
|
||||||
|
"out": out
|
||||||
|
}
|
||||||
|
|
||||||
|
if allow_multiple_connections:
|
||||||
|
options.update({
|
||||||
|
"split": "16",
|
||||||
|
"max-connection-per-server": "16",
|
||||||
|
"min-split-size": "1M"
|
||||||
|
})
|
||||||
|
|
||||||
|
downloads = self.aria2.add(url, options=options)
|
||||||
|
|
||||||
self.download = downloads[0]
|
self.download = downloads[0]
|
||||||
|
|
||||||
|
|||||||
@@ -147,11 +147,11 @@ def action():
|
|||||||
torrent_downloader.start_download(url, data['save_path'])
|
torrent_downloader.start_download(url, data['save_path'])
|
||||||
else:
|
else:
|
||||||
if existing_downloader and isinstance(existing_downloader, HttpDownloader):
|
if existing_downloader and isinstance(existing_downloader, HttpDownloader):
|
||||||
existing_downloader.start_download(url, data['save_path'], data.get('header'), data.get('out'))
|
existing_downloader.start_download(url, data['save_path'], data.get('header'), data.get('out'), data.get('allow_multiple_connections', False))
|
||||||
else:
|
else:
|
||||||
http_downloader = HttpDownloader()
|
http_downloader = HttpDownloader()
|
||||||
downloads[game_id] = http_downloader
|
downloads[game_id] = http_downloader
|
||||||
http_downloader.start_download(url, data['save_path'], data.get('header'), data.get('out'))
|
http_downloader.start_download(url, data['save_path'], data.get('header'), data.get('out'), data.get('allow_multiple_connections', False))
|
||||||
|
|
||||||
downloading_game_id = game_id
|
downloading_game_id = game_id
|
||||||
|
|
||||||
|
|||||||
@@ -123,3 +123,14 @@ const copyAria2 = () => {
|
|||||||
|
|
||||||
copyAria2();
|
copyAria2();
|
||||||
downloadLudusavi();
|
downloadLudusavi();
|
||||||
|
|
||||||
|
if (process.platform !== "win32") {
|
||||||
|
const binariesPath = path.join(__dirname, "..", "binaries");
|
||||||
|
|
||||||
|
if (fs.existsSync(binariesPath)) {
|
||||||
|
const zzzPath = path.join(binariesPath, "7zz");
|
||||||
|
const zzzsPath = path.join(binariesPath, "7zzs");
|
||||||
|
if (fs.existsSync(zzzPath)) fs.chmodSync(zzzPath, 0o755);
|
||||||
|
if (fs.existsSync(zzzsPath)) fs.chmodSync(zzzsPath, 0o755);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -50,8 +50,6 @@ export class SevenZip {
|
|||||||
});
|
});
|
||||||
|
|
||||||
child.once("exit", (code) => {
|
child.once("exit", (code) => {
|
||||||
console.log("EXIT CALLED", code, filePath);
|
|
||||||
|
|
||||||
if (code === 0) {
|
if (code === 0) {
|
||||||
successCb();
|
successCb();
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -16,12 +16,6 @@ export class Aria2 {
|
|||||||
"--rpc-listen-all",
|
"--rpc-listen-all",
|
||||||
"--file-allocation=none",
|
"--file-allocation=none",
|
||||||
"--allow-overwrite=true",
|
"--allow-overwrite=true",
|
||||||
"-s",
|
|
||||||
"16",
|
|
||||||
"-x",
|
|
||||||
"16",
|
|
||||||
"-k",
|
|
||||||
"1M",
|
|
||||||
],
|
],
|
||||||
{ stdio: "inherit", windowsHide: true }
|
{ stdio: "inherit", windowsHide: true }
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -371,6 +371,7 @@ export class DownloadManager {
|
|||||||
game_id: downloadId,
|
game_id: downloadId,
|
||||||
url: downloadUrl,
|
url: downloadUrl,
|
||||||
save_path: download.downloadPath,
|
save_path: download.downloadPath,
|
||||||
|
allow_multiple_connections: true,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
case Downloader.TorBox: {
|
case Downloader.TorBox: {
|
||||||
@@ -383,6 +384,7 @@ export class DownloadManager {
|
|||||||
url,
|
url,
|
||||||
save_path: download.downloadPath,
|
save_path: download.downloadPath,
|
||||||
out: name,
|
out: name,
|
||||||
|
allow_multiple_connections: true,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user