I want to create a random playlist for my entire music collection of 90,000 tracks. - i.e.generate a single m3u playlist containing every mp3 in every subfolder of my music folder, and present the list in random order. Any suggestions for how I can do that?
1 Answer
First, set up the list (you only need to do this when you add/delete files) :
find Music -type f -print >files.list
wc -l files.list >files.list.nlines
Then, to pick a random one,
line_number=$(echo "$(cat files.list.nlines) * $RANDOM / 32767" | bc -q)
file_to_play="$(sed -n ${line_number}p files.list)"
-
Thanks. The first command works well, but generates a list of all files - how would I adapt it to list just the mp3's? I can't get the 2nd command to work. When I run it I get a ">" prompt. Is there a syntax error? Feb 4, 2019 at 23:44
-
-
-
-