fix: add back speed to normal downloads

This commit is contained in:
Fredrik Burmester
2024-09-29 12:03:37 +02:00
parent b6c6bac06a
commit 31dbd84bec
3 changed files with 12 additions and 2 deletions

View File

@@ -82,8 +82,15 @@ export const ActiveDownloads: React.FC<Props> = ({ ...props }) => {
<View>
<Text className="font-semibold">{p.item.Name}</Text>
<Text className="text-xs opacity-50">{p.item.Type}</Text>
<View className="flex flex-row items-center space-x-2 mt-1 text-purple-600">
<Text className="text-xs">{p.progress.toFixed(0)}%</Text>
<View className="flex flex-row items-center space-x-4">
<View className="flex flex-row items-center space-x-2 mt-1 text-purple-600">
<Text className="text-xs">{p.progress.toFixed(0)}%</Text>
</View>
{p.speed && (
<View className="flex flex-row items-center space-x-2 mt-1 text-purple-600">
<Text className="text-xs">{p.speed.toFixed(2)}%</Text>
</View>
)}
</View>
<View className="flex flex-row items-center space-x-2 mt-1 text-purple-600">
<Text className="text-xs capitalize">{p.state}</Text>

View File

@@ -65,6 +65,7 @@ export const useRemuxHlsToMp4 = (item: BaseItemDto) => {
const fps = item.MediaStreams?.[0]?.RealFrameRate || 25;
const totalFrames = videoLength * fps;
const processedFrames = statistics.getVideoFrameNumber();
const speed = statistics.getSpeed();
const percentage =
totalFrames > 0
@@ -74,6 +75,7 @@ export const useRemuxHlsToMp4 = (item: BaseItemDto) => {
if (!item.Id) throw new Error("Item is undefined");
updateProcess(item.Id, {
progress: percentage,
speed: Math.max(speed, 0),
});
});

View File

@@ -30,6 +30,7 @@ export type ProcessItem = {
item: Partial<BaseItemDto>;
progress: number;
size?: number;
speed?: number;
state:
| "optimizing"
| "downloading"