Navigation Menu

Skip to content

Commit

Permalink
Get the currently playing song title
Browse files Browse the repository at this point in the history
  • Loading branch information
tsibley committed Mar 7, 2013
1 parent eed3a99 commit 056ab8a
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
22 changes: 22 additions & 0 deletions 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.";
}
6 changes: 5 additions & 1 deletion stream
Expand Up @@ -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
;;
*)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 056ab8a

Please sign in to comment.