🎧 Your Personal Streaming Service
Go airsonicmadsonicmedia-servermusicmusic-servernavidromeopensubsonicraspberry-piself-hostedstreamerstreaming-apistreaming-audiosubsonicsubsonic-server
Initialize Index Groups regex just once
Deluan939f3eee97f6
diff --git a/utils/index_group_parser.go b/utils/index_group_parser.goindex 76a407646..714062334 100644--- a/utils/index_group_parser.go+++ b/utils/index_group_parser.go@@ -18,12 +18,14 @@ type IndexGroups map[string]string// for grouping accented characters (such as A, \u00C0 and \u00C1)//// Files and folders that are not covered by an index entry will be placed under the index entry "#".++var indexGroupsRx = regexp.MustCompile(`(.+)\((.+)\)`)+func ParseIndexGroups(spec string) IndexGroups {parsed := make(IndexGroups)split := strings.Split(spec, " ")- re := regexp.MustCompile(`(.+)\((.+)\)`)for _, g := range split {- sub := re.FindStringSubmatch(g)+ sub := indexGroupsRx.FindStringSubmatch(g)if len(sub) > 0 {i := 0chars := strings.Split(sub[2], "")