mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-06-13 01:10:22 +01:00
fix(review): address second CodeRabbit pass
- streamystats: derive toggle enablement from the same effective URL the input renders (locked admin URL no longer disables every switch) - FilterSheet: use the deep-equality rule for toggling that rendering already uses — option objects are recreated across renders - DownloadCard: take t from useTranslation so badge labels re-render on language change - fileOperations: count trickplay bytes in the storage total, matching the per-item size model - PendingAccountSaveModal: warn instead of silently swallowing a failed account save
This commit is contained in:
@@ -97,6 +97,9 @@ export function getDownloadedItemSize(id: string): number {
|
||||
export function calculateTotalDownloadedSize(): number {
|
||||
const items = getAllDownloadedItems();
|
||||
return items.reduce((sum, item) => {
|
||||
// Trickplay bytes count too — getDownloadedItemSize models per-item size
|
||||
// as video + trickplay, the total must match.
|
||||
const trickplaySize = item.trickPlayData?.size ?? 0;
|
||||
// Read the live file size on disk so the total reflects actual usage and
|
||||
// self-heals items whose stored videoFileSize is 0 (old schema, or
|
||||
// `fileInfo.size` was undefined at download time). Fall back to the stored
|
||||
@@ -105,12 +108,12 @@ export function calculateTotalDownloadedSize(): number {
|
||||
try {
|
||||
const file = new File(filePathToUri(item.videoFilePath));
|
||||
if (file.exists) {
|
||||
return sum + (file.size ?? item.videoFileSize ?? 0);
|
||||
return sum + (file.size ?? item.videoFileSize ?? 0) + trickplaySize;
|
||||
}
|
||||
} catch (error) {
|
||||
console.warn("Failed to stat downloaded file for size:", error);
|
||||
}
|
||||
}
|
||||
return sum + (item.videoFileSize ?? 0);
|
||||
return sum + (item.videoFileSize ?? 0) + trickplaySize;
|
||||
}, 0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user