sub cmd_music {
# call last track from database with sql query: select * from music order by id desc limit 1;
my $current_mp3=`psql -tc "select music from music order by id desc limit 1;"`;
my ($data, $server, $witem) = @_;
if (!$server) {
Irssi::print('You are not connected to a server.');
return;
}
if ($witem && ($witem->{type} eq "CHANNEL" || $witem->{type} eq "QUERY")) {
$witem->command('me Now playing: '.$current_mp3);
} else
{
Irssi::print('Can not message this window.');
return;
}
}