feat(indexers): animebytes parse group and category (#327)

* refactor(AB): get releaseGroup

* feat(AB): match category
This commit is contained in:
varoOP 2022-07-06 18:31:52 +05:30 committed by GitHub
parent 97020a957c
commit 95ff83cd3a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 37 additions and 6 deletions

View file

@ -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
}

View file

@ -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) {

View file

@ -49,15 +49,21 @@ parse:
type: single
lines:
- test:
- "Other Show! 3rd Season - TV Series [2020] :: Blu-ray / MKV / h265 10-bit / 1080p / FLAC 5.0 / RAW (LoliHouse) / Freeleech || https://animebytes.tv/torrents.php?id=000000&torrentid=00000000 || music || Uploaded by: Anonymous"
- "Show 1 - TV Series [2004] :: DVD / MKV / h264 10-bit / 712x478 / FLAC 2.0 / Dual Audio / Softsubs (WSE) || https://animebytes.tv/torrents.php?id=0000&torrentid=000000 || coming.of.age, romance, seinen, slice.of.life, tragedy || Uploaded by: Uploader"
- "Artist - Album! Original Sound Track [2011] :: MP3 / V0 (VBR) / CD || https://animebytes.tv/torrents2.php?id=000000&torrentid=0000000 || soundtrack || Uploaded by: Test-Uploader"
- "Cool Movie - Movie  [2020] :: Blu-ray / MKV / h265 10-bit / 1929x804 / AC3 5.1 / Dual Audio / Softsubs (CBM) || https://animebytes.tv/torrents.php?id=000000&torrentid=0000000 || drama, romance, slice.of.life || Uploaded by: Anonymous"
pattern: '(.*)[\s\p{Zs}]{2,}\[(\d+)\] :: (.*) \|\| (https.*)\/torrents.*\?id=\d+&torrentid=(\d+) \|\| (.+?(?:(?:\|\| Uploaded by|$))?)(?:\|\| Uploaded by: (.*))?$'
- "Aweomse Raw Novel - Light Novel [2005] :: Raw / EPUB || https://animebytes.tv/torrents.php?id=00000&torrentid=00000 || supernatural || Uploaded by: Test-Uploader"
- "Awesome Translated Novel - Light Novel [2018] :: Translated (Translation Group) / EPUB || https://animebytes.tv/torrents.php?id=00000&torrentid=000000 || adventure, comedy, fantasy, harem, school.life, magic, action || Uploaded by: UPLOADER"
- "Great BluRay SoftSubbed Anime - TV Series [2020] :: Blu-ray / MKV / h264 10-bit / 1080p / FLAC 2.0 / Dual Audio / Softsubs (Sub Group) / Freeleech || https://animebytes.tv/torrents.php?id=00008&torrentid=000000 || comedy, drama, school.life, sports || Uploaded by: Uploader"
- "Awesome Translated Manga - Manga [2019] :: Translated (Translation Group) / Digital / Ongoing || https://animebytes.tv/torrents.php?id=00000&torrentid=000000 || comedy, fantasy, school.life, shounen, slice.of.life"
- "Cool Movie - Movie [2020] :: Blu-ray / MKV / h265 10-bit / 1929x804 / AC3 5.1 / Dual Audio / Softsubs (Sub Group) || https://animebytes.tv/torrents.php?id=000000&torrentid=0000000 || drama, romance, slice.of.life || Uploaded by: Anon-Uploader"
- "Awesome Live Action Special - Live Action TV Special [2021] :: Web / MKV / h264 / 848x480 / AAC 2.0 / Softsubs (Sub Group) || https://animebytes.tv/torrents.php?id=00000&torrentid=00000 || manga|| Uploaded by: Some-Uploader"
- "Best Visual Novel - Visual Novel [2006] :: Game / PC / Unarchived / Hentai (Censored) || https://animebytes.tv/torrents.php?id=00000&torrentid=00000 || nukige || Uploaded by: Uploader"
- "Artist Name - Album of awesome Music [1991] :: MP3 / V0 (VBR) / CD || https://animebytes.tv/torrents2.php?id=00000&torrentid=000000 || ambient, folk || Uploaded by: Uploader"
pattern: '(.*?(Visual Novel|Light Novel|TV.*|Movie|Manga|OVA|ONA|DVD Special|BD Special|Oneshot|Anthology|Manhwa|Manhua|Artbook|Game|Live Action.*|))[\s\p{Zs}]{2,}\[(\d+)\] :: (.*(?:RAW|Softsubs|Hardsubs|Translated)\s\((.+)\).*|.*)\|\| (https.*)\/torrents.*\?id=\d+&torrentid=(\d+) \|\| (.+?(?:(?:\|\| Uploaded by|$))?)(?:\|\| Uploaded by: (.*))?$'
vars:
- torrentName
- category
- year
- releaseTags
- releaseGroup
- baseUrl
- torrentId
- tags