Add README and initial script for clearing Spotify cache
This commit is contained in:
11
README.md
11
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:
|
||||||
|
```
|
||||||
27
clear-spotify-cache.ps1
Normal file
27
clear-spotify-cache.ps1
Normal 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"
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user