summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMikkel Kroman2014-08-20 04:26:42 +0200
committerMikkel Kroman2014-08-20 04:26:42 +0200
commitb632543e79f033c7cde7a46bae0ff93f0c690a4c (patch)
treed6a559dfc26d50fbfc13345bed85ecb6857ceb62
parent01de4a72e9103e8087bd5fdf7bb42ce4b7f8f9ab (diff)
downloadscripts.irssi.org-b632543e79f033c7cde7a46bae0ff93f0c690a4c.tar.bz2
Add bitrate and volume format directives
-rw-r--r--_data/scripts.yaml8
-rw-r--r--scripts/mpd.pl15
2 files changed, 16 insertions, 7 deletions
diff --git a/_data/scripts.yaml b/_data/scripts.yaml
index 3303db7..d79a183 100644
--- a/_data/scripts.yaml
+++ b/_data/scripts.yaml
@@ -2396,15 +2396,15 @@
url: "http://wouter.coekaerts.be/irssi/"
version: "1.0.0"
-- 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"
description: "print the song you are listening to"
filename: "mpd.pl"
- modified: "2014-08-09 13:19:26"
+ modified: "2014-08-20 04:23:10"
license: "GPLv2"
modules: "IO::Socket"
name: "mpd"
- version: "0.6"
+ version: "0.7"
- authors: "Ricardo Mesquita"
contact: "ricardomesquita@netcabo.pt"
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")) {