7eb2b445cb
- Major query performance boost: replaced correlated subqueries with DistinctBy() in BaseItemRepository, added episode deduplication index, and increased default command timeout to 120s. - Fixed LibraryMonitor shutdown race: added disposal checks and exception handling in FileRefresher to prevent ObjectDisposedException. - Added PowerShell and SQL utilities for fixing Linux paths in config files and database; new scripts for WebDir and path migration. - Auto-fix for WebDir in startup.json on load; new helper scripts and docs. - Added automated weekly DB performance monitoring scripts and reporting. - Expanded documentation and README for all fixes, scripts, and migration steps. - Updated SQL scripts for index creation and diagnostics; improved output handling. - Updated db-config defaults and added new diagnostic/report files.
84 lines
3.0 KiB
PowerShell
84 lines
3.0 KiB
PowerShell
# Fix startup.json WebDir paths
|
|
# This script finds and fixes incorrect WebDir paths in startup.json files
|
|
|
|
Write-Host "=================================================" -ForegroundColor Cyan
|
|
Write-Host "Jellyfin startup.json WebDir Fixer" -ForegroundColor Cyan
|
|
Write-Host "=================================================" -ForegroundColor Cyan
|
|
Write-Host ""
|
|
|
|
$searchPaths = @(
|
|
".",
|
|
".\bin\Debug\net11.0",
|
|
".\bin\Release\net11.0",
|
|
".\bin\Debug\net11.0\config",
|
|
".\bin\Release\net11.0\config"
|
|
)
|
|
|
|
$filesFound = 0
|
|
$filesFixed = 0
|
|
|
|
foreach ($path in $searchPaths) {
|
|
$jsonPath = Join-Path $path "startup.json"
|
|
|
|
if (Test-Path $jsonPath) {
|
|
$filesFound++
|
|
Write-Host "Found: $jsonPath" -ForegroundColor Yellow
|
|
|
|
try {
|
|
$content = Get-Content $jsonPath -Raw
|
|
$originalContent = $content
|
|
|
|
# Check for incorrect WebDir
|
|
if ($content -match '"WebDir":\s*"[^"]*C:/ProgramData/jellyfin/wwwroot[^"]*"') {
|
|
Write-Host " Status: Has incorrect WebDir path" -ForegroundColor Red
|
|
|
|
# Create backup
|
|
$backupPath = "$jsonPath.backup.$(Get-Date -Format 'yyyyMMdd_HHmmss')"
|
|
Copy-Item $jsonPath $backupPath
|
|
Write-Host " Backup: $backupPath" -ForegroundColor Gray
|
|
|
|
# Fix the path
|
|
$content = $content -replace '"WebDir":\s*"C:/ProgramData/jellyfin/wwwroot"', '"WebDir": "wwwroot"'
|
|
|
|
# Also fix any data path if it has /data appended
|
|
$content = $content -replace '"WebDir":\s*"C:/ProgramData/jellyfin/data/wwwroot"', '"WebDir": "wwwroot"'
|
|
|
|
Set-Content -Path $jsonPath -Value $content -NoNewline
|
|
$filesFixed++
|
|
|
|
Write-Host " Result: FIXED!" -ForegroundColor Green
|
|
}
|
|
elseif ($content -match '"WebDir":\s*"wwwroot"') {
|
|
Write-Host " Status: Already correct (relative path)" -ForegroundColor Green
|
|
}
|
|
else {
|
|
Write-Host " Status: Has custom path (not changed)" -ForegroundColor Cyan
|
|
}
|
|
}
|
|
catch {
|
|
Write-Host " ERROR: Failed to process - $_" -ForegroundColor Red
|
|
}
|
|
|
|
Write-Host ""
|
|
}
|
|
}
|
|
|
|
Write-Host "=================================================" -ForegroundColor Cyan
|
|
|
|
if ($filesFound -eq 0) {
|
|
Write-Host "No startup.json files found." -ForegroundColor Yellow
|
|
Write-Host "Run Jellyfin once to create the configuration file." -ForegroundColor White
|
|
}
|
|
elseif ($filesFixed -eq 0) {
|
|
Write-Host "All files are already correct!" -ForegroundColor Green
|
|
}
|
|
else {
|
|
Write-Host "Fixed $filesFixed of $filesFound file(s)" -ForegroundColor Green
|
|
Write-Host ""
|
|
Write-Host "Next steps:" -ForegroundColor Yellow
|
|
Write-Host "1. Rebuild your solution (if needed)" -ForegroundColor White
|
|
Write-Host "2. Run Jellyfin to verify WebDir path is correct" -ForegroundColor White
|
|
}
|
|
|
|
Write-Host ""
|