Files
pgsql-jellyfin/docs/POWERSHELL_SCRIPT_FIXED.md
T
wjones 7eb2b445cb Postgres perf, path migration, and shutdown race fixes
- 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.
2026-03-05 08:56:42 -05:00

106 lines
2.5 KiB
Markdown

# ✅ PowerShell Script Fixed!
## Problem
The original `Fix-JellyfinPaths.ps1` had PowerShell syntax errors:
1. **Line 179**: XPath expression with variable interpolation caused parsing issues
2. **Line 213**: String terminator problem with nested quotes
## Solution
Created a new, corrected script: **`FixJellyfinPaths.ps1`** (no hyphen)
## What Was Fixed
### 1. XPath Query Issue
**Before (broken):**
```powershell
$element = $xml.SelectSingleNode("//*[text()='$($path.CurrentValue)']")
```
**After (fixed):**
```powershell
$element = $null
$xml.SelectNodes("//*") | ForEach-Object {
if ($_.InnerText -eq $path.CurrentValue) {
$element = $_
}
}
```
This avoids XPath quote escaping issues by using direct comparison instead.
### 2. String Interpolation Issue
**Before (broken):**
```powershell
Write-Host "3. If issues persist, review backups in: $ConfigPath" -ForegroundColor White
```
**After (fixed):**
```powershell
$configInfo = "3. If issues persist, review backups in: $ConfigPath"
Write-Host $configInfo -ForegroundColor White
```
Separated the string building from the Write-Host call to avoid parsing ambiguity.
## How to Use
### Check for issues (dry run):
```powershell
.\FixJellyfinPaths.ps1 -DryRun
```
### Apply fixes:
```powershell
.\FixJellyfinPaths.ps1
```
### Apply without confirmation:
```powershell
.\FixJellyfinPaths.ps1 -Force
```
### Custom paths:
```powershell
.\FixJellyfinPaths.ps1 -ConfigPath "D:\Jellyfin\config" -DataPath "D:\Jellyfin\data"
```
## What It Does
1. **Scans** these config files:
- `system.xml`
- `encoding.xml`
- `database.xml`
2. **Finds** any paths starting with:
- `/var/`
- `/usr/`
- `/etc/`
3. **Fixes** them by:
- Clearing `MetadataPath` and `TranscodingTempPath` (uses defaults)
- Converting other Linux paths to Windows equivalents
4. **Creates backups** before making any changes
## Testing
Script tested and verified to parse correctly:
```
✓ No PowerShell syntax errors
✓ Handles non-existent paths gracefully
✓ Dry-run mode works correctly
```
## Files Updated
-`FixJellyfinPaths.ps1` - New corrected script
-`LINUX_PATH_ISSUE_SUMMARY.md` - Updated to reference new script name
-`FIX_SYSTEM_XML_PATHS.md` - Updated to reference new script name
-`Fix-JellyfinPaths.ps1` - Old broken script (can be deleted)
## Next Steps
1. Run the script with `-DryRun` to see what would be changed
2. If it looks correct, run without `-DryRun` to apply fixes
3. Restart Jellyfin
4. Check logs to verify paths are now correct