feat: adding libtorrent again

This commit is contained in:
Chubby Granny Chaser 2024-06-27 14:55:50 +01:00
parent ccd1d18981
commit e44049ff63
No known key found for this signature in database
3 changed files with 11 additions and 85 deletions

View file

@ -1,80 +0,0 @@
declare module "aria2" {
export type Aria2Status =
| "active"
| "waiting"
| "paused"
| "error"
| "complete"
| "removed";
export interface StatusResponse {
gid: string;
status: Aria2Status;
totalLength: string;
completedLength: string;
uploadLength: string;
bitfield: string;
downloadSpeed: string;
uploadSpeed: string;
infoHash?: string;
numSeeds?: string;
seeder?: boolean;
pieceLength: string;
numPieces: string;
connections: string;
errorCode?: string;
errorMessage?: string;
followedBy?: string[];
following: string;
belongsTo: string;
dir: string;
files: {
path: string;
length: string;
completedLength: string;
selected: string;
}[];
bittorrent?: {
announceList: string[][];
comment: string;
creationDate: string;
mode: "single" | "multi";
info: {
name: string;
verifiedLength: string;
verifyIntegrityPending: string;
};
};
}
export default class Aria2 {
constructor(options: any);
open: () => Promise<void>;
call(
method: "addUri",
uris: string[],
options: { dir: string }
): Promise<string>;
call(
method: "tellStatus",
gid: string,
keys?: string[]
): Promise<StatusResponse>;
call(method: "pause", gid: string): Promise<string>;
call(method: "forcePause", gid: string): Promise<string>;
call(method: "unpause", gid: string): Promise<string>;
call(method: "remove", gid: string): Promise<string>;
call(method: "forceRemove", gid: string): Promise<string>;
call(method: "pauseAll"): Promise<string>;
call(method: "forcePauseAll"): Promise<string>;
listNotifications: () => [
"onDownloadStart",
"onDownloadPause",
"onDownloadStop",
"onDownloadComplete",
"onDownloadError",
"onBtDownloadComplete",
];
on: (event: string, callback: (params: any) => void) => void;
}
}

View file

@ -9,9 +9,8 @@ import {
} from "typeorm"; } from "typeorm";
import { Repack } from "./repack.entity"; import { Repack } from "./repack.entity";
import type { GameShop } from "@types"; import type { GameShop, GameStatus } from "@types";
import { Downloader } from "@shared"; import { Downloader } from "@shared";
import type { Aria2Status } from "aria2";
import type { DownloadQueue } from "./download-queue.entity"; import type { DownloadQueue } from "./download-queue.entity";
@Entity("game") @Entity("game")
@ -47,7 +46,7 @@ export class Game {
shop: GameShop; shop: GameShop;
@Column("text", { nullable: true }) @Column("text", { nullable: true })
status: Aria2Status | null; status: GameStatus | null;
@Column("int", { default: Downloader.Torrent }) @Column("int", { default: Downloader.Torrent })
downloader: Downloader; downloader: Downloader;

View file

@ -1,6 +1,13 @@
import type { Aria2Status } from "aria2";
import type { DownloadSourceStatus, Downloader } from "@shared"; import type { DownloadSourceStatus, Downloader } from "@shared";
export type GameStatus =
| "active"
| "waiting"
| "paused"
| "error"
| "complete"
| "removed";
export type GameShop = "steam" | "epic"; export type GameShop = "steam" | "epic";
export interface SteamGenre { export interface SteamGenre {
@ -106,7 +113,7 @@ export interface Game {
id: number; id: number;
title: string; title: string;
iconUrl: string; iconUrl: string;
status: Aria2Status | null; status: GameStatus | null;
folderName: string; folderName: string;
downloadPath: string | null; downloadPath: string | null;
repacks: GameRepack[]; repacks: GameRepack[];