Skip to content

Instantly share code, notes, and snippets.

@blackknight36
Created April 6, 2016 14:04
Show Gist options
  • Save blackknight36/9bd500ee2ca01d02a60d4b477bd27a0e to your computer and use it in GitHub Desktop.
Save blackknight36/9bd500ee2ca01d02a60d4b477bd27a0e to your computer and use it in GitHub Desktop.
#!/usr/bin/perl
use strict;
use List::Util qw(shuffle);
my $cmd = "find \"/home/music\" -type f";
my @files = `$cmd`;
my @songs = shuffle @files;
open(LIST, ">", "/var/tmp/rand_playlist.m3u");
foreach my $song (@songs) {
next unless ($song =~ m/\.mp3$/) or ($song =~ m/\.ogg$/);
print LIST $song;
}
close(LIST);
system("audacious /tmp/rand_playlist.m3u &");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment