#!/usr/bin/perl -w # # xmms_automute # http://warped.org/linux/mute_commercials_online_radio_xmms.html # # Max Baker 2/28/08 # # For use by XMMS Song Change plugin # # Requires: # Patched version of xmms (see http: # AUMIX program # # Assumes: # - Using PCM (-w) channel my $song = shift @ARGV; $log = $ENV{HOME} . "/.xmms_song.log"; push @re, qr/php web-developer/i; # Add more songs here with regular expressions #push @re, qr/search string/i; #push @re, qr/search string/i; #push @re, qr/search string/i; $match = 0; foreach my $r (@re) { if ($song =~ $r) { $match++; last; } } # get current volume $current = `aumix -w q`; chomp $current; # pcm 35, 35 $current =~ s/^.*pcm\s+(\d+).*$/$1/; if ($match) { # add, mute system("aumix -w 0"); } else { # not an ad # unmute if needed if ($current == 0) { # Change 35 to your default volume of choice system("aumix -w 35"); } } open (L, ">> $log") or die "Can't open $log. $!\n"; print L "$song $match $current\n"; close L or die;