diff --git a/server/torrent-clients/index.ts b/server/torrent-clients/index.ts index 01cfa0e..18c5d8d 100644 --- a/server/torrent-clients/index.ts +++ b/server/torrent-clients/index.ts @@ -41,7 +41,10 @@ export interface TorrentInfo { progress : number size : number downloaded: number + uploaded : number + ratio : number speed : number + upspeed : number eta : number save_path : string category : string diff --git a/server/torrent-clients/qbittorrent.ts b/server/torrent-clients/qbittorrent.ts index 4052d35..2395d86 100644 --- a/server/torrent-clients/qbittorrent.ts +++ b/server/torrent-clients/qbittorrent.ts @@ -93,7 +93,10 @@ const QB: TorrentClientDriver = { progress : Math.round(t.progress * 100), size : t.size, downloaded: t.downloaded, + uploaded : t.uploaded ?? 0, + ratio : Math.round((t.ratio ?? 0) * 100) / 100, speed : t.dlspeed, + upspeed : t.upspeed ?? 0, eta : t.eta ?? -1, save_path : t.save_path, category : t.category ?? '', diff --git a/server/torrent-clients/rtorrent.ts b/server/torrent-clients/rtorrent.ts index 68b3aea..e7cba3d 100644 --- a/server/torrent-clients/rtorrent.ts +++ b/server/torrent-clients/rtorrent.ts @@ -178,11 +178,13 @@ const RT: TorrentClientDriver = { 'd.complete', 'd.size_bytes', 'd.bytes_done', + 'd.up.total', // total uploadé + 'd.ratio', // ratio x1000 'd.down.rate', + 'd.up.rate', 'd.left_bytes', - 'd.down.rate', 'd.directory', - 'd.custom1', // label rTorrent + 'd.custom1', ] const rows = await d_multicall(config, 'main', methods) @@ -190,10 +192,11 @@ const RT: TorrentClientDriver = { return rows .map(r => { const [hash, name, isOpen, isActive, isChecking, isComplete, - size, downloaded, speed, leftBytes, , directory, label] = r + size, downloaded, uploadedTotal, ratioRaw, + dlSpeed, ulSpeed, leftBytes, directory, label] = r const progress = size > 0 ? Math.min(100, Math.round(((size - leftBytes) / size) * 100)) : 0 - const eta = speed > 0 && leftBytes > 0 ? Math.round(leftBytes / speed) : -1 + const eta = Number(dlSpeed) > 0 && Number(leftBytes) > 0 ? Math.round(Number(leftBytes) / Number(dlSpeed)) : -1 return { hash : String(hash).toLowerCase(), @@ -202,7 +205,10 @@ const RT: TorrentClientDriver = { progress, size : Number(size), downloaded: Number(downloaded), - speed : Number(speed), + uploaded : Number(uploadedTotal ?? 0), + ratio : Math.round((Number(ratioRaw ?? 0) / 1000) * 100) / 100, + speed : Number(dlSpeed), + upspeed : Number(ulSpeed ?? 0), eta, save_path : String(directory), category : String(label ?? ''), diff --git a/server/torrent-clients/synology-ds.ts b/server/torrent-clients/synology-ds.ts index 0178925..bd03690 100644 --- a/server/torrent-clients/synology-ds.ts +++ b/server/torrent-clients/synology-ds.ts @@ -108,11 +108,6 @@ const DS: TorrentClientDriver = { const tasks: any[] = data?.tasks ?? [] return tasks - .filter(t => { - if (!category) return true - // Synology n'a pas de labels natifs — on filtre par destination si elle contient la catégorie - return (t.additional?.detail?.destination as string)?.includes(String(category)) - }) .map(t => { const transfer = t.additional?.transfer ?? {} const size = t.size ?? 0 @@ -124,10 +119,13 @@ const DS: TorrentClientDriver = { progress : size > 0 ? Math.min(100, Math.round((dl / size) * 100)) : 0, size, downloaded: dl, + uploaded : transfer.size_uploaded ?? 0, + ratio : size > 0 ? Math.round(((transfer.size_uploaded ?? 0) / size) * 100) / 100 : 0, speed : transfer.speed_download ?? 0, + upspeed : transfer.speed_upload ?? 0, eta : -1, save_path : t.additional?.detail?.destination ?? '', - category : '', + category : category ?? '', } satisfies TorrentInfo }) }, diff --git a/server/torrent-clients/transmission.ts b/server/torrent-clients/transmission.ts index 89e2c8b..c2273ed 100644 --- a/server/torrent-clients/transmission.ts +++ b/server/torrent-clients/transmission.ts @@ -94,7 +94,8 @@ const TR: TorrentClientDriver = { async list(config, category) { const fields = [ 'hashString', 'name', 'status', 'percentDone', 'totalSize', - 'downloadedEver', 'rateDownload', 'eta', 'downloadDir', 'labels', + 'downloadedEver', 'uploadedEver', 'uploadRatio', + 'rateDownload', 'rateUpload', 'eta', 'downloadDir', 'labels', ] const data = await trRequest(config, 'torrent-get', { fields }) const torrents: any[] = data.arguments?.torrents ?? [] @@ -111,7 +112,10 @@ const TR: TorrentClientDriver = { progress : Math.round(t.percentDone * 100), size : t.totalSize, downloaded: t.downloadedEver, + uploaded : t.uploadedEver ?? 0, + ratio : Math.round((t.uploadRatio ?? 0) * 100) / 100, speed : t.rateDownload, + upspeed : t.rateUpload ?? 0, eta : t.eta ?? -1, save_path : t.downloadDir, category : t.labels?.[0] ?? '', diff --git a/server/torrent-clients/utorrent.ts b/server/torrent-clients/utorrent.ts index 3437bc8..a345185 100644 --- a/server/torrent-clients/utorrent.ts +++ b/server/torrent-clients/utorrent.ts @@ -62,7 +62,7 @@ function mapTorrent(t: any[]): TorrentInfo { // [hash, status, name, size, progress, downloaded, uploaded, ratio, // ul_speed, dl_speed, eta, label, peers_connected, peers_swarm, // seeds_connected, seeds_swarm, availability, queue_order, remaining] - const [hash, status, name, size, progress, downloaded, , , , dlSpeed, eta, label] = t + const [hash, status, name, size, progress, downloaded, uploaded, ratio, ulSpeed, dlSpeed, eta, label] = t return { hash : hash.toLowerCase(), name, @@ -70,9 +70,12 @@ function mapTorrent(t: any[]): TorrentInfo { progress : Math.min(100, Math.round(progress / 10)), size, downloaded, + uploaded : uploaded ?? 0, + ratio : Math.round(((ratio ?? 0) / 1000) * 100) / 100, // uTorrent ratio est x1000 speed : dlSpeed ?? 0, + upspeed : ulSpeed ?? 0, eta : eta ?? -1, - save_path : '', // récupéré séparément via torrent properties si besoin + save_path : '', category : label ?? '', } } diff --git a/src/views/DownloadsView.vue b/src/views/DownloadsView.vue index 7ed14ca..b9ec283 100644 --- a/src/views/DownloadsView.vue +++ b/src/views/DownloadsView.vue @@ -39,7 +39,7 @@ - +
Colonnes affichées
+ +{{ clampedProgress(t) }}%
-{{ formatSize(t.downloaded) }} / {{ formatSize(t.size) }}
+{{ formatSize(t.downloaded) }} / {{ formatSize(t.size) }}