From d91b5e8f4daeae4ee9070b5672398aeed09ea419 Mon Sep 17 00:00:00 2001 From: Deluan Date: Mon, 23 Mar 2026 11:39:52 -0400 Subject: [PATCH] refactor: simplify playlist name extraction using strings.CutPrefix --- core/playlists/parse_m3u.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/playlists/parse_m3u.go b/core/playlists/parse_m3u.go index 97ed7df6..b9f5c92a 100644 --- a/core/playlists/parse_m3u.go +++ b/core/playlists/parse_m3u.go @@ -31,8 +31,8 @@ func (s *playlists) parseM3U(ctx context.Context, pls *model.Playlist, folder *m filteredLines := make([]string, 0, len(lines)) for _, line := range lines { line := strings.TrimSpace(line) - if strings.HasPrefix(line, "#PLAYLIST:") { - pls.Name = line[len("#PLAYLIST:"):] + if after, ok := strings.CutPrefix(line, "#PLAYLIST:"); ok { + pls.Name = after continue } if after, ok := strings.CutPrefix(line, "#EXTALBUMARTURL:"); ok {