use strict; use Irssi; use Irssi::Irc; use vars qw($VERSION %IRSSI); $VERSION = "0.1"; %IRSSI = ( authors => "sogal", contact => "sogal\@member.fsf.org", name => "mocp", description => "A script that show others what MOC is currently playing", license => "GNU GPLv2 or later", changed => "Tue Mar 22 16:51:40 CET 2016" ); # Usage: # 1: load the script # 2: use /moc $ENV{'PATH'} = '/usr/bin'; sub do_getmocinfo { # set up variables my $song; my $outtext; # getting the info from mocp $song=`mocp -Q "%song par %artist sur %album"`; # setting up variables my ($data, $server, $witem) = @_; $outtext="ME "."écoute ".$song; # tell the worl what's your listening to if ($witem && ($witem->{type} eq "CHANNEL" || $witem->{type} eq "QUERY")) { $witem->command($outtext); } } # setting irssi environment Irssi::command_bind("moc", "do_getmocinfo"); print CLIENTCRAP "%B>>%n ".$IRSSI{name}." v".$VERSION." loaded... (command: /moc)";