feat(macros): add Group (#1378)

This commit is contained in:
Vince Villamora 2024-01-26 23:26:18 +08:00 committed by GitHub
parent fffd5bbf56
commit 16bf2a52fd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 15 additions and 0 deletions

View file

@ -23,6 +23,7 @@ type Macro struct {
TorrentUrl string TorrentUrl string
TorrentDataRawBytes []byte TorrentDataRawBytes []byte
MagnetURI string MagnetURI string
Group string
GroupID string GroupID string
DownloadUrl string DownloadUrl string
InfoUrl string InfoUrl string
@ -58,6 +59,7 @@ func NewMacro(release Release) Macro {
TorrentHash: release.TorrentHash, TorrentHash: release.TorrentHash,
TorrentID: release.TorrentID, TorrentID: release.TorrentID,
MagnetURI: release.MagnetURI, MagnetURI: release.MagnetURI,
Group: release.Group,
GroupID: release.GroupID, GroupID: release.GroupID,
InfoUrl: release.InfoURL, InfoUrl: release.InfoURL,
DownloadUrl: release.DownloadURL, DownloadUrl: release.DownloadURL,

View file

@ -214,6 +214,19 @@ func TestMacros_Parse(t *testing.T) {
want: "DownloadUrl: https://test.local/this/page/1001", want: "DownloadUrl: https://test.local/this/page/1001",
wantErr: false, 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 { for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) { t.Run(tt.name, func(t *testing.T) {