diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4d8c4daf0..661011281 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -46,9 +46,20 @@ jobs: - win-arm64 - win-x86 - win-x64 + - linux-arm64 + - linux-x86 - linux-x64 - osx-arm64 - osx-x64 + include-ffmpeg: + - true + - false + exclude: + # FFmpeg builds for these platforms are not easily available + - include-ffmpeg: true + rid: linux-arm64 + - include-ffmpeg: true + rid: linux-x86 runs-on: ${{ startsWith(matrix.rid, 'win-') && 'windows-latest' || startsWith(matrix.rid, 'osx-') && 'macos-latest' || 'ubuntu-latest' }} timeout-minutes: 10 @@ -66,6 +77,11 @@ jobs: with: dotnet-version: 8.0.x + - name: Download FFmpeg + if: ${{ matrix.include-ffmpeg }} + working-directory: YoutubeDownloader/ + run: dotnet build -t:DownloadFFmpeg + - name: Publish app run: > dotnet publish YoutubeDownloader @@ -79,7 +95,7 @@ jobs: - name: Upload artifacts uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4 with: - name: YoutubeDownloader.${{ matrix.rid }} + name: ${{ matrix.include-ffmpeg && 'YoutubeDownloader' || 'YoutubeDownloader.Raw' }}.${{ matrix.rid }} path: YoutubeDownloader/bin/publish if-no-files-found: error @@ -116,9 +132,20 @@ jobs: - win-arm64 - win-x86 - win-x64 + - linux-arm64 + - linux-x86 - linux-x64 - osx-arm64 - osx-x64 + include-ffmpeg: + - true + - false + exclude: + # FFmpeg builds for these platforms are not easily available + - include-ffmpeg: true + rid: linux-arm64 + - include-ffmpeg: true + rid: linux-x86 runs-on: ubuntu-latest timeout-minutes: 10 @@ -131,26 +158,26 @@ jobs: - name: Download artifacts uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 with: - name: YoutubeDownloader.${{ matrix.rid }} + name: ${{ matrix.include-ffmpeg && 'YoutubeDownloader' || 'YoutubeDownloader.Raw' }}.${{ matrix.rid }} path: YoutubeDownloader/ - name: Set permissions if: ${{ !startsWith(matrix.rid, 'win-') }} run: | chmod +x YoutubeDownloader/YoutubeDownloader - chmod +x YoutubeDownloader/ffmpeg + ${{ matrix.include-ffmpeg && 'chmod +x YoutubeDownloader/ffmpeg' || '' }} - name: Create package # Change into the artifacts directory to avoid including the directory itself in the zip archive working-directory: YoutubeDownloader/ - run: zip -r ../YoutubeDownloader.${{ matrix.rid }}.zip . + run: zip -r ../${{ matrix.include-ffmpeg && 'YoutubeDownloader' || 'YoutubeDownloader.Raw' }}.${{ matrix.rid }}.zip . - name: Upload release asset env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: > gh release upload ${{ github.ref_name }} - YoutubeDownloader.${{ matrix.rid }}.zip + ${{ matrix.include-ffmpeg && 'YoutubeDownloader' || 'YoutubeDownloader.Raw' }}.${{ matrix.rid }}.zip --repo ${{ github.event.repository.full_name }} notify: diff --git a/Readme.md b/Readme.md index c14a4061b..2a61d2810 100644 --- a/Readme.md +++ b/Readme.md @@ -45,6 +45,10 @@ To learn more about the war and how you can help, [click here](https://tyrrrz.me > **Note**: > If you're unsure which build is right for your system, consult with [this page](https://useragent.cc) to determine your OS and CPU architecture. +> **Note**: +> **YoutubeDownloader** relies on [FFmpeg](https://ffmpeg.org) to handle video processing, and it comes bundled with the application. +> You can also download a version of **YoutubeDownloader** that doesn't include FFmpeg (`YoutubeDownloader.Raw.*`) if you prefer to use your own installation. + ## Features - Cross-platform graphical user interface diff --git a/YoutubeDownloader/DownloadFFmpeg.ps1 b/YoutubeDownloader/DownloadFFmpeg.ps1 index e2e63bc64..20d8021d1 100644 --- a/YoutubeDownloader/DownloadFFmpeg.ps1 +++ b/YoutubeDownloader/DownloadFFmpeg.ps1 @@ -1,3 +1,6 @@ +# This script is called from inside an MSBuild task to download FFmpeg binaries: +# dotnet build -t:DownloadFFmpeg + param ( [string]$platform, [string]$outputPath @@ -8,12 +11,6 @@ $ErrorActionPreference = "Stop" # Normalize platform identifier $platform = $platform.ToLower().Replace("win-", "windows-") -# Check if already exists -if (Test-Path $outputPath) { - Write-Host "Skipped downloading FFmpeg, file already exists." - exit -} - # Download the archive Write-Host "Downloading FFmpeg..." [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 diff --git a/YoutubeDownloader/Services/UpdateService.cs b/YoutubeDownloader/Services/UpdateService.cs index f5881af6c..583d0f413 100644 --- a/YoutubeDownloader/Services/UpdateService.cs +++ b/YoutubeDownloader/Services/UpdateService.cs @@ -14,11 +14,12 @@ public class UpdateService(SettingsService settingsService) : IDisposable new GithubPackageResolver( "Tyrrrz", "YoutubeDownloader", + // Use the raw builds to avoid updating FFmpeg. // Examples: - // YoutubeDownloader.win-arm64.zip - // YoutubeDownloader.win-x64.zip - // YoutubeDownloader.linux-x64.zip - $"YoutubeDownloader.{RuntimeInformation.RuntimeIdentifier}.zip" + // YoutubeDownloader.Raw.win-arm64.zip + // YoutubeDownloader.Raw.win-x64.zip + // YoutubeDownloader.Raw.linux-x64.zip + $"YoutubeDownloader.Raw.{RuntimeInformation.RuntimeIdentifier}.zip" ), new ZipPackageExtractor() ) diff --git a/YoutubeDownloader/ViewModels/MainViewModel.cs b/YoutubeDownloader/ViewModels/MainViewModel.cs index caddf8ff3..11328d14f 100644 --- a/YoutubeDownloader/ViewModels/MainViewModel.cs +++ b/YoutubeDownloader/ViewModels/MainViewModel.cs @@ -83,7 +83,7 @@ private async Task ShowFFmpegMessageAsync() $""" FFmpeg is required for {Program.Name} to work. Please download it and make it available in the application directory or on the system PATH. - Click DOWNLOAD to go to the FFmpeg download page. You can also install FFmpeg using a package manager instead. + Click DOWNLOAD to go to the FFmpeg download page. Alternatively, you can download a version of {Program.Name} that has FFmpeg bundled with it. """, "DOWNLOAD", "CLOSE" diff --git a/YoutubeDownloader/YoutubeDownloader.csproj b/YoutubeDownloader/YoutubeDownloader.csproj index fbe16e8b7..01e286a6a 100644 --- a/YoutubeDownloader/YoutubeDownloader.csproj +++ b/YoutubeDownloader/YoutubeDownloader.csproj @@ -53,7 +53,7 @@ - + $(RuntimeIdentifier) win-arm64 @@ -68,14 +68,13 @@ ffmpeg - + - - - - - + + + + \ No newline at end of file