Created
September 4, 2025 19:09
-
-
Save joshooaj/3c0eff42bea83141e4a2eae5e5775833 to your computer and use it in GitHub Desktop.
Generate "Best Of Decade" smart playlists for Navidrome
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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