diff --git a/README.md b/README.md index a614eae..512e28a 100644 --- a/README.md +++ b/README.md @@ -32,9 +32,29 @@ An open-source YouTube video downloader that allows you to easily download video - Microsoft Windows 7+ (x64) - [.NET 8.0 Desktop Runtime](https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=8.0.0&arch=x64&rid=win-x64&gui=true) - [Releases](https://github.com/legend2ks/YoutubeDownloader/releases) +## Building from source code + +Clone the repository (including submodules): + +``` +git clone --recursive https://github.com/legend2ks/YoutubeDownloader +``` + +Build the project using the build script, or: + +``` +cd YoutubeDownloader +dotnet publish "YoutubeApp/YoutubeApp.csproj" -c "Release" -o "Publish/app" -p:DebugType=None -p:PublishSingleFile=true --self-contained false +``` + +Download these project dependencies and put them in `Publish/app/utils`: + +- "aria2c.exe" from https://github.com/aria2/aria2/releases (look for the releases file download `aria2-1.37.0-win-64bit-build1.zip`). +- "yt-dlp.exe" from https://github.com/yt-dlp/yt-dlp/releases (look for the `yt-dlp.exe` file) +- "ffmpeg.exe" from https://github.com/BtbN/FFmpeg-Builds/releases (for example the `ffmpeg-master-latest-win64-lgpl.zip` and extract the `ffmpeg.exe`) + ## Roadmap * [x] Channels section diff --git a/Scripts/Build.ps1 b/Scripts/Build.ps1 new file mode 100644 index 0000000..8635734 --- /dev/null +++ b/Scripts/Build.ps1 @@ -0,0 +1,40 @@ +cd .. +$publishFolder = "Publish" +$publishFolderApp = "$publishFolder/app" + +# Cleanup: +Write-Host -F Blue "Cleaning up folder: '$publishFolderApp'" +if (test-path $publishFolderApp) +{ + Remove-Item "$publishFolderApp/*" -Force -Recurse + Write-Host -F Yellow "Removed folder: $publishFolderApp" +} + +# Build as .exe: +# https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-publish +Write-Host -F Blue "Publishing app..." +dotnet publish "YoutubeApp/YoutubeApp.csproj" -c "Release" -o $publishFolderApp -p:DebugType=None -p:PublishSingleFile=true --self-contained false # -r "win-x64" +if ($LASTEXITCODE -ne 0) +{ + Write-Host -F Red "Publishing app FAILED!" + exit -1 +} +Write-Host -F Green "Publishing app DONE!" + +mkdir "$publishFolderApp/utils" -Force + +# TODO: download: +# - "aria2c.exe" from https://github.com/aria2/aria2/releases (look for the releases file download `aria2-1.37.0-win-64bit-build1.zip`). +# - "yt-dlp.exe" from https://github.com/yt-dlp/yt-dlp/releases (look for the `yt-dlp.exe` file) +# - "ffmpeg.exe" from https://github.com/BtbN/FFmpeg-Builds/releases (for example the `ffmpeg-master-latest-win64-lgpl.zip` and extract the `ffmpeg.exe`) + +# TODO: compress: +# $version = (Get-Item "$publishFolderApp/YoutubeApp.exe").VersionInfo.FileVersion +# $destinationZip = "$publishFolder/YoutubeApp-v$version.zip" +# Write-Host -F Blue "Compressing binaries into: '$destinationZip'..." +# https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.archive/compress-archive?view=powershell-7.3 +# Compress-Archive -Path "$publishFolderApp/*" -DestinationPath $destinationZip -Force + +Start $publishFolder + +Write-Host -F Green "Finished Build!" diff --git a/YoutubeApp.sln b/YoutubeApp.sln index 08713b6..0ebccc8 100644 --- a/YoutubeApp.sln +++ b/YoutubeApp.sln @@ -5,10 +5,21 @@ VisualStudioVersion = 17.4.33122.133 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "YoutubeApp", "YoutubeApp\YoutubeApp.csproj", "{D8731E42-5487-4304-8CBB-5DB68DDF6A32}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "YoutubeApp.Tests", "YoutubeApp.Tests\YoutubeApp.Tests.csproj", "{FBE41C3C-DA78-4D32-8185-82A1231C2000}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "YoutubeApp.Tests", "YoutubeApp.Tests\YoutubeApp.Tests.csproj", "{FBE41C3C-DA78-4D32-8185-82A1231C2000}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MessageBox.Avalonia", "MessageBox.Avalonia\src\MessageBox.Avalonia\MessageBox.Avalonia.csproj", "{B8D18D54-ECC6-49BF-B897-BDDB1BFD8092}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{76C039DA-C7C7-414F-9B6D-983F5341C4AE}" + ProjectSection(SolutionItems) = preProject + LICENSE = LICENSE + README.md = README.md + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Scripts", "Scripts", "{75801BB8-7117-4172-B48B-AB700F5B36AF}" + ProjectSection(SolutionItems) = preProject + Scripts\Build.ps1 = Scripts\Build.ps1 + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU