diff --git a/TwitchDownloaderCLI/Program.cs b/TwitchDownloaderCLI/Program.cs index f3b60ed6..abd99c2e 100644 --- a/TwitchDownloaderCLI/Program.cs +++ b/TwitchDownloaderCLI/Program.cs @@ -16,6 +16,7 @@ class Program { static string previousStatus = ""; static string ffmpegPath = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "ffmpeg.exe" : "ffmpeg"; + static bool was_last_message_percent = false; static void Main(string[] args) { if (args.Any(x => x.Equals("--download-ffmpeg"))) @@ -240,6 +241,11 @@ private static void Progress_ProgressChanged(object sender, ProgressReport e) { if (e.reportType == ReportType.Message) { + if (was_last_message_percent) + { + was_last_message_percent = false; + Console.WriteLine(""); + } string currentStatus = "[STATUS] - " + e.data; if (currentStatus != previousStatus) { @@ -249,8 +255,18 @@ private static void Progress_ProgressChanged(object sender, ProgressReport e) } else if (e.reportType == ReportType.Log) { + if(was_last_message_percent) + { + was_last_message_percent = false; + Console.WriteLine(""); + } Console.WriteLine("[LOG] - " + e.data); } + else if (e.reportType == ReportType.MessageInfo) + { + Console.Write("\r[STATUS] - " + e.data); + was_last_message_percent = true; + } } } } diff --git a/TwitchDownloaderCore/ChatDownloader.cs b/TwitchDownloaderCore/ChatDownloader.cs index f39d2faf..0bf08cc6 100644 --- a/TwitchDownloaderCore/ChatDownloader.cs +++ b/TwitchDownloaderCore/ChatDownloader.cs @@ -99,7 +99,7 @@ public async Task DownloadAsync(IProgress progress, Cancellation int percent = (int)Math.Floor((latestMessage - videoStart) / videoDuration * 100); progress.Report(new ProgressReport() { reportType = ReportType.Percent, data = percent }); - progress.Report(new ProgressReport() { reportType = ReportType.Message, data = $"Downloading {percent}%" }); + progress.Report(new ProgressReport() { reportType = ReportType.MessageInfo, data = $"Downloading {percent}%" }); cancellationToken.ThrowIfCancellationRequested(); diff --git a/TwitchDownloaderCore/ChatRenderer.cs b/TwitchDownloaderCore/ChatRenderer.cs index 3f0d6727..bcc0d439 100644 --- a/TwitchDownloaderCore/ChatRenderer.cs +++ b/TwitchDownloaderCore/ChatRenderer.cs @@ -148,8 +148,8 @@ await Task.Run(() => CheckCancelation(cancellationToken, downloadFolder); } }); - - progress.Report(new ProgressReport() { reportType = ReportType.Message, data = "Rendering Video 0%" }); + + progress.Report(new ProgressReport() { reportType = ReportType.MessageInfo, data = "Rendering Video 0%" }); await Task.Run(() => RenderVideo(renderOptions, new Queue(finalComments.OrderBy(x => x.SecondsOffset)), chatJson, progress), cancellationToken); progress.Report(new ProgressReport() { reportType = ReportType.Message, data = "Cleaning up..." }); Cleanup(downloadFolder); @@ -428,7 +428,7 @@ private void RenderVideo(ChatRenderOptions renderOptions, Queue f progress.Report(new ProgressReport() { reportType = ReportType.Percent, data = percentInt }); int timeLeftInt = (int)Math.Floor(100.0 / percentDouble * stopwatch.Elapsed.TotalSeconds) - (int)stopwatch.Elapsed.TotalSeconds; TimeSpan timeLeft = new TimeSpan(0, 0, timeLeftInt); - progress.Report(new ProgressReport() { reportType = ReportType.Message, data = $"Rendering Video {percentInt}% ({timeLeft.ToString(@"h\hm\ms\s")} left)" }); + progress.Report(new ProgressReport() { reportType = ReportType.MessageInfo, data = $"Rendering Video {percentInt}% ({timeLeft.ToString(@"h\hm\ms\s")} left)" }); } } } diff --git a/TwitchDownloaderCore/ProgressReport.cs b/TwitchDownloaderCore/ProgressReport.cs index 4f08a17a..0d3c8c39 100644 --- a/TwitchDownloaderCore/ProgressReport.cs +++ b/TwitchDownloaderCore/ProgressReport.cs @@ -4,7 +4,8 @@ public enum ReportType { Log, Percent, - Message + Message, + MessageInfo } public class ProgressReport diff --git a/TwitchDownloaderCore/VideoDownloader.cs b/TwitchDownloaderCore/VideoDownloader.cs index 5fdf357a..87d63409 100644 --- a/TwitchDownloaderCore/VideoDownloader.cs +++ b/TwitchDownloaderCore/VideoDownloader.cs @@ -143,7 +143,7 @@ public async Task DownloadAsync(IProgress progress, Cancellation doneCount++; int percent = (int)Math.Floor(((double)doneCount / (double)partCount) * 100); - progress.Report(new ProgressReport() { reportType = ReportType.Message, data = String.Format("Downloading {0}% (1/3)", percent) }); + progress.Report(new ProgressReport() { reportType = ReportType.MessageInfo, data = String.Format("Downloading {0}% (1/3)", percent) }); progress.Report(new ProgressReport() { reportType = ReportType.Percent, data = percent }); return; diff --git a/TwitchDownloaderWPF/PageChatDownload.xaml.cs b/TwitchDownloaderWPF/PageChatDownload.xaml.cs index 150a2732..a94b9f10 100644 --- a/TwitchDownloaderWPF/PageChatDownload.xaml.cs +++ b/TwitchDownloaderWPF/PageChatDownload.xaml.cs @@ -262,7 +262,7 @@ private void OnProgressChanged(ProgressReport progress) { if (progress.reportType == ReportType.Percent) statusProgressBar.Value = (int)progress.data; - if (progress.reportType == ReportType.Message) + if (progress.reportType == ReportType.Message || progress.reportType == ReportType.MessageInfo) statusMessage.Text = (string)progress.data; if (progress.reportType == ReportType.Log) AppendLog((string)progress.data); diff --git a/TwitchDownloaderWPF/PageChatRender.xaml.cs b/TwitchDownloaderWPF/PageChatRender.xaml.cs index 4c2d4837..42f48efc 100644 --- a/TwitchDownloaderWPF/PageChatRender.xaml.cs +++ b/TwitchDownloaderWPF/PageChatRender.xaml.cs @@ -131,7 +131,7 @@ private void OnProgressChanged(ProgressReport progress) { if (progress.reportType == ReportType.Percent) statusProgressBar.Value = (int)progress.data; - if (progress.reportType == ReportType.Message) + if (progress.reportType == ReportType.Message || progress.reportType == ReportType.MessageInfo) statusMessage.Text = (string)progress.data; if (progress.reportType == ReportType.Log) AppendLog((string)progress.data); diff --git a/TwitchDownloaderWPF/PageVodDownload.xaml.cs b/TwitchDownloaderWPF/PageVodDownload.xaml.cs index 2b6b6e62..b82d7d12 100644 --- a/TwitchDownloaderWPF/PageVodDownload.xaml.cs +++ b/TwitchDownloaderWPF/PageVodDownload.xaml.cs @@ -199,7 +199,7 @@ private void OnProgressChanged(ProgressReport progress) { if (progress.reportType == ReportType.Percent) statusProgressBar.Value = (int) progress.data; - if (progress.reportType == ReportType.Message) + if (progress.reportType == ReportType.Message || progress.reportType == ReportType.MessageInfo) statusMessage.Text = (string)progress.data; if (progress.reportType == ReportType.Log) AppendLog((string)progress.data);