diff --git a/src/N_m3u8DL-RE.Common/N_m3u8DL-RE.Common.csproj b/src/N_m3u8DL-RE.Common/N_m3u8DL-RE.Common.csproj
index 0007c36..f2b1cf2 100644
--- a/src/N_m3u8DL-RE.Common/N_m3u8DL-RE.Common.csproj
+++ b/src/N_m3u8DL-RE.Common/N_m3u8DL-RE.Common.csproj
@@ -10,7 +10,7 @@
-
+
diff --git a/src/N_m3u8DL-RE/Column/DownloadSpeedColumn.cs b/src/N_m3u8DL-RE/Column/DownloadSpeedColumn.cs
index 45238c1..cc0f522 100644
--- a/src/N_m3u8DL-RE/Column/DownloadSpeedColumn.cs
+++ b/src/N_m3u8DL-RE/Column/DownloadSpeedColumn.cs
@@ -15,7 +15,6 @@ namespace N_m3u8DL_RE.Column
{
private long _stopSpeed = 0;
private ConcurrentDictionary DateTimeStringDic = new();
- private ConcurrentDictionary SpeedDic = new();
protected override bool NoWrap => true;
private ConcurrentDictionary SpeedContainerDic { get; set; }
@@ -26,7 +25,7 @@ namespace N_m3u8DL_RE.Column
public Style MyStyle { get; set; } = new Style(foreground: Color.Green);
- public override IRenderable Render(RenderContext context, ProgressTask task, TimeSpan deltaTime)
+ public override IRenderable Render(RenderOptions options, ProgressTask task, TimeSpan deltaTime)
{
var taskId = task.Id;
var speedContainer = SpeedContainerDic[taskId];
@@ -41,16 +40,15 @@ namespace N_m3u8DL_RE.Column
//一秒汇报一次即可
if (DateTimeStringDic.TryGetValue(taskId, out var oldTime) && oldTime != now && !flag)
{
- SpeedDic[taskId] = FormatFileSize(speedContainer.Downloaded);
+ speedContainer.NowSpeed = speedContainer.Downloaded;
//速度为0,计数增加
- if (speedContainer.Downloaded <= _stopSpeed) { speedContainer.AddLowSpeedCount(); SpeedDic[taskId] += $"({speedContainer.LowSpeedCount})"; }
+ if (speedContainer.Downloaded <= _stopSpeed) { speedContainer.AddLowSpeedCount(); }
else speedContainer.ResetLowSpeedCount();
speedContainer.Reset();
}
DateTimeStringDic[taskId] = now;
var style = flag ? Style.Plain : MyStyle;
- SpeedDic.TryGetValue(taskId, out var speed);
- return flag ? new Text("-", style).Centered() : new Text(speed ?? "0Bps", style).Centered();
+ return flag ? new Text("-", style).Centered() : new Text(FormatFileSize(speedContainer.NowSpeed) + (speedContainer.LowSpeedCount > 0 ? $"({speedContainer.LowSpeedCount})" : ""), style).Centered();
}
private static string FormatFileSize(double fileSize)
diff --git a/src/N_m3u8DL-RE/Column/DownloadStatusColumn.cs b/src/N_m3u8DL-RE/Column/DownloadStatusColumn.cs
index 2fa70f8..60edcc4 100644
--- a/src/N_m3u8DL-RE/Column/DownloadStatusColumn.cs
+++ b/src/N_m3u8DL-RE/Column/DownloadStatusColumn.cs
@@ -24,9 +24,9 @@ namespace N_m3u8DL_RE.Column
this.SpeedContainerDic = speedContainerDic;
}
- public override IRenderable Render(RenderContext context, ProgressTask task, TimeSpan deltaTime)
+ public override IRenderable Render(RenderOptions options, ProgressTask task, TimeSpan deltaTime)
{
- if (task.Value == 0) return new Text("-", MyStyle).RightAligned();
+ if (task.Value == 0) return new Text("-", MyStyle).RightJustified();
var now = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
var speedContainer = SpeedContainerDic[task.Id];
@@ -43,7 +43,7 @@ namespace N_m3u8DL_RE.Column
if (task.IsFinished) sizeStr = GlobalUtil.FormatFileSize(size);
- return new Text(sizeStr ?? "-", MyStyle).RightAligned();
+ return new Text(sizeStr ?? "-", MyStyle).RightJustified();
}
}
}
diff --git a/src/N_m3u8DL-RE/Column/MyPercentageColumn.cs b/src/N_m3u8DL-RE/Column/MyPercentageColumn.cs
index e138458..849821b 100644
--- a/src/N_m3u8DL-RE/Column/MyPercentageColumn.cs
+++ b/src/N_m3u8DL-RE/Column/MyPercentageColumn.cs
@@ -21,11 +21,11 @@ namespace N_m3u8DL_RE.Column
public Style CompletedStyle { get; set; } = new Style(foreground: Color.Green);
///
- public override IRenderable Render(RenderContext context, ProgressTask task, TimeSpan deltaTime)
+ public override IRenderable Render(RenderOptions options, ProgressTask task, TimeSpan deltaTime)
{
var percentage = task.Percentage;
var style = percentage == 100 ? CompletedStyle : Style ?? Style.Plain;
- return new Text($"{task.Value}/{task.MaxValue} {percentage:F2}%", style).RightAligned();
+ return new Text($"{task.Value}/{task.MaxValue} {percentage:F2}%", style).RightJustified();
}
}
}
diff --git a/src/N_m3u8DL-RE/Column/RecordingDurationColumn.cs b/src/N_m3u8DL-RE/Column/RecordingDurationColumn.cs
index cf76384..461e834 100644
--- a/src/N_m3u8DL-RE/Column/RecordingDurationColumn.cs
+++ b/src/N_m3u8DL-RE/Column/RecordingDurationColumn.cs
@@ -26,10 +26,10 @@ namespace N_m3u8DL_RE.Column
_recodingDurDic = recodingDurDic;
_refreshedDurDic = refreshedDurDic;
}
- public override IRenderable Render(RenderContext context, ProgressTask task, TimeSpan deltaTime)
+ public override IRenderable Render(RenderOptions options, ProgressTask task, TimeSpan deltaTime)
{
if (_refreshedDurDic == null)
- return new Text($"{GlobalUtil.FormatTime(_recodingDurDic[task.Id])}", MyStyle).LeftAligned();
+ return new Text($"{GlobalUtil.FormatTime(_recodingDurDic[task.Id])}", MyStyle).LeftJustified();
else
{
return new Text($"{GlobalUtil.FormatTime(_recodingDurDic[task.Id])}/{GlobalUtil.FormatTime(_refreshedDurDic[task.Id])}", GreyStyle);
diff --git a/src/N_m3u8DL-RE/Column/RecordingSizeColumn.cs b/src/N_m3u8DL-RE/Column/RecordingSizeColumn.cs
index 72b3fe8..21b76f4 100644
--- a/src/N_m3u8DL-RE/Column/RecordingSizeColumn.cs
+++ b/src/N_m3u8DL-RE/Column/RecordingSizeColumn.cs
@@ -22,7 +22,7 @@ namespace N_m3u8DL_RE.Column
{
_recodingSizeDic = recodingSizeDic;
}
- public override IRenderable Render(RenderContext context, ProgressTask task, TimeSpan deltaTime)
+ public override IRenderable Render(RenderOptions options, ProgressTask task, TimeSpan deltaTime)
{
var now = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
var taskId = task.Id;
@@ -33,7 +33,7 @@ namespace N_m3u8DL_RE.Column
}
DateTimeStringDic[taskId] = now;
var flag = RecodingSizeDic.TryGetValue(taskId, out var size);
- return new Text(GlobalUtil.FormatFileSize(flag ? size : 0), MyStyle).LeftAligned();
+ return new Text(GlobalUtil.FormatFileSize(flag ? size : 0), MyStyle).LeftJustified();
}
}
}
diff --git a/src/N_m3u8DL-RE/Column/RecordingStatusColumn.cs b/src/N_m3u8DL-RE/Column/RecordingStatusColumn.cs
index b1cf60f..aa0a057 100644
--- a/src/N_m3u8DL-RE/Column/RecordingStatusColumn.cs
+++ b/src/N_m3u8DL-RE/Column/RecordingStatusColumn.cs
@@ -13,11 +13,11 @@ namespace N_m3u8DL_RE.Column
protected override bool NoWrap => true;
public Style MyStyle { get; set; } = new Style(foreground: Color.Default);
public Style FinishedStyle { get; set; } = new Style(foreground: Color.Yellow);
- public override IRenderable Render(RenderContext context, ProgressTask task, TimeSpan deltaTime)
+ public override IRenderable Render(RenderOptions options, ProgressTask task, TimeSpan deltaTime)
{
if (task.IsFinished)
- return new Text($"{task.Value}/{task.MaxValue} Waiting ", FinishedStyle).LeftAligned();
- return new Text($"{task.Value}/{task.MaxValue} Recording", MyStyle).LeftAligned();
+ return new Text($"{task.Value}/{task.MaxValue} Waiting ", FinishedStyle).LeftJustified();
+ return new Text($"{task.Value}/{task.MaxValue} Recording", MyStyle).LeftJustified();
}
}
}
diff --git a/src/N_m3u8DL-RE/Entity/SpeedContainer.cs b/src/N_m3u8DL-RE/Entity/SpeedContainer.cs
index 4775756..2445f4f 100644
--- a/src/N_m3u8DL-RE/Entity/SpeedContainer.cs
+++ b/src/N_m3u8DL-RE/Entity/SpeedContainer.cs
@@ -12,6 +12,7 @@ namespace N_m3u8DL_RE.Entity
internal class SpeedContainer
{
public bool SingleSegment { get; set; } = false;
+ public long NowSpeed { get; set; } = 0L; //当前每秒速度
public long? ResponseLength { get; set; }
public long RDownloaded { get => _Rdownloaded; }
private int _zeroSpeedCount = 0;