Shuffle/Random Songs - my Solution

Hi
I have a Library with +300k Songs. I often listen to it in random mode, but the randomize from roon is not was I excepted.
Everytime when I start shuffle I have a few albums where a few songs comes for sure. Sometimes 2 or 3 from the same album within 2 hours.

So I thought about it, and here is my solution. I wrote a powershell script where extract a random playlist every night, which is really :slight_smile: shuffled trough my library.

In words it works like this:

Once in amonth it dumps all Files from my library in a file.
Every night 500 Lines from the big File (70MB in my case) are dumped into a playlist where Roon can automatically import.

The script look like this:

$Input = "\\ServerName\Path\"
$AllMusic = "\\ServerName\Path\playlists\AllMusicFiles.txt"
$RandomMusic = "\\ServerName\Path\playlists\Random.m3u"

#First day of month dump your Library in a File   
if  ((Get-Date).Day -eq "1")
{
 get-childitem $Input -Exclude *.txt, *.log, *.bmp, *.jpg, *.png, *.cue -Recurse -File |  `
 ForEach-Object {$_ -replace "\\\\ServerName\\Path", ".." } | `
 Out-File -filepath $AllMusic
}

Get-Random -InputObject (get-content $AllMusic) -Count 500 | Out-File -FilePath $RandomMusic

The Script is running every night and generate a new Playlist with 500 random songs.

btw, the line ForEach-Object {$_ -replace β€œ\\ServerName\Path”, β€œβ€¦β€ } doing this with your File:
Input: \\ServerName\Path\Artist\musicfile.flac
Output: …\Artist\musicfile.flac

4 Likes