-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathformat_updater.bat
26 lines (23 loc) · 1007 Bytes
/
format_updater.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
@echo off
REM Get supported formats from ffmpeg
set scriptDir=%~dp0
powershell -Command ^
"$psScriptDir = '%scriptDir%';" ^
"$output = ffmpeg -formats;" ^
"if (-not $output) { Write-Host 'No output captured from FFmpeg'; exit; }" ^
"$formats = @();" ^
"$output -split '`r?`n' | ForEach-Object { " ^
"$line = $_.Trim();" ^
"if ($line -match '^\s*([D]+[E]*\s+)(\S+)\s+(.+)') { " ^
"$format = @{};" ^
"$format['Description'] = $matches[3].Trim();" ^
"$format['Ext'] = $matches[2];" ^
"$format['Support'] = $matches[1].Trim();" ^
"$formats += $format;" ^
"}" ^
"};" ^
"if ($formats.Count -eq 0) { Write-Host 'No formats parsed'; exit; }" ^
"$formats | ConvertTo-Json | Set-Content (Join-Path $psScriptDir 'supported_formats.json');" ^
"Write-Host 'Supported formats have been saved to supported_formats.json';" ^
"Invoke-Item (Join-Path $psScriptDir 'supported_formats.json');"
pause