scenerules.org replicated for swamp — ruleset mirror, rule lookup and search, plus a scene release-name parser, validator and formatter
  • TypeScript 100%
Find a file
keeb 60a0aaa83d Initial release: scenerules.org replicated + scene release-name parser
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 09:11:25 -07:00
extensions/models Initial release: scenerules.org replicated + scene release-name parser 2026-10-25 09:11:25 -07:00
tests Initial release: scenerules.org replicated + scene release-name parser 2026-10-25 09:11:25 -07:00
.gitignore Initial release: scenerules.org replicated + scene release-name parser 2026-10-25 09:11:25 -07:00
LICENSE.txt Initial release: scenerules.org replicated + scene release-name parser 2026-10-25 09:11:25 -07:00
manifest.yaml Initial release: scenerules.org replicated + scene release-name parser 2026-10-25 09:11:25 -07:00
README.md Initial release: scenerules.org replicated + scene release-name parser 2026-10-25 09:11:25 -07:00

@keeb/scenerules

scenerules.org replicated as a swamp model. The site is the archive of scene release standards: one static index, every ruleset in four renderings (picture, text, numbered text, original .nfo), a handful of standalone pages, and a search.php. It has no API, so this model turns it into data, and implements the current scene video standards as code:

Standard id Document
2020_WDX THE.2020.WEB.AND.WEBRIP.SD.HD.X264.UHD.X265.RULESET.v2.0-WDX
2020_X265 High Definition x264 / Ultra High Definition x265 rev 5.0 (HDX)
tvx2642k16 The 2016 TV-720p x264 Releasing Standards
sdtvx2642k16 The 2016 SD TV x264 Releasing Standards

Model: @keeb/scenerules

Method What it does Resource (instance)
catalogue Scrape the index: every ruleset with id, listed name, year/version label, era (current, old, non-English), section or language, key markers, and rendering URLs catalogue (catalogue)
fetch Mirror selected rulesets (by ids, era, group, name) as decoded text; .nfo is cp437 decoded to Unicode document (doc-<id>)
sync Mirror the whole site: every ruleset plus the standalone pages. Unchanged documents (same SHA-256) are skipped document per changed doc, sync
page One standalone page: nuke-rules, mod0, keywords (RFC 2119), sizes, misc, wanted document (doc-page-<id>)
search The site's own full-text search (search.php) search (search-<q>)
grep Regex over the local mirror; every hit carries its line and the rule number it falls under search (grep-<pattern>)
rule Cite a rule and its sub-rules by number, e.g. 2020_WDX 19.4 (fetches the document if it isn't mirrored) rule (rule-<doc>-<rule>)
parse Release names or filenames (scene, P2P, fansub) → title, country, year, season/episodes, part, date, episode title, tags, language, resolution, source, format, codec, HDR, audio, service, group, standard, confidence names (parse-<name>)
validate Check names against the standard their source implies (or standard); every violation cites <standard> <rule> names (validate-<name>)
format Build compliant directory names from fields, validated on the way out names (format-<name>)
standards The encoded vocabulary of each standard: permitted tags, sources, and the rule number behind each check standards (standards)
swamp behavior run @keeb/scenerules sync scenerules
swamp behavior run scenerules rule --input document=2020_WDX --input rule=19.4
swamp behavior run scenerules parse --input 'names=["Survivor.S51E05.1080p.WEB.H264-HOTDOGWATER"]'
swamp behavior run scenerules validate --input 'names=["Show..Name.S1E1.720p.WEB.x264-GRP"]'
swamp data query 'modelName == "scenerules" && name == "validate-latest"' --select 'attributes.items.map(i, i.violations)'

Parsing

Names are read the way the standards write them (WDX 19.4, X265 18.4, TV 16.4):

Weekly.TV.Show.[COUNTRY_CODE].[YEAR].SXXEXX[Episode.Part].[Episode.Title].<TAGS>.[LANGUAGE].<RESOLUTION>.<FORMAT>-GROUP
Feature.Title.<YEAR>.<TAGS>.[LANGUAGE].<RESOLUTION>.<FORMAT>-GROUP

Kinds: episode, multi-episode (S01E01-E03, S01E01E02), special (S00), season-pack, miniseries (Part3, Part.3), daily (YYYY.MM.DD), crossover (_), feature, unknown. A trailing two-letter ISO 3166 code and year on a show title are split off as country and year (WDX 19.8–19.10).

The technical tail is found backwards from the first unambiguous technical token (resolution, source, codec), so title words that are also tags stay in the title (The.Line.2017, Madame.Web.2024, an episode called Red.Line). Scene tags are uppercase; a Title-case word is a title word.

P2P names (spaces, (2019), -[YTS.MX], [EZTVx.to], DDP5 1 H 264, Season 06 Episode 22, EP 4, S2E27- Title, trailing groups without a dash) and fansub names ([Group] Title - 05v2 (1080p) [CRC32], Title S2 - 01) are parsed too, with style set so callers can tell them apart.

confidence is high when the name has numbering (or a feature year), a title, a technical tag, and no unrecognized tokens after the numbering; medium when anchored but noisy (absolute numbering without brackets like Bleach 225 is always medium); low otherwise. On a 21k-file catalogue: 69% high, 24% medium, 7% low, the lows being extras and year-less movies.

Validation

Checks, each citing the rule in the applicable standard: allowed characters, consecutive punctuation, -GROUP, directory format (numbering or production year), 2-digit season/episode, permitted tags, tag variations (READ.NFO), READNFO with PROPER/REPACK/RERIP, tags used once (REAL may stack), English carries no language tag, full language names, source per standard, format (WEB.H264/WEB.H265 untouched, WEBRip.x264/WEBRip.x265 transcoded, x264|x265 for retail, .x264 for TV), resolution (720p for TV-720p, none for SD TV), production year on features, encoding details that belong in the NFO (audio, service, bit depth, HEVC), site tags, and tag order (tags < language < resolution < format).

The mirror makes every other check citable: grep and rule return the exact text with rule numbers for any of the ~280 documents.