From 7b0dd50e5050a200317116a9cc80a20f1ebc4893 Mon Sep 17 00:00:00 2001 From: Scrub <72096833+ScrubN@users.noreply.github.com> Date: Fri, 30 Aug 2024 17:31:11 -0400 Subject: [PATCH] Fix FFmpeg downloaders fetching >4 year old FFmpeg builds on Windows (#1205) * Do not fetch extremely outdated Zenaroe FFmpeg builds * Redownload WPF FFmpeg if the file is over 1 year old --- TwitchDownloaderCLI/Modes/FfmpegHandler.cs | 9 ++++----- TwitchDownloaderWPF/MainWindow.xaml.cs | 4 ++-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/TwitchDownloaderCLI/Modes/FfmpegHandler.cs b/TwitchDownloaderCLI/Modes/FfmpegHandler.cs index d2a192c6..04f9e0dc 100644 --- a/TwitchDownloaderCLI/Modes/FfmpegHandler.cs +++ b/TwitchDownloaderCLI/Modes/FfmpegHandler.cs @@ -37,16 +37,15 @@ private static void DownloadFfmpeg(ITaskProgress progress) using var progressHandler = new XabeProgressHandler(progress); + FFmpegDownloader.GetLatestVersion(FFmpegVersion.Official, progressHandler).GetAwaiter().GetResult(); + + Console.WriteLine(); + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { - FFmpegDownloader.GetLatestVersion(FFmpegVersion.Full, progressHandler).GetAwaiter().GetResult(); return; } - FFmpegDownloader.GetLatestVersion(FFmpegVersion.Official, progressHandler).GetAwaiter().GetResult(); - - Console.WriteLine(); - try { var ffmpegFileInfo = new UnixFileInfo("ffmpeg") diff --git a/TwitchDownloaderWPF/MainWindow.xaml.cs b/TwitchDownloaderWPF/MainWindow.xaml.cs index d99f7f5b..05876f92 100644 --- a/TwitchDownloaderWPF/MainWindow.xaml.cs +++ b/TwitchDownloaderWPF/MainWindow.xaml.cs @@ -99,12 +99,12 @@ private async void Window_Loaded(object sender, RoutedEventArgs e) #endif // TODO: extract FFmpeg handling to a dedicated service - if (!File.Exists("ffmpeg.exe")) + if (!File.Exists("ffmpeg.exe") || File.GetLastWriteTime("ffmpeg.exe") < DateTime.Now - TimeSpan.FromDays(365)) { var oldTitle = Title; try { - await FFmpegDownloader.GetLatestVersion(FFmpegVersion.Full, new FfmpegDownloadProgress()); + await FFmpegDownloader.GetLatestVersion(FFmpegVersion.Official, new FfmpegDownloadProgress()); // Flash the window to signify that FFmpeg has been downloaded FlashTaskbarIconIfNotForeground(TimeSpan.FromSeconds(3));