use strict;
use Irssi;
use vars qw($VERSION %IRSSI);
$VERSION = '1.0';
%IRSSI = (
authors => 'Aurimas',
contact => 'aurimas.d\@gmail.com',
name => 'Now Playing script using audtool for audacious',
description => 'Returns what audacious is currently playing',
license => 'Public Domain',
url => 'http://dont.have.yet.sorry',
changed => 'Sat Dec 9 19:45 EEST 2006',
commands => '/np',
note => 'Make sure audacious is running!',
);
sub cmd_np {
my $title = `audtool current-song`;
my $elapsed = `audtool current-song-output-length`;
my $length = `audtool current-song-length`;
my $status = `audtool playback-status`;
chomp( $title, $elapsed, $length, $status );
if ( $title =~ /audtool: audacious server is not running!/ ) {
Irssi::print "Audacious server is not running!";
}
if ( $status =~ /playing/ ) {
my $output = "np: $title [$elapsed/$length]";
Irssi::active_win()->command( 'say ' . $output );
}
else {
Irssi::print "Audacious is $status";
}
}
Irssi::command_bind( 'np', 'cmd_np' );
|