From 08826db0360c89eb4660e163efc2bed463878717 Mon Sep 17 00:00:00 2001 From: ze0s <43699394+zze0s@users.noreply.github.com> Date: Sun, 8 Jan 2023 15:06:04 +0100 Subject: [PATCH] feat(indexers): improve RED and OPS artist parsing (#629) * feat(indexers): improve RED and OPS artist parsing * feat(indexers): deprecate lidarr red ops workaround * feat(indexers): change artist and album field check * seperator before tags and tags optional for red * fix: update rejection msg Co-authored-by: martylukyy <35452459+martylukyy@users.noreply.github.com> --- internal/action/lidarr.go | 7 ------- internal/domain/filter.go | 8 ++++---- internal/indexer/definitions/orpheus.yaml | 2 +- internal/indexer/definitions/red.yaml | 2 +- 4 files changed, 6 insertions(+), 13 deletions(-) diff --git a/internal/action/lidarr.go b/internal/action/lidarr.go index 8cc8595..7681cd2 100644 --- a/internal/action/lidarr.go +++ b/internal/action/lidarr.go @@ -2,7 +2,6 @@ package action import ( "context" - "fmt" "time" "github.com/autobrr/autobrr/internal/domain" @@ -53,12 +52,6 @@ func (s *service) lidarr(ctx context.Context, action *domain.Action, release dom PublishDate: time.Now().Format(time.RFC3339), } - // special handling for RED and OPS because their torrent names contain to little info - // "Artist - Album" is not enough for Lidarr to make a decision. It needs year like "Artist - Album 2022" - if release.Indexer == "redacted" || release.Indexer == "ops" { - r.Title = fmt.Sprintf("%v (%d)", release.TorrentName, release.Year) - } - rejections, err := arr.Push(ctx, r) if err != nil { s.log.Error().Err(err).Msgf("lidarr: failed to push release: %v", r) diff --git a/internal/domain/filter.go b/internal/domain/filter.go index e86bead..38d86a3 100644 --- a/internal/domain/filter.go +++ b/internal/domain/filter.go @@ -375,12 +375,12 @@ func (f Filter) CheckFilter(r *Release) ([]string, bool) { r.addRejectionF("tags unwanted. got: %v want: %v", r.Tags, f.ExceptTags) } - if len(f.Artists) > 0 && !containsFuzzy(r.TorrentName, f.Artists) { - r.addRejectionF("artists not matching. got: %v want: %v", r.TorrentName, f.Artists) + if len(f.Artists) > 0 && !contains(r.Artists, f.Artists) { + r.addRejectionF("artists not matching. got: %v want: %v", r.Artists, f.Artists) } - if len(f.Albums) > 0 && !containsFuzzy(r.TorrentName, f.Albums) { - r.addRejectionF("albums not matching. got: %v want: %v", r.TorrentName, f.Albums) + if len(f.Albums) > 0 && !contains(r.Title, f.Albums) { + r.addRejectionF("albums not matching. got: %v want: %v", r.Title, f.Albums) } // Perfect flac requires Cue, Log, Log Score 100, FLAC and 24bit Lossless diff --git a/internal/indexer/definitions/orpheus.yaml b/internal/indexer/definitions/orpheus.yaml index f02e559..58158e8 100644 --- a/internal/indexer/definitions/orpheus.yaml +++ b/internal/indexer/definitions/orpheus.yaml @@ -61,7 +61,7 @@ irc: - "TORRENT: That Artist - Albuum [2002] [Single] - FLAC / Lossless / WEB - 2000s,house,uk.garage,garage.house - https://orpheus.network/torrents.php?id=000000 / https://orpheus.network/torrents.php?action=download&id=0000000" - "TORRENT: Something [2021] [Album] - FLAC / Lossless / CD - - https://orpheus.network/torrents.php?id=000000 / https://orpheus.network/torrents.php?action=download&id=0000000" - "TORRENT: Artist 1 & Artist 2 - Best album (subtitle) [2004] [Album] - FLAC / Lossless / Log (100%) / Cue / CD - experimental,ambient,downtempo - https://orpheus.network/torrents.php?id=000000 / https://orpheus.network/torrents.php?action=download&id=0000000" - pattern: 'TORRENT: (.*) \[(.+?)\] \[(.+?)\] - (.*) - \s*(.*) - https?:\/\/.* \/ (https?:\/\/.+\/).+id=(\d+)' + pattern: 'TORRENT: (.* \[(.*?)\] \[(.*?)\] - (.*)) - \s*(.*) - https?:\/\/.* \/ (https?:\/\/.*\/).*id=(\d+)' vars: - torrentName - year diff --git a/internal/indexer/definitions/red.yaml b/internal/indexer/definitions/red.yaml index 2f2e500..117608d 100644 --- a/internal/indexer/definitions/red.yaml +++ b/internal/indexer/definitions/red.yaml @@ -85,7 +85,7 @@ irc: - test: - "Artist - Albumname [2008] [Single] - FLAC / Lossless / Log / 100% / Cue / CD - https://redacted.ch/torrents.php?id=0000000 / https://redacted.ch/torrents.php?action=download&id=0000000 - hip.hop,rhythm.and.blues,2000s" - "A really long name here - Concertos 5 and 6, Suite No 2 [1991] [Album] - FLAC / Lossless / Log / 100% / Cue / CD - https://redacted.ch/torrents.php?id=0000000 / https://redacted.ch/torrents.php?action=download&id=0000000 - classical" - pattern: '(.*) (?:\[(.*)\] \[(.*)\] - (.*))? .* \/ (https?\:\/\/.+\/).+id=(\d+) - (.+)' + pattern: '(.* (?:\[(.*)\] \[(.*)\] - (.*))?) - .* \/ (https?\:\/\/.+\/).+id=(\d+)[ -]*(.*)' vars: - torrentName - year