fix(transmission): total download incorrect for cross seeded torrents (#3211)
This commit is contained in:
@@ -46,6 +46,7 @@ export class TransmissionIntegration extends Integration implements IDownloadCli
|
|||||||
name: torrent.name,
|
name: torrent.name,
|
||||||
size: torrent.totalSize,
|
size: torrent.totalSize,
|
||||||
sent: torrent.uploadedEver,
|
sent: torrent.uploadedEver,
|
||||||
|
received: torrent.downloadedEver,
|
||||||
downSpeed: torrent.percentDone !== 1 ? torrent.rateDownload : undefined,
|
downSpeed: torrent.percentDone !== 1 ? torrent.rateDownload : undefined,
|
||||||
upSpeed: torrent.rateUpload,
|
upSpeed: torrent.rateUpload,
|
||||||
time:
|
time:
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ export const downloadClientItemSchema = z.object({
|
|||||||
size: z.number(),
|
size: z.number(),
|
||||||
/** Total uploaded in Bytes, only required for Torrent items */
|
/** Total uploaded in Bytes, only required for Torrent items */
|
||||||
sent: z.number().optional(),
|
sent: z.number().optional(),
|
||||||
|
/** Total downloaded in Bytes, only required for Torrent items */
|
||||||
|
received: z.number().optional(),
|
||||||
/** Download speed in Bytes/s, only required if not complete
|
/** Download speed in Bytes/s, only required if not complete
|
||||||
* (Says 0 only if it should be downloading but isn't) */
|
* (Says 0 only if it should be downloading but isn't) */
|
||||||
downSpeed: z.number().optional(),
|
downSpeed: z.number().optional(),
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ import {
|
|||||||
IconX,
|
IconX,
|
||||||
} from "@tabler/icons-react";
|
} from "@tabler/icons-react";
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
|
import relativeTime from "dayjs/plugin/relativeTime";
|
||||||
import type { MRT_ColumnDef, MRT_VisibilityState } from "mantine-react-table";
|
import type { MRT_ColumnDef, MRT_VisibilityState } from "mantine-react-table";
|
||||||
import { MantineReactTable, useMantineReactTable } from "mantine-react-table";
|
import { MantineReactTable, useMantineReactTable } from "mantine-react-table";
|
||||||
|
|
||||||
@@ -48,6 +49,8 @@ import { useScopedI18n } from "@homarr/translation/client";
|
|||||||
|
|
||||||
import type { WidgetComponentProps } from "../definition";
|
import type { WidgetComponentProps } from "../definition";
|
||||||
|
|
||||||
|
dayjs.extend(relativeTime);
|
||||||
|
|
||||||
interface QuickFilter {
|
interface QuickFilter {
|
||||||
integrationKinds: string[];
|
integrationKinds: string[];
|
||||||
statuses: ExtendedDownloadClientItem["state"][];
|
statuses: ExtendedDownloadClientItem["state"][];
|
||||||
@@ -188,14 +191,14 @@ export default function DownloadClientsWidget({
|
|||||||
)
|
)
|
||||||
//Add extrapolated data and actions if user is allowed interaction
|
//Add extrapolated data and actions if user is allowed interaction
|
||||||
.map((item): ExtendedDownloadClientItem => {
|
.map((item): ExtendedDownloadClientItem => {
|
||||||
const received = Math.floor(item.size * item.progress);
|
const received = item.received ?? Math.floor(item.size * item.progress);
|
||||||
const integrationIds = [pair.integration.id];
|
const integrationIds = [pair.integration.id];
|
||||||
return {
|
return {
|
||||||
integration: pair.integration,
|
integration: pair.integration,
|
||||||
...item,
|
...item,
|
||||||
category: item.category !== undefined && item.category.length > 0 ? item.category : undefined,
|
category: item.category !== undefined && item.category.length > 0 ? item.category : undefined,
|
||||||
received,
|
received,
|
||||||
ratio: item.sent !== undefined ? item.sent / (received || 1) : undefined,
|
ratio: item.sent !== undefined ? item.sent / item.size : undefined,
|
||||||
//Only add if permission to use mutations
|
//Only add if permission to use mutations
|
||||||
actions: integrationsWithInteractions.includes(pair.integration.id)
|
actions: integrationsWithInteractions.includes(pair.integration.id)
|
||||||
? {
|
? {
|
||||||
@@ -714,7 +717,10 @@ const ItemInfoModal = ({ items, currentIndex, opened, onClose }: ItemInfoModalPr
|
|||||||
/>
|
/>
|
||||||
{item.type !== "miscellaneous" && <NormalizedLine itemKey="ratio" values={item.ratio} />}
|
{item.type !== "miscellaneous" && <NormalizedLine itemKey="ratio" values={item.ratio} />}
|
||||||
<NormalizedLine itemKey="added" values={item.added === undefined ? "unknown" : dayjs(item.added).format()} />
|
<NormalizedLine itemKey="added" values={item.added === undefined ? "unknown" : dayjs(item.added).format()} />
|
||||||
<NormalizedLine itemKey="time" values={item.time !== 0 ? dayjs().add(item.time).format() : "∞"} />
|
<NormalizedLine
|
||||||
|
itemKey="time"
|
||||||
|
values={item.time !== 0 ? dayjs().add(item.time, "milliseconds").fromNow() : "∞"}
|
||||||
|
/>
|
||||||
<NormalizedLine itemKey="category" values={item.category} />
|
<NormalizedLine itemKey="category" values={item.category} />
|
||||||
</Stack>
|
</Stack>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Reference in New Issue
Block a user