Various changes/updates
[videoscripts/.git] / homevideo_random.pl
diff --git a/homevideo_random.pl b/homevideo_random.pl
new file mode 100755 (executable)
index 0000000..4e5a81a
--- /dev/null
@@ -0,0 +1,16 @@
+#!/usr/bin/perl
+
+use List::Util 'shuffle';
+
+my $dir = "/naspool/videos/HomeVideos";
+my $plsfile = "$dir/Random.pls";
+my $avifiles = "????/????-??-??.avi";
+
+chdir $dir || die "Couldn't change directory!\n";
+system "rm -f $plsfile";
+@files = `ls -1 $avifiles`;
+@shuffled = shuffle(@files);
+open (FILE, ">$plsfile") || die "Couldn't open $plsfile!\n";
+print FILE @shuffled;
+close (FILE);
+