* Parse post live dvr info
* add otf info
* dash rework
* Bug in detecting live videos in HLS streams
* small refactor
* otf support (maybe)
* remove indexRangeExact
* tweak
* Enable OTF, and hope for the best
* Fix OTF and post live dvr
* logs
* tweaks and error handling
* change profile
* dash tweaks
* hls tweak
* Drm support
* A few tweaks to http connection
* changelog
* changelog
* add requires_widevine_drm to app manifest
* movie renderer nodes
* Small fix in header parsing
* Fix windows path issues
* Few script changes to support windows
* Update build scripts
* remove duplicate call
* changelog
* Fix for telnet test runner
* Consistent node parser warnings
* telemetry release
* remove friendly name from tags
* revert log level calls, use noTelemetry
* Ignore nodes
* Event fingerprinting
* ignore known error
* NodesParser fingerprinting
* user id
* Fix missing title when fetching video
* changelog
* tweak
* no telemetry in longpoller
* rate limit
* Attachment support
* Playlet decipher server
* cache sts
* wip
* PoToken per video
* remove unused param
* potoken mandatory for videos
* separate potoken option
* logging
* rename
* /player with auth
* Refactor rename
* Fix rename
* parse isloggedin tweak
* TODO
* get rid of hardcoded formats
* Remove hardcoded formats in web app
* refactor
* no cache for sts request
* [skip ci] todo
* [skip ci] update PRVACY
* No visitor data if we're using a profile
* Cancellation
* remove visitor data header for authed /player
* iOS fallback for live videos
* changelog
* revert using dashUrl
* refactor
* Add Job System
* Remove testing stuff
* changelog
* plugin work
* Convert a couple more jobs
* simplify callback
* assert
* Logging changes and rendezvous perf
* changelog
* sb segment viewed job
* clear cache, and few changes
* Lint fix
* a couple more jobs
* reduce rendezvous in web server
* refactor
* Lint fix
* no message
* test shutdown
* comment
* free fields
---------
Co-authored-by: github-action linter <githubaction@githubaction.com>
* [Spike] ytjs and boguard in web app
* storyboards and captions
* cache potoken
* captions fix
* Increase session data to 7 days
* changelog
* Fix missing timestamp issue
* Watch history has video info
* Lint fix
* Fix upcoming in watch history
---------
Co-authored-by: github-action linter <githubaction@githubaction.com>
* Search continuations
* add another type of playlists
* Continuation for search and channels working
* Playlist continuation
* Fix pagination - what a fucking mess I've created
* web app fix
* Changelog
* Parse author in videoRenderer
* Parse more fields
* Parse live badge
* playlist video count
* Parse more things
* parse playlists and albums
* More parsing work
* announcement and changelog
* Lint fix
---------
Co-authored-by: github-action linter <githubaction@githubaction.com>
* locale for web app
* more translations
* Rename profiles service to avoid locale conflict
* More translation work
* Lint fix
---------
Co-authored-by: github-action linter <githubaction@githubaction.com>
* OK button as Play/Pause
First OK press now shows Video UI.
It's achievable via hidden Roku Video node property `showUI`, which allows you to override how trickplay should be displayed by specifying parts of the UI to be rendered (like 'titleAndTime', 'trickplayBar', e.t.c). A timer is started every time custom UI is shown to prevent UI from staying forever.
Second OK press while UI is visible pauses the video (pause poster animation is not added yet).
However, since we shouldn't break default OK button actions, we must track whether user is seeking in video UI and if they do, fallback to Video internal OK handler.
Also, auto-formatted VideoPlayer.xml
* fix comment typo
* move HideUI function slightly higher
* Addressed the feedback:
* Add a workaround to leave Live video behavior intact (no pause, ok simply switches UI back and forth)
* Hide UI when minimizing to avoid a bug where title and time element could stay forver
* More aggressive `isSeeking` detection, so every left/right/ff/rw button press would cause us to fall back to default OK button handler
* More accurate liveNow handling
* Changelog
---------
Co-authored-by: Brahim Hadriche <brahim.hadriche@gmail.com>
* Refactor long press
* Lint fix
* Queue UI, refactor PlayQueue to use ContentNode
* Add queue notification hint
* Play at index
* Play queue with highlight
* Priority
* Comment
---------
Co-authored-by: github-action linter <githubaction@githubaction.com>
* Smooth scroll to top if active screen selected in web UI
* Use fullname repo
---------
Co-authored-by: agathanonymous <agatha@juggalol.com>
Co-authored-by: Brahim Hadriche <brahim.hadriche@gmail.com>
* Empty bookmarks screen
* Bookmarks object
* Long press support
* Lint fix
* Context menu v1
* A working context menu
* Basic bookmarks in context menu
* Use a root content node for bookmarks
* context menu animation
* small tweak
* move logger around, adjust animation
* Lint fix
* Restore logger fix
* Cache channel info
* Bookmarks v1
* Added comment
* Adjust "popular" feed error handling
* Progress with bookmarks
* Add todo
* add todo
* handle roDateTime logging
* logger adjustment
* Use yaml for api and layout
* rename requestData to feedSource
* Restructure things
* Lint fix
* remove comment
* introduce feedSource id
* small cleanup
* playlist context menu
* Context menu for the channel view
* changelog
---------
Co-authored-by: github-action linter <githubaction@githubaction.com>
* Generate dash locally
* Refactor xml gen
* Lint fix
* Add feature flag
* Multi language audio tracks
* Unused var
* Set video expiration to 5 hours
---------
Co-authored-by: github-action linter <githubaction@githubaction.com>
Playlet, the Roku app, does not collect any user information whatsoever.
In fact, it does not have any servers capable of collecting any form of data.
Playlet, the Roku app, does not collect any user personal information whatsoever.
Playlet does not show advertising, whether personalized or non personalized.
Playlet may integrate with 3rd party telemetry services in order to capture anonymous diagnostics data. The only purpose of this data is to diagnose issues and improve the app.
## Invidious
Playlet may request information from one or more [Invidious](https://invidious.io/)
servers, depending on user configuration. With these requests, absolutely no
user data is collected, and only the bare minimum and necessary information
servers, depending on user configuration. With these requests, absolutely no
user data is collected, and only the bare minimum and necessary information
is sent, which is used to enable the viewing of content.
Please note that some of the [Invidious](https://invidious.io/) servers used
could be public instances hosted by volenteers. These instances are available
[here](https://api.invidious.io/).
at [api.invidious.io](https://api.invidious.io/).
While invidious does no data collection by default, and it is in fact built to
be privacy driven, but in theory, from a playlet request it is possible to
know the IP address of a user, the identifiers of watched video, and search
be privacy driven, but in theory, from a Playlet request it is possible to
know the IP address of a user, the identifiers of watched video, and search
keywords. In case the user has privacy concerns, they can host their own
Invidious instance and use it from Playlet.
## SponsorBlock
Playlet may request information from a [SponsorBlock](https://github.com/ajayyy/SponsorBlock)
server, in order to get sponsor sections for requested videos to watch.
With these requests, absolutely no
user data is collected, and only the bare minimum and necessary information
## Innertube
When the Playlet built-in backend is in use, instead of an Invidious instance,
Playlet makes requests directly to Innertube instead of Invidious.
Similar to Invidious requests, only the bare minimum and necessary information
is sent, which is used to enable the viewing of content.
Playlet uses hashing when requesting video metadata, which obfuscates
Additionally, when a YouTube account is used in Playlet, Innertube traffic can
become associated with the account, which further reduces user privacy. This
is necessary to use features associated with YouTube accounts, such as
subscriptions, playlists, and watch history.
## SponsorBlock
Playlet may request information from a [SponsorBlock](https://github.com/ajayyy/SponsorBlock)
server, in order to get sponsor sections for requested videos to watch.
With these requests, absolutely no
user data is collected, and only the bare minimum and necessary information
is sent, which is used to enable the viewing of content.
Playlet uses hashing when requesting video metadata, which obfuscates
the video id requested. This is a SponsorBlock privacy feature that protects
user privacy.
Additionally, Playlet may send a "skipped" event to SponsorBlock, to indicate
that a section of a video has been skipped. This event does not have any
tracking information attached to it, and it is anonymous. It is merely to
indicate to contributers how much their contributions are being used in the wild.
that a section of a video has been skipped. This event does not have any
tracking information attached to it, and it is anonymous. It is merely to
indicate to contributors how much their contributions are being used in the wild.
## LeanBack
LeanBack, also known as Lounge API, also known as "cast from phone". Is a feature that Playlet implmements as a convenience to allow users to use a separate device to browse and cast videos.
When this feature is used, all traffic related to the videos being watched, added to the queue, and the video player state is routed through YouTube servers.
Playlet tries to preserve user privacy, to the best of its ability, by implementing several techniques, such as randomizing device id, using a fresh session on each start, and only providing necessary fields for the feature to function.
Additionally, Playlet does not join a session/lounge, until a device is attempting to connect using DIAL (**DI**scovery **A**nd **L**aunch spec) also known as "Connect with Wi-Fi", or when a `Link with TV code` is generated, by visiting the appropriate settings page.
If you have privacy concerns and do not wish to use this functionality, simply do not connect from a local network using the YouTube app or the browser, and do not visit the `Link with TV code` tab.
@@ -34,24 +40,28 @@ More under [Screenshots](./docs/screenshots/README.md)
## Installation
[Playlet on Roku channel store](https://channelstore.roku.com/en-ca/details/840aec36f51bfe6d96cf6db9055a372a/playlet)
[Playlet on Roku channel store](https://channelstore.roku.com/details/4a41d0921265a5e31429a7679442153f:b5bcb5b630c28b01e93bf59856317b43/playlet) or search "Playlet" in the Roku channel store on your device.
Can't install from the store? See [How to install Playlet as a sideloaded/dev app](https://github.com/iBicha/playlet/discussions/371)
## Features
- 🔥 No Ads (Not now, not ever)
- 🕵️ No Tracking
- 🛡️ Privacy driven (uses Invidious backend)
-⚔️ SponsorBlock integration (skips undesirable sections in videos)
-📱 Browse, search, and cast from phone using the web app
-🙋 User accounts (supports YouTube and Invidious accounts)
-⚔️ [SponsorBlock](https://sponsor.ajay.app/) integration (skips undesirable sections in videos)
- 📱 Browse, search, and cast from phone using the YouTube app or the browser
- 🔮 Picture-in-picture mode
- ⚡ Fast! [Check out how we compare with the official Youtube app](https://youtu.be/qmSvA-QQW20)
- ⚡ Fast! [Check out how we compare with the official YouTube app](https://youtu.be/qmSvA-QQW20)
- 🔤 Translated using [Weblate](https://hosted.weblate.org/projects/playlet/playlet/)
### Cast from phone
1. Open "Web app" tab in Playlet
1. Scan QR Code with Phone
1. Browse or search videos
1. Click the video and choose the "Play on TV" option
- Open "Remote" tab in Playlet
- Scan QR Code with Phone, and use the browser; OR
- Use the YouTube app to connect using the same Wi-Fi; OR
- Use the `Link with TV code` to connect
### Picture-in-picture
@@ -62,14 +72,24 @@ More under [Screenshots](./docs/screenshots/README.md)
### Customize Invidious instance
1. Open settings in Playlet
1. Scan QR Code with Phone
1.Change the Invidious instance
1.You can also do this from the settings tab
1. Select Invidious -> Instance
1.Set a custom instance, or choose a public one hosted by volunteers (from [api.invidious.io](https://api.invidious.io/))
1.Optionally, Select `Test instance` to make sure it works
1. Hit save
> ℹ️ **Note**: If you are logged in when you change the instance, you will remain logged in to the old instance. In this case, Playlet will use the old instance to retrieve your subscriptions and your playlists, but will use the new instance for everything else. After switching to a new instance, you can log out and log in again to use your profile on the new instance.
## Development
For everything related to Playlet app development, please see the [documentation](./docs/README.md)
## Analytics and telemetry
Roku collects usage data, and you can find the data made available to Playlet in the [Wiki](https://github.com/iBicha/playlet/wiki).
Playlet could run on variaty of devices, with different capabilities and screen sizes, and different Invidious instances, in addition to the experimentation YouTube does based on account and/or ip.
This is why it was necessary to collect telemetry/diagnostics data, in order to capture issues and fix them. However, you can disable this feature in the settings.
But it's not enough, it's important to report any issues you encouter using Playlet, so they can be addressed.
## Why Playlet
```none
@@ -78,10 +98,10 @@ play•let /ˈplālət/
: a short play
```
**Playlet** is about keeping the time you spend on Youtube short and useful. It values your time, so it does not show you ads, and allows you to skip sponsored sections and other irrelevant information that's designed to monitize you and/or waste your time.
**Playlet** is about keeping the time you spend on YouTube short and useful. It values your time, so it does not show you ads, and allows you to skip sponsored sections and other irrelevant information that's designed to monitize you and/or waste your time.
There's a cliché about how a lot of open source software is **`"Made with ♡"`**. This project in particular is **not**.<br/>
**Playlet** was created out of **spite**, because I believe I have watched enough back-to-back, unskippable Youtube ads for a lifetime.
**Playlet** was created out of **spite**, because I believe I have watched enough back-to-back, unskippable YouTube ads for a lifetime.
By removing all the bloat, the ads, the tracking, we could end up with an even faster app than the official one.
@@ -90,6 +110,7 @@ In any case, I hope you find **Playlet** useful, and pleasant to use.
## Disclaimer
**Playlet** does not serve or distribute any material from unauthorized sources.<br/>
**Playlet** is simply a frontend to other systems (such as [Invidious](https://github.com/iv-org/invidious)), bringing the watching experience to the TV, as opposed to the existing frontends that are web and mobile focused.
**Playlet** is simply a frontend to other systems (such as [Invidious](https://github.com/iv-org/invidious)), bringing the watching experience to the TV, as opposed to the existing frontends that are web and mobile focused.<br/>
**Playlet** authors acknowledge that all trademarks and registered trademarks mentioned in this repository and related pages are the property of their respective owners. The use of these trademarks or trade names is for identification purposes only and does not imply any endorsement, affiliation, or sponsorship by the trademark owner.
- Playlet relies on [Invidious](https://github.com/iv-org/invidious). Invidious tries to keep up with Youtube making changes to their platform, but sometimes, a breaking change happens that requires Playlet to react quickly. Releasing through the Roku Channel store can take days, or a week. During this time, Playlet would be not functional, and that's not acceptable.
- The ability to roll back: Sometimes an app breaking bug gets released. Allowing users to choose a seperate version is a flexible way to keep things working. Although right now rollbacks are behind a - hidden by default - developer menu, the reasoning still stands.
- It is simply easier to release: Releasing Playlet Lib on Github, and everyone receives the latest version immediately, is very conveninct and less of a hassle, than going through the Roku Channel store.
- Playlet relies on [Invidious](https://github.com/iv-org/invidious). Invidious tries to keep up with YouTube making changes to their platform, but sometimes, a breaking change happens that requires Playlet to react quickly. Releasing through the Roku Channel store can take days, or a week. During this time, Playlet would be not functional, and that's not acceptable.
- The ability to roll back: Sometimes an app breaking bug gets released. Allowing users to choose a seperate version is a flexible way to keep things working. For example, it's possible to choose a different verrsion from the developer settings in the web app.
- It is simply easier to release: Releasing Playlet Lib on Github, and everyone receives the latest version immediately, is very convenient and less of a hassle, than going through the Roku Channel store.
- I've had instances where I was trying to pass the certfication for Playlet to publish it. One of the criterias is to pass a some automated tests. But the tests were failing because their system could not connect to their Roku test devices (connection keeps timing out). My only option was to keep trying over and over until it worked.
- It might sound that Playlet Lib is just a workaround for the Roku Channel release process. But phrased differently, Roku Channel release process is not good enough of what we need for Playlet.
- Canary builds: The latest version of Playlet can be tested as soon as it lands in the main branch. This is a great way to test newer features in production, without affecting the stability of the released version. Roku has the concept of "beta" channels, but they are more cumbersome.
@@ -163,9 +164,7 @@ Playlet lib comes equipped with a web server that runs on port 8888 when the app
- Allows remotely casting videos, change preferences, etc.
- Authentication using Invidious
The web server runs on a continiously running [Task](https://developer.roku.com/en-ca/docs/references/scenegraph/control-nodes/task.md) and uses a middeware system to manage routes, serve static files, [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS), and more.
The server's API enpoints are described through the Open API spec file [playlet-web-api.yml](./playlet-web-api.yml)
The web server runs on a continuously running [Task](https://developer.roku.com/en-ca/docs/references/scenegraph/control-nodes/task.md) and uses a middeware system to manage routes, serve static files, [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS), and more.
Please note: while we would like to keep the API stable as much as possible, Playlet can't reasonbly maintain multiple versions of the API like traditional web apis, because it adds complexity and maintainablity burden on an app the runs in constrained environment. In short, we'll try not to break the API, but we might from time to time.
@@ -181,15 +180,16 @@ These are useful to see if the files and caching are working as expected.
### Releases from Github
Since Component Libraries are simply zip files hosted at some https endpoint, Github releases are used to host and deliver Playet Lib to users. By default, Playlet grabs `https://github.com/iBicha/playlet/releases/latest/download/playlet-lib.zip` and loads it, but this can be pointed to somewhere else, if for some reason the Github repository becomes unavailable.
Since Component Libraries are simply zip/squashfs files hosted at some HTTPS endpoint, Github releases are used to host and deliver Playet Lib to users. By default, Playlet grabs `https://github.com/iBicha/playlet/releases/latest/download/playlet-lib.squashfs.pkg` and loads it, but this can be pointed to somewhere else, if for some reason the Github repository becomes unavailable.
Squashfs files are faster to load, but they require signing. Zip files can be used without signing if they are served from an HTTPS endpoint.
### Dev library hosted by VS Code Extension
When in debug mode, Playlet lib is packaged and served locally on port 8080, and Playlet app would use it instead of the Playlet lib from Github. This is an important detail, because once you stop debugging in VS Code, the dev app on your Roku TV won't function anymore, with an error:
When in debug mode, Playlet lib is packaged and served locally on port 8086, and Playlet app would use it instead of the Playlet lib from Github. This is an important detail, because once you stop debugging in VS Code, the dev app on your Roku TV won't function anymore, with an error:
> Could not load Playlet component library from any of the following urls:
> If the problem persist, contact Playlet authors.
@@ -210,13 +210,13 @@ Additionally, the web server exposes the settings under `/api/preferences`, whic
When Playlet starts, it shows a video feed on the screen. Subscription, Trending videos, and so on.
The layout is defined under [playlet-lib/src/config/default_home_layout.json5](/playlet-lib/src/config/default_home_layout.json5).
The layout is defined under [playlet-lib/src/config/default_home_layout.yaml](/playlet-lib/src/config/default_home_layout.yaml).
This could allow users to define custom layouts, so they can see what they find relevant in the home page. This can include Subscription, Trending, Popular videos, Search per keywords, or Playlists.
Additionally each feed has information on how it is fetched. For now, only Invidious can be data source, but other systems should be configured in the same way.
Invidious API definitions are defined under [playlet-lib/src/config/invidious_video_api.json5](/playlet-lib/src/config/invidious_video_api.json5), and Playlet parses these at runtime and make the right API calls to fetch the data.
Invidious API definitions are defined under [playlet-lib/src/config/invidious_video_api.yaml](/playlet-lib/src/config/invidious_video_api.yaml), and Playlet parses these at runtime and make the right API calls to fetch the data.
Finally, this layout system is what allows both the BrightScript app and the Web app to display the same homepage.
@@ -256,7 +256,7 @@ The web app uses [Svelte](https://svelte.dev/), [Vite](https://vitejs.dev/) and
Since modifying the web app code requires building all three projects (Playlet, Playlet lib, and Playlet web app) this makes the iteration speed very slow, and we lose the benefits of web development, such as hot reloads.
For that reason, the recommended iteration when working on the dev app is:
For that reason, the recommended iteration when working on the web app is:
1. Start `Playlet (dev)` (by selecting `Playlet (dev)` and pressing Play in VS Code)
1. Once Playlet starts, switch to `Playlet Web (dev)` and press play. Do not stop `Playlet (dev)`
@@ -272,7 +272,11 @@ For debugging, choose the compound target `Playlet Web (Debug)`.
The Playlet web app uses [Tailwind CSS](https://tailwindcss.com/) as its base styling library. Additionally, it uses [DaisyUI](https://daisyui.com/) as it offers a versatile set of components, and has built-in supports for themes.
### API calls (proxy authenticated)
### API calls
The Playlet web app communicates with the Playlet Roku app using web APIs. The web app also uses Invidious apis documented at [https://docs.invidious.io/api](https://docs.invidious.io/api)
#### API calls (proxy authenticated)
When making authenticated calls to Invidious (for example to fetch the user Subscription feed) the Bearer token is needed.
@@ -286,22 +290,28 @@ For API calls that don't require authentication, the web app fetches data from I
### Developer settings
The developer settings are only visible through the web app. They are found at the buttom of the settings page.
The developer settings are found at the buttom of the settings page.
For now, it allows you to point to a different Github release other than the default `latest`.
One setting that is only available in the web app is `Playlet Library version`. It allows you to point to a different Github release other than the default `latest`.
This is mostly useful to QA the `canary` release (see [Canary release](https://en.wikipedia.org/wiki/Feature_toggle#Canary_release)) in a "production" setting before making it available to all users as the official "latest" version.
#### In case of a softlock
If the dev menu is used to load a custom Playlet lib url, but the lib does not have a functionality to revert back:
If the dev menu is used to load a custom Playlet lib url, but you couldn't revert back:
description:The ID of the content to play. If specified with mediaType=video, this is the videoId.
required:false
schema:
type:string
ecpMediaType:
name:mediaType
in:query
description:The type of the content of ContentId. To be used with the contentId argument.
required:false
schema:
type:string
enum:
- video
ecpVideoId:
name:videoId
in:query
description:The video ID of the video to play. If specified, the video will be played.
required:false
schema:
type:string
ecpTimestamp:
name:timestamp
in:query
description:The timestamp of the video to play. To be used with the contentId argument.
required:false
schema:
type:integer
ecpTitle:
name:title
in:query
description:The title of the video. This is optionally added so we can display the title while loading, or when displaying the "Added to queue" notification.
required:false
schema:
type:string
ecpAuthor:
name:author
in:query
description:The author of the video. This is optionally added so we can display the author while loading, or when displaying the "Added to queue" notification.
required:false
schema:
type:string
ecpClearPlayletLibUrls:
name:clearPlayletLibUrls
in:query
description:If specified, the Playlet lib URLs will be cleared.
Playlet implements a few [Brighterscript Plugins](https://github.com/rokucommunity/brighterscript/blob/master/docs/plugins.md). The plugins inject themselves in the compilation process, allowing the modification of bs scripts, xml components, and even assets or the app manifest. Let's start with a simple one:
@@ -28,21 +30,6 @@ Brightscript can only parse json natively using [ParseJson](https://developer.ro
At the end of the build, the plugin scans for certain files (`jsonc`, `json`, `json5` and `yaml`), and converts them to plain json, while keeping the original file name. That way they are all parsable by the [ParseJson](https://developer.roku.com/en-ca/docs/references/brightscript/language/global-utility-functions.md#parsejsonjsonstring-as-string-flags---as-string-as-object) function, even though their original format is not compatible.
This plugin allows us to convert svg files to png files.
### Why
This is used to convert splash screen, app poster, as well as icons in the app. Having svg images (or vector images in general) as the source of truth is better, in case images need to be modified or resized. Since Roku can't load them, we convert them to png.
### How
Each `.svg` file found will have an associated `.svg.meta.json5` file, which will contain the hash (MD5) of the svg, conversion paramters, and the hash of the output files. This allows us to hash existing files and see if a conversion is needed.
Notice how each `.svg` file can be configured to generate multiple png files. This is especially the case to generate the app artwork (splash screen/poster) with different sizes from the same logo `.svg` file.
@@ -407,7 +394,7 @@ Notice how the function has `@oninit`, which means it will be called in the `Ini
When the `bindings` field is set, the node registers itself to a global array of nodes that need binding.
Next, once all nodes are registered, we need to call a function called `AutoBindSceneGraph()`. This need to be called once from the root node's `Init()` (concretely, [here](https://github.com/iBicha/playlet/blob/bea7fb209b2bd42aff620d06b416cf1e45988190/playlet-lib/src/components/MainScene.bs#L17))
Next, once all nodes are registered, we need to call a function called `AutoBindSceneGraph()`. This need to be called once from the root node's `Init()` (concretely, [here in MainScene.bs](https://github.com/iBicha/playlet/blob/bea7fb209b2bd42aff620d06b416cf1e45988190/playlet-lib/src/components/MainScene.bs#L17))
`AutoBindSceneGraph()` will loop through all the nodes that require binding, and use the information we assigned to `m.top.bindings` of each node to populate all the needed references.
calling `BindNode` will trigger all the binding steps just for this node. But it is expected that all its dependencies are already in the scene and can be found.
This plugin generates `Task` components a scripts that makes it simpler to call a function in a background thread, and get the result in a callback function.
The Job System simplifies the creation of background jobs without the risk of creating too many threads.
It manages a number of Tasks which are capable of executing jobs from a queue.
### Why
To implement functionality that runs in background threads, [Task](https://developer.roku.com/en-ca/docs/references/scenegraph/control-nodes/task.md)s must be used.
To implement functionality that runs in background threads, [Tasks](https://developer.roku.com/en-ca/docs/references/scenegraph/control-nodes/task.md) must be used.
Setting up a task involves lots of boilerplate: setting up the task in an xml file, defining inputs and outputs, code to listen for a task to finish, and so on.
Additionally, there's no standard way to do error handling, cancellation, and so on.
Additionally, there's no standard way to do error handling and cancellation.
Another concern is managing too many threads across the application, and managing rendezvous(s).
### How
Use a function with the attribute `@asynctask`.
In a separate file, define the task function:
Define a function in its own file called `ExecuteJob` annotated with `@job("JobName")`:
```brighterscript
@asynctask
function MyBackgroundTask(input as object) as object
myVar = input.myVar
@job("MyJob")
function ExecuteJob() as void
' input is an associative array set when the job is queued.
input = JobGetInput()
value = DoWork(myVar)
value = DoWork(input.myVar)
return {
value: value
}
' optional
JobSuccessData({result: value})
end function
```
And use the function like so
by doing this, the generator will generate a component named "MyJob" and will inherit from "BaseJob".
The job can now queued for execution:
```brighterscript
StartAsyncTask(MyBackgroundTask, {myVar: "some input"}, function(output as object) as void
The rest will be taken care of by the plugin, which will generate an `xml` file containing the task component, and a script that handles calling the function.
And the job system will take care of queueing, scheduling, and scaling up the available tasks in order to execute jobs.
The job system creates job nodes inside task threads, which reduces the amount of rendezvous necessary. Some rendezvous are still necessary, such as when a task node is signaling that it is ready to take on a new job, or when the job is returning results to render thread.
The job system will auto scale up to a maximum number of tasks, in order to avoid `Too many threads` errors. Once the job system activity settles down, the job system will release task nodes that has been idle for a certain amount of time.
Although very useful, this pattern might not be the best for long running tasks (like the Web Server) or other tasks that require task reuse. This is because `StartAsyncTask` create a new instance of the task every time.
Although very useful, this pattern might not be the best for long running tasks (like the Web Server) and it is simpler to create dedicated tasks for those.
By now, you realize we make a lot of transformations to the source code through many plugins. As a sanity check, this plugin allows us to keep track of the transpiled files, so we can be sure that the output is what we expect.
**[Source](/tools/bs-plugins/logger-plugin.ts)**
### Why
This is useful to catch errors with the plugin usage, of bugs with the plugins themselves.
The logger plugin does some code transformation to log calls, which can add caller path at compile time, or the filename, based on debug/release configuration.
### How
When transpiling a file, say `MyComponent.xml`, the plugin will see if there is a `MyComponent.transpiled.xml` right next to it in the source.
If a file is found, then the transpiled file of `MyComponent.xml` will be copied back from the staging folder to `MyComponent.transpiled.xml`.
The logger plugin searches for calls to the predefined functions `LogError`, `LogWarn`, `LogInfo` and `LogDebug`. Once found, it does the following (we take `LogError` as an example):
Additionally, if there's a folder `MyFolder` and `MyFolder.transpiled` in the source, then all transpiled files of `MyFolder` will also be copied back to `MyFolder.transpiled`. Keeping track of entire folders is primarily to track of transpiled files of test nodes and scripts.
- It replaces calls of `LogError` with `LogErrorX` where X is the number of arguments.
- For example, it replaces `LogError("Cannot complete operation:", error)` with `LogError2("Cannot complete operation:", error)`
- Based on usage, it generates `LogErrorX` functions used. Example:
To reduce the noise of this plugin, it only runs when we're making a test build.
Because we continiously make test build in Github actions, the tracked transpilied files will be automatically added to PRs, so that we notice if outputs do not look right.
- Finally, it adds the caller file and line number to the args.
-`LogError("Cannot complete operation:", error)` is replaced with `LogError(CALLER, "Cannot complete operation:", error)`
-`CALLER` would be the full path to the source .bs file and line number, for easier debugging
- In release mode, `CALLER` would be only the file name and line number, without the full path. This is so that dev directory does not get "leaked" in releases.
This is implemented to make it easy to identify where logs came from, and to generate log functions with the right number of parameters based on usage. This way we do not need all combination of functions (`LogError`, `LogWarn`, `LogInfo` and `LogDebug` multiplied by number of parameters, `LogError1`, `LogError2`, `LogError3`, and so on). Since brightscript does not support function templates or function overloading, it is either this method, or use optional parameters (but then we would have to check which parameter was passed, and which was is using the default value.) and end up with a log function with logs of if's else'es.
To understand more about what's being generated, download `playlet-lib.zip` from [releases](https://github.com/iBicha/playlet/releases), extract, and inspect the file `source/utils/Logging.brs`. You will see it contains log functions in the form `LogVerbX`, that are generated based on usage.
To give credit where credit is due, some of the ideas here (like adding the source location to the log) came from [roku-log](https://github.com/georgejecook/roku-log)
Handles routing annotations (e.g. `@get("/api/something")) so that they are handled by the routers/middlewares. It's nicer than having to register things by hand.
### How
Routers need to inherit from `Http.HttpRouter`. Then, once a request handled is annotated, e.g.
```bs
@get("/")
function GoHome(context as object) as boolean
response = context.response
response.Redirect("/index.html")
return true
end function
```
The route and the handler are added to the router. In this example, the `/` route redirects to `index/html`.
There one special annotation, and one special route:
- `@all` matches all methods
- `*` matches all paths
So `@all(*)` would be a middleware that will be matched with any request.
Roku's built-in localization system has some undesired side effects: for example, it might translate node ids, which would break the relationship between the nodes.
This plugin enforces some rules to ensure translation files are kept up to date with code implementation.
See the next section for the validation rules.
### How
The plugin checks for the following:
- Translated words and sentenses are defined in an enum annotated with `@locale`
- All the values in the `@locale` enums must be provided in the English (`en_US`) translation. This is because `en_US` is the fallback translation when the current localte translations are not complete.
- `en_US` must have matching source and translation values, so it can act as a fallback translation.
- All `source` translations from all languages must be present in the `@locale` enums. This is to prevent renaming the values in the code without updating translation files.
- Translation `source` keys can't be used except for certain fields such as `"text"` and `"title"`. This is to prevent the accidental localization of non-display fields, such as node ids.
To generate BrighterScript encoding/decoding functions for Protobuf types.
These are needed for some functionality (e.g. Search filters in Innertube backend)
### How
The plugin scans for `.proto` files, and parse them into plain objects using [protocol-buffers-schema](https://www.npmjs.com/package/protocol-buffers-schema)
Then the right functions that get generated to serialize/deserialize types.
Please note this generator is VERY bare bone: only features necessary for Playlet were implemented.
"description":"Unofficial Youtube client for Roku",
"version":"0.43.7",
"description":"Unofficial YouTube client for Roku",
"devDependencies":{
"@rokucommunity/bslint":"^0.8.10",
"@types/crypto-js":"^4.1.2",
"@types/fs-extra":"^11.0.2",
"@types/node":"^20.7.2",
"@types/xml2js":"^0.4.12",
"@rokucommunity/bslint":"^0.8.38",
"@types/crypto-js":"^4.2.2",
"@types/fs-extra":"^11.0.4",
"@types/node":"^24.9.2",
"@types/xml2js":"^0.4.14",
"argparse":"^2.0.1",
"brighterscript":"^0.65.7",
"brighterscript-formatter":"^1.6.33",
"convert-svg-to-png":"^0.6.4",
"cross-fetch":"^4.0.0",
"crypto-js":"^4.1.1",
"dotenv":"^16.3.1",
"express":"^4.18.2",
"fs-extra":"^11.1.1",
"glob":"^10.3.10",
"ip":"^1.1.8",
"brighterscript":"0.70.3",
"brighterscript-formatter":"^1.7.19",
"convert-svg-to-png":"^0.7.1",
"crypto-js":"^4.2.0",
"dotenv":"^17.2.3",
"fs-extra":"^11.3.2",
"glob":"^11.0.3",
"imap":"^0.8.19",
"ip":"^2.0.1",
"json5":"^2.2.3",
"roku-deploy":"^3.10.3",
"rooibos-roku":"^5.7.0",
"semver":"^7.5.4",
"shelljs":"^0.8.5",
"ts-node":"^10.9.1",
"typescript":"^5.2.2",
"mailparser":"^3.7.5",
"protocol-buffers-schema":"^3.6.0",
"puppeteer":"^24.27.0",
"roku-deploy":"^3.14.4",
"roku-test-automation":"^2.2.1",
"rooibos-roku":"5.15.5",
"rounded-rect-9patch":"^1.1.2",
"semver":"^7.7.3",
"shelljs":"^0.10.0",
"ts-node":"^10.9.2",
"typescript":"5.9.3",
"telnet-client":"^2.2.6",
"xml2js":"^0.6.2",
"yaml":"^2.3.2"
"yaml":"^2.8.1"
},
"engines":{
"node":"18"
"node":"22"
},
"scripts":{
"dev:web":"cd playlet-web && npm run dev",
"prebuild":"rm -rf dist",
"build:dev":"npm run build:web && npm run build:lib:dev && npm run build:app:dev",
"build:prod":"npm run build:web && npm run build:lib:prod && npm run build:app:prod",
"build:release":"npm run build:release:ci && npm run sign-package",
"build:release:ci":"npm run format:fix && npm run lint:fix && npm run version-sync && npm run manifest-git-hash && npm run build:prod",
"prebuild":"node tools/rm.js dist",
"build:dev":"npm run prebuild && npm run build:web && npm run build:lib:dev && npm run build:app:dev",
"build:prod":"npm run prebuild && npm run build:web && npm run build:lib:prod && npm run build:app:prod",
"build:release":"npm run prebuild && npm run format:fix && npm run lint:fix && npm run version-sync && npm run manifest-git-hash && npm run build:prod",
"build:app:dev":"cd playlet-app && npm run build:dev",
"build:app:prod":"cd playlet-app && npm run build:prod",
"build:lib:dev":"cd playlet-lib && npm run build:dev",
"build:lib:prod":"cd playlet-lib && npm run build:prod",
"build:web":"cd playlet-web && npm run build",
"lint":"cd playlet-lib && npm run lint && cd ../playlet-app && npm run lint",
"lint:fix":"cd playlet-lib && npm run lint:fix && cd ../playlet-app && npm run lint:fix",
"lint":"cd playlet-lib && npm run lint && cd ../playlet-app && npm run lint && cd ../playlet-web && npm run lint",
"lint:fix":"cd playlet-lib && npm run lint:fix && cd ../playlet-app && npm run lint:fix && cd ../playlet-web && npm run lint",
"format":"cd playlet-lib && npm run format && cd ../playlet-app && npm run format",
"format:fix":"cd playlet-lib && npm run format:fix && cd ../playlet-app && npm run format:fix",
"test":"npm run test:lib && npm run test:app",
@@ -54,14 +58,23 @@
"test:build:app":"cd playlet-app && npm run test:build",
"test:lib":"cd playlet-lib && npm run test",
"test:build:lib":"cd playlet-lib && npm run test:build",
d="m 180.21484,360.71785 h 3.43467 v -11.34934 h 6.34667 v 11.34934 h 6.64534 v 5.22667 h -6.64534 v 20.23468 q 0,2.61333 1.64267,4.256 1.64267,1.568 4.256,1.568 v 5.6 q -6.048,0 -9.184,-2.912 -3.06134,-2.912 -3.06134,-8.512 v -20.23468 h -3.43467 z"
d="m 180.21484,360.71785 h 3.43467 v -11.34934 h 6.34667 v 11.34934 h 6.64534 v 5.22667 h -6.64534 v 20.23468 q 0,2.61333 1.64267,4.256 1.64267,1.568 4.256,1.568 v 5.6 q -6.048,0 -9.184,-2.912 -3.06134,-2.912 -3.06134,-8.512 v -20.23468 h -3.43467 z"
Loaded 100 of 730 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.