commit:3d39b148f0bbe3e6578ded3b79221acb0eae1f38
author:Chip Black
committer:Chip Black
date:Wed Oct 1 04:39:25 2008 -0500
parents:814e83d6119554339c8eb0fa27b3e8e490859e46
Created 'omake' directory for extra useful things.  Added ut-party-add,
which shuffles new songs into a party mix.
diff --git a/omake/shuffle b/omake/shuffle
line changes: +9/-0
index 0000000..1247ad3
--- /dev/null
+++ b/omake/shuffle
@@ -0,0 +1,9 @@
+#!/usr/bin/perl
+# Shuffle stdin. Like 'sort', but not. :)
+# Solution shamelessly stolen from http://www.perlmonks.org/?node_id=625977
+# If you read that article, you may want to first lay down plastic
+# sheets with which to capture the exploded pieces of your brain.
+
+push @a, $_ while <STDIN>;
+@x = 0..$#a;
+print @a[map splice(@x, rand @x, 1), @x];

diff --git a/omake/ut-party-add b/omake/ut-party-add
line changes: +39/-0
index 0000000..f034d10
--- /dev/null
+++ b/omake/ut-party-add
@@ -0,0 +1,39 @@
+#!/usr/bin/perl
+use POSIX qw(:signal_h);
+use strict;
+
+my $uthome = "$ENV{HOME}/.utunes";
+
+open PID, "$uthome/pid";
+chomp(my $pid = <PID>);
+close PID;
+
+open CURRENT, "$uthome/current";
+my $current = <CURRENT> + 0;
+close CURRENT;
+
+open PLAYLIST, "$uthome/playlist";
+scalar <PLAYLIST> while $current--;
+my $current = <PLAYLIST>;
+
+open NEWPLAYLIST, ">$uthome/playlist.new";
+print NEWPLAYLIST $current;
+close NEWPLAYLIST;
+
+open NEWPLAYLIST, "| shuffle >>$uthome/playlist.new";
+print NEWPLAYLIST while <PLAYLIST>;
+print NEWPLAYLIST while <STDIN>;
+close NEWPLAYLIST;
+
+close PLAYLIST;
+
+rename "$uthome/playlist.new", "$uthome/playlist";
+
+open CURRENT, ">$uthome/current";
+print CURRENT "0 $current\n";
+close CURRENT;
+
+if ($pid) {
+	print "$pid\n";
+	kill SIGUSR1, $pid;
+}

diff --git a/shuffle b/shuffle
line changes: +0/-9
index 1247ad3..0000000
--- a/shuffle
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/usr/bin/perl
-# Shuffle stdin. Like 'sort', but not. :)
-# Solution shamelessly stolen from http://www.perlmonks.org/?node_id=625977
-# If you read that article, you may want to first lay down plastic
-# sheets with which to capture the exploded pieces of your brain.
-
-push @a, $_ while <STDIN>;
-@x = 0..$#a;
-print @a[map splice(@x, rand @x, 1), @x];