feat(macros): add Artists (#1493)

This commit is contained in:
martylukyy 2024-04-08 11:02:10 +02:00 committed by GitHub
parent f1b42146c1
commit b181231b12
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 0 deletions

View file

@ -49,6 +49,7 @@ type Macro struct {
CurrentMinute int CurrentMinute int
CurrentSecond int CurrentSecond int
Tags string Tags string
Artists string
} }
func NewMacro(release Release) Macro { func NewMacro(release Release) Macro {
@ -88,6 +89,7 @@ func NewMacro(release Release) Macro {
CurrentMinute: currentTime.Minute(), CurrentMinute: currentTime.Minute(),
CurrentSecond: currentTime.Second(), CurrentSecond: currentTime.Second(),
Tags: strings.Join(release.Tags, ", "), Tags: strings.Join(release.Tags, ", "),
Artists: release.Artists,
} }
return ma return ma

View file

@ -254,6 +254,15 @@ func TestMacros_Parse(t *testing.T) {
want: "Tags: country, rock", want: "Tags: country, rock",
wantErr: false, wantErr: false,
}, },
{
name: "test_artists",
release: Release{
Artists: "Jon Boy",
},
args: args{text: "Artists: {{ .Artists }}"},
want: "Artists: Jon Boy",
wantErr: false,
},
} }
for _, tt := range tests { for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) { t.Run(tt.name, func(t *testing.T) {