i3blocks-music.pl: remove line breaks and punctation-delimited postambles
[scripts.git] / i3blocks-music.pl
index 4d6ab2734744e8e9261967a8af70783adddb78c1..62e3a16ec0d46333dba4a1eeb822a96e15e53607 100755 (executable)
@@ -27,9 +27,15 @@ my $artist = qx(playerctl $player_arg metadata artist);
 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\()[Ff]([et]at[. ].*|t.*)//;
+$title =~ s/(\s\(.+\) *|\s-\s.+)//;
+$title =~ s/&/&/;
 push(@metadata, $title) if $title;
 
+for (@metadata){
+  s/\n//;
+}
+
 # Print stuff
 print(join(" - ", @metadata)) if @metadata;
 print("</span>");