improve webp-convert.sh
[scripts.git] / i3blocks-music.pl
index 2cebc3821f1bd8833030b67059e91afd75fd206c..ead4f4dbbb517140cc156f40ebc71421e47a1561 100755 (executable)
@@ -14,12 +14,12 @@ if ($ARGV[0] =~ "--player=") {
 }
 
 # Check playback status and set appropriate colour
-$_ = qx(playerctl status);
+$_ = qx(playerctl $player_arg status);
 if (not m/Playing/) {
-  print("<span color='#586e75'>");
+  print("<span color='#586e75'>♪ ");
 }
 else {
- print("<span>");
+ print("<span>♪ ");
 }
 
 # Obtain & format metadata from playerctl
@@ -28,12 +28,12 @@ push(@metadata, $artist) if $artist;
 
 my $title = qx(playerctl $player_arg metadata title);
 $title =~ s/(\s|\s\()[Ff]([et]at[. ].*|t.*)//;
-$title =~ s/((\s(\(|\[).+(\)|\]).+)|(\s-\s.+))+//;
-$title =~ s/&/&amp;/;   # fix ampersand rendering for i3bar
+$title =~ s/((\s(\(|\[).+(\)|\]).*)|(\s-\s.+))//;
 push(@metadata, $title) if $title;
 
 for (@metadata){
   s/\n//;   # remove newlines
+  s/&/&amp;/;   # fix ampersand rendering for i3bar
 }
 
 # Print stuff