feat(definitions): add expectations for test lines (#1257)

* factor out test helpers

* refactor, add tests for animebytes

* revert test refactor

* better name

* change format, migrate some examples

* migrated remaining test cases

* add comment about `Test` vs `Tests`

* refactor

* reorder expectations to match vars

* generate

* turn on strict unmarshalling, remove old `Test` from schema

* start modifying actual definitions

* done with the As

* Bs

* C, D

* E, F

* G, H, I, ... L

* M, N

* O, P

* R

* bonus error. without this, pattern/vars disagreement can panic.

* S

* T, U

* X.. Now we know our ABCs next time won't you sing with meeeee

* fix another test

* another driveby change

* be less strict parsing custom definitions

* fix(definitions): load custom definitions

---------

Co-authored-by: ze0s <ze0s@riseup.net>
This commit is contained in:
Frederick Robinson 2023-11-18 06:41:39 -08:00 committed by GitHub
parent e842a7bd42
commit fef0da5711
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
83 changed files with 1887 additions and 565 deletions

View file

@ -12,7 +12,7 @@ supports:
- irc
- rss
- api
source: gazelle
# source: gazelle
settings:
- name: authkey
type: secret
@ -32,17 +32,17 @@ settings:
label: API Key
help: Username -> Edit Profile -> API
api:
url: https://api.broadcasthe.net
type: jsonrpc
limits:
max: 150
per: hour
settings:
- name: api_key
type: secret
label: API Key
help: Username -> Edit Profile -> API
# api:
# url: https://api.broadcasthe.net
# type: jsonrpc
# limits:
# max: 150
# per: hour
# settings:
# - name: api_key
# type: secret
# label: API Key
# help: Username -> Edit Profile -> API
irc:
network: BroadcasTheNet
@ -75,18 +75,28 @@ irc:
parse:
type: multi
lines:
- test:
- "NOW BROADCASTING! [ The Show S06E07 720p WEB-DL DD 5.1 H.264 - LP ]"
- tests:
- line: NOW BROADCASTING! [ The Show S06E07 720p WEB-DL DD 5.1 H.264 - LP ]
expect:
torrentName: The Show S06E07 720p WEB-DL DD 5.1 H.264 - LP
pattern: ^NOW BROADCASTING! \[ (.*) \]
vars:
- torrentName
- test:
- "[ Title: S06E07 ] [ Series: The Show ]"
- tests:
- line: '[ Title: S06E07 ] [ Series: The Show ]'
expect:
title: The Show
pattern: '^\[ Title: .* \] \[ Series: (.*) \]'
vars:
- title
- test:
- "[ 2010 ] [ Episode ] [ MKV | x264 | WEB | P2P ] [ Uploader: Uploader1 ]"
- tests:
- line: '[ 2010 ] [ Episode ] [ MKV | x264 | WEB | P2P ] [ Uploader: Uploader1 ]'
expect:
year: "2010"
category: Episode
releaseTags: MKV | x264 | WEB | P2P
uploader: Uploader1
preTime: ""
pattern: '^(?:\[ (\d+) \] )?\[ (.*) \] \[ (.*) \] \[ Uploader: (.*?) \](?: \[ Pretime: (.*) \])?'
vars:
- year
@ -94,8 +104,12 @@ irc:
- releaseTags
- uploader
- preTime
- test:
- "[ https://XXXXXXXXX/torrents.php?id=7338 / https://XXXXXXXXX/torrents.php?action=download&id=9116 ]"
- tests:
- line: '[ https://XXXXXXXXX/torrents.php?id=7338 / https://XXXXXXXXX/torrents.php?action=download&id=9116 ]'
expect:
baseUrl: https://XXXXXXXXX/
groupId: "7338"
torrentId: "9116"
pattern: \[ (https?:\/\/.*\/).+id=(\d+) \/ https?:\/\/.*\/.+id=(\d+) \]
vars:
- baseUrl