-
-
Notifications
You must be signed in to change notification settings - Fork 825
Custom Formatter
Here is a complete reference to the custom formatter system
A custom format allows you to fully control the output of the streams. You can test your formats live at the configuration page using the Preview.
When writing your format, you have access to specific objects, known as variables, each with their own properties. The format to access a variable is as follows:
{variableName.propertyName}.
You may also apply specific "modifiers". The available modifiers depend on the type of properties. i.e. strings, numbers, lists, each have their own modifiers.
| Access | Type | Description |
|---|---|---|
{config.addonName} |
string |
The name of the AIOStreams instance (the value of the ADDON_NAME environment variable) |
{config.showDie} |
boolean |
The value of the SHOW_DIE environment variable, which controls whether to show a π² emoji |
| Access | Type | Description |
|---|---|---|
{stream.proxied} |
boolean |
Whether the stream is proxied using MediaFlow proxy |
{stream.filename}or {stream.name} (deprecated) |
string |
Filename of the stream or media file |
{stream.folderName} |
string |
The folder name of the stream, usually only available to specific addons. |
{stream.size} |
number |
Size of the stream/file in bytes |
{stream.personal} |
boolean |
Whether the stream is from personal library |
{stream.quality} |
string |
Quality indicator of the stream |
{stream.resolution} |
string |
Video resolution (e.g., "1080p", "4K") |
{stream.languages} |
string[] |
Available audio/subtitle languages |
{stream.languageEmojis} |
string[] |
Available audio/subtitle languages in emoji form |
{stream.visualTags} |
string[] |
Tags related to video characteristics |
{stream.audioTags} |
string[] |
Tags related to audio characteristics |
{stream.releaseGroup} |
string |
Name of the group that released the content |
{stream.encode} |
string |
Encoding format (e.g., "x264", "HEVC") |
{stream.indexer} |
string |
Source indexer that provided the stream |
{stream.title} |
string |
The title of the movie or show, extracted from the filename |
{stream.year} |
string |
Any year contained in the filename |
{stream.season} |
number |
The season number |
{stream.seasons} |
[number[](#array-modifier) |
A list of seasons detected for multi-season packs |
{stream.episode} |
number |
The episode number |
{stream.seeders} |
number |
Number of seeders (for torrents) |
{stream.age} |
string |
Age of the stream since release |
{stream.duration} |
number |
Duration of the media in seconds |
{stream.infoHash} |
string |
Info hash for torrent streams |
{stream.message} |
string |
Additional information or status message |
| Access | Type | Description |
|---|---|---|
{provider.id} |
string |
Unique identifier of the provider |
{provider.shortName} |
string |
Abbreviated name of the provider |
{provider.name} |
string |
Full name of the provider |
{provider.cached} |
boolean |
Whether the stream is cached |
| Access | Type | Description |
|---|---|---|
{addon.id} |
string |
Unique identifier of the addon |
{addon.name} |
string |
Display name of the addon |
| Access | Type | Description |
|---|---|---|
{debug.json} |
string |
Raw JSON string representation of data |
{debug.jsonf} |
string |
Formatted JSON string representation of data |
-
::upper- Convert string to uppercase -
::lower- Convert string to lowercase -
::title- Title case the string (capitalise the first letters) -
::length- Return the length of the string -
::reverse- Reverses the string
-
::bytes- Format number as bytes with appropriate unit (KB, MB, GB) -
::time- Format number of seconds as human-readable time -
::hex- Encode the number to hex -
::octal- Encode the number to octal -
::binary- Encode the number to binary
-
::join('separator')- Join array elements with specified separator -
::length- Return the number of elements in the array -
::first- Return the first element of the array -
::last- Return the last element of the array
To use conditional modifiers, you need to add them after the variable with a double colon ::, like normal modifiers but with a different format: {variableName.property::conditionalModifier["trueString"||"falseString"]}.
For example, to show the seeders if greater than 1, you would do the following:
{stream.seeders::>1["{stream.seeders}"||""]}
| Modifier | Description | Types | Variables |
|---|---|---|---|
| istrue | If the boolean is true | boolean | None |
| isfalse | If the boolean is true | boolean | None |
| exists | Whether the element exists | string, array | None |
| $X | If the string starts with X | string | X = string |
| ^X | If the string ends with X | string | X = string |
| ~X | If the string includes X | string | X = string |
| =X | If the value equals to X | string, number | X = string or number |
| >=X | If the number is greater or equal to X | number | X = number |
| >X | If the number is greater than X | number | X = number |
| <=X | If the number is lesser or equal to X | number | X = number |
| <X | If the number is lesser than X | number | X = number |
Note
The istrue and isfalse modifiers returns false when the property is null. Therefore, you must use two conditional modifiers when wanting to show an output depending on whether a value is true or false but not null.
You also have a few formatting tools available throw the following syntax:
{tools.toolName}
| Access | Description |
|---|---|
{tools.newLine} |
Will add a newline wherever placed |
{tools.removeLine} |
Will remove the entire line wherever found |
Find formats created by the community and share your own at the Discord Server
Author: Viren070
This is the default 'gdrive' format written as a custom formatter:
Name:
{stream.proxied::istrue["π΅οΈ "||""]}{stream.infoHash::exists["[P2P]"||""]}{provider.shortName::exists["[{provider.shortName}"||""]}{provider.cached::istrue["β‘] "||""]}{provider.cached::isfalse["β³]"||""]}{addon.name}{stream.personal::istrue[" (Your Media)"||""]} {stream.resolution::exists["{stream.resolution}"||""]}
Description:
{stream.quality::exists["π₯ {stream.quality} "||""]}{stream.encode::exists["ποΈ {stream.encode} "||""]}{stream.releaseGroup::exists["π·οΈ {stream.releaseGroup}"||""]}
{stream.visualTags::exists["πΊ {stream.visualTags::join(' | ')} "||""]}{stream.audioTags::exists["π§ {stream.audioTags::join(' | ')}"||""]}
{stream.size::>0["π¦ {stream.size::bytes} "||""]}{stream.duration::>0["β±οΈ {stream.duration::time} "||""]}{stream.seeders::>0["π₯ {stream.seeders} "||""]}{stream.age::exists["π
{stream.age} "||""]}{stream.indexer::exists["π {stream.indexer}"||""]}
{stream.languages::exists["π {stream.languages::join(' | ')}"||""]}
{stream.folderName::exists["π {stream.folderName}"||""]}
{stream.filename::exists["π {stream.filename}"||""]}
Name:
{config.addonName}
Description:
π² {stream.proxied::istrue["π΅οΈ "||""]}{stream.infoHash::exists["[P2P] "||""]}{provider.shortName::exists["[{provider.shortName}"||""]}{provider.cached::istrue["β‘] "||""]}{provider.cached::isfalse["β³] "||""]}{addon.name} {stream.resolution::exists["{stream.resolution}"||""]}{stream.personal::istrue[" (Your Media)"||""]}
{stream.quality::exists["π₯ {stream.quality} "||""]}{stream.encode::exists["ποΈ {stream.encode} "||""]}{stream.releaseGroup::exists["π·οΈ {stream.releaseGroup}"||""]}
{stream.visualTags::exists["πΊ {stream.visualTags::join(' | ')} "||""]}{stream.audioTags::exists["π§ {stream.audioTags::join(' | ')}"||""]}
{stream.size::>0["π¦ {stream.size::bytes} "||""]}{stream.duration::>0["β±οΈ {stream.duration::time} "||""]}{stream.seeders::>0["π₯ {stream.seeders} "||""]}{stream.age::exists["π
{stream.age} "||""]}{stream.indexer::exists["π {stream.indexer}"||""]}
{stream.languages::exists["π {stream.languages::join(' | ')}"||""]}
{stream.folderName::exists["π {stream.folderName}"||""]}
{stream.filename::exists["π {stream.filename}"||""]}
Important
The Wiki has moved to docs.aiostreams.viren070.me