Skip to content

Commit

Permalink
Fix FFmpeg downloaders fetching >4 year old FFmpeg builds on Windows (#…
Browse files Browse the repository at this point in the history
…1205)

* Do not fetch extremely outdated Zenaroe FFmpeg builds

* Redownload WPF FFmpeg if the file is over 1 year old
  • Loading branch information
ScrubN authored Aug 30, 2024
1 parent 64fac09 commit 7b0dd50
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
9 changes: 4 additions & 5 deletions TwitchDownloaderCLI/Modes/FfmpegHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
4 changes: 2 additions & 2 deletions TwitchDownloaderWPF/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit 7b0dd50

Please sign in to comment.