mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-03-09 15:40:26 +00:00
feat: added fields in entities to support rar decompression progress, and real debrid api token settings
This commit is contained in:
parent
6fa4c178a7
commit
3ef2f87412
5 changed files with 34 additions and 5 deletions
|
@ -34,6 +34,9 @@ export class Game {
|
||||||
@Column("text", { nullable: true })
|
@Column("text", { nullable: true })
|
||||||
executablePath: string | null;
|
executablePath: string | null;
|
||||||
|
|
||||||
|
@Column("text", { nullable: true })
|
||||||
|
rarPath: string | null;
|
||||||
|
|
||||||
@Column("int", { default: 0 })
|
@Column("int", { default: 0 })
|
||||||
playTimeInMilliseconds: number;
|
playTimeInMilliseconds: number;
|
||||||
|
|
||||||
|
@ -43,12 +46,18 @@ export class Game {
|
||||||
@Column("text", { nullable: true })
|
@Column("text", { nullable: true })
|
||||||
status: GameStatus | "";
|
status: GameStatus | "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Progress is a float between 0 and 1
|
||||||
|
*/
|
||||||
@Column("float", { default: 0 })
|
@Column("float", { default: 0 })
|
||||||
progress: number;
|
progress: number;
|
||||||
|
|
||||||
@Column("float", { default: 0 })
|
@Column("float", { default: 0 })
|
||||||
fileVerificationProgress: number;
|
fileVerificationProgress: number;
|
||||||
|
|
||||||
|
@Column("float", { default: 0 })
|
||||||
|
decompressionProgress: number;
|
||||||
|
|
||||||
@Column("int", { default: 0 })
|
@Column("int", { default: 0 })
|
||||||
bytesDownloaded: number;
|
bytesDownloaded: number;
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,9 @@ export class UserPreferences {
|
||||||
@Column("text", { default: "en" })
|
@Column("text", { default: "en" })
|
||||||
language: string;
|
language: string;
|
||||||
|
|
||||||
|
@Column("text", { nullable: true })
|
||||||
|
realDebridApiToken: string | null;
|
||||||
|
|
||||||
@Column("boolean", { default: false })
|
@Column("boolean", { default: false })
|
||||||
downloadNotificationsEnabled: boolean;
|
downloadNotificationsEnabled: boolean;
|
||||||
|
|
||||||
|
@ -32,3 +35,4 @@ export class UserPreferences {
|
||||||
@UpdateDateColumn()
|
@UpdateDateColumn()
|
||||||
updatedAt: Date;
|
updatedAt: Date;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ import {
|
||||||
import type { GameShop, TorrentProgress } from "@types";
|
import type { GameShop, TorrentProgress } from "@types";
|
||||||
import { useDate } from "./use-date";
|
import { useDate } from "./use-date";
|
||||||
import { formatBytes } from "@renderer/utils";
|
import { formatBytes } from "@renderer/utils";
|
||||||
|
import { GameStatus } from "@globals";
|
||||||
|
|
||||||
export function useDownload() {
|
export function useDownload() {
|
||||||
const { updateLibrary } = useLibrary();
|
const { updateLibrary } = useLibrary();
|
||||||
|
@ -63,9 +64,10 @@ export function useDownload() {
|
||||||
updateLibrary();
|
updateLibrary();
|
||||||
});
|
});
|
||||||
|
|
||||||
const isVerifying = ["downloading_metadata", "checking_files"].includes(
|
const isVerifying =
|
||||||
lastPacket?.game.status
|
GameStatus.DownloadingMetadata == lastPacket?.game.status ||
|
||||||
);
|
GameStatus.CheckingFiles == lastPacket?.game.status ||
|
||||||
|
GameStatus.Decompressing == lastPacket?.game.status;
|
||||||
|
|
||||||
const getETA = () => {
|
const getETA = () => {
|
||||||
if (isVerifying || !isFinite(lastPacket?.timeRemaining)) {
|
if (isVerifying || !isFinite(lastPacket?.timeRemaining)) {
|
||||||
|
@ -84,8 +86,10 @@ export function useDownload() {
|
||||||
};
|
};
|
||||||
|
|
||||||
const getProgress = () => {
|
const getProgress = () => {
|
||||||
if (lastPacket?.game.status === "checking_files") {
|
if (lastPacket?.game.status === GameStatus.CheckingFiles) {
|
||||||
return formatDownloadProgress(lastPacket?.game.fileVerificationProgress);
|
return formatDownloadProgress(lastPacket?.game.fileVerificationProgress);
|
||||||
|
} else if (lastPacket?.game.status === GameStatus.Decompressing) {
|
||||||
|
return formatDownloadProgress(lastPacket?.game.decompressionProgress);
|
||||||
}
|
}
|
||||||
|
|
||||||
return formatDownloadProgress(lastPacket?.game.progress);
|
return formatDownloadProgress(lastPacket?.game.progress);
|
||||||
|
@ -98,7 +102,7 @@ export function useDownload() {
|
||||||
dispatch(setGameDeleting(gameId));
|
dispatch(setGameDeleting(gameId));
|
||||||
return window.electron.deleteGameFolder(gameId);
|
return window.electron.deleteGameFolder(gameId);
|
||||||
})
|
})
|
||||||
.catch(() => {})
|
.catch(() => { })
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
updateLibrary();
|
updateLibrary();
|
||||||
dispatch(removeGameFromDeleting(gameId));
|
dispatch(removeGameFromDeleting(gameId));
|
||||||
|
|
|
@ -11,6 +11,7 @@ export function Settings() {
|
||||||
downloadNotificationsEnabled: false,
|
downloadNotificationsEnabled: false,
|
||||||
repackUpdatesNotificationsEnabled: false,
|
repackUpdatesNotificationsEnabled: false,
|
||||||
telemetryEnabled: false,
|
telemetryEnabled: false,
|
||||||
|
realDebridApiToken: null,
|
||||||
});
|
});
|
||||||
|
|
||||||
const { t } = useTranslation("settings");
|
const { t } = useTranslation("settings");
|
||||||
|
@ -27,6 +28,7 @@ export function Settings() {
|
||||||
repackUpdatesNotificationsEnabled:
|
repackUpdatesNotificationsEnabled:
|
||||||
userPreferences?.repackUpdatesNotificationsEnabled,
|
userPreferences?.repackUpdatesNotificationsEnabled,
|
||||||
telemetryEnabled: userPreferences?.telemetryEnabled,
|
telemetryEnabled: userPreferences?.telemetryEnabled,
|
||||||
|
realDebridApiToken: userPreferences.realDebridApiToken,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}, []);
|
}, []);
|
||||||
|
@ -107,6 +109,14 @@ export function Settings() {
|
||||||
updateUserPreferences("telemetryEnabled", !form.telemetryEnabled)
|
updateUserPreferences("telemetryEnabled", !form.telemetryEnabled)
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<TextField
|
||||||
|
label={t("real_debrid_api_token")}
|
||||||
|
value={form.realDebridApiToken ?? ""}
|
||||||
|
onChange={(event) => {
|
||||||
|
updateUserPreferences("realDebridApiToken", event.target.value);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
);
|
);
|
||||||
|
|
|
@ -84,6 +84,7 @@ export interface Game extends Omit<CatalogueEntry, "cover"> {
|
||||||
repack: GameRepack;
|
repack: GameRepack;
|
||||||
progress: number;
|
progress: number;
|
||||||
fileVerificationProgress: number;
|
fileVerificationProgress: number;
|
||||||
|
decompressionProgress: number;
|
||||||
bytesDownloaded: number;
|
bytesDownloaded: number;
|
||||||
playTimeInMilliseconds: number;
|
playTimeInMilliseconds: number;
|
||||||
executablePath: string | null;
|
executablePath: string | null;
|
||||||
|
@ -107,6 +108,7 @@ export interface UserPreferences {
|
||||||
downloadNotificationsEnabled: boolean;
|
downloadNotificationsEnabled: boolean;
|
||||||
repackUpdatesNotificationsEnabled: boolean;
|
repackUpdatesNotificationsEnabled: boolean;
|
||||||
telemetryEnabled: boolean;
|
telemetryEnabled: boolean;
|
||||||
|
realDebridApiToken: string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface HowLongToBeatCategory {
|
export interface HowLongToBeatCategory {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue