fix(indexers): improve animebytes parsing (#477)

* Fixed typo for "Aweomse Raw Novel"
Added one missing whitespace after "manga" tag for "Awesome Live Action Special" test
Changed regex expression to fix AB parsing

* Fixed regex to acknowledge "uploader" var in case there is no tags in the announce.
Added test line for announces without tags.

* chore: update rls package

* fix(release): don't overwrite season and episode
This commit is contained in:
xoaaC 2022-10-13 20:35:48 +02:00 committed by GitHub
parent bc335ccf1f
commit 2777f8c3cd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 33 additions and 34 deletions

View file

@ -102,8 +102,7 @@ func (a *announceProcessor) processQueue(queue chan string) {
rls := domain.NewRelease(a.indexer.Identifier)
// on lines matched
err := a.onLinesMatched(a.indexer, tmpVars, rls)
if err != nil {
if err := a.onLinesMatched(a.indexer, tmpVars, rls); err != nil {
a.log.Debug().Msgf("error match line: %v", "")
continue
}
@ -164,20 +163,18 @@ func (a *announceProcessor) parseExtract(pattern string, vars []string, tmpVars
// onLinesMatched process vars into release
func (a *announceProcessor) onLinesMatched(def *domain.IndexerDefinition, vars map[string]string, rls *domain.Release) error {
var err error
err = rls.MapVars(def, vars)
if err != nil {
if err := rls.MapVars(def, vars); err != nil {
a.log.Error().Stack().Err(err).Msg("announce: could not map vars for release")
return err
}
// parse fields
// run before ParseMatch to not potentially use a reconstructed TorrentName
rls.ParseString(rls.TorrentName)
// parse torrentUrl
err = def.Parse.ParseMatch(vars, def.SettingsMap, rls)
if err != nil {
if err := def.Parse.ParseMatch(vars, def.SettingsMap, rls); err != nil {
a.log.Error().Stack().Err(err).Msgf("announce: %v", err)
return err
}
@ -219,8 +216,7 @@ func (a *announceProcessor) processTorrentUrl(match string, vars map[string]stri
}
var b bytes.Buffer
err = tmpl.Execute(&b, &tmpVars)
if err != nil {
if err := tmpl.Execute(&b, &tmpVars); err != nil {
a.log.Error().Err(err).Msg("could not write torrent url template output")
return "", err
}