Skip to content

Commit

Permalink
feat(indexers): improve RED and OPS artist parsing (#629)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
zze0s and martylukyy committed Jan 8, 2023
1 parent 12d05f0 commit 08826db
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 13 deletions.
7 changes: 0 additions & 7 deletions internal/action/lidarr.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package action

import (
"context"
"fmt"
"time"

"github.com/autobrr/autobrr/internal/domain"
Expand Down Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions internal/domain/filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion internal/indexer/definitions/orpheus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion internal/indexer/definitions/red.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 08826db

Please sign in to comment.