mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 08:49:13 +00:00
feat(indexers): animebytes parse group and category (#327)
* refactor(AB): get releaseGroup * feat(AB): match category
This commit is contained in:
parent
97020a957c
commit
95ff83cd3a
3 changed files with 37 additions and 6 deletions
|
@ -190,7 +190,6 @@ func (r *Release) ParseString(title string) {
|
|||
r.Resolution = rel.Resolution
|
||||
r.Season = rel.Series
|
||||
r.Episode = rel.Episode
|
||||
r.Group = rel.Group
|
||||
r.Region = rel.Region
|
||||
r.Audio = rel.Audio
|
||||
r.AudioChannels = rel.Channels
|
||||
|
@ -204,6 +203,10 @@ func (r *Release) ParseString(title string) {
|
|||
r.Year = rel.Year
|
||||
}
|
||||
|
||||
if r.Group == "" {
|
||||
r.Group = rel.Group
|
||||
}
|
||||
|
||||
r.ParseReleaseTagsString(r.ReleaseTags)
|
||||
|
||||
return
|
||||
|
@ -466,6 +469,10 @@ func (r *Release) MapVars(def *IndexerDefinition, varMap map[string]string) erro
|
|||
r.Resolution = resolution
|
||||
}
|
||||
|
||||
if releaseGroup, err := getStringMapValue(varMap, "releaseGroup"); err == nil {
|
||||
r.Group = releaseGroup
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
@ -426,6 +426,24 @@ func TestRelease_MapVars(t *testing.T) {
|
|||
definition: IndexerDefinition{Parse: &IndexerParse{ForceSizeUnit: "MB"}},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "9",
|
||||
fields: &Release{},
|
||||
want: &Release{
|
||||
TorrentName: "Greatest Anime Ever",
|
||||
Year: 2022,
|
||||
Group: "GROUP1",
|
||||
Tags: []string{"comedy", "fantasy", "school.life", "shounen", "slice.of.life"},
|
||||
Uploader: "Tester",
|
||||
},
|
||||
args: args{varMap: map[string]string{
|
||||
"torrentName": "Greatest Anime Ever",
|
||||
"year": "2022",
|
||||
"releaseGroup": "GROUP1",
|
||||
"tags": "comedy, fantasy, school.life, shounen, slice.of.life",
|
||||
"uploader": "Tester",
|
||||
}},
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue