fix parenthesis detection in i3blocks-music
authorAndrew Lorimer <andrew@lorimer.id.au>
Thu, 6 Jun 2019 05:31:33 +0000 (15:31 +1000)
committerAndrew Lorimer <andrew@lorimer.id.au>
Thu, 6 Jun 2019 05:31:33 +0000 (15:31 +1000)
i3blocks-music.pl
index 62e3a16ec0d46333dba4a1eeb822a96e15e53607..2cebc3821f1bd8833030b67059e91afd75fd206c 100755 (executable)
@@ -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;/;
+$title =~ s/((\s(\(|\[).+(\)|\]).+)|(\s-\s.+))+//;
+$title =~ s/&/&amp;/;   # fix ampersand rendering for i3bar
 push(@metadata, $title) if $title;
 
 for (@metadata){
-  s/\n//;
+  s/\n//;   # remove newlines
 }
 
 # Print stuff