fix: added the @globals back and removed some merge leftovers

This commit is contained in:
lilezek 2024-04-30 11:09:29 +02:00
parent c8fe984171
commit 6d36db5446
8 changed files with 535 additions and 367 deletions

View file

@ -10,17 +10,17 @@ export enum GameStatus {
}
export namespace GameStatus {
export const isDownloading = (status: GameStatus | "") =>
export const isDownloading = (status: GameStatus | null) =>
status === GameStatus.Downloading ||
status === GameStatus.DownloadingMetadata ||
status === GameStatus.CheckingFiles;
export const isVerifying = (status: GameStatus | "") =>
export const isVerifying = (status: GameStatus | null) =>
GameStatus.DownloadingMetadata == status ||
GameStatus.CheckingFiles == status ||
GameStatus.Decompressing == status;
export const isReady = (status: GameStatus | "") =>
export const isReady = (status: GameStatus | null) =>
status === GameStatus.Finished ||
status === GameStatus.Seeding;
}

View file

@ -1,5 +1,5 @@
import { stateManager } from "./state-manager";
import { GameStatus, repackers } from "./constants";
import { repackers } from "./constants";
import {
getNewGOGGames,
getNewRepacksFromCPG,
@ -17,11 +17,13 @@ import {
steamGameRepository,
userPreferencesRepository,
} from "./repository";
import { TorrentClient } from "./services/torrent-client";
import { TorrentClient } from "./services/donwloaders/torrent-client";
import { Repack } from "./entity";
import { Notification } from "electron";
import { t } from "i18next";
import { In } from "typeorm";
import { Downloader } from "./services/donwloaders/downloader";
import { GameStatus } from "@globals";
startProcessWatcher();
@ -40,12 +42,7 @@ Promise.all([writePipe.createPipe(), readPipe.createPipe()]).then(async () => {
});
if (game) {
writePipe.write({
action: "start",
game_id: game.id,
magnet: game.repack.magnet,
save_path: game.downloadPath,
});
Downloader.downloadGame(game, game.repack);
}
readPipe.socket?.on("data", (data) => {
@ -126,4 +123,4 @@ const loadState = async () => {
import("./events");
};
loadState().then(() => checkForNewRepacks());
loadState().then(() => checkForNewRepacks());

View file

@ -90,7 +90,7 @@ export class TorrentClient {
return GameStatus.DownloadingMetadata;
if (state === TorrentState.Finished) return GameStatus.Finished;
if (state === TorrentState.Seeding) return GameStatus.Seeding;
return "";
return null;
}
public static async onSocketData(data: Buffer) {

View file

@ -7,7 +7,6 @@ export class Unrar {
private constructor(private extractor: Extractor<Uint8Array>) { }
static async fromFilePath(filePath: string, targetFolder: string) {
console.log(filePath, targetFolder);
const extractor = await createExtractorFromFile({
filepath: filePath,
targetPath: targetFolder,

View file

@ -77,7 +77,7 @@ export interface Game extends Omit<CatalogueEntry, "cover"> {
id: number;
title: string;
iconUrl: string;
status: GameStatus | "";
status: GameStatus | null;
folderName: string;
downloadPath: string | null;
repacks: GameRepack[];