feat: Worker V2 Flet GUI mit Feature-Parität und neuem Installer
This commit is contained in:
@@ -482,8 +482,8 @@ function Do-Install {
|
||||
$poolArg = if ($slots -le 1) { "--pool=solo" } else { "--pool=threads --concurrency=$slots" }
|
||||
Log "Gleichzeitige Auftraege: $slots"
|
||||
|
||||
$trayBat = "@echo off`r`ncd /d `"%~dp0`"`r`nset REDIS_URL=redis://${rHost}:6379/0`r`nset DATABASE_URL=postgresql://rippy:rippy@${rHost}:5432/rippy`r`nset API_URL=http://${rHost}:8000`r`nset WORKER_NAME=$wName`r`nset RIPPY_TRAY_HOST=$rHost`r`nset RIPPY_SLOTS=$slots`r`nset TZ=UTC`r`n${mapZeile}set PATH=%~dp0;%PATH%`r`nstart `"`" venv\Scripts\pythonw.exe tray.py"
|
||||
Set-Content -Path "start-tray.bat" -Value $trayBat -Encoding ASCII
|
||||
$trayBat = "@echo off`r`ncd /d `"%~dp0`"`r`nset REDIS_URL=redis://${rHost}:6379/0`r`nset DATABASE_URL=postgresql://rippy:rippy@${rHost}:5432/rippy`r`nset API_URL=http://${rHost}:8000`r`nset WORKER_NAME=$wName`r`nset RIPPY_TRAY_HOST=$rHost`r`nset RIPPY_SLOTS=$slots`r`nset TZ=UTC`r`n${mapZeile}set PATH=%~dp0;%PATH%`r`nstart `"`" venv\Scripts\pythonw.exe gui.py"
|
||||
Set-Content -Path "start-gui.bat" -Value $trayBat -Encoding ASCII
|
||||
|
||||
$workBat = "@echo off`r`ncd /d `"%~dp0`"`r`nset REDIS_URL=redis://${rHost}:6379/0`r`nset DATABASE_URL=postgresql://rippy:rippy@${rHost}:5432/rippy`r`nset API_URL=http://${rHost}:8000`r`nset WORKER_NAME=$wName`r`nset RIPPY_SLOTS=$slots`r`nset TZ=UTC`r`n${mapZeile}set PATH=%~dp0;%PATH%`r`nvenv\Scripts\celery.exe -A celery_app worker --loglevel=info -Q transcode $poolArg -n ${wName}@%%h"
|
||||
Set-Content -Path "start-worker.bat" -Value $workBat -Encoding ASCII
|
||||
@@ -565,9 +565,15 @@ if (-not `$schreibbar -and -not `$istAdmin) {
|
||||
}
|
||||
|
||||
# 1. Alles beenden, was aus diesem Ordner läuft (Tray, celery, HandBrake).
|
||||
Get-CimInstance Win32_Process | Where-Object {
|
||||
`$_.ExecutablePath -like "`$ordner*"
|
||||
} | ForEach-Object { Stop-Process -Id `$_.ProcessId -Force -ErrorAction SilentlyContinue }
|
||||
#
|
||||
# Der Tray-Prozess (pythonw.exe tray.py) kann mehrere Instanzen haben.
|
||||
# Wir filtern via WMI anhand der CommandLine.
|
||||
Get-WmiObject Win32_Process | Where-Object {
|
||||
`$_.ExecutablePath -like "`$PSScriptRoot*" -or `$_.CommandLine -like "*gui.py*" -or `$_.CommandLine -like "*tray.py*"
|
||||
} | ForEach-Object {
|
||||
Write-Host "Beende Worker-Prozess: PID `$(`$_.ProcessId) (`$(`$_.Name))"
|
||||
Stop-Process -Id `$_.ProcessId -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
Start-Sleep 3
|
||||
|
||||
# 2. Verknüpfungen entfernen — Autostart UND Desktop, jeweils an BEIDEN möglichen
|
||||
@@ -619,7 +625,7 @@ Start-Process cmd.exe -ArgumentList '/c timeout /t 4 /nobreak >nul & rd /s /q "'
|
||||
try {
|
||||
# Der Pfad zur .bat muss in Anführungszeichen, falls Leerzeichen drin sind.
|
||||
# schtasks erwartet diese Escaped-Anführungszeichen: \"C:\Pfad\...\"
|
||||
$aktion = "\`"$InstallDir\start-tray.bat\`""
|
||||
$aktion = "\`"$InstallDir\start-gui.bat\`""
|
||||
$process = Start-Process schtasks -ArgumentList "/create /tn `"RippyWorker`" /tr $aktion /sc ONLOGON /rl HIGHEST /f" -NoNewWindow -Wait -PassThru
|
||||
|
||||
if ($process.ExitCode -eq 0) {
|
||||
@@ -655,20 +661,18 @@ Start-Process cmd.exe -ArgumentList '/c timeout /t 4 /nobreak >nul & rd /s /q "'
|
||||
} else {
|
||||
[Environment]::GetFolderPath("Desktop")
|
||||
}
|
||||
$wsh = New-Object -ComObject WScript.Shell
|
||||
$lnk = $wsh.CreateShortcut((Join-Path $desktopDir "Rippy Worker.lnk"))
|
||||
$lnk.TargetPath = (Join-Path $InstallDir "start-tray.bat")
|
||||
$lnk.WorkingDirectory = $InstallDir
|
||||
$lnk.Description = "Rippy Encoding-Worker starten (Symbol neben der Uhr)"
|
||||
$lnk.WindowStyle = 7 # minimiert, damit die .bat nicht aufblitzt
|
||||
$ico = Join-Path $InstallDir "rippy.ico"
|
||||
if (Test-Path $ico) { $lnk.IconLocation = $ico }
|
||||
$lnk.Save()
|
||||
$wshell = New-Object -ComObject WScript.Shell
|
||||
$lnk = Join-Path $desktopDir "Rippy Worker.lnk"
|
||||
$sh = $wshell.CreateShortcut($lnk)
|
||||
$sh.TargetPath = Join-Path $InstallDir "start-gui.bat"
|
||||
$sh.WorkingDirectory = $InstallDir
|
||||
$sh.IconLocation = Join-Path $InstallDir "rippy.ico"
|
||||
$sh.Save()
|
||||
Log "Verknüpfung 'Rippy Worker' auf dem Desktop angelegt."
|
||||
} catch {
|
||||
Log "HINWEIS: Desktop-Verknüpfung ging nicht ($($_.Exception.Message))."
|
||||
Log " Der Worker ist trotzdem fertig — starten über"
|
||||
Log " $InstallDir\start-tray.bat"
|
||||
Log " $InstallDir\start-gui.bat"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -702,8 +706,8 @@ $btnMap.Add_Click({
|
||||
})
|
||||
$btnInstall.Add_Click({ Do-Install })
|
||||
$btnStart.Add_Click({
|
||||
Start-Process -FilePath (Join-Path $InstallDir "start-tray.bat") -WindowStyle Hidden
|
||||
[System.Windows.Forms.MessageBox]::Show("Worker gestartet - Symbol erscheint unten rechts neben der Uhr.", "Rippy")
|
||||
Start-Process -FilePath (Join-Path $InstallDir "start-gui.bat") -WindowStyle Hidden
|
||||
[System.Windows.Forms.MessageBox]::Show("Worker-Dashboard gestartet.", "Rippy")
|
||||
$form.Close()
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user