#!/usr/bin/perl
#
# Josef Kufner <jk@myserver.cz>
#

$debug = 0;
$mpc = 'mpc';

$track = "";

sub dbgmsg {
	if ($debug) {
		for (@_) {
			print $_;
		}
	}
};


open(STAT, "$mpc |") or die "Can't run \"$mpc\": $!";
while (<STAT>) {
	dbgmsg "read:  $_";
	if (/^\[[^\]]*\] #(\d*)\/\d*/) {
		dbgmsg "found: $1\n";
		$track = $1;
	}
}
close STAT;

if ($track != "") {
	system "$mpc del $track";
}

