From 570af0940ba2b28207d5c3a004bbb2e23bf992ef Mon Sep 17 00:00:00 2001 From: Frederick Robinson Date: Sat, 18 Nov 2023 14:07:50 -0800 Subject: [PATCH] fix(indexers): AnimeBytes parsing (#1259) * change test to expect correct output * fix regex * improve error message --- internal/indexer/definition_test.go | 4 ++-- internal/indexer/definitions/animebytes.yaml | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/indexer/definition_test.go b/internal/indexer/definition_test.go index 85911fe..735db40 100644 --- a/internal/indexer/definition_test.go +++ b/internal/indexer/definition_test.go @@ -25,10 +25,10 @@ func TestYamlExpectations(t *testing.T) { } for _, parseLine := range d.IRC.Parse.Lines { - for i, test := range parseLine.Tests { + for _, test := range parseLine.Tests { parseOutput := map[string]string{} ParseLine(nil, parseLine.Pattern, parseLine.Vars, parseOutput, test.Line, parseLine.Ignore) - assert.Equal(t, test.Expect, parseOutput, "error in expectation %d", i) + assert.Equal(t, test.Expect, parseOutput, "error parsing %s", test.Line) } } } diff --git a/internal/indexer/definitions/animebytes.yaml b/internal/indexer/definitions/animebytes.yaml index a84c136..9307d8e 100644 --- a/internal/indexer/definitions/animebytes.yaml +++ b/internal/indexer/definitions/animebytes.yaml @@ -135,9 +135,9 @@ irc: uploader: "Anon-Uploader" - line: "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" expect: - torrentName: "Awesome " - title: "Awesome " - category: "Live Action Special - Live Action TV Special" + torrentName: "Awesome Live Action Special" + title: "Awesome Live Action Special" + category: "Live Action TV Special" year: "2021" releaseTags: "Web / MKV / h264 / 848x480 / AAC 2.0 / Softsubs (Sub Group)" releaseGroup: "Sub Group" @@ -193,7 +193,7 @@ irc: torrentId: "000000" tags: "" uploader: "Uploader" - pattern: '((.*?)+)(?: - )?(Visual Novel|Light Novel|TV S.*|Movie|Manga|OVA|ONA|DVD Special|BD Special|Oneshot|Anthology|Manhwa|Manhua|Artbook|Game|Live Action.*|)[\s\p{Zs}]{2,}\[(\d+)\] :: (.*?(?:Hardsubs|RAW|Softsubs|Translated) \((.*?)\).*?|.*?)(?: \/ Episode (\d+).*?)?(?: \/ )?(Freeleech)?(?:.?\|\|.?)(https.+\/)torrents.*\?id=(\d+)&torrentid=(\d+)(?:.?\|\|.?)?([A-Za-z,. ]+\w)?(?:.?\|\|.?)?(?:Uploaded by: (.*))?' + pattern: '((.*?)+)(?: - (Visual Novel|Light Novel|TV S.*|Movie|Manga|OVA|ONA|DVD Special|BD Special|Oneshot|Anthology|Manhwa|Manhua|Artbook|Game|Live Action.*|))?[\s\p{Zs}]{2,}\[(\d+)\] :: (.*?(?:Hardsubs|RAW|Softsubs|Translated) \((.*?)\).*?|.*?)(?: \/ Episode (\d+).*?)?(?: \/ )?(Freeleech)?(?:.?\|\|.?)(https.+\/)torrents.*\?id=(\d+)&torrentid=(\d+)(?:.?\|\|.?)?([A-Za-z,. ]+\w)?(?:.?\|\|.?)?(?:Uploaded by: (.*))?' vars: - torrentName - title