1. Tools & Reference
  2. Expression Language

​
SEL (Stream Expression Language)

AIOStreams uses SEL for all filtering, inclusion, and scoring expressions. SEL expressions operate on a streams array and return a filtered subset — they are not JavaScript.

​
Expression Types

​
ESE — Excluded Stream Expressions

Expressions that return streams to remove. Each ESE evaluates against the current stream pool and returns the subset that should be excluded.

/* CB | Kill YouTube */
keyword(streams, 'filename', 'YouTube', 'YT')

​
ISE — Included Stream Expressions

Expressions that protect streams from exclusion. An ISE marks matching streams so downstream ESEs cannot remove them.

/* CB | Library & SeaDex Protection */
passthrough(merge(library(streams), seadex(streams)), 'excluded')

​
PSE — Preferred Stream Expressions

Scoring tiers that rank streams by quality. Each PSE assigns a score to matching streams — higher-scored streams sort first.

/* APEX S-Tier 4K Remux — IQR Tukey fence */
(count(resolution(quality(streams, 'remux'), '2160p')) >= 4)
  ? size(bitrate(resolution(quality(streams, 'remux'), '2160p'),
      q1(values(bitrate(resolution(quality(streams, 'remux'), '2160p'), '5Mbps'), 'bitrate'))
        - 1.5 * iqr(values(bitrate(resolution(quality(streams, 'remux'), '2160p'), '5Mbps'), 'bitrate')),
      q3(values(bitrate(resolution(quality(streams, 'remux'), '2160p'), '5Mbps'), 'bitrate'))
        + 1.5 * iqr(values(bitrate(resolution(quality(streams, 'remux'), '2160p'), '5Mbps'), 'bitrate'))
    ), '15GB')
  : []

​
Core Builds ESE Categories

Core Builds uses approximately 81 ESEs across all template variants:

​
SEL Function Reference

​
Stream Filters

FunctionDescription
resolution(streams, ...res)Filter by resolution ('2160p', '1080p', '720p')
quality(streams, ...q)Filter by quality ('remux', 'bluray', 'webdl', 'webrip')
encode(streams, ...enc)Filter by codec ('x265', 'x264', 'AV1')
bitrate(streams, min, max)Filter by bitrate range (bits/sec)
size(streams, maxSize)Filter by file size ('15GB', '4GB')
seeders(streams, min, max)Filter by seeder count
age(streams, maxDays)Filter by release age
cached(streams)Only cached streams
uncached(streams)Only uncached streams
service(streams, ...names)Filter by debrid service ('torbox', 'realdebrid')
language(streams, ...langs)Filter by audio language
library(streams)User’s library/continue-watching streams
seadex(streams)SeaDex best-release anime streams
seasonPack(streams, mode)Season pack streams ('seasonPack' or 'onlySeasons')
multiEpisode(streams)Multi-episode file streams
addon(streams, ...ids)Filter by scraper addon
releaseGroup(streams, ...groups)Filter by release group name
keyword(streams, attr, ...terms)Attribute contains any term ('filename', 'releaseGroup', 'all')
indexer(streams, ...names)Filter by indexer/scraper
passthrough(streams, context)Shield streams from a filter context ('excluded')

​
Statistical Functions

FunctionDescription
values(streams, field)Extract numeric field values from stream set
q1(values)First quartile
median(values) / q2(values)Median
q3(values)Third quartile
iqr(values)Interquartile range (Q3 − Q1)
min(values) / max(values)Extremes
avg(values) / mean(values)Average
count(streams)Number of streams in set
stddev(values)Standard deviation

​
Array Operations

FunctionDescription
merge(a, b, ...)Combine multiple stream sets
negate(subset, full)Streams in full that are NOT in subset
slice(streams, start, end)Take a range of streams
perGroup(streams, field, n)Round-robin interleave n per group
pin(streams, position)Pin streams to 'top' or 'bottom' (side-effect, returns [])

​
Match / Score Functions

FunctionDescription
seScore(streams, min, max)Filter by stream expression score range
regexScore(streams, min, max)Filter by regex score range
regexMatched(streams, ...names)Streams matched by named regex patterns
rseMatched(streams, ...names)Streams matched by named ranked regex entries
seMatched(streams, ...names)Streams matched by named stream expressions

​
SEL Variables

Available as bare names in expressions:

VariableTypeDescription
queryTypestring'movie', 'series', 'anime.movie', 'anime.series'
isAnimebooleanTrue for anime content
daysSinceReleasenumberDays since release
latestSeasonnumberLatest season number
ongoingSeasonbooleanWhether the season is ongoing
hasSeaDexbooleanWhether SeaDex data exists
totalStreamsnumberTotal stream count (dynamic addon fetching)

​
Math Functions

pow, sqrt, floor, ceil, round, trunc — standard math operations available in expressions.

​
PSE Architecture

Core Builds uses three PSE architectures:

​
IQR Tukey Fence (4K templates)

Three-tier adaptive bitrate ranking:

  • 4+ peers — IQR Tukey fence: Q1 − 1.5×IQR to Q3 + 1.5×IQR
  • 1–3 peers — min/max ±20% window
  • 0 peers — pow(0.95, daysSinceRelease) exponential decay

​
CB Static Tiers (Stream, Essential, Speed, Flash)

Fixed quality + resolution matching into S/A/B/C/D tiers with 720p fallback.

​
Hybrid TorBox-Priority (Hybrid templates)

Each IQR tier has a TorBox-only twin PSE before it using service(...):

service(size(bitrate(streams, IQR_LO, IQR_HI), '15GB'), 'torbox')

Returns [] if no TorBox streams match, falling through to the all-service PSE.

​
Late Pack Fallback

Pack filtering is always the final ESE step. Never hard-remove season packs before quality, cache, and result-limit ESEs have run.

/* CB | Late Pack Fallback — hide multi-episode files only when 3 playable singles remain */
(queryType == 'series' and not isAnime
  and count(negate(merge(multiEpisode(streams), seasonPack(streams, 'seasonPack')), streams)) >= 3)
  ? multiEpisode(streams) : []

​
Next Steps