From 9511cadd7e959f7cdb3e87d4f58b7daa995a5384 Mon Sep 17 00:00:00 2001 From: aonemd Date: Fri, 30 Mar 2018 18:51:38 +0200 Subject: [PATCH] Fix cmus indicator trimming last chars of artist or song name --- components/cmus.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/cmus.go b/components/cmus.go index ec9d6d8..79e2f7f 100644 --- a/components/cmus.go +++ b/components/cmus.go @@ -16,8 +16,8 @@ func main() { artistPattern, _ := regexp.Compile("tag artist .*") titlePattern, _ := regexp.Compile("tag title .*") - artist := strings.Trim(artistPattern.FindString(string(response)), "tag artist") - title := strings.Trim(titlePattern.FindString(string(response)), "tag title") + artist := strings.TrimPrefix(artistPattern.FindString(string(response)), "tag artist ") + title := strings.TrimPrefix(titlePattern.FindString(string(response)), "tag title ") if artist != "" && title != "" { fmt.Println(fmt.Sprintf(" %s - %s", artist, title))