Light theme default + yt-dlp search fallback
This commit is contained in:
@@ -0,0 +1,144 @@
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$Root = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||
$Assets = Join-Path $Root "assets\windows_hd"
|
||||
|
||||
New-Item -ItemType Directory -Force -Path $Assets | Out-Null
|
||||
|
||||
# Version stable utilisée uniquement comme bootstrap vérifié par SHA-256.
|
||||
# Le script passe ensuite automatiquement au canal nightly.
|
||||
$YtVersion = "2026.07.04"
|
||||
$YtBase = "https://github.com/yt-dlp/yt-dlp/releases/download/$YtVersion"
|
||||
$YtExe = Join-Path $Assets "yt-dlp.exe"
|
||||
$YtSums = Join-Path $env:TEMP "youtube-personal-yt-dlp-sha256.txt"
|
||||
|
||||
$DenoVersion = "2.9.4"
|
||||
$DenoBase = "https://github.com/denoland/deno/releases/download/v$DenoVersion"
|
||||
$DenoZipName = "deno-x86_64-pc-windows-msvc.zip"
|
||||
$DenoZip = Join-Path $env:TEMP "youtube-personal-deno.zip"
|
||||
$DenoSum = Join-Path $env:TEMP "youtube-personal-deno.sha256sum"
|
||||
$DenoExtract = Join-Path $env:TEMP "youtube-personal-deno-extract"
|
||||
$DenoExe = Join-Path $Assets "deno.exe"
|
||||
|
||||
function Assert-Sha256 {
|
||||
param(
|
||||
[Parameter(Mandatory = $true)][string]$File,
|
||||
[Parameter(Mandatory = $true)][string]$Expected
|
||||
)
|
||||
|
||||
$Actual = (Get-FileHash -Algorithm SHA256 -Path $File).Hash.ToLowerInvariant()
|
||||
$ExpectedNormalized = $Expected.Trim().ToLowerInvariant()
|
||||
|
||||
if ($Actual -ne $ExpectedNormalized) {
|
||||
Remove-Item -Force -ErrorAction SilentlyContinue $File
|
||||
throw "SHA-256 incorrect pour $File`nAttendu: $ExpectedNormalized`nObtenu: $Actual"
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "=== YouTube Personal - Preparation HD/4K Windows ===" -ForegroundColor Cyan
|
||||
Write-Host ""
|
||||
|
||||
Write-Host "[1/5] Telechargement bootstrap de yt-dlp stable $YtVersion..."
|
||||
Invoke-WebRequest -UseBasicParsing `
|
||||
-Uri "$YtBase/yt-dlp.exe" `
|
||||
-OutFile $YtExe
|
||||
|
||||
Invoke-WebRequest -UseBasicParsing `
|
||||
-Uri "$YtBase/SHA2-256SUMS" `
|
||||
-OutFile $YtSums
|
||||
|
||||
$YtLine = Get-Content $YtSums |
|
||||
Where-Object { $_ -match "\syt-dlp\.exe$" } |
|
||||
Select-Object -First 1
|
||||
|
||||
if (-not $YtLine) {
|
||||
throw "Impossible de lire le SHA-256 officiel de yt-dlp.exe."
|
||||
}
|
||||
|
||||
$YtExpected = ($YtLine -split "\s+")[0]
|
||||
Assert-Sha256 -File $YtExe -Expected $YtExpected
|
||||
|
||||
Write-Host "[2/5] yt-dlp stable verifie." -ForegroundColor Green
|
||||
|
||||
Write-Host "[3/5] Mise a jour de yt-dlp vers le canal nightly..."
|
||||
& $YtExe --update-to nightly
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "La mise a jour yt-dlp nightly a echoue."
|
||||
}
|
||||
|
||||
$YtNightlyVersion = (& $YtExe --version).Trim()
|
||||
if (-not $YtNightlyVersion) {
|
||||
throw "Impossible de lire la version yt-dlp nightly."
|
||||
}
|
||||
|
||||
Write-Host "yt-dlp nightly actif: $YtNightlyVersion" -ForegroundColor Green
|
||||
|
||||
Write-Host "[4/5] Telechargement de Deno $DenoVersion..."
|
||||
Invoke-WebRequest -UseBasicParsing `
|
||||
-Uri "$DenoBase/$DenoZipName" `
|
||||
-OutFile $DenoZip
|
||||
|
||||
Invoke-WebRequest -UseBasicParsing `
|
||||
-Uri "$DenoBase/$DenoZipName.sha256sum" `
|
||||
-OutFile $DenoSum
|
||||
|
||||
# Le fichier .sha256sum de Deno n'utilise pas forcément le format
|
||||
# "<hash> <filename>". Certaines releases utilisent un petit format
|
||||
# structuré avec des champs comme "path" et "hash".
|
||||
#
|
||||
# On extrait donc explicitement l'unique SHA-256 (64 caractères hexadécimaux)
|
||||
# au lieu de supposer que le premier mot de la ligne est le hash.
|
||||
$DenoChecksumText = Get-Content $DenoSum -Raw
|
||||
|
||||
$DenoHashMatches = [regex]::Matches(
|
||||
$DenoChecksumText,
|
||||
'(?i)(?<![0-9a-f])[0-9a-f]{64}(?![0-9a-f])'
|
||||
)
|
||||
|
||||
if ($DenoHashMatches.Count -ne 1) {
|
||||
throw "Impossible de lire de façon sûre le SHA-256 officiel de Deno. Nombre de hash trouvés: $($DenoHashMatches.Count)"
|
||||
}
|
||||
|
||||
$DenoExpected = $DenoHashMatches[0].Value
|
||||
Assert-Sha256 -File $DenoZip -Expected $DenoExpected
|
||||
|
||||
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue $DenoExtract
|
||||
New-Item -ItemType Directory -Force -Path $DenoExtract | Out-Null
|
||||
Expand-Archive -Force -Path $DenoZip -DestinationPath $DenoExtract
|
||||
|
||||
$ExtractedDeno = Join-Path $DenoExtract "deno.exe"
|
||||
|
||||
if (-not (Test-Path $ExtractedDeno)) {
|
||||
throw "deno.exe absent de l'archive officielle."
|
||||
}
|
||||
|
||||
Copy-Item -Force $ExtractedDeno $DenoExe
|
||||
|
||||
Write-Host "[5/5] Verification des executables..." -ForegroundColor Green
|
||||
|
||||
& $YtExe --version
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "yt-dlp.exe ne demarre pas."
|
||||
}
|
||||
|
||||
& $DenoExe --version
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "deno.exe ne demarre pas."
|
||||
}
|
||||
|
||||
Remove-Item -Force -ErrorAction SilentlyContinue $YtSums
|
||||
Remove-Item -Force -ErrorAction SilentlyContinue $DenoZip
|
||||
Remove-Item -Force -ErrorAction SilentlyContinue $DenoSum
|
||||
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue $DenoExtract
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "HD/4K Windows prepare avec succes." -ForegroundColor Green
|
||||
Write-Host "Fichiers:"
|
||||
Write-Host " $YtExe"
|
||||
Write-Host " $DenoExe"
|
||||
Write-Host ""
|
||||
Write-Host "Commande suivante:"
|
||||
Write-Host ' flutter clean'
|
||||
Write-Host ' flutter pub get'
|
||||
Write-Host ' flutter run -d windows'
|
||||
Reference in New Issue
Block a user