SubtitleRenamer/SubtitleRenamer.ps1
2022-10-06 20:06:05 -03:00

39 lines
1.3 KiB
PowerShell

# How to use
# Place file in folder with video files. You will need to inspect the contents of the Subs folder to determine the correct sub number you want to copy.
# Select the language (or custom) and then use the sub number you selected before
# let it run and it will copy all the subs and rename them
Copy-Item -Path ".\Subs" -Destination ".\Subs.tmp" -Recurse
Set-Location ".\Subs.tmp"
$choice = Read-Host -Prompt "English (1) or French (2) or Manual (3)"
if ($choice -eq "1") {
$lang = "*English*"
$langcode = "eng"
}
elseif ($choice -eq "2") {
$lang = "*French*"
$langcode = "fra"
}
elseif ($choice -eq "3") {
$lang = Read-Host -Prompt "Filter"
$langcode = Read-Host -Prompt "Language code"
}
else {
return
}
$choice = Read-Host -Prompt "Manual Sub Number"
$lang = $choice + $lang
foreach($path in Get-ChildItem -Directory) {
# $path.FullName
Get-ChildItem -Path $path -Filter $lang | Select-Object -ExpandProperty FullName
}
Read-Host -Prompt "Ctrl C to quit"
foreach($path in Get-ChildItem -Directory) {
# $path.FullName
$filename = Get-ChildItem -Path $path -Filter $lang
Copy-Item $filename.FullName -Destination "..\$path.$langcode.srt"
}
Set-Location ".."
Remove-Item ".\Subs.tmp" -Recurse
Read-Host -Prompt "Errors above"