Recently Written · git

desktop-subtitle-replay

git clone https://github.com/equwal/desktop-subtitle-replay

Log | Files | Refs


start.ps1 (1929 bytes)

1 # Starts both halves: live captions now, and automatic subtitling of every
2 # replay clip OBS saves.
3 #
4 #   .\start.ps1                     # Finnish
5 #   .\start.ps1 -Lang ru            # Russian
6 #   .\start.ps1 -Lang ja -Model base
7 #   .\start.ps1 -LiveOnly
8 #
9 # Two windows open. Close either to stop that half.
10 
11 param(
12     [string]$Lang = "fi",
13     [string]$Model = "small",
14     [string]$ReplayModel = "large-v3-turbo",
15     [string]$WatchFolder = "",
16     [int]$ServePort = 8778,
17     [switch]$LiveOnly,
18     [switch]$ReplayOnly
19 )
20 
21 $ErrorActionPreference = "Stop"
22 Set-Location $PSScriptRoot
23 $py = ".\.venv\Scripts\python.exe"
24 if (-not (Test-Path $py)) { throw "Run .\setup.ps1 first." }
25 
26 if (-not $ReplayOnly) {
27     Write-Host "Starting live captions ($Lang, $Model)..." -ForegroundColor Cyan
28     Start-Process -FilePath $py `
29         -ArgumentList ".\livecap.py", "--lang", $Lang, "--model", $Model `
30         -WorkingDirectory $PSScriptRoot
31     Start-Sleep -Seconds 2
32     Write-Host "  OBS overlay   http://127.0.0.1:8777/overlay.html?ws=8765"
33     Write-Host "  Reader        http://127.0.0.1:8777/reader.html?ws=8765" -ForegroundColor Green
34     Write-Host "  Control       http://127.0.0.1:8777/control.html?ws=8765"
35 }
36 
37 if (-not $LiveOnly) {
38     $watchArgs = @(".\subtitle.py", "--lang", $Lang, "--model", $ReplayModel,
39                    "--serve", "$ServePort", "--watch")
40     if ($WatchFolder) { $watchArgs += $WatchFolder }
41 
42     Write-Host ""
43     Write-Host "Starting replay watcher ($ReplayModel)..." -ForegroundColor Cyan
44     Start-Process -FilePath $py -ArgumentList $watchArgs -WorkingDirectory $PSScriptRoot
45     Start-Sleep -Seconds 2
46     Write-Host "  Clips         http://127.0.0.1:$ServePort/" -ForegroundColor Green
47     Write-Host "  Save a replay in OBS and its mining page appears there."
48 }
49 
50 Write-Host ""
51 Write-Host "Open the Reader and the Clips pages in the browser where Yomitan lives." -ForegroundColor Yellow