Advertisement
tm512

Untitled

Jun 16th, 2012
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.58 KB | None | 0 0
  1. use Irssi;
  2. use Irssi::Irc;
  3.  
  4. %IRSSI = (
  5.     authors => "tm512",
  6.     contact => "no",
  7.     name => "np",
  8.     description => "Now playing script for mpd",
  9.     license => "wtfpl",
  10.     url => "underhalls.net",
  11. );
  12.  
  13. sub cmd_np
  14. {
  15.     my $mpc_out = `mpc`;
  16.     my @mpc_lines = split (/\n/, $mpc_out);
  17.     my ($data, $server, $witem) = @_;
  18.  
  19.     if ($#mpc_lines == 0)
  20.     {  
  21.         $witem->command ("ME \0034np:\003 \0035[stopped]");
  22.     }  
  23.     else
  24.     {  
  25.         $witem->command ("ME \002\0033np: \002".$mpc_lines[0]);
  26.     }  
  27. }
  28.  
  29. Irssi::command_bind ('np', 'cmd_np');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement