Skip to content

Commit 8f756d4

Browse files
authored
Enhancement: Add size of torrent(s) in leechProgress list to qbittorrent widget (#5803)
1 parent 02089a3 commit 8f756d4

File tree

4 files changed

+10
-1
lines changed

4 files changed

+10
-1
lines changed

docs/widgets/services/qbittorrent.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ widget:
1616
username: username
1717
password: password
1818
enableLeechProgress: true # optional, defaults to false
19+
enableLeechSize: true # optional, defaults to false
1920
```

src/components/widgets/queue/queueEntry.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export default function QueueEntry({ title, activity, timeLeft, progress }) {
1+
export default function QueueEntry({ title, activity, timeLeft, progress, size }) {
22
return (
33
<div className="text-theme-700 dark:text-theme-200 relative h-5 rounded-md bg-theme-200/50 dark:bg-theme-900/20 m-1 px-1 flex">
44
<div
@@ -11,6 +11,7 @@ export default function QueueEntry({ title, activity, timeLeft, progress }) {
1111
<div className="absolute w-full whitespace-nowrap text-ellipsis overflow-hidden text-left">{title}</div>
1212
</div>
1313
<div className="self-center text-xs flex justify-end mr-1.5 pl-1 z-10 text-ellipsis overflow-hidden whitespace-nowrap">
14+
{size && `${size} - `}
1415
{timeLeft ? `${activity} - ${timeLeft}` : activity}
1516
</div>
1617
</div>

src/utils/config/service-helpers.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@ export function cleanServiceGroups(groups) {
284284

285285
// deluge, qbittorrent
286286
enableLeechProgress,
287+
enableLeechSize,
287288

288289
// diskstation
289290
volume,
@@ -493,6 +494,7 @@ export function cleanServiceGroups(groups) {
493494
}
494495
if (["deluge", "qbittorrent"].includes(type)) {
495496
if (enableLeechProgress !== undefined) widget.enableLeechProgress = JSON.parse(enableLeechProgress);
497+
if (enableLeechSize !== undefined) widget.enableLeechSize = JSON.parse(enableLeechSize);
496498
}
497499
if (["opnsense", "pfsense"].includes(type)) {
498500
if (wan) widget.wan = wan;

src/widgets/qbittorrent/component.jsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,11 @@ export default function Component({ service }) {
8080
timeLeft={t("common.duration", { value: queueEntry.eta })}
8181
title={queueEntry.name}
8282
activity={queueEntry.state}
83+
size={
84+
widget?.enableLeechSize
85+
? t("common.bbytes", { value: queueEntry.size, maximumFractionDigits: 1 })
86+
: undefined
87+
}
8388
key={`${queueEntry.name}-${queueEntry.amount_left}`}
8489
/>
8590
))}

0 commit comments

Comments
 (0)