Skip to content

Instantly share code, notes, and snippets.

@sylints
Created April 21, 2018 03:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sylints/1a6c13e0fe459dd0cd5b16988a40202b to your computer and use it in GitHub Desktop.
Save sylints/1a6c13e0fe459dd0cd5b16988a40202b to your computer and use it in GitHub Desktop.
grammar PT is export {
token TOP {[
<year>
| <season>
| <episode>
| <resolution>
| <quality>
| <codec>
| <audio>
| <group>
| <region>
| <extended>
| <hardcoded>
| <proper>
| <repack>
| <container>
| <widescreen>
| <language>
| <sbs>
| <unrated>
| <size>
| <threeD>
| <sep>
| <title>
]* }
token season {:i s? (<[0..9]> ** 1..2 ) | season \s? "."? (<[0..9]> ** 1..2) }
token episode {:i <[ex]> (<[0..9]> ** 2) [<-[0..9]>| $] }
token year { <[ \[ \(]>? ([19 <[0..9]> | 20 <[0..1]>] <[0..9]>) <[ \] \)]>? }
token resolution {:i <[0..9]> ** 3..4 p }
token quality { [PPV\.]? <[HP]>DTV | [HD]? CAM | B[D|R|r]Rip | [HD"-"?]? TS
| [PPV \s]? WEB \-? DL [DVDRip]? | HDRip | HdRip | HDRIP | DVDRip
| DvDScr | DVDScr | CamRip | WBBRip | W [EB] [Rip]? | WEBrip
| BluRay | bluray | telesync | TELESYNC }
token codec {:i xvid | <[hx]> \.? 26 <[45]> }
token audio {:i MP3 | DD5 "."? 1 | Dual <[\- \s ]> Audio | LiNE | DTS | AAC <[ \. \- ]> LC
| AAC [\.? 2\.0]? | AC3 [\.5\.1]? | DDP [5\.1]? | AAC [\.? 5 \. 1]?}
token group {:i \- \s? (<-[\-]>+ [\- \= \{ <-[\-]>+ \-?$]?) $ }
token region {:i (R <[0..9]>) }
token extended {:i (EXTENDED [.CUT]?) }
token hardcoded {:i HC }
token proper {:i PROPER }
token repack {:i REPACK }
token container {:i ([MKV | AVI | MP4]) }
token widescreen { WS }
token language {:i (rus\.eng | ita\.eng) }
token sbs {:i ([Half"-"]? SBS) }
token unrated {:i UNRATED }
token size {:i (\d+ [\. \d+]? [GB|MB]) }
token threeD {:i 3D }
token title { \w }
token sep { \s | '-' | "." | "'" | '(' | ')' | '/' | '|' | '[' | ']' | ':' | '_' }
}
class PT-actions {
method TOP ($/) {
make {
season => PT<season>.made[0][0].Int;
episode => PT<episode>.made[0][0].Int;
year => PT<year>.made[0][0].Int;
resolution => PT<resolution>.Str;
quality => PT<quality>.Str;
codec => PT<codec>.Str;
audio => PT<audio>.Str;
group => PT<group>.Str;
region => PT<region>.Str;
extended => PT<extended>.defined;
hardcoded => PT<hardcoded>.defined;
proper => PT<proper>.defined;
repack => PT<repack>.defined;
container => PT<container>.Str;
widescreen => PT<widescreen>.defined;
language => PT<language>.Str;
sbs => PT<sbs>.defined;
unrated => PT<unrated>.defined;
size => PT<size>.Str;
threeD => PT<threeD>.defined;
title => PT<title>.Str;
sep => PT<sep>.Str;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment