diff --git a/soundbridge-whois b/soundbridge-whois new file mode 100755 index 0000000..bc62bb4 --- /dev/null +++ b/soundbridge-whois @@ -0,0 +1,22 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use open qw/ :utf8 :std /; +use utf8; +use feature qw/ say /; + +use Soundbridge; + +my $sb = Soundbridge->new; +my $volume = shift @ARGV; + +# Suppress warnings about errors when the device is off +$sb->log_level(0); + +my ($title) = grep { s/^title: +// } $sb->get("CurrentSongInfo"); + +if (defined $title and length $title) { + say "🎶 $title"; +} else { + say "🔇 Not playing."; +} diff --git a/stream b/stream index 80a6260..9bb0235 100755 --- a/stream +++ b/stream @@ -4,7 +4,7 @@ shift src=${1:-spotify} case "$dst" in - preset|from|vol|power) + preset|from|vol|power|whois) # These take arguments other than pulseaudio input sinks ;; *) @@ -45,6 +45,10 @@ case "$dst" in soundbridge-volume "$@" exit ;; + whois) + soundbridge-whois + exit + ;; alsa|local|hw|off|stop) move_to_sink 0 gconftool -s --type bool /system/pulseaudio/modules/raop-discover/enabled false