Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Get the currently playing song title
- Loading branch information
Showing
2 changed files
with
27 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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."; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters