Created
April 6, 2016 14:04
-
-
Save blackknight36/9bd500ee2ca01d02a60d4b477bd27a0e to your computer and use it in GitHub Desktop.
This file contains 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
#!/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