fix parenthesis detection in i3blocks-music
[scripts.git] / i3blocks-music.pl
index 6a8cc72faef33b47c0aafcca39358a744667528e..2cebc3821f1bd8833030b67059e91afd75fd206c 100755 (executable)
@@ -28,8 +28,14 @@ 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/&/&/;   # fix ampersand rendering for i3bar
 push(@metadata, $title) if $title;
 
+for (@metadata){
+  s/\n//;   # remove newlines
+}
+
 # Print stuff
 print(join(" - ", @metadata)) if @metadata;
 print("</span>");