From: Andrew Lorimer Date: Thu, 6 Jun 2019 05:31:33 +0000 (+1000) Subject: fix parenthesis detection in i3blocks-music X-Git-Url: https://git.lorimer.id.au/scripts.git/diff_plain/c34acdcebab3532929655f9c08ebb2e706bb8635?ds=sidebyside;hp=-c fix parenthesis detection in i3blocks-music --- c34acdcebab3532929655f9c08ebb2e706bb8635 diff --git a/i3blocks-music.pl b/i3blocks-music.pl index 62e3a16..2cebc38 100755 --- a/i3blocks-music.pl +++ b/i3blocks-music.pl @@ -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/&/&/; +$title =~ s/((\s(\(|\[).+(\)|\]).+)|(\s-\s.+))+//; +$title =~ s/&/&/; # fix ampersand rendering for i3bar push(@metadata, $title) if $title; for (@metadata){ - s/\n//; + s/\n//; # remove newlines } # Print stuff