fix(indexers): OPS log score parsing (#1592)

* fix(parsing): OPS Missing %

The message from OPS Announce does not contain a % sign and that seemed to break it. This is probably not the best fix but it is something.

* fix(parsing): Join Tags and Remove Unnecessary Char Replacement

Forgot to join tags before parsing, and removed an unnecessary char replacement that was not needed.

* fix(parsing): Added Regex for 0-100

I forgot to check for all score values, also added the regex import

* feat: add test cases for OPS log score parsing

---------

Co-authored-by: ze0s <ze0s@riseup.net>
This commit is contained in:
Alejo Gaitán 2024-07-16 19:39:29 -03:00 committed by GitHub
parent 3cb18b013f
commit 8f995006b1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 56 additions and 1 deletions

View file

@ -79,7 +79,7 @@ func TestIndexersParseAndFilter(t *testing.T) {
{
name: "announce_2",
args: args{
announceLines: []string{"TORRENT: Dirty Dike Bogies & Alcohol [2024] [EP] CD/FLAC/Lossless hip.hop,uk.hip.hop,united.kingdom https://orpheus.network/torrents.php?id=0000000 https://orpheus.network/torrents.php?id=0000000&torrentid=0000000&action=download"},
announceLines: []string{"TORRENT: Dirty Dike Bogies & Alcohol [2024] [EP] CD/FLAC/Lossless/Cue/Log/100 hip.hop,uk.hip.hop,united.kingdom https://orpheus.network/torrents.php?id=0000000 https://orpheus.network/torrents.php?id=0000000&torrentid=0000000&action=download"},
filters: []filterTest{
{
filter: &domain.Filter{
@ -94,6 +94,22 @@ func TestIndexersParseAndFilter(t *testing.T) {
},
match: true,
},
{
filter: &domain.Filter{
Name: "filter_1",
MatchCategories: "EP,Album",
Years: "2024",
Quality: []string{"Lossless"},
Sources: []string{"CD"},
Formats: []string{"FLAC"},
Log: true,
LogScore: 100,
PerfectFlac: true,
Artists: "Dirty Dike",
Albums: "Bogies & Alcohol",
},
match: true,
},
{
filter: &domain.Filter{
Name: "filter_2",
@ -111,6 +127,30 @@ func TestIndexersParseAndFilter(t *testing.T) {
},
match: false,
},
{
name: "announce_3",
args: args{
announceLines: []string{"TORRENT: Dirty Dike Bogies & Alcohol [2024] [EP] CD/FLAC/Lossless/Cue/Log/80 hip.hop,uk.hip.hop,united.kingdom https://orpheus.network/torrents.php?id=0000000 https://orpheus.network/torrents.php?id=0000000&torrentid=0000000&action=download"},
filters: []filterTest{
{
filter: &domain.Filter{
Name: "filter_1",
MatchCategories: "EP,Album",
Years: "2024",
Quality: []string{"24bit Lossless"},
Sources: []string{"CD"},
Formats: []string{"FLAC"},
Log: true,
LogScore: 100,
Albums: "Best album",
},
match: false,
rejections: []string{"albums not matching. got: Bogies & Alcohol want: Best album", "quality not matching. got: [Cue FLAC Lossless Log80 Log] want: [24bit Lossless]", "log score. got 80 want: 100"},
},
},
},
match: false,
},
},
match: true,
},