Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add publish script and build docs. #15

Merged
merged 2 commits into from
May 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
40 changes: 40 additions & 0 deletions Scripts/Build.ps1
Original file line number Diff line number Diff line change
@@ -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!"
13 changes: 12 additions & 1 deletion YoutubeApp.sln
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading