Add README and initial script for clearing Spotify cache

This commit is contained in:
2025-05-05 17:20:05 +02:00
parent f335aa4e29
commit f8341181c2
2 changed files with 37 additions and 1 deletions

27
clear-spotify-cache.ps1 Normal file
View File

@@ -0,0 +1,27 @@
# Description: This script fixes Spotify playlist caching issues.
# get spotify path - might be different, i installed thru ms store
$spotifyBasePath = Join-Path $env:LOCALAPPDATA "Packages\SpotifyAB.SpotifyMusic_zpdnekdrzrea0\LocalState\Spotify\Users"
if (Test-Path $spotifyBasePath) {
# i had multiple users, loop thru all of them
$userDirs = Get-ChildItem -Path $spotifyBasePath -Directory -Filter "*-user"
foreach ($userDir in $userDirs) {
# primary.ldb is a folder, not a file for some reason
$ldbPath = Join-Path $userDir.FullName "primary.ldb"
if (Test-Path $ldbPath -PathType Container) {
try {
Remove-Item -Path $ldbPath -Recurse -Force
Write-Host "Deleted: $ldbPath"
} catch {
Write-Warning "Failed to delete $ldbPath: $_"
}
} else {
Write-Host "No primary.ldb folder found at $ldbPath"
}
}
} else {
Write-Warning "Spotify user directory not found at $spotifyBasePath"
}