rendered paste bodyuse Irssi;
use Irssi::TextUI;
use vars qw($VERSION %IRSSI);
$VERSION = '0.1';
%IRSSI = (
description => 'Quod Libet now playing script, LaTeX look.',
changed => '20:10EST Saturday 04/11/06',
);
sub get_info {
open (FILE, '/home/ryan/.quodlibet/current') or die();
@all = <FILE>;
close (FILE);
my ($data, $server, $witem) = @_;
@artist = grep (/artist/, @all);
@title = grep (/title/, @all);
@format = grep (/format/, @all);
@bitrate = grep(/bitrate/, @all);
$artist = $artist[0];
$title = $title[0];
$format = $format[0];
$bitrate = $bitrate[0];
$artist =~ s/artist=//;
$title =~ s/title=//;
$format =~ s/~format=//;
$bitrate =~ s/~#bitrate=//;
$artist =~ s/\n//;
$title =~ s/\n//;
$format =~ s/\n//;
$bitrate = int($bitrate / 1024);
$bitrate .= "kbps";
if($witem && ($witem->{type} eq "CHANNEL" || $witem->{type} eq "QUERY")){
if($bitrate eq "0kbps") {
$witem->command("ME \0037\\np\0036[$format]{$artist\ -\ $title}");
}
else {
$witem->command("ME \0037\\np\0036[$format,\ $bitrate]{$artist\ -\ $title}");
}
}
}
Irssi::command_bind('amp', 'get_info');