# (C) 2008 by Philipp Winter (Mail: 0x9617D5D3) # Released under the GPLv3 # # $Id: np.pl 5 2008-08-23 09:17:14Z pwr $ # use Irssi; use strict; use vars qw($VERSION %IRSSI); $VERSION = '0.1'; %IRSSI = ( authors => 'Philipp Winter', contact => 'pwr@7c0.org', name => 'now_playing', description => 'Prints current song which is played by AmaroK', license => 'GPLv3', ); print 'now_playing script loaded...'; sub now_playing { my ($data, $server, $witem) = @_; my $playing = `/usr/bin/dcop amarok player nowPlaying 2>/dev/null`; if ($? == 0) { chomp $playing; if ($witem) { $witem->command('ME plays: '.$playing); } else { Irssi::print('No active channel or query in this window...'); } } else { Irssi::print('Unable to contact dcop server...'); } } Irssi::command_bind('np', 'now_playing');