Skip to content

Instantly share code, notes, and snippets.

@joshooaj
Created September 4, 2025 19:09
Show Gist options
  • Select an option

  • Save joshooaj/3c0eff42bea83141e4a2eae5e5775833 to your computer and use it in GitHub Desktop.

Select an option

Save joshooaj/3c0eff42bea83141e4a2eae5e5775833 to your computer and use it in GitHub Desktop.
Generate "Best Of Decade" smart playlists for Navidrome
param(
[Parameter()]
[int]
$MinYear = 1960,
[Parameter()]
[int]
$MaxYear = 2020,
[Parameter()]
[int]
$MinRating = 4,
[Parameter()]
[int]
$Limit = 1000,
[Parameter()]
[string[]]
$IgnoreGenre = @('Ambient', 'Electronic', 'Comedy'),
[Parameter()]
[string]
$Destination = '/mnt/library/'
)
foreach ($decade in $Min..$Max | Where-Object { $_ % 10 -eq 0 }) {
$playlist = [pscustomobject]@{
name = "Best of $decade's"
comment = "Music from the $decade's with at least a $MinRating-star rating"
sort = "year"
limit = $Limit
all = @(
[pscustomobject]@{
gt = [pscustomobject]@{
year = $decade - 1
}
},
[pscustomobject]@{
lt = [pscustomobject]@{
year = $decade + 10
}
},
[pscustomobject]@{
gt = [pscustomobject]@{
mbrating = 4
}
}
)
}
foreach ($genre in $IgnoreGenre) {
$playlist.all += [pscustomobject]@{
notcontains = [pscustomobject]@{
genre = $genre
}
}
}
$playlist | ConvertTo-Json -Depth 5 -Compress | Set-Content -Path (Join-Path $Destination "playlist_Best-of-$($decade)s.nsp")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment