mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 08:49:13 +00:00
feat(macros): add Group (#1378)
This commit is contained in:
parent
fffd5bbf56
commit
16bf2a52fd
2 changed files with 15 additions and 0 deletions
|
@ -23,6 +23,7 @@ type Macro struct {
|
|||
TorrentUrl string
|
||||
TorrentDataRawBytes []byte
|
||||
MagnetURI string
|
||||
Group string
|
||||
GroupID string
|
||||
DownloadUrl string
|
||||
InfoUrl string
|
||||
|
@ -58,6 +59,7 @@ func NewMacro(release Release) Macro {
|
|||
TorrentHash: release.TorrentHash,
|
||||
TorrentID: release.TorrentID,
|
||||
MagnetURI: release.MagnetURI,
|
||||
Group: release.Group,
|
||||
GroupID: release.GroupID,
|
||||
InfoUrl: release.InfoURL,
|
||||
DownloadUrl: release.DownloadURL,
|
||||
|
|
|
@ -214,6 +214,19 @@ func TestMacros_Parse(t *testing.T) {
|
|||
want: "DownloadUrl: https://test.local/this/page/1001",
|
||||
wantErr: false,
|
||||
},
|
||||
{
|
||||
name: "test_group",
|
||||
release: Release{
|
||||
TorrentName: "This movie 2021",
|
||||
DownloadURL: "https://some.site/download/fakeid",
|
||||
Group: "thisgrp",
|
||||
Indexer: "mock1",
|
||||
Year: 2021,
|
||||
},
|
||||
args: args{text: "movies-{{.Group}}"},
|
||||
want: "movies-thisgrp",
|
||||
wantErr: false,
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue