summaryrefslogtreecommitdiffstats
path: root/scripts/mpd.pl
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/mpd.pl')
-rw-r--r--scripts/mpd.pl15
1 files changed, 12 insertions, 3 deletions
diff --git a/scripts/mpd.pl b/scripts/mpd.pl
index e0f8453..789bdaf 100644
--- a/scripts/mpd.pl
+++ b/scripts/mpd.pl
@@ -30,6 +30,7 @@
# Some minor changes #
# 0.6: Added some more format directives(time, album) #
# Added support for password authentication #
+# 0.7: Added format directives for bitrate and volume #
#######################################################################
use strict;
@@ -38,11 +39,11 @@ use Irssi;
use vars qw{$VERSION %IRSSI %MPD};
-$VERSION = "0.6";
+$VERSION = "0.7";
%IRSSI = (
name => 'mpd',
- authors => 'Erik Scharwaechter, Tobias Böhm',
- contact => 'diozaka@gmx.de, code@aibor.de',
+ authors => 'Erik Scharwaechter, Tobias Böhm, Mikkel Kroman',
+ contact => 'diozaka@gmx.de, code@aibor.de, mk@maero.dk',
license => 'GPLv2',
description => 'print the song you are listening to',
);
@@ -109,6 +110,8 @@ sub np {
$MPD{'filename'} = "";
$MPD{'elapsed'} = "";
$MPD{'total'} = "";
+ $MPD{'volume'} = "";
+ $MPD{'bitrate'} = "";
my $ans = "";
my $str = "";
@@ -125,6 +128,10 @@ sub np {
} elsif ($ans =~ /^time: (\d+):(\d+)$/) {
$MPD{'elapsed'} = sprintf("%01d:%02d", $1/60,$1%60);
$MPD{'total'} = sprintf("%01d:%02d", $2/60,$2%60);
+ } elsif ($ans =~ /^volume: (\d+)$/) {
+ $MPD{'volume'} = $1
+ } elsif ($ans =~ /^bitrate: (\d+)$/) {
+ $MPD{'bitrate'} = $1
}
}
@@ -165,6 +172,8 @@ sub np {
$str =~ s/\%FILENAME/$MPD{'filename'}/g;
$str =~ s/\%ELAPSED/$MPD{'elapsed'}/g;
$str =~ s/\%TOTAL/$MPD{'total'}/g;
+ $str =~ s/\%BITRATE/$MPD{'bitrate'}/g;
+ $str =~ s/\%VOLUME/$MPD{'volume'}/g;
if ($witem && ($witem->{type} eq "CHANNEL" ||
$witem->{type} eq "QUERY")) {