mirror of
https://github.com/karl0ss/homepage.git
synced 2025-05-21 21:35:18 +01:00
Enhancement: downloading torrents list for deluge (#4436)
This commit is contained in:
parent
6b2a3da7ee
commit
59ed5ed114
@ -14,4 +14,5 @@ widget:
|
|||||||
type: deluge
|
type: deluge
|
||||||
url: http://deluge.host.or.ip
|
url: http://deluge.host.or.ip
|
||||||
password: password # webui password
|
password: password # webui password
|
||||||
|
enableLeechProgress: true # optional, defaults to false
|
||||||
```
|
```
|
||||||
|
@ -402,6 +402,9 @@ export function cleanServiceGroups(groups) {
|
|||||||
mappings,
|
mappings,
|
||||||
display,
|
display,
|
||||||
|
|
||||||
|
// deluge, qbittorrent
|
||||||
|
enableLeechProgress,
|
||||||
|
|
||||||
// diskstation
|
// diskstation
|
||||||
volume,
|
volume,
|
||||||
|
|
||||||
@ -479,9 +482,6 @@ export function cleanServiceGroups(groups) {
|
|||||||
// proxmox
|
// proxmox
|
||||||
node,
|
node,
|
||||||
|
|
||||||
// qbittorrent
|
|
||||||
enableLeechProgress,
|
|
||||||
|
|
||||||
// speedtest
|
// speedtest
|
||||||
bitratePrecision,
|
bitratePrecision,
|
||||||
|
|
||||||
@ -572,6 +572,9 @@ export function cleanServiceGroups(groups) {
|
|||||||
if (allowScrolling) widget.allowScrolling = allowScrolling;
|
if (allowScrolling) widget.allowScrolling = allowScrolling;
|
||||||
if (refreshInterval) widget.refreshInterval = refreshInterval;
|
if (refreshInterval) widget.refreshInterval = refreshInterval;
|
||||||
}
|
}
|
||||||
|
if (["deluge", "qbittorrent"].includes(type)) {
|
||||||
|
if (enableLeechProgress !== undefined) widget.enableLeechProgress = JSON.parse(enableLeechProgress);
|
||||||
|
}
|
||||||
if (["opnsense", "pfsense"].includes(type)) {
|
if (["opnsense", "pfsense"].includes(type)) {
|
||||||
if (wan) widget.wan = wan;
|
if (wan) widget.wan = wan;
|
||||||
}
|
}
|
||||||
@ -674,9 +677,6 @@ export function cleanServiceGroups(groups) {
|
|||||||
if (type === "spoolman") {
|
if (type === "spoolman") {
|
||||||
if (spoolIds !== undefined) widget.spoolIds = spoolIds;
|
if (spoolIds !== undefined) widget.spoolIds = spoolIds;
|
||||||
}
|
}
|
||||||
if (type === "qbittorrent") {
|
|
||||||
if (enableLeechProgress !== undefined) widget.enableLeechProgress = JSON.parse(enableLeechProgress);
|
|
||||||
}
|
|
||||||
return widget;
|
return widget;
|
||||||
});
|
});
|
||||||
return cleanedService;
|
return cleanedService;
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
import { useTranslation } from "next-i18next";
|
import { useTranslation } from "next-i18next";
|
||||||
|
|
||||||
|
import QueueEntry from "../../components/widgets/queue/queueEntry";
|
||||||
|
|
||||||
import Container from "components/services/widget/container";
|
import Container from "components/services/widget/container";
|
||||||
import Block from "components/services/widget/block";
|
import Block from "components/services/widget/block";
|
||||||
import useWidgetAPI from "utils/proxy/use-widget-api";
|
import useWidgetAPI from "utils/proxy/use-widget-api";
|
||||||
@ -32,21 +34,38 @@ export default function Component({ service }) {
|
|||||||
let rateDl = 0;
|
let rateDl = 0;
|
||||||
let rateUl = 0;
|
let rateUl = 0;
|
||||||
let completed = 0;
|
let completed = 0;
|
||||||
|
const leechTorrents = [];
|
||||||
|
|
||||||
for (let i = 0; i < keys.length; i += 1) {
|
for (let i = 0; i < keys.length; i += 1) {
|
||||||
const torrent = torrents[keys[i]];
|
const torrent = torrents[keys[i]];
|
||||||
rateDl += torrent.download_payload_rate;
|
rateDl += torrent.download_payload_rate;
|
||||||
rateUl += torrent.upload_payload_rate;
|
rateUl += torrent.upload_payload_rate;
|
||||||
completed += torrent.total_remaining === 0 ? 1 : 0;
|
completed += torrent.total_remaining === 0 ? 1 : 0;
|
||||||
|
if (torrent.state === "Downloading") {
|
||||||
|
leechTorrents.push(torrent);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const leech = keys.length - completed || 0;
|
const leech = keys.length - completed || 0;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Container service={service}>
|
<>
|
||||||
<Block label="deluge.leech" value={t("common.number", { value: leech })} />
|
<Container service={service}>
|
||||||
<Block label="deluge.download" value={t("common.byterate", { value: rateDl })} />
|
<Block label="deluge.leech" value={t("common.number", { value: leech })} />
|
||||||
<Block label="deluge.seed" value={t("common.number", { value: completed })} />
|
<Block label="deluge.download" value={t("common.byterate", { value: rateDl })} />
|
||||||
<Block label="deluge.upload" value={t("common.byterate", { value: rateUl })} />
|
<Block label="deluge.seed" value={t("common.number", { value: completed })} />
|
||||||
</Container>
|
<Block label="deluge.upload" value={t("common.byterate", { value: rateUl })} />
|
||||||
|
</Container>
|
||||||
|
{widget?.enableLeechProgress &&
|
||||||
|
leechTorrents.map((queueEntry) => (
|
||||||
|
<QueueEntry
|
||||||
|
progress={queueEntry.progress}
|
||||||
|
timeLeft={t("common.duration", { value: queueEntry.eta })}
|
||||||
|
title={queueEntry.name}
|
||||||
|
activity={queueEntry.state}
|
||||||
|
key={`${queueEntry.name}-${queueEntry.total_remaining}`}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@ const dataParams = [
|
|||||||
"download_payload_rate",
|
"download_payload_rate",
|
||||||
"upload_payload_rate",
|
"upload_payload_rate",
|
||||||
"total_remaining",
|
"total_remaining",
|
||||||
|
"eta",
|
||||||
],
|
],
|
||||||
{},
|
{},
|
||||||
];
|
];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user