diff --git a/README.md b/README.md index 5519c8b..c3754f1 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,11 @@ -# useful-scripts +# Useful scripts +This repository contains some of the scripts I use on a frequent basis. +Run these at your own risk! + +## Format + +Make sure the script contains the following tag: +```md +# Description: +``` \ No newline at end of file diff --git a/clear-spotify-cache.ps1 b/clear-spotify-cache.ps1 new file mode 100644 index 0000000..1070897 --- /dev/null +++ b/clear-spotify-cache.ps1 @@ -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" +}