⚠️ These docs are currently under construction and may not be fully accurate.
AIOStreamsAIOStreams
Reference

Stream Expression Language

Complete technical reference for SEL syntax, operators, constants, and all functions.

The Stream Expression Language (SEL) lets you write custom logic to filter, rank, and select streams. It is used in Groups, Stream Expression Filters, Precompute Selectors, and more.


Operators

OperatorDescriptionExample
==EqualqueryType == 'movie'
!=Not equalqueryType != 'series'
> < >= <=Comparisoncount(previousStreams) > 5
inMembership — value exists in sequence'Torrentio' in queriedAddons
+ - * /ArithmetictotalTimeTaken / 1000
and or notLogicalisAnime and season == 1
x ? y : zTernaryisAnime ? seadex(streams) : streams
()Grouping(a or b) and c

Nesting Functions

Most functions accept a stream list as input and return a stream list as output. Chain them together by nesting:

count(resolution(cached(streams), '2160p'))
  1. cached(streams) — get only cached streams
  2. resolution(..., '2160p') — keep only 4K ones
  3. count(...) — count how many remain

Context Constants

The constants available to you depend on where the expression is used.

Group Conditions

ConstantTypeDescription
previousStreamsParsedStream[]Streams found by the last group that ran
totalStreamsParsedStream[]All streams found by all groups so far
queryTypestringMedia type being searched (e.g. "movie", "series")
previousGroupTimeTakennumberTime the last group took (ms)
totalTimeTakennumberTotal time spent so far (ms)

Dynamic Exit Conditions

ConstantTypeDescription
totalStreamsParsedStream[]All streams found by all groups so far
totalTimeTakennumberTotal time spent so far (ms)
queryTypestringMedia type (e.g. "movie", "series", "anime.series", "anime.movie")
queriedAddonsstring[]Addon names queried so far

Stream Expression Filters & Precompute Selector

ConstantTypeDefaultDescription
streamsParsedStream[]All available streams
queryTypestring''Media type
isAnimebooleanfalseWhether the media is anime
seasonnumber-1Season number
episodenumber-1Episode number
absoluteEpisodenumber-1Absolute episode number
genresstring[][]List of genres
titlestring''Media title
yearnumber0Release year
yearEndnumber0End year (series)
daysSinceReleasenumber-1Days since media was released
runtimenumber0Runtime in minutes
originalLanguagestring''Original language (e.g. "English")
hasSeaDexbooleanfalseWhether SeaDex results exist for this media
hasNextEpisodebooleanfalseWhether a next episode exists
daysUntilNextEpisodenumber-1Days until next episode airs
daysSinceFirstAirednumber-1Days since the first episode aired
daysSinceLastAirednumber-1Days since the last episode aired
latestSeasonnumber-1Latest season number
ongoingSeasonbooleanfalseViewing the latest season with a next episode pending

Naming Expressions

Assign a name to a Stream Expression by adding a C-style comment. The name is used in the Custom Formatter.

/* 4K Dolby Vision */ merge(resolution(streams, '2160p'), visualTag(streams, 'DV'))

Multiple names (for Ranked Stream Expressions):

/* 4K */ resolution(streams, '2160p') /* High Quality */

Reference-only comment (not used as a name — start with #):

/*# This is just a note */ quality(streams, 'Bluray')

Preferred vs. Ranked

TypeMatching behaviourFormatter variable
PreferredStream matches only the first expression it satisfies{stream.seMatched}
RankedStream can match multiple expressions; scores are summed{stream.rseMatched}

Function Reference

Utility Functions

negate()

Returns streams from originalStreamList that are not in streamsToExclude.

ParameterTypeDescription
streamsToExcludeParsedStream[]Streams to exclude
originalStreamListParsedStream[]Full stream list to filter from
negate(quality(streams, 'CAM', 'TS'), streams)

merge()

Combines multiple stream arrays into one, removing duplicates.

merge(visualTag(streams, 'DV'), audioTag(streams, 'Atmos'))

slice()

Returns a section of the stream list. Negative indices count from the end.

ParameterTypeDescription
streamsParsedStream[]Stream list to slice
startnumberStart index (inclusive)
endnumber?End index (exclusive). Omit to go to the end.
slice(addon(streams, 'TorBox'), 0, 5)  // first 5 TorBox streams

values()

Extracts a numeric property from each stream as an array of numbers. Used with Math Functions.

ParameterTypeDescription
streamsParsedStream[]Stream list
attributestringProperty to extract

Accepted attributes: 'bitrate' 'size' 'folderSize' 'age' 'duration' 'seeders' 'seScore' 'regexScore'

avg(values(streams, 'bitrate'))

Filter Functions

All filter functions follow the pattern: fn(streams, ...values)ParsedStream[]


indexer()

Filter by originating indexer name (case-sensitive).

indexer(streams, '1337x', 'RARBG')

resolution()

Filter by video resolution.

Accepted values: '2160p' '1440p' '1080p' '720p' '576p' '480p' '360p' '240p' '144p' 'Unknown'

resolution(streams, '2160p', '1080p')

quality()

Filter by quality tag.

Accepted values: 'Bluray REMUX' 'Bluray' 'WEB-DL' 'WEBRip' 'HDRip' 'HC HD-Rip' 'DVDRip' 'HDTV' 'CAM' 'TS' 'TC' 'SCR' 'Unknown'

quality(streams, 'Bluray', 'WEB-DL')

encode()

Filter by video encoding format (e.g. 'H.264', 'H.265', 'HEVC', 'x265').

encode(streams, 'H.265', 'HEVC')

type()

Filter by stream type.

Accepted values: 'debrid' 'usenet' 'http' 'live' 'p2p' 'external' 'youtube'

type(streams, 'debrid', 'p2p')

visualTag()

Filter by visual tag (e.g. 'HDR', 'DV', 'HDR10', 'HDR10+', 'HLG').

visualTag(streams, 'DV', 'HDR')

audioTag()

Filter by audio format tag (e.g. 'Atmos', 'DTS', 'DTS-HD MA', 'AC3', 'EAC3').

audioTag(streams, 'Atmos', 'DTS-HD MA')

audioChannels()

Filter by audio channel configuration (e.g. '5.1', '7.1', '2.0').

audioChannels(streams, '5.1', '7.1')

language()

Filter by audio language (e.g. 'English', 'Spanish').

language(streams, 'English')

seeders()

Filter by torrent seeder count.

ParameterTypeDescription
streamsParsedStream[]Stream list
minnumber?Minimum seeders (inclusive)
maxnumber?Maximum seeders (inclusive)
seeders(streams, 5, 200)

age()

Filter by age in hours.

ParameterTypeDescription
streamsParsedStream[]Stream list
minnumber?Minimum age in hours
maxnumber?Maximum age in hours
age(streams, 24, 8760)  // 1 day to 1 year old

size()

Filter by file size. Accepts human-readable strings ('1GB', '500MB') or raw byte counts.

ParameterTypeDescription
streamsParsedStream[]Stream list
minnumber | string?Minimum size
maxnumber | string?Maximum size
size(streams, '1GB', '10GB')

bitrate()

Filter by bitrate. Accepts '5Mbps', '5000kbps', or raw bits-per-second.

ParameterTypeDescription
streamsParsedStream[]Stream list
minnumber | string?Minimum bitrate
maxnumber | string?Maximum bitrate
bitrate(streams, '5Mbps')

service()

Filter by Debrid service.

Accepted values: 'realdebrid' 'debridlink' 'alldebrid' 'torbox' 'pikpak' 'seedr' 'offcloud' 'premiumize' 'easynews' 'easydebrid'

service(streams, 'realdebrid', 'torbox')

cached()

Filter for cached Debrid streams only.

cached(streams)

uncached()

Filter for non-cached streams only.

uncached(streams)

releaseGroup()

Filter by release group name (case-sensitive). Omitting names matches streams with any release group.

releaseGroup(streams, 'YIFY', 'FLUX')

seasonPack()

Filter for season pack streams.

ParameterTypeDescription
streamsParsedStream[]Stream list
modestring?'seasonPack' — stream originates from a season pack. 'onlySeasons' (default) — title contains only season info, no episode info (ambiguous pack).
seasonPack(streams, 'seasonPack')   // from any season pack
seasonPack(streams, 'onlySeasons')  // ambiguous packs without episode reference

addon()

Filter by addon name (case-sensitive).

addon(streams, 'Torrentio', 'Knightcrawler')

library()

Filter for streams from a personal Debrid library.

library(streams)

message()

Filter by a stream's message property.

ParameterTypeDescription
streamsParsedStream[]Stream list
mode'exact' | 'includes'Exact match or substring
...messagesstringOne or more message strings
message(streams, 'includes', 'cached')

seadex()

Filter for SeaDex-listed streams (best anime releases).

ParameterTypeDescription
streamsParsedStream[]Stream list
type'best' | 'all'?'best' for only SeaDex "Best" entries; omit or 'all' for all SeaDex matches

Only active when SeaDex integration is enabled under Filters → Miscellaneous.

seadex(streams, 'best')

regexMatched()

Filter for streams that matched a preferred or ranked regex filter.

ParameterTypeDescription
streamsParsedStream[]Stream list
...namesstring?Optional filter names. If omitted, matches any regex filter.

Does not work in Included Stream Expressions — regex matching is computed after filtering.

regexMatched(streams)                          // matched any regex
regexMatched(streams, 'HighQuality', 'Extras') // matched specific ones

regexMatchedInRange()

Filter for streams where the matched regex filter's index is within [min, max].

Does not work in Included Stream Expressions.
regexMatchedInRange(streams, 0, 5)

streamExpressionScore()

Filter by Ranked Stream Expression score.

Does not work in Included Stream Expressions.
streamExpressionScore(streams, 100, 500)

regexScore()

Filter by Ranked Regex score.

Does not work in Included Stream Expressions.
regexScore(streams, 50)

passthrough()

Flags streams to bypass specific pipeline stages. Best used in Included Stream Expressions or rarely in Excluded Stream Expressions.

While any stream selected by an Included Stream Expression (ISE) is already protected from normal filters, it still passes through stages like deduplication and result limiting. Wrapping your ISE with passthrough() expands which stages those streams skip.

When used in an Excluded Stream Expression: flagged streams won't be removed by subsequent excluded expressions. Since ESE filters run last, most stage values are not applicable here — only excluded is relevant.

ParameterTypeDescription
streamsParsedStream[]Stream list
...stagesstring?Stages to skip. Omit to bypass all stages.

Accepted stage values: filter language dedup limit excluded required title year episode digitalRelease

passthrough(streams, 'language', 'limit')
passthrough(streams)  // bypass all stages

pin()

Pins streams to the very top or bottom of the final results list, overriding sort order. Typically used in Excluded Stream Expressions. Can also be used in Required Stream Expressions — but since unselected streams get filtered out, set returnMatched: true when doing so.

ParameterTypeDefaultDescription
streamsParsedStream[]Streams to pin
position'top' | 'bottom''top'Where to pin them
returnMatchedbooleanfalsetrue → return pinned streams; false → return empty array (useful for chaining)
pin(seadex(streams, 'best'), 'top')

Math Functions

Math functions operate on arrays of numbers, typically from values().

Most accept either an array (avg(values(streams, 'bitrate'))) or individual arguments (avg(1, 2, 3)).

FunctionAliasDescription
count(arr)Number of items in the array
max(numbers)Largest value
min(numbers)Smallest value
avg(numbers)meanArithmetic mean
sum(numbers)Sum of all values
median(numbers)q2Middle value (50th percentile)
mode(numbers)Most frequently occurring value
range(numbers)max - min
variance(numbers)Spread from the average
stddev(numbers)Standard deviation
percentile(numbers, p)Value below which p% of observations fall
q1(numbers)First quartile (25th percentile)
q3(numbers)Third quartile (75th percentile)
iqr(numbers)Interquartile range (q3 - q1)
skewness(numbers)Asymmetry of the distribution
kurtosis(numbers)"Tailedness" of the distribution

On this page