| 1 | /** Field names follow the qBittorrent WebUI API v2 so the real adapter passes them through. */ |
| 2 | export type TorrentState = |
| 3 | | "error" | "missingFiles" | "uploading" | "stoppedUP" | "queuedUP" | "stalledUP" | "checkingUP" | "forcedUP" |
| 4 | | "allocating" | "downloading" | "metaDL" | "forcedMetaDL" | "stoppedDL" | "queuedDL" | "stalledDL" |
| 5 | | "checkingDL" | "forcedDL" | "checkingResumeData" | "moving" | "unknown"; |
| 6 | |
| 7 | export interface Torrent { |
| 8 | hash: string; |
| 9 | name: string; |
| 10 | size: number; |
| 11 | progress: number; |
| 12 | dlspeed: number; |
| 13 | upspeed: number; |
| 14 | /** Seconds; {@link import("./model.ts").UNKNOWN_ETA} when unknown. */ |
| 15 | eta: number; |
| 16 | ratio: number; |
| 17 | state: TorrentState; |
| 18 | category: string; |
| 19 | added_on: number; |
| 20 | /** Queue position; -1 when seeding or queueing is off. */ |
| 21 | priority: number; |
| 22 | uploaded: number; |
| 23 | /** Seeders and leechers connected, and in the whole swarm. */ |
| 24 | num_seeds: number; |
| 25 | num_complete: number; |
| 26 | num_leechs: number; |
| 27 | num_incomplete: number; |
| 28 | magnet_uri: string; |
| 29 | save_path: string; |
| 30 | /** The torrent's top folder; empty for a single-file torrent. */ |
| 31 | root_path: string; |
| 32 | } |
| 33 | |
| 34 | export interface TorrentFile { |
| 35 | name: string; |
| 36 | size: number; |
| 37 | progress: number; |
| 38 | } |
| 39 | |
| 40 | export interface ServerState { |
| 41 | dl_info_speed: number; |
| 42 | up_info_speed: number; |
| 43 | alltime_dl: number; |
| 44 | alltime_ul: number; |
| 45 | global_ratio: string; |
| 46 | free_space_on_disk: number; |
| 47 | connection_status: "connected" | "firewalled" | "disconnected"; |
| 48 | save_path: string; |
| 49 | listen_port: number; |
| 50 | current_network_interface: string; |
| 51 | } |
| 52 | |
| 53 | export const TORRENT_ACTIONS = ["stop", "start", "topPrio", "increasePrio", "decreasePrio", "bottomPrio"] as const; |