Compare commits

..
114 Commits
Author SHA1 Message Date
Brahim Hadriche 9df1b70e49 Release v0.19.0 (#258) 2024-01-10 17:12:53 -05:00
Brahim Hadriche bb471a5cde Sponsorblock tweak 2024-01-09 23:09:47 -05:00
Brahim Hadriche b68aad7d4a Add links to internal state 2024-01-09 22:08:23 -05:00
Brahim Hadriche 73b6314ec7 Add app logs to log file
Refactor a new functions by adding name spaces
Startup times are now logged
2024-01-09 14:19:54 -05:00
Brahim Hadriche 29969db3e4 use location hash to store current tab 2024-01-08 20:42:39 -05:00
Brahim Hadriche 5335a0273b Feature/optimize task imports (#257)
* Prune empty code files

* delete file

* Restore

* refactor

* fix warnings

* Fix tasks

* Add diag

* tweak

* Log load times

* changelog
2024-01-08 19:38:39 -05:00
Brahim Hadriche 641c9ef5bf setting description tweak 2024-01-07 22:39:27 -05:00
Brahim Hadriche b0257d97e0 [skip ci] docs 2024-01-07 22:24:20 -05:00
Brahim Hadriche 5c9c1c204f [skip ci] plugin docs 2024-01-07 22:16:14 -05:00
Brahim Hadriche 11afc34ecc [skip ci] typo 2024-01-07 19:06:13 -05:00
Brahim Hadriche 3edfce1366 Fix for bookmarked invalid videos (#255)
* Fix for bookmarked invalid videos

* Update InvidiousService.bs

* Change status code
2024-01-07 16:48:58 -05:00
Brahim Hadriche 5ff02af7ac Remove deprecated related channels leftover 2024-01-07 16:40:55 -05:00
Brahim Hadriche 0cc8cdf2be [skip ci] add close button to layout editor in web app 2024-01-07 11:48:00 -05:00
Brahim Hadriche 3ecac831bf [skip ci] warn on failed requests 2024-01-07 11:21:07 -05:00
Brahim Hadriche 86d5710969 Fix HTTP/0.9 when not allowed errors (#253)
* Fix `HTTP/0.9 when not allowed` errors

* tweak retry callback

* throw ex in debug mode
2024-01-07 11:17:05 -05:00
Brahim Hadriche 575935f5ac Generate type validation functions (#254) 2024-01-07 11:08:03 -05:00
Brahim Hadriche 7eb20dfe2c [skip ci] comment 2024-01-06 18:55:59 -05:00
Brahim Hadriche 0b01830ad9 changelog edit 2024-01-06 18:31:46 -05:00
33fdf796a2 update dependencies (#251)
Co-authored-by: iBicha <iBicha@users.noreply.github.com>
Co-authored-by: Brahim Hadriche <brahim.hadriche@gmail.com>
2024-01-06 18:24:51 -05:00
Brahim Hadricheandgithub-action linter fd7bdde733 Customize home screen (#250)
* Customize home screen

* remove logs

* Lint fix

* move func

* Fix for checklist

* Fix save state

* open api

* Fix spec

* Changelog

* Add TODO

* Button size

---------

Co-authored-by: github-action linter <githubaction@githubaction.com>
2024-01-06 18:17:29 -05:00
Brahim Hadriche e7324495fe [skip ci] add MathUtils 2024-01-06 10:01:59 -05:00
Brahim Hadriche 2e7b3d0aa5 Add curl error codes 2024-01-06 10:00:17 -05:00
Brahim Hadriche 20f345593e [skip ci] small tweak in http client 2024-01-02 21:05:16 -05:00
Brahim Hadriche 754da7e836 [skip ci] typo 2024-01-02 18:08:33 -05:00
Brahim Hadriche 85c3eb8321 Screenshots (#249) 2024-01-02 13:45:57 -05:00
Brahim Hadriche e59e45e310 Release v0.18.1 (#248) 2024-01-02 12:48:57 -05:00
Brahim Hadriche 2548fb9097 Fix/invalid subs (#247)
* Sort

* Remove invalid

* Fix for unsupported subtitles

* Actually disable unsupported subs
2024-01-02 12:34:44 -05:00
Brahim Hadriche 1cb80f71b5 Use asyncStopSemantics to prevent execution timeout crashes (#246)
* Use asyncStopSemantics to prevent execution timeout crashes

* Clarify

* Changelog

* no message
2024-01-02 11:05:47 -05:00
Brahim Hadriche 0a7a6c65e2 Bug fix 2024-01-02 10:57:14 -05:00
Brahim Hadriche 529b915d7f [skip ci] Add comment with supported subtitle languages 2024-01-01 15:15:21 -05:00
Brahim Hadriche a76a2cb77f [skip ci] typo 2024-01-01 13:01:49 -05:00
Brahim Hadriche 707739b901 small refactor 2024-01-01 10:52:14 -05:00
Brahim Hadriche 8c72258879 Add TODO 2024-01-01 10:40:13 -05:00
Brahim Hadriche d245c072e9 Remove Funny and News from home screen (#245) 2023-12-30 22:47:06 -05:00
Brahim Hadriche 0f000590a0 Fixes for RowList cells (#244)
* Fixes for RowList cells

* typo
2023-12-30 22:32:43 -05:00
Brahim Hadriche 93c1e48d39 Add TODO 2023-12-30 19:21:21 -05:00
d6c7d81347 [chore] update dependencies (#243)
* Add TODO

* update dependencies

* plugin fix

---------

Co-authored-by: Brahim Hadriche <brahim.hadriche@gmail.com>
Co-authored-by: iBicha <iBicha@users.noreply.github.com>
2023-12-29 22:46:52 -05:00
Brahim Hadriche 331f2ff3cb Add playlist updated field in web app 2023-12-29 17:58:30 -05:00
Brahim Hadriche 6c42fbe056 Add tab titles in web app 2023-12-29 11:04:19 -05:00
Brahim Hadriche 7e8c828007 Remove legacy stuff 2023-12-28 18:17:42 -05:00
Brahim Hadriche ba59aad767 Release v0.18.0 (#240) 2023-12-28 14:27:28 -05:00
Brahim Hadriche 36ae525154 Fix another bug related to public instances 2023-12-28 14:19:45 -05:00
Brahim Hadriche 5ef130bc51 Fix tests 2023-12-23 10:55:58 -05:00
Brahim Hadriche 39591abc34 Adjust diagnostic filters 2023-12-23 10:52:08 -05:00
Brahim Hadriche 84bd50d970 Update bsc 2023-12-23 10:39:17 -05:00
fd0259615b [chore] update dependencies (#239)
* update dependencies

* Revert bsc update

---------

Co-authored-by: iBicha <iBicha@users.noreply.github.com>
Co-authored-by: Brahim Hadriche <brahim.hadriche@gmail.com>
2023-12-22 19:53:58 -05:00
Brahim Hadriche e53ad785c6 Refresh lint rules (#238)
* Lint

* Color rules

* Update sponsorblock config file

* Small tweak

* Color adjustments
2023-12-22 19:36:36 -05:00
Brahim Hadriche cbda8dbf9b Fix formatting 2023-12-22 15:22:02 -05:00
Brahim Hadriche 242298911c Fix dialog palette 2023-12-22 15:19:19 -05:00
Brahim Hadriche 8f1d3778d8 Add unused arg validation rule 2023-12-22 11:42:51 -05:00
Brahim Hadriche 192401c847 Remove LOCAL_DASH feature flag 2023-12-22 10:54:42 -05:00
Brahim Hadriche 132e3ec3e3 Add a sleep before canary release as a workaround 2023-12-20 17:13:32 -05:00
Brahim Hadriche 3570f011c4 Formatting 2023-12-20 17:01:22 -05:00
Brahim Hadriche 482daf5e12 Color adjustments 2023-12-20 16:59:15 -05:00
Brahim Hadriche 64f5985aae Small bug fix 2023-12-20 16:42:45 -05:00
Brahim Hadriche a1aed7d253 Watch history (#232)
* [PoC] Watch history

* Render watch history on web app

* Changelog

* Log out user on insufficient access
2023-12-20 09:39:42 -05:00
Brahim Hadriche f581d568d9 Fix sponsor skip infinite loop bug (#231) 2023-12-19 20:02:15 -05:00
Brahim Hadriche 54b0acbe8f Add medium video quality video to the settings (#230) 2023-12-19 19:18:06 -05:00
Brahim Hadriche 6e4262e6a5 Support for legacy browsers (#228) 2023-12-18 22:18:38 -05:00
Brahim Hadriche 4c90cf1e98 Restart playlet from web app 2023-12-18 08:53:49 -05:00
Brahim Hadriche 72f547cc22 Styling fix for Safari 2023-12-18 08:25:59 -05:00
Brahim Hadricheandgithub-action linter 1cee5d61ab Feature/web socket (#180)
* Websockets

* Sending payloads

* Lint fix

* Remove example code

* Disable web sockets

* remove todo

---------

Co-authored-by: github-action linter <githubaction@githubaction.com>
2023-12-17 11:51:53 -05:00
github-actions[bot]andiBicha d87337d389 update dependencies (#223)
Co-authored-by: iBicha <iBicha@users.noreply.github.com>
2023-12-15 21:31:01 -05:00
Brahim Hadriche 2ba2115da7 (Regression) Fix issue where auto-play keeps playing the same videos in a loop 2023-12-15 21:27:41 -05:00
Brahim Hadriche 49be599c32 No xmas 2023-12-13 16:51:31 -05:00
Brahim Hadriche 8d5646aeb3 Release v0.17.3 (#222) 2023-12-13 16:27:41 -05:00
Brahim Hadriche 07b0e422ff Xmas 2023-12-13 16:22:40 -05:00
Brahim Hadriche 35325bfae2 lint 2023-12-12 20:16:05 -05:00
Brahim Hadriche c122d286dc Missed a rename 2023-12-12 20:15:19 -05:00
Brahim Hadriche 66208d941d Adjust config files 2023-12-12 20:07:43 -05:00
Brahim Hadriche 9cf6626efb Adjust messages 2023-12-12 18:06:23 -05:00
Brahim Hadriche 69c87228af Create README.md 2023-12-12 09:38:40 -05:00
Brahim Hadriche 2502eae462 Add some randomness to loading messages 2023-12-11 08:46:58 -05:00
Brahim Hadriche b0e0c2d09d Small refactor in bootstrap scene 2023-12-11 08:19:15 -05:00
Brahim Hadriche 5982b5a75f validation rule for callFunc operator 2023-12-10 22:54:00 -05:00
Brahim Hadriche 51966cb33f Use local ip for dash 2023-12-10 22:35:53 -05:00
Brahim Hadriche bfe8a3c860 Downgrade todos 2023-12-10 22:14:14 -05:00
Brahim Hadriche ef17ff44af Update signing script 2023-12-10 15:51:53 -05:00
Brahim Hadriche 826228e939 Release v0.17.2 (#221) 2023-12-10 15:30:04 -05:00
Brahim Hadricheandgithub-action linter b77519493d Feature/loading messages (#220)
* Add loading message

* Add messages and cache file

* Lint fix

---------

Co-authored-by: github-action linter <githubaction@githubaction.com>
2023-12-10 15:24:30 -05:00
Brahim Hadriche 6a46d4cd09 Fix typo 2023-12-09 09:32:38 -05:00
github-actions[bot]andiBicha 382cbe33d3 update dependencies (#218)
Co-authored-by: iBicha <iBicha@users.noreply.github.com>
2023-12-09 09:31:31 -05:00
Brahim Hadriche e9b57c9c08 Release v0.17.1 (#217) 2023-12-08 07:00:06 -05:00
Brahim Hadriche 457242057d Bug fix 2023-12-08 06:50:57 -05:00
Brahim Hadriche 665f76701d Small bug fix 2023-12-08 06:40:05 -05:00
Brahim Hadriche 258726fadb fix line ending 2023-12-08 06:12:27 -05:00
Brahim Hadriche 215a23c91d Update deps, lock brighterscript version 2023-12-08 06:10:26 -05:00
Brahim Hadriche 19ecc25852 add todo
more todos

Add todo
2023-12-08 05:43:12 -05:00
github-actions[bot]andiBicha 0ae524f88c update dependencies (#214)
Co-authored-by: iBicha <iBicha@users.noreply.github.com>
2023-12-04 23:46:48 +01:00
Brahim Hadriche 8bf16bfbd5 Update plugins.md 2023-12-04 23:28:44 +01:00
Brahim Hadriche 0acb7031d3 Refactor query params 2023-11-26 18:11:48 -05:00
Brahim Hadriche 0ddc9a48aa Enable manual releases 2023-11-25 20:00:25 -05:00
Brahim Hadriche 3ac4d959d3 Fix formatting 2023-11-25 19:53:17 -05:00
Brahim Hadriche 19de693298 Add instance test to make sure thumbnails are reachable 2023-11-25 19:50:13 -05:00
github-actions[bot]andiBicha 46af79c2ae update dependencies (#210)
Co-authored-by: iBicha <iBicha@users.noreply.github.com>
2023-11-24 20:23:22 -05:00
Brahim Hadriche fd077a0d1a Adjust icon resolution 2023-11-24 15:23:24 -05:00
Brahim Hadriche 981e95b0d4 Change icon 2023-11-24 14:54:57 -05:00
Brahim Hadriche 8883a59fcb Tweak 2023-11-24 14:27:49 -05:00
Brahim Hadriche 662cb4b634 Adjusting layout 2023-11-24 14:26:01 -05:00
Brahim Hadriche 7269fdff7d Adjust logo 2023-11-24 14:13:57 -05:00
Brahim Hadriche 710e892545 More memory cleanup 2023-11-24 11:39:53 -05:00
Brahim Hadriche 7dd5561faa Partially fix a memory leak 2023-11-23 22:18:07 -05:00
Brahim Hadriche d40a12d1f1 Adjust fs debug flags 2023-11-23 21:38:36 -05:00
Brahim Hadriche 1170f422ec typo 2023-11-22 08:21:33 -05:00
Brahim Hadriche 2639267e1f Center navbar buttons 2023-11-19 21:42:12 -05:00
Brahim Hadriche 3b35adeae9 Update js deps 2023-11-19 20:07:45 -05:00
Brahim Hadriche e8b6cd1588 clear expired and invalid cache 2023-11-19 19:33:12 -05:00
Brahim Hadriche 0377f075be small fix 2023-11-19 19:21:33 -05:00
Brahim Hadriche 89034378fb Fix app info fields order 2023-11-19 19:18:54 -05:00
Brahim Hadriche 9ae8601a32 Small refactors to http client and caching 2023-11-19 19:05:46 -05:00
Brahim Hadriche 61327401b0 Rename version to app_version 2023-11-19 18:30:29 -05:00
Brahim Hadriche 94a017a878 Add TODOs 2023-11-18 17:43:01 -05:00
Brahim Hadriche eb3d1724e4 Add TODOs 2023-11-18 14:08:59 -05:00
Brahim Hadriche 9d95834ebb fix job 2023-11-17 19:37:55 -05:00
272 changed files with 6480 additions and 2268 deletions

No files matched your search

+6
View File
@@ -3,6 +3,7 @@ name: Release
on:
push:
branches: ["main"]
workflow_dispatch: {}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
@@ -63,6 +64,11 @@ jobs:
latest_release=$(awk 'BEGIN { RS="## \\[" } NR==2 { print "## ["$0 }' CHANGELOG.md)
echo -e "\n$latest_release" >> docs/canary-changelog.md
# A bug in gh cli causes the release to be created as a draft, and not released.
# See https://github.com/cli/cli/issues/8458
- name: Wait 10 seconds
run: sleep 10
- name: Create Canary release
run: gh release create canary ./release/playlet.zip ./release/playlet-lib.zip --notes-file docs/canary-changelog.md --prerelease --title Canary
env:
+3 -3
View File
@@ -25,12 +25,12 @@ jobs:
run: npm run update-deps
- name: Install dependencies
run: npm ci
run: npm i
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
commit-message: "update dependencies"
branch: shore/update-deps
title: "[shore] update dependencies"
branch: chore/update-deps
title: "[chore] update dependencies"
body: "Weekly pull request to update dependencies."
+73
View File
@@ -5,6 +5,79 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [0.19.0] - 2024-01-10
### Added
- A home screen editor allowing to enable/disable feeds, and change their order.
- The editor can be accessed from the Settings screen.
### Fixed
- `HTTP/0.9 when not allowed` errors by adding a retry to web requests
- Issue where a bookmarked video is no longer valid (such as a video made private, or a live stream that ended)
- [Perf] App loads slightly faster (~500ms)
## [0.18.1] - 2024-01-02
### Fixed
- A rare bug that causes the app to crash when displaying video cells
- A rare bug where a long press can cause a crash
- [Attempt] to fix a crash caused by execution timeout when stopping a video takes too long
- Unsupported subtitles (subtitles that can't be rendered will not be used)
### Removed
- `Funny` and `News` from the Home screen.
- These are not standard feeds (like `Trending`), and are just search results for `Funny` and `News`. They were added in earlier Playlet versions to have more content in the Home screen.
- If you like to add these two feeds to your bookmarks:
- Search for `Funny` (or `News`)
- Set the `Sort by` filter to `Upload date`
- Press and hold the `Ok` button while a video from the search result is selected
- Choose the `Add to "Search - Funny"` option
## [0.18.0] - 2023-12-28
### Added
- Medium video quality in the settings (For most videos, this is 360p)
- Invidious watch history feed
### Fixed
- (Regression) Issue where auto-play keeps playing the same videos in a loop
- Small search box styling bug for Safari
- A bug where the skipping of a sponsored section at the end of a video leads to an infinite loop
- A couple of bugs when listing Invidious public instances
### Removed
- Xmas theme logo - can't publish it before end of year... ([link](https://blog.roku.com/developer/channel-store-blackouts-2023))
## [0.17.3] - 2023-12-13
### Added
- Xmas theme logo
## [0.17.2] - 2023-12-10
### Added
- Loading message
## [0.17.1] - 2023-12-08
### Added
- An instance test to make sure thumbnails are reachable
### Fixed
- A rare error when video player is closed but does not have valid content
- A rare error that can occur with loading indicators causing a crash
## [0.17.0] - 2023-11-17
### Added
@@ -3,11 +3,16 @@
"createPackage": false,
"diagnosticFilters": [
{
"src": "**/roku_modules/**/*.*"
},
1090
"src": "**/*.part.xml",
"codes": [
// 1067 - Cannot find function with name '${name}' in component scope
// This is to prevent errors where the onChange function is not found in the component scope
1067
]
}
],
"diagnosticLevel": "error",
// The validation regex rules are validated using the validation-plugin.ts plugin
"validation": [
{
"code": "NO_SET_FOCUS",
@@ -20,6 +25,21 @@
"regex": "\\.observeField(scoped)?\\s*\\(\\s*\"\\w+\"\\s*,\\s*\"\\w+\"\\s*\\)",
"regexFlags": "ig",
"message": "observeField(\"field\", \"callback\") is not allowed. Use observeField(\"field\", FuncName(callback)) instead."
},
{
"code": "NO_INVALID_CALLFUNC_ARG",
"regex": "@\\.\\w+\\(invalid\\)",
"regexFlags": "ig",
"message": "the arg invalid in @.func(invalid) is not needed. Just use @.func() instead."
},
{
// Tagging unused variables (Available since Roku OS 11.0) – Variables can explicitly
// be marked as unused by prepending an underscore to the value (for example, sub myTask(_x)).
// https://developer.roku.com/en-ca/docs/references/brightscript/language/expressions-variables-types.md#types
"code": "UNUSED_ARG_STARTS_WITH_UNDERSCORE",
"regex": "\\b(?!_unused)unused\\b",
"regexFlags": "ig",
"message": "unused args should start with _ (e.g. _unused)"
}
],
"files": [
@@ -50,16 +70,13 @@
"../tools/bs-plugins/json-yaml-plugin.ts",
"../tools/bs-plugins/validation-plugin.ts",
"../tools/bs-plugins/logger-plugin.ts",
"../tools/bs-plugins/image-gen-plugin.ts"
"../tools/bs-plugins/image-gen-plugin.ts",
"../tools/bs-plugins/type-gen-plugin.ts"
],
"retainStagingDir": true,
"require": [
"ts-node/register"
],
"rokuLog": {
"insertPkgPath": true,
"removeComments": false,
"strip": false
},
"sourceMap": true
"sourceMap": true,
"pruneEmptyCodeFiles": true
}
@@ -1,5 +1,5 @@
{
"extends": "bsconfig.base.json",
"extends": "bsconfig.base.jsonc",
"files": [
"source/**",
"components/**",
@@ -26,7 +26,8 @@
"../tools/bs-plugins/json-yaml-plugin.ts",
"../tools/bs-plugins/validation-plugin.ts",
"../tools/bs-plugins/logger-plugin.ts",
"../tools/bs-plugins/image-gen-plugin.ts"
"../tools/bs-plugins/image-gen-plugin.ts",
"../tools/bs-plugins/type-gen-plugin.ts"
],
"rooibos": {
"logLevel": 2,
+21 -12
View File
@@ -5,23 +5,32 @@
"**/bslib.brs"
],
"rules": {
"aa-comma-style": "no-dangling",
"anon-function-style": "no-sub",
"assign-all-paths": "warn",
"block-if-style": "no-then",
"case-sensitivity": "warn",
"condition-style": "no-group",
"consistent-return": "error",
"eol-last": "always",
// Code style
"inline-if-style": "never",
"block-if-style": "no-then",
"condition-style": "no-group",
"named-function-style": "no-sub",
"anon-function-style": "no-sub",
"aa-comma-style": "never",
"no-print": "warn",
"no-stop": "error",
"no-todo": "off",
"no-stop": "error",
"eol-last": "always",
// Strictness
"type-annotations": "all",
"unreachable-code": "warn",
// Color
"color-format": "hash-hex",
"color-case": "upper",
"color-alpha": "always",
"color-alpha-defaults": "allowed",
"color-cert": "always",
// Code flow
"assign-all-paths": "error",
"unsafe-path-loop": "error",
"unsafe-iterators": "error",
"unsafe-path-loop": "warn",
"unused-variable": "warn"
"unreachable-code": "warn",
"case-sensitivity": "error",
"unused-variable": "error",
"consistent-return": "error"
}
}
+2 -2
View File
@@ -163,7 +163,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 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.
The server's API enpoints are described through the Open API spec file [playlet-web-api.yml](./playlet-web-api.yml)
@@ -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)`
+1 -1
View File
@@ -42,7 +42,7 @@ These are mostly the steps when releasing a new version:
For releasing to the store (when needed), this is done following a Playlet lib release:
- Switch to main branch and pull changes - **match commit corresponding to the release.**
- Switch to main branch and pull changes, **including tags** - **match commit corresponding to the release.**
- `npm run build:release:ci`
- This makes sure to have a valid app in the staging folder
- `npm run sign-released-package`
+38 -3
View File
@@ -2,7 +2,7 @@ openapi: 3.0.0
info:
title: Playlet Web API
version: 0.17.0
version: 0.19.0
description:
Playlet Web API is a RESTful API for controlling the Playlet app on
Roku devices. The API is intended to be used by the Playlet web app, but can
@@ -153,7 +153,7 @@ paths:
properties:
index:
type: integer
playlistIndex
playlistIndex:
type: integer
items:
type: array
@@ -178,7 +178,7 @@ paths:
properties:
index:
type: integer
playlistIndex
playlistIndex:
type: integer
items:
type: array
@@ -227,6 +227,41 @@ paths:
description: No Content
"400":
description: Bad Request
/api/home-layout:
get:
summary: Get home layout
description: Get the current home layout. This is the layout of the home screen, based on user preferences.
operationId: getHomeLayout
responses:
"200":
description: OK
content:
application/json:
schema:
type: array
items:
type: object
properties:
id:
type: string
title:
type: string
feedSources:
type: array
items:
type: object
properties:
apiType:
type: string
endpoint:
type: string
id:
type: string
queryParams:
type: object
additionalProperties: true
title:
type: string
/api/playlet-lib-urls:
get:
summary: Get Playlet lib URLs
+75 -3
View File
@@ -9,6 +9,8 @@
- [Bindings](#bindings)
- [Async Task Generator](#async-task-generator)
- [Tracking transpilied files](#tracking-transpilied-files)
- [Logger](#logger)
- [Type Gen](#type-gen)
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:
@@ -427,7 +429,7 @@ myNode = CreateObject("roSGNode", "MyComponent")
' Add it to the right parent
myParentNode.appendChild(myNode)
' Trigger the binding manually
myNode@.BindNode(invalid)
myNode@.BindNode()
```
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.
@@ -468,7 +470,10 @@ end function
And use the function like so
```brighterscript
StartAsyncTask(MyBackgroundTask, {myVar: "some input"}, function(output as object) as void
import "pkg:/source/AsyncTask/Tasks.bs"
import "pkg:/source/AsyncTask/AsyncTask.bs"
AsyncTask.Start(Tasks.MyBackgroundTask, {myVar: "some input"}, function(output as object) as void
if output.success
print(output.result.value)
end if
@@ -477,7 +482,7 @@ end function)
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.
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) or other tasks that require task reuse. This is because `AsyncTask.Start` create a new instance of the task every time.
## Tracking transpilied files
@@ -499,3 +504,70 @@ Additionally, if there's a folder `MyFolder` and `MyFolder.transpiled` in the so
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.
## Logger
**[Source](/tools/bs-plugins/logger-plugin.ts)**
### Why
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
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):
- 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:
```brs
function LogError2(arg0, arg1) as void
logger = m.global.logger
if logger.logLevel < 0
return
end if
m.global.logger.logLine = "[ERROR]" + ToString(arg0) + " " + ToString(arg1)
end function
```
- 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)
## Type Gen
**[Source](/tools/bs-plugins/type-gen-plugin.ts)**
### Why
I found myself implementing type checking functions like `IsBool`, `IsInt`, and `IsString`, and functions for getting a valid type, like `ValidBool`, `ValidInt`, and `ValidString`. The implementation is the same, why not generate them?
### How
Simply we declare them in an object describing the type, the interface, and the default value, and generate all corresponding functions.
Sample output:
```brs
' Returns true if the given object is of type Bool, false otherwise
function IsBool(obj as dynamic) as boolean
return obj <> invalid and GetInterface(obj, "ifBoolean") <> invalid
end function
' Returns the given object if it is of type Bool, otherwise returns the default value `false`
function ValidBool(obj as dynamic) as boolean
if obj <> invalid and GetInterface(obj, "ifBoolean") <> invalid
return obj
else
return false
end if
end function
```
+27 -20
View File
@@ -1,30 +1,37 @@
# Screenshots
## Home
## Playlet
![Home](./home.jpg)
| Home | Search |
| ------------------- | ----------------------- |
| ![Home](./home.jpg) | ![Search](./search.jpg) |
## Search
| Bookmarks | Queue + Picture-in-picture |
| ----------------------------- | ----------------------------------------------------- |
| ![Bookmarks](./bookmarks.jpg) | ![Queue + Picture-in-picture](./queue-pic-in-pic.jpg) |
![Search](./search.jpg)
| Channel | Playlist |
| ------------------------- | --------------------------- |
| ![Channel](./channel.jpg) | ![Playlist](./playlist.jpg) |
## Settings
| Settings | Invidious instances | Invidious testing |
| --------------------------- | ------------------------------------------------ | --------------------------------------------- |
| ![Settings](./settings.jpg) | ![Invidious instances](./invidious-settings.jpg) | ![Invidious testing](./invidious-testing.jpg) |
![Settings](./settings.jpg)
| Link to web app | App info |
| ----------------------------------- | --------------------------- |
| ![Link to web app](./webapp-qr.jpg) | ![App info](./app-info.jpg) |
## Playlist
## Playlet web app
![Playlist](./playlist.jpg)
## Link to web app
![Link to web app](./webapp-qr.jpg)
## App info
![App info](./app-info.jpg)
## Web app
| ![Web app home](./webapp-home.png) | ![Web app search](./webapp-search.png) | ![Web app settings](./webapp-settings.png) |
| Home | Search | Settings |
| ---------------------------------- | -------------------------------------- | ------------------------------------------ |
| ![Web app home](./webapp-home.png) | ![Web app search](./webapp-search.png) | ![Web app settings](./webapp-settings.png) |
| Bookmarks | Remote | Cast video |
| ------------------------------------ | ------------------------------ | -------------------------------- |
| ![Bookmarks](./webapp-bookmarks.png) | ![Remote](./webapp-remote.png) | ![Cast video](./webapp-cast.png) |
| App info | | |
| ------------------------------ | --- | --- |
| ![App info](./webapp-info.png) | | |
Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 123 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 83 KiB

After

Width:  |  Height:  |  Size: 124 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

After

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 639 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 982 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 358 KiB

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 244 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 154 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 362 KiB

After

Width:  |  Height:  |  Size: 751 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 99 KiB

After

Width:  |  Height:  |  Size: 256 KiB

+63 -63
View File
@@ -1,39 +1,39 @@
{
"name": "playlet",
"version": "0.17.0",
"version": "0.19.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "playlet",
"version": "0.17.0",
"version": "0.19.0",
"hasInstallScript": true,
"devDependencies": {
"@rokucommunity/bslint": "^0.8.12",
"@rokucommunity/bslint": "^0.8.14",
"@types/crypto-js": "^4.2.1",
"@types/fs-extra": "^11.0.4",
"@types/node": "^20.9.0",
"@types/node": "^20.10.7",
"@types/xml2js": "^0.4.14",
"argparse": "^2.0.1",
"brighterscript": "^0.65.9",
"brighterscript-formatter": "^1.6.35",
"brighterscript": "0.65.16",
"brighterscript-formatter": "^1.6.37",
"convert-svg-to-png": "^0.6.4",
"cross-fetch": "^4.0.0",
"crypto-js": "^4.2.0",
"dotenv": "^16.3.1",
"express": "^4.18.2",
"fs-extra": "^11.1.1",
"fs-extra": "^11.2.0",
"glob": "^10.3.10",
"imap": "^0.8.19",
"ip": "^1.1.8",
"json5": "^2.2.3",
"mailparser": "^3.6.5",
"roku-deploy": "^3.10.4",
"rooibos-roku": "^5.8.0",
"mailparser": "^3.6.6",
"roku-deploy": "^3.11.2",
"rooibos-roku": "^5.10.0",
"semver": "^7.5.4",
"shelljs": "^0.8.5",
"ts-node": "^10.9.1",
"typescript": "^5.2.2",
"ts-node": "^10.9.2",
"typescript": "^5.3.3",
"xml2js": "^0.6.2",
"yaml": "^2.3.4"
},
@@ -276,9 +276,9 @@
"dev": true
},
"node_modules/@rokucommunity/bslint": {
"version": "0.8.12",
"resolved": "https://registry.npmjs.org/@rokucommunity/bslint/-/bslint-0.8.12.tgz",
"integrity": "sha512-0kU6sHpjEq51f54ajzscxzLT5Tq7SjF8FPszr7pRMSmUHHIDmTu5e1vDu8gS5UzWM+RGhXHqa3EXXt789B6sdQ==",
"version": "0.8.14",
"resolved": "https://registry.npmjs.org/@rokucommunity/bslint/-/bslint-0.8.14.tgz",
"integrity": "sha512-vKD2weW5I8jOXe+2xHN9FZ9GUCkbE/FOTbWcziLXrObraXJZcNRqk+fWDvi7go79ourQ/9DmYfmFH0bocjOMqg==",
"dev": true,
"dependencies": {
"fs-extra": "^10.0.0",
@@ -370,9 +370,9 @@
}
},
"node_modules/@types/node": {
"version": "20.9.0",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.9.0.tgz",
"integrity": "sha512-nekiGu2NDb1BcVofVcEKMIwzlx4NjHlcjhoxxKBNLtz15Y1z7MYf549DFvkHSId02Ax6kGwWntIBPC3l/JZcmw==",
"version": "20.10.7",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.7.tgz",
"integrity": "sha512-fRbIKb8C/Y2lXxB5eVMj4IU7xpdox0Lh8bUPEdtLysaylsml1hOOx1+STloRs/B9nf7C6kPRmmg/V7aQW7usNg==",
"dev": true,
"dependencies": {
"undici-types": "~5.26.4"
@@ -728,9 +728,9 @@
}
},
"node_modules/brighterscript": {
"version": "0.65.9",
"resolved": "https://registry.npmjs.org/brighterscript/-/brighterscript-0.65.9.tgz",
"integrity": "sha512-cjJmftkY+2A5HrGIbmRz2fylywEwj3+Y/EXeSx4TJsEvOW0/M61G5gHRdGyqPF/TMEGlPHGlTBAmPdOMi85+xw==",
"version": "0.65.16",
"resolved": "https://registry.npmjs.org/brighterscript/-/brighterscript-0.65.16.tgz",
"integrity": "sha512-2RJMF8itkrPXtZ92JkJf3emvzcCl5ETXGVyPsdO/hMKbUGinEGMRFG07FR0bzjRotbALzsozGE/Hjzw412Sjww==",
"dev": true,
"dependencies": {
"@rokucommunity/bslib": "^0.1.1",
@@ -756,7 +756,7 @@
"parse-ms": "^2.1.0",
"readline": "^1.3.0",
"require-relative": "^0.8.7",
"roku-deploy": "^3.10.4",
"roku-deploy": "^3.11.2",
"serialize-error": "^7.0.1",
"source-map": "^0.7.4",
"vscode-languageserver": "7.0.0",
@@ -771,12 +771,12 @@
}
},
"node_modules/brighterscript-formatter": {
"version": "1.6.35",
"resolved": "https://registry.npmjs.org/brighterscript-formatter/-/brighterscript-formatter-1.6.35.tgz",
"integrity": "sha512-OtExVLvgfZ7QlBDFpNqDUZQiSbO8sNO1l0wEfkspYJzPbhbhKYL2NEEL9OSTzUJYCrO/I8ZL7bo57ZGNQlcNBQ==",
"version": "1.6.37",
"resolved": "https://registry.npmjs.org/brighterscript-formatter/-/brighterscript-formatter-1.6.37.tgz",
"integrity": "sha512-jIlqRjPVIp2WwB9Pe0YwK4KU4G3WqhRsqRluuOFY1sTDVW0R/AKXMvCfTsu99L2W7CbpeWA4UjOPzl9JOqN5hw==",
"dev": true,
"dependencies": {
"brighterscript": "^0.65.9",
"brighterscript": "^0.65.16",
"glob-all": "^3.3.0",
"jsonc-parser": "^3.0.0",
"source-map": "^0.7.3",
@@ -1997,9 +1997,9 @@
"dev": true
},
"node_modules/fastq": {
"version": "1.15.0",
"resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz",
"integrity": "sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==",
"version": "1.16.0",
"resolved": "https://registry.npmjs.org/fastq/-/fastq-1.16.0.tgz",
"integrity": "sha512-ifCoaXsDrsdkWTtiNJX5uzHDsrck5TzfKKDcuFFTIrrc/BS076qgEIfoIy1VeZqViznfKiysPYTh/QeHtnIsYA==",
"dev": true,
"dependencies": {
"reusify": "^1.0.4"
@@ -2142,9 +2142,9 @@
"dev": true
},
"node_modules/fs-extra": {
"version": "11.1.1",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.1.1.tgz",
"integrity": "sha512-MGIE4HOvQCeUCzmlHs0vXpih4ysz4wg9qiSAu6cd42lVwPbTM1TjV7RusoyQqMmk/95gdQZX72u+YW+c3eEpFQ==",
"version": "11.2.0",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.2.0.tgz",
"integrity": "sha512-PmDi3uwK5nFuXh7XDTlVnS17xJS7vW36is2+w3xcv8SVxiB4NyATf4ctkVY5bkSjX0Y4nbvZCq1/EjtEyr9ktw==",
"dev": true,
"dependencies": {
"graceful-fs": "^4.2.0",
@@ -2902,12 +2902,12 @@
}
},
"node_modules/linkify-it": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-4.0.1.tgz",
"integrity": "sha512-C7bfi1UZmoj8+PQx22XyeXCuBlokoyWQL5pWSP+EI6nzRylyThouddufc2c1NDIcP9k5agmN9fLpA7VNJfIiqw==",
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-5.0.0.tgz",
"integrity": "sha512-5aHCbzQRADcdP+ATqnDuhhJ/MRIqDkZX5pyjFHRRysS8vZ5AbqGEoFIb6pYHPZ+L/OC2Lc+xT8uHVVR5CAK/wQ==",
"dev": true,
"dependencies": {
"uc.micro": "^1.0.1"
"uc.micro": "^2.0.0"
}
},
"node_modules/locate-path": {
@@ -2980,9 +2980,9 @@
}
},
"node_modules/mailparser": {
"version": "3.6.5",
"resolved": "https://registry.npmjs.org/mailparser/-/mailparser-3.6.5.tgz",
"integrity": "sha512-nteTpF0Khm5JLOnt4sigmzNdUH/6mO7PZ4KEnvxf4mckyXYFFhrtAWZzbq/V5aQMH+049gA7ZjfLdh+QiX2Uqg==",
"version": "3.6.6",
"resolved": "https://registry.npmjs.org/mailparser/-/mailparser-3.6.6.tgz",
"integrity": "sha512-noCjBl3FToxmqTP2fp7z17hQsiCroWNntfTd8O+UejOAF59xeN5WGZK27ilexXV2e2X/cbUhG3L8sfEKaz0/sw==",
"dev": true,
"dependencies": {
"encoding-japanese": "2.0.0",
@@ -2990,10 +2990,10 @@
"html-to-text": "9.0.5",
"iconv-lite": "0.6.3",
"libmime": "5.2.1",
"linkify-it": "4.0.1",
"linkify-it": "5.0.0",
"mailsplit": "5.4.0",
"nodemailer": "6.9.3",
"tlds": "1.240.0"
"nodemailer": "6.9.8",
"tlds": "1.248.0"
}
},
"node_modules/mailparser/node_modules/iconv-lite": {
@@ -3200,9 +3200,9 @@
}
},
"node_modules/nodemailer": {
"version": "6.9.3",
"resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.9.3.tgz",
"integrity": "sha512-fy9v3NgTzBngrMFkDsKEj0r02U7jm6XfC3b52eoNV+GCrGj+s8pt5OqhiJdWKuw51zCTdiNR/IUD1z33LIIGpg==",
"version": "6.9.8",
"resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.9.8.tgz",
"integrity": "sha512-cfrYUk16e67Ks051i4CntM9kshRYei1/o/Gi8K1d+R34OIs21xdFnW7Pt7EucmVKA0LKtqUGNcjMZ7ehjl49mQ==",
"dev": true,
"engines": {
"node": ">=6.0.0"
@@ -3923,9 +3923,9 @@
}
},
"node_modules/roku-deploy": {
"version": "3.10.4",
"resolved": "https://registry.npmjs.org/roku-deploy/-/roku-deploy-3.10.4.tgz",
"integrity": "sha512-Drl0c78HjZejaC0zovm4f/pJRCw0DbbBzR5Pe+ADKlMfOSJuF4UvNaejJzgbTcGXKkeztgOBvu5xxpOL7gqhWQ==",
"version": "3.11.2",
"resolved": "https://registry.npmjs.org/roku-deploy/-/roku-deploy-3.11.2.tgz",
"integrity": "sha512-3JDlnbTxv6Xk5GVolQoA3+d34MLZXXwZWMySprHwazZoWLP3LvulYHP92YvFOJAo/aI4IZp/TFA8kR82IrmHKA==",
"dev": true,
"dependencies": {
"chalk": "^2.4.2",
@@ -3994,9 +3994,9 @@
}
},
"node_modules/rooibos-roku": {
"version": "5.8.0",
"resolved": "https://registry.npmjs.org/rooibos-roku/-/rooibos-roku-5.8.0.tgz",
"integrity": "sha512-mPAszwOH1VdxMgSaoXQ/CgpAZ3RQ0A+d3BoxyY8axMsYS5kPO/8dL8fa7iFTGEZYA7803Ur52zlyN8GXqV5nLg==",
"version": "5.10.0",
"resolved": "https://registry.npmjs.org/rooibos-roku/-/rooibos-roku-5.10.0.tgz",
"integrity": "sha512-Idiv3nWQOEr5V8z8oHcIovjcoBffgqRtTQ5B6K+x/cGAouKxyVJp0fsZ80xQvUul9IwHQ0XIPUYbNWCR3RQ3sA==",
"dev": true,
"dependencies": {
"source-map": "^0.7.3",
@@ -4477,9 +4477,9 @@
"dev": true
},
"node_modules/tlds": {
"version": "1.240.0",
"resolved": "https://registry.npmjs.org/tlds/-/tlds-1.240.0.tgz",
"integrity": "sha512-1OYJQenswGZSOdRw7Bql5Qu7uf75b+F3HFBXbqnG/ifHa0fev1XcG+3pJf3pA/KC6RtHQzfKgIf1vkMlMG7mtQ==",
"version": "1.248.0",
"resolved": "https://registry.npmjs.org/tlds/-/tlds-1.248.0.tgz",
"integrity": "sha512-noj0KdpWTBhwsKxMOXk0rN9otg4kTgLm4WohERRHbJ9IY+kSDKr3RmjitaQ3JFzny+DyvBOQKlFZhp0G0qNSfg==",
"dev": true,
"bin": {
"tlds": "bin.js"
@@ -4525,9 +4525,9 @@
"dev": true
},
"node_modules/ts-node": {
"version": "10.9.1",
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz",
"integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==",
"version": "10.9.2",
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz",
"integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==",
"dev": true,
"dependencies": {
"@cspotcode/source-map-support": "^0.8.0",
@@ -4599,9 +4599,9 @@
}
},
"node_modules/typescript": {
"version": "5.2.2",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz",
"integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==",
"version": "5.3.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz",
"integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==",
"dev": true,
"bin": {
"tsc": "bin/tsc",
@@ -4612,9 +4612,9 @@
}
},
"node_modules/uc.micro": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.6.tgz",
"integrity": "sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA==",
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-2.0.0.tgz",
"integrity": "sha512-DffL94LsNOccVn4hyfRe5rdKa273swqeA5DJpMOeFmEn1wCDc7nAbbB0gXlgBCL7TNzeTv6G7XVWzan7iJtfig==",
"dev": true
},
"node_modules/unbzip2-stream": {
+11 -11
View File
@@ -1,33 +1,33 @@
{
"name": "playlet",
"version": "0.17.0",
"version": "0.19.0",
"description": "Unofficial Youtube client for Roku",
"devDependencies": {
"@rokucommunity/bslint": "^0.8.12",
"@rokucommunity/bslint": "^0.8.14",
"@types/crypto-js": "^4.2.1",
"@types/fs-extra": "^11.0.4",
"@types/node": "^20.9.0",
"@types/node": "^20.10.7",
"@types/xml2js": "^0.4.14",
"argparse": "^2.0.1",
"brighterscript": "^0.65.9",
"brighterscript-formatter": "^1.6.35",
"brighterscript": "0.65.16",
"brighterscript-formatter": "^1.6.37",
"convert-svg-to-png": "^0.6.4",
"cross-fetch": "^4.0.0",
"crypto-js": "^4.2.0",
"dotenv": "^16.3.1",
"express": "^4.18.2",
"fs-extra": "^11.1.1",
"fs-extra": "^11.2.0",
"glob": "^10.3.10",
"imap": "^0.8.19",
"ip": "^1.1.8",
"json5": "^2.2.3",
"mailparser": "^3.6.5",
"roku-deploy": "^3.10.4",
"rooibos-roku": "^5.8.0",
"mailparser": "^3.6.6",
"roku-deploy": "^3.11.2",
"rooibos-roku": "^5.10.0",
"semver": "^7.5.4",
"shelljs": "^0.8.5",
"ts-node": "^10.9.1",
"typescript": "^5.2.2",
"ts-node": "^10.9.2",
"typescript": "^5.3.3",
"xml2js": "^0.6.2",
"yaml": "^2.3.4"
},
+1 -1
View File
@@ -1,5 +1,5 @@
{
"extends": "../config/bsconfig.base.json",
"extends": "../config/bsconfig.base.jsonc",
"rootDir": "src/",
"stagingDir": "../build/playlet-app",
"outFile": "../dist/playlet-app.zip"
+1 -1
View File
@@ -1,5 +1,5 @@
{
"extends": "../config/bsconfig.tests.base.json",
"extends": "../config/bsconfig.tests.base.jsonc",
"rootDir": "src/",
"stagingDir": "../build/playlet-app-tests",
"outFile": "../build/playlet-app-tests.zip"
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "playlet-app",
"version": "0.17.0",
"version": "0.19.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "playlet-app",
"version": "0.17.0"
"version": "0.19.0"
}
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "playlet-app",
"version": "0.17.0",
"version": "0.19.0",
"description": "Unofficial Youtube client for Roku",
"scripts": {
"prebuild": "rm -rf build/playlet-app",
@@ -1,13 +1,19 @@
import "LoadingMessages.bs"
import "pkg:/source/Logger.bs"
function Init() as void
m.top.backgroundColor = "0x242424FF"
m.scene = m.top.getScene()
m.top.backgroundColor = "#242424FF"
m.top.backgroundURI = ""
m.loadingIndicator = m.top.findNode("LoadingIndicator")
m.loadingIndicator.visible = true
m.global.addFields({
loadingIndicator: m.loadingIndicator
})
m.loadingIndicator.visible = true
m.loadingIndicator.message = GetLoadingMessage()
m.playletLibUrls = GetPlayletLibUrls()
m.playletLibUrlIndex = 0
@@ -16,17 +22,17 @@ end function
function GetPlayletLibUrls() as object
#if DEBUG
debug = { type: "debug", link: ReadManifestValue("playlet_lib_debug_url") }
debug = { type: "debug", link: Manifest.ReadValue("playlet_lib_debug_url") }
return [debug]
#else
savedUrls = GetPlayletLibUrlsFromRegistry()
savedUrls = Registry.GetPlayletLibUrlsFromRegistry()
if savedUrls <> invalid
m.shouldClearRegistryOnLoadFail = true
return savedUrls
end if
github = { type: "github", link: ReadManifestValue("playlet_lib_remote_url") }
embedded = { type: "embedded", link: ReadManifestValue("playlet_lib_embedded_url") }
github = { type: "github", link: Manifest.ReadValue("playlet_lib_remote_url") }
embedded = { type: "embedded", link: Manifest.ReadValue("playlet_lib_embedded_url") }
return [github, embedded]
#end if
end function
@@ -35,39 +41,31 @@ function LoadPlayletLib() as void
if m.playletLibUrlIndex >= m.playletLibUrls.Count()
m.loadingIndicator.visible = false
if m.shouldClearRegistryOnLoadFail = true
DeleteRegistryKey("playlet_lib_urls", "Playlet")
Registry.DeleteKey("playlet_lib_urls", "Playlet")
end if
ShowPlayletLibLoadErrorDialog()
return
end if
RemoveComponentLibrary()
m.lib = m.top.getScene().createChild("ComponentLibrary")
' bs:disable-next-line NO_OBSERVE_STRING_CALLBACK
m.lib.observeField("loadStatus", "OnLoadStatusChanged")
uri = m.playletLibUrls[m.playletLibUrlIndex].link
' bs:disable-next-line LINT3012
?"Loading Playlet lib from " uri
m.lib.uri = uri
LoadComponentLibrary(uri)
end function
function OnLoadStatusChanged() as void
libUrl = m.playletLibUrls[m.playletLibUrlIndex]
if m.lib.loadStatus = "ready"
RemoveComponentLibrary()
' bs:disable-next-line LINT3012
?"Playlet lib loaded from " libUrl.link
scene = m.top.getScene()
scene.playletLibLoadedUrl = libUrl
container = scene.findNode("MainSceneContainer")
Logger.Log(`Playlet lib loaded from ${libUrl.link} in ${m.timer.TotalMilliseconds()} ms`)
m.timer = invalid
m.scene.playletLibLoadedUrl = libUrl
container = m.scene.findNode("MainSceneContainer")
container.createChild("PlayletLib:MainScene")
return
end if
if m.lib.loadStatus = "failed"
' bs:disable-next-line LINT3012
?"Playlet lib failed to load from " libUrl.link
Logger.Log(`Playlet lib failed to load from ${libUrl.link}`)
' Try next url
m.playletLibUrlIndex += 1
LoadPlayletLib()
@@ -79,11 +77,23 @@ function RemoveComponentLibrary() as void
return
end if
scene = m.top.getScene()
scene.removeChild(m.lib)
m.lib.unobserveField("loadStatus")
m.scene.removeChild(m.lib)
m.lib = invalid
end function
function LoadComponentLibrary(uri as string)
m.timer = CreateObject("roTimespan")
m.timer.mark()
m.lib = m.scene.createChild("ComponentLibrary")
' bs:disable-next-line NO_OBSERVE_STRING_CALLBACK
m.lib.observeField("loadStatus", "OnLoadStatusChanged")
Logger.Log(`Loading Playlet lib from ${uri}`)
m.lib.uri = uri
end function
function ShowPlayletLibLoadErrorDialog()
message = [
"Could not load Playlet component library from any of the following urls:",
@@ -99,5 +109,5 @@ function ShowPlayletLibLoadErrorDialog()
"If the problem persist, contact Playlet authors."
]
ShowErrorDialog(message, bulletText, bottomText)
Dialog.ShowError(message, bulletText, bottomText)
end function
@@ -0,0 +1,41 @@
function GetLoadingMessage() as string
messages = GetLoadingMessagesFromCache()
if messages = invalid or messages.count() = 0
messages = [
"Now loading Playlet...",
"One moment please...",
"Downloading the internet...",
"Unclogging the tubes...",
"Warming up the flux capacitor...",
"Loading, ehm, stuff...",
"Restoring quantum entanglement...",
"Searching for kitten videos...",
"One Mississippi... two Mississippi...",
"Checking the TV's extended warranty...",
"Deleting system32...",
"Updating: 3 hours 32 minutes remaining...",
"Asking ChatGPT for humorous loading messages...",
"Loading today's sponsor... NordVPN!",
"Don't worry, this is normal...",
"Don't forget to like and subscribe...",
"Shoveling coal into the server...",
"Counting down from infinity...",
]
end if
index = GetRandom(0, messages.count() - 1)
return messages[index]
end function
function GetLoadingMessagesFromCache() as object
messagesFile = ReadAsciiFile("cachefs:/loading_messages_v1.json")
if messagesFile = invalid or messagesFile = ""
return invalid
end if
return ParseJson(messagesFile)
end function
function GetRandom(min as integer, max as integer) as integer
dateTime = CreateObject("roDateTime")
random = Rnd(max) + dateTime.GetMilliseconds()
return min + (random mod (max - min + 1))
end function
@@ -1,4 +1,7 @@
<component name="LoadingIndicator" extends="Group">
<interface>
<field id="message" type="string" alias="messageLabel.text" />
</interface>
<children>
<Rectangle
width="1280"
@@ -9,6 +12,16 @@
id="busySpinner"
inheritParentOpacity="false"
spinInterval="1" />
<Label
id="messageLabel"
inheritParentOpacity="false"
width="1280"
height="200"
horizAlign="center"
translation="[0,460]"
wrap="true">
<Font role="font" uri="font:SystemFontFile" size="28" />
</Label>
</Rectangle>
</children>
</component>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.5 KiB

After

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

@@ -3,24 +3,24 @@
outputs: [
{
outputFilePath: 'images/channel-poster_fhd.png',
outputHash: 'd644a0db84deed0bcc41a41d08a4ef75',
outputHash: '50729b5bdd2a7c0fd4a1d502812117d4',
width: 540,
height: 405,
background: '#FFFFFF',
background: '#EEEEEE',
},
{
outputFilePath: 'images/channel-poster_hd.png',
outputHash: 'd07a4ffaa021b55528bee91710f4e9d2',
outputHash: '8022dc6fa993ce3194c5aea37d6ea49a',
width: 290,
height: 218,
background: '#FFFFFF',
background: '#EEEEEE',
},
{
outputFilePath: 'images/channel-poster_sd.png',
outputHash: '66a311c639f89ff009e4624468282b2f',
outputHash: '63b8f12ac155c29b4e85db17a2886817',
width: 246,
height: 140,
background: '#FFFFFF',
background: '#EEEEEE',
},
],
}
+1 -1
View File
@@ -2,7 +2,7 @@ title=Playlet
# Do not update version manually, it is auto updated from package.json
major_version=0
minor_version=17
minor_version=19
build_version=00000
ui_resolutions=hd
+41 -22
View File
@@ -1,26 +1,45 @@
function ShowErrorDialog(message as object, bulletText as object, bottomMessage as object)
' TODO:P2 a null check on StandardMessageDialog, only available on 10.0 and later
dialog = CreateObject("roSGNode", "StandardMessageDialog")
dialog.message = message
dialog.bulletText = bulletText
dialog.bottomMessage = bottomMessage
dialog.title = "Error loading Playlet"
dialog.buttons = ["Exit"]
namespace Dialog
' bs:disable-next-line NO_OBSERVE_STRING_CALLBACK
dialog.observeField("buttonSelected", "OnButtonSelected")
' bs:disable-next-line NO_OBSERVE_STRING_CALLBACK
dialog.observeField("wasClosed", "OnDialogClosed")
function ShowError(message as object, bulletText as object, bottomMessage as object)
' Note: dialog can be null since StandardMessageDialog is only available on 10.0 and later
msgDialog = CreateObject("roSGNode", "StandardMessageDialog")
SetPalette(msgDialog)
msgDialog.message = message
msgDialog.bulletText = bulletText
msgDialog.bottomMessage = bottomMessage
msgDialog.title = "Error loading Playlet"
msgDialog.buttons = ["Exit"]
m.top.getScene().dialog = dialog
end function
' bs:disable-next-line NO_OBSERVE_STRING_CALLBACK
msgDialog.observeField("buttonSelected", "OnButtonSelected")
' bs:disable-next-line NO_OBSERVE_STRING_CALLBACK
msgDialog.observeField("wasClosed", "OnDialogClosed")
function OnButtonSelected()
m.top.getScene().dialog.close = true
end function
m.top.getScene().dialog = msgDialog
end function
function SetPalette(msgDialog as object)
palette = createObject("roSGNode", "RSGPalette")
palette.colors = {
DialogBackgroundColor: "#242424FF"
DialogFocusColor: "#CECECEFF"
DialogFocusItemColor: "#202020FF"
DialogSecondaryTextColor: "#DBDBDBFF"
DialogSecondaryItemColor: "#FF1C30FF"
DialogTextColor: "#DBDBDBFF"
}
msgDialog.palette = palette
end function
function OnButtonSelected()
m.top.getScene().dialog.close = true
end function
function OnDialogClosed()
' TODO:P1 throw an exception to cause a crash report to be generated
' Should include which playlet lib failed to load
m.top.getScene().exitChannel = true
end function
end namespace
function OnDialogClosed()
' TODO:P1 throw an exception to cause a crash report to be generated
' Should include which playlet lib failed to load
m.top.getScene().exitChannel = true
end function
+20
View File
@@ -0,0 +1,20 @@
namespace Logger
' Put the file at the root directry to avoid needing to create a folder
const LOGS_FILE_PATH = "cachefs:/playlet_startup_logs.txt"
function Init()
DeleteFile(LOGS_FILE_PATH)
end function
function Log(msg as string)
msg = "[APP] " + msg
' bs:disable-next-line LINT3012
print(msg)
buffer = CreateObject("roByteArray")
buffer.FromAsciiString(msg + `\n`)
buffer.AppendFile(LOGS_FILE_PATH)
end function
end namespace
+4 -3
View File
@@ -1,5 +1,5 @@
' Playlet (App to play videos from an Invidious server on Roku TVs)
' Copyright (C) 2023 Brahim Hadriche
' Copyright (C) 2024 Brahim Hadriche
' This program is free software: you can redistribute it and/or modify
' it under the terms of the GNU Affero General Public License as published by
@@ -19,8 +19,9 @@ function Main(args as object) as void
port = CreateObject("roMessagePort")
screen.setMessagePort(port)
m.global = screen.getGlobalNode()
Logger.Init()
ClearPlayletLibUrlsIfNeeded(args)
Registry.ClearPlayletLibUrlsIfNeeded(args)
scene = screen.CreateScene("BootstrapScene")
screen.show()
@@ -77,7 +78,7 @@ function Main(args as object) as void
field = msg.getField()
data = msg.getData()
if field = "exitChannel" and data = true
END
return
end if
else if msgType = "roInputEvent"
scene.inputArgs = msg.getInfo()
+9 -4
View File
@@ -1,4 +1,9 @@
function ReadManifestValue(key as string) as string
appInfo = CreateObject("roAppInfo")
return appInfo.GetValue(key)
end function
namespace Manifest
function ReadValue(key as string) as string
appInfo = CreateObject("roAppInfo")
return appInfo.GetValue(key)
end function
end namespace
+1 -1
View File
@@ -11,7 +11,7 @@ namespace Tests
@params("playlet_lib_remote_url", "https://github.com/iBicha/playlet/releases/latest/download/playlet-lib.zip")
@params("playlet_lib_embedded_url", "pkg:/lib/playlet-lib.zip")
function _(key as string, expectedValue as string)
m.assertEqual(ReadManifestValue(key), expectedValue)
m.assertEqual(Manifest.ReadValue(key), expectedValue)
end function
end class
+31 -26
View File
@@ -1,29 +1,34 @@
function ReadRegistryKey(key as string, section as string) as dynamic
sec = CreateObject("roRegistrySection", section)
if not sec.Exists(key)
return invalid
end if
return sec.Read(key)
end function
namespace Registry
function DeleteRegistryKey(key as string, section as string)
sec = CreateObject("roRegistrySection", section)
sec.Delete(key)
sec.Flush()
end function
function ReadKey(key as string, section as string) as dynamic
sec = CreateObject("roRegistrySection", section)
if not sec.Exists(key)
return invalid
end if
return sec.Read(key)
end function
function GetPlayletLibUrlsFromRegistry() as object
urlsJson = ReadRegistryKey("playlet_lib_urls", "Playlet")
if urlsJson = invalid
return invalid
end if
urls = ParseJson(urlsJson)
return urls
end function
function DeleteKey(key as string, section as string)
sec = CreateObject("roRegistrySection", section)
sec.Delete(key)
sec.Flush()
end function
function ClearPlayletLibUrlsIfNeeded(launchArgs as object) as void
if launchArgs = invalid or launchArgs.clearPlayletLibUrls = invalid
return
end if
DeleteRegistryKey("playlet_lib_urls", "Playlet")
end function
function GetPlayletLibUrlsFromRegistry() as object
urlsJson = ReadKey("playlet_lib_urls", "Playlet")
if urlsJson = invalid
return invalid
end if
urls = ParseJson(urlsJson)
return urls
end function
function ClearPlayletLibUrlsIfNeeded(launchArgs as object) as void
if launchArgs = invalid or launchArgs.clearPlayletLibUrls = invalid
return
end if
DeleteKey("playlet_lib_urls", "Playlet")
Logger.Log("Cleared key playlet_lib_urls from registry")
end function
end namespace
+1 -1
View File
@@ -1,5 +1,5 @@
{
"extends": "../config/bsconfig.base.json",
"extends": "../config/bsconfig.base.jsonc",
"rootDir": "src/",
"stagingDir": "../build/playlet-lib",
"outFile": "../dist/playlet-lib.zip"
+1 -1
View File
@@ -1,5 +1,5 @@
{
"extends": "../config/bsconfig.tests.base.json",
"extends": "../config/bsconfig.tests.base.jsonc",
"rootDir": "src/",
"stagingDir": "../build/playlet-lib-tests",
"outFile": "../build/playlet-lib-tests.zip"
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "playlet-lib",
"version": "0.17.0",
"version": "0.19.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "playlet-lib",
"version": "0.17.0"
"version": "0.19.0"
}
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "playlet-lib",
"version": "0.17.0",
"version": "0.19.0",
"description": "Unofficial Youtube client for Roku",
"scripts": {
"prebuild": "rm -rf build/playlet-lib",
@@ -21,7 +21,7 @@ function PushScreen(node as object)
FocusTopScreen(invalid)
end function
function PopScreen(unused as dynamic)
function PopScreen(_unused as dynamic)
childCount = m.stack.getChildCount()
if childCount > 1
m.stack.removeChildIndex(childCount - 1)
@@ -29,7 +29,7 @@ function PopScreen(unused as dynamic)
end if
end function
function FocusTopScreen(unused as dynamic)
function FocusTopScreen(_unused as dynamic)
childCount = m.stack.getChildCount()
topScreen = m.stack.getChild(childCount - 1)
NodeSetFocus(topScreen, true)
@@ -60,7 +60,7 @@ function ShowRootScreen(screenName as string) as void
' insert child at 0 to make sure it is behind the navbar
m.root.insertChild(screen, 0)
if screen.hasField("binding_done")
screen@.BindNode(invalid)
screen@.BindNode()
end if
end if
screen = m.screens[screenName]
@@ -5,7 +5,7 @@ namespace ChannelUtils
appController = m.appController
end if
appController@.PushScreen(channelView)
channelView@.BindNode(invalid)
channelView@.BindNode()
channelView.content = contentNode
end function
end namespace
@@ -1,11 +1,11 @@
import "pkg:/components/Navigation/Navigation.bs"
import "pkg:/source/asyncTask/asyncTask.bs"
import "pkg:/source/AsyncTask/AsyncTask.bs"
import "pkg:/source/AsyncTask/Tasks.bs"
import "pkg:/source/utils/DisposableObserve.bs"
import "pkg:/source/utils/FocusManagement.bs"
import "pkg:/source/utils/Logging.bs"
import "pkg:/source/utils/StringUtils.bs"
import "pkg:/source/utils/Types.bs"
import "SubscribeTask.bs"
function Init()
m.container = m.top.findNode("container")
@@ -21,7 +21,7 @@ function Init()
m.rowList.focusable = true
m.rowList.screen = m.top
DisposableObserveField(m.banner, "loadStatus", FuncName(OnBannerLoadStatus))
DisposableObserveFieldScoped(m.banner, "loadStatus", FuncName(OnBannerLoadStatus))
m.author = ""
m.authorId = ""
@@ -29,13 +29,13 @@ function Init()
end function
function OnNodeready()
m.rowList@.BindNode(invalid)
m.rowList@.BindNode()
SetNavigation(m.rowList, "up", m.subscribeButton)
SetNavigation(m.subscribeButton, "down", m.rowList)
m.subscribeButton.text = "Subscribe"
DisposableObserveField(m.subscribeButton, "buttonSelected", FuncName(OnSubscribeButtonSelected))
DisposableObserveFieldScoped(m.subscribeButton, "buttonSelected", FuncName(OnSubscribeButtonSelected))
SetSubscribeButtonVisibility()
DisposableObserveFieldScoped(m.invidious, "authToken", FuncName(SetSubscribeButtonVisibility))
@@ -115,13 +115,17 @@ function OnkeyEvent(key as string, press as boolean) as boolean
end function
function Close()
m.appController@.PopScreen(invalid)
m.appController@.PopScreen()
m.top.dispose = true
end function
function OnDispose()
m.rowList.dispose = true
DisposeObservers()
if m.subscribeTask <> invalid
m.subscribeTask.cancel = true
m.subscribeTask = invalid
end if
end function
function OnSubscribeButtonSelected()
@@ -130,9 +134,9 @@ function OnSubscribeButtonSelected()
end if
isSubbed = IsSubscribed()
m.subscribeTask = StartAsyncTask(SubscribeTask, {
invidious: m.invidious,
ucid: m.authorId,
m.subscribeTask = AsyncTask.Start(Tasks.SubscribeTask, {
invidious: m.invidious
ucid: m.authorId
subscribe: not isSubbed
})
end function
@@ -168,33 +172,30 @@ function InitializeTabs()
m.tabs = {
videos: function(authorId as string, author as string) as object
return CreateChannelFeed("Latest videos", "channel_videos", authorId, author)
end function,
end function
shorts: function(authorId as string, author as string) as object
return CreateChannelFeed("Shorts", "channel_shorts", authorId, author)
end function,
end function
streams: function(authorId as string, author as string) as object
return CreateChannelFeed("Live", "channel_streams", authorId, author)
end function,
end function
podcasts: function(authorId as string, author as string) as object
return CreateChannelFeed("Podcasts", "channel_podcasts", authorId, author)
end function,
end function
playlists: function(authorId as string, author as string) as object
return CreateChannelFeed("Playlists", "channel_playlists", authorId, author)
end function,
channels: function(authorId as string, author as string) as object
return CreateChannelFeed("Channels", "channel_channels", authorId, author)
end function
}
end function
function CreateChannelFeed(title as string, endpoint as string, ucid as string, author as string) as object
return {
title: title,
title: title
feedSources: [{
"id": `inv_${endpoint}_${ucid}`,
"title": `${author} - ${title}`,
"apiType": "Invidious",
"endpoint": endpoint,
"id": `inv_${endpoint}_${ucid}`
"title": `${author} - ${title}`
"apiType": "Invidious"
"endpoint": endpoint
"pathParams": {
"ucid": ucid
}
@@ -22,7 +22,7 @@ function SubscribeTask(input as object) as object
error = response.ErrorMessage()
LogError("Failed to subscribe/unsubscribe to channel:", error)
return {
success: false,
success: false
error: error
}
end if
@@ -1,7 +1,9 @@
import "pkg:/components/ContentNode/ChannelContentTask.bs"
import "pkg:/components/Dialog/DialogUtils.bs"
import "pkg:/source/asyncTask/asyncTask.bs"
import "pkg:/components/VideoFeed/FeedLoadState.bs"
import "pkg:/source/AsyncTask/AsyncTask.bs"
import "pkg:/source/AsyncTask/Tasks.bs"
import "pkg:/source/utils/ErrorUtils.bs"
import "pkg:/source/utils/Logging.bs"
function Init()
end function
@@ -17,8 +19,8 @@ function LoadChannel(invidiousNode as object) as void
end if
m.top.loadState = FeedLoadState.Loading
m.contentTask = StartAsyncTask(ChannelContentTask, {
content: m.top,
m.contentTask = AsyncTask.Start(Tasks.ChannelContentTask, {
content: m.top
invidious: invidiousNode
}, OnChannelContentTaskResult)
end function
@@ -24,7 +24,7 @@ function ChannelContentTask(input as object) as object
if not response.IsSuccess() or metadata = invalid
contentNode.loadState = FeedLoadState.Error
return {
success: false,
success: false
error: response.ErrorMessage()
}
end if
@@ -3,8 +3,8 @@ import "pkg:/source/utils/Logging.bs"
import "pkg:/source/utils/StringUtils.bs"
import "pkg:/source/utils/Types.bs"
' TODO:P0 Web app support
' TODO:P0 Web apis and open api spec updates
' TODO:P1 Web app support
' TODO:P1 Web apis and open api spec updates
'
' From the main screen:
' When a video is selected:
@@ -167,5 +167,5 @@ function OnkeyEvent(key as string, press as boolean) as boolean
end function
function Close()
m.top.appController@.PopScreen(invalid)
m.top.appController@.PopScreen()
end function
@@ -11,19 +11,19 @@ function OnItemHasFocus()
hasFocus = m.top.itemHasFocus
if hasFocus
m.top.font = "font:SmallestBoldSystemFont"
m.top.color = "0x262626ff"
m.top.color = "#262626ff"
else
m.top.font = "font:SmallestSystemFont"
m.top.color = "0xddddddff"
m.top.color = "#DBDBDBFF"
end if
end function
function OnFocusPercent()
if m.top.focusPercent > 0.5
m.top.font = "font:SmallestBoldSystemFont"
m.top.color = "0x262626ff"
m.top.color = "#262626FF"
else
m.top.font = "font:SmallestSystemFont"
m.top.color = "0xddddddff"
m.top.color = "#DBDBDBFF"
end if
end function
@@ -19,7 +19,7 @@ namespace ContextMenuUtils
ContextMenuUtils.SetItem(contextMenu, item)
contextMenu.options = options
contextMenu@.Show(invalid)
contextMenu@.Show()
return contextMenu
end function
@@ -0,0 +1,12 @@
function SetPalette(dialog as object)
palette = createObject("roSGNode", "RSGPalette")
palette.colors = {
DialogBackgroundColor: "#242424FF"
DialogFocusColor: "#CECECEFF"
DialogFocusItemColor: "#202020FF"
DialogSecondaryTextColor: "#DBDBDBFF"
DialogSecondaryItemColor: "#FF1C30FF"
DialogTextColor: "#DBDBDBFF"
}
dialog.palette = palette
end function
@@ -1,9 +1,11 @@
import "pkg:/components/Screens/WebAppScreen/GenerateQrCodeTask.bs"
import "pkg:/source/asyncTask/asyncTask.bs"
import "DialogPalette.bs"
import "pkg:/source/AsyncTask/AsyncTask.bs"
import "pkg:/source/AsyncTask/Tasks.bs"
import "pkg:/source/utils/StringUtils.bs"
import "pkg:/source/utils/Types.bs"
function Init()
SetPalette(m.top)
m.urlLabel = m.top.findNode("urlLabel")
m.qrCode = m.top.findNode("QrCodePoster")
@@ -12,9 +14,9 @@ function Init()
end function
function OnNodeReady()
address = m.webserver@.GetServerAddress(invalid)
isValidIp = not StringUtils.IsNullOrEmpty(address)
if isValidIp
address = m.webserver@.GetServerAddress()
isValidAddress = not StringUtils.IsNullOrEmpty(address)
if isValidAddress
m.top.url = `${address}/invidious/login`
else
m.urlLabel.text = "No IP address found"
@@ -31,10 +33,10 @@ function OnUrlSet()
url = m.top.url
m.urlLabel.text = url
StartAsyncTask(GenerateQrCodeTask, {
poster: m.qrCode,
text: url,
size: m.qrCode.loadWidth,
AsyncTask.Start(Tasks.GenerateQrCodeTask, {
poster: m.qrCode
text: url
size: m.qrCode.loadWidth
padding: 10
})
end function
@@ -18,7 +18,7 @@
horizAlign="right"
width="400"
extendToDialogEdge="false"
showDivider="true">
showDivider="false">
<Label
text="Scan the QR Code"
horizAlign="center"
@@ -1,6 +1,8 @@
import "DialogPalette.bs"
import "pkg:/source/utils/Types.bs"
function Init()
SetPalette(m.top)
m.top.observeField("buttonSelected", FuncName(CloseDialog))
end function
+12 -2
View File
@@ -1,5 +1,5 @@
import "pkg:/source/utils/Logging.bs"
import "pkg:/source/utils/Types.bs"
import "pkg:/source/utils/StringUtils.bs"
function Init()
m.top.functionName = "LoggerLoop"
@@ -32,13 +32,23 @@ function LoggerLoop()
port = m.port
buffer = CreateObject("roByteArray")
previousLogsFile = m.top.folder + "/" + m.top.filenamePrevious
logsFile = m.top.folder + "/" + m.top.filename
previousLogsFile = m.top.folder + "/" + m.top.filenamePrevious
filenameStartup = m.top.filenameStartup
CreateDirectory(m.top.folder)
DeleteFile(previousLogsFile)
MoveFile(logsFile, previousLogsFile)
startUpLogs = ReadAsciiFile(filenameStartup)
if not StringUtils.IsNullOrEmpty(startUpLogs)
line = `************* Startup Logs *************\n${startUpLogs}*********** End Startup Logs ***********\n`
' bs:disable-next-line LINT3012
print line
buffer.FromAsciiString(line)
buffer.AppendFile(logsFile)
end if
while true
msg = wait(0, port)
msgType = type(msg)
@@ -5,5 +5,6 @@
<field id="folder" type="string" value="cachefs:/logs" />
<field id="filename" type="string" value="app_logs.txt" />
<field id="filenamePrevious" type="string" value="app_logs_previous.txt" />
<field id="filenameStartup" type="string" value="cachefs:/playlet_startup_logs.txt" />
</interface>
</component>
+3 -1
View File
@@ -1,5 +1,6 @@
import "pkg:/components/EcpArgs.bs"
import "pkg:/components/parts/AutoBind/AutoBind.part.bs"
import "pkg:/components/parts/AutoBind/OnNodeReadyNoOp.bs"
import "pkg:/source/utils/LoadingScreen.bs"
function Init()
@@ -16,9 +17,10 @@ function MainSceneContainerChanged()
HideLoadingScreen()
InitEcpArgs()
m.scene.signalBeacon("AppLaunchComplete")
CopyLoadingMessagesToCache()
end function
function StartWebServer()
m.webServer = m.top.findNode("WebServer")
m.webServer@.StartServer(invalid)
m.webServer@.StartServer()
end function
@@ -1,5 +1,6 @@
'import "pkg:/components/EcpArgs.bs"
'import "pkg:/components/parts/AutoBind/AutoBind.part.bs"
'import "pkg:/components/parts/AutoBind/OnNodeReadyNoOp.bs"
'import "pkg:/source/utils/LoadingScreen.bs"
function Init()
@@ -17,6 +18,7 @@ function MainSceneContainerChanged()
HideLoadingScreen()
InitEcpArgs()
m.scene.signalBeacon("AppLaunchComplete")
CopyLoadingMessagesToCache()
end function
function StartWebServer()
@@ -10,6 +10,7 @@
<script type="text/brightscript" uri="pkg:/components/MainScene_bindings.brs" />
<script type="text/brightscript" uri="pkg:/components/MainScene.brs" />
<script type="text/brightscript" uri="pkg:/source/utils/LoadingScreen.brs" />
<script type="text/brightscript" uri="pkg:/components/parts/AutoBind/OnNodeReadyNoOp.brs" />
<script type="text/brightscript" uri="pkg:/components/EcpArgs.brs" />
<script type="text/brightscript" uri="pkg:/source/utils/Types.brs" />
<script type="text/brightscript" uri="pkg:/source/utils/StringUtils.brs" />
+14 -3
View File
@@ -1,4 +1,3 @@
import "pkg:/source/utils/ColorUtils.bs"
import "pkg:/source/utils/FocusManagement.bs"
import "pkg:/source/utils/Types.bs"
@@ -31,8 +30,8 @@ function PopulateButtons() as void
buttons = []
for each item in navBarItems
button = CreateObject("roSGNode", "IconButton")
button.background = ColorUtils.HexToInt("242424")
button.focusBackground = ColorUtils.HexToInt("ff1c30")
button.background = "#242424FF"
button.focusBackground = "#FF1C30FF"
button.padding = 20
button.height = 50
button.width = 90
@@ -47,6 +46,18 @@ function PopulateButtons() as void
m.top.focusable = buttons.Count() > 0
m.top.focusIndex = m.top.focusIndex
CenterButtons()
end function
function CenterButtons()
parent = m.buttonGroup.getParent()
parentWidth = parent.width
parentHeight = parent.height
rect = m.buttonGroup.boundingRect()
m.buttonGroup.translation = [parentWidth / 2 - rect.width / 2, parentHeight / 2 - rect.height / 2]
end function
function onKeyEvent(key as string, press as boolean) as boolean
@@ -3,7 +3,7 @@ const OPTIONS_LONG_PRESS_KEY = "OPTIONS_LONG_PRESS"
function InitializeLongPress(keys as object, duration = 1.0 as float)
longPressKeyMap = {
"OK": OK_LONG_PRESS_KEY,
"OK": OK_LONG_PRESS_KEY
"options": OPTIONS_LONG_PRESS_KEY
}
m._longPressKeyMap = {}
@@ -17,7 +17,7 @@ function InitializeLongPress(keys as object, duration = 1.0 as float)
' - press K to simulate an "OK" long press on the remote.
' - press O to simulate an "options" long press on the remote.
simulatedLongPressKeyMap = {
"OK": "Lit_k",
"OK": "Lit_k"
"options": "Lit_o"
}
@@ -10,8 +10,8 @@ function SetNavigation(fromNode as object, direction as string, toNode as object
end if
m._navigation[direction].push({
fromNode: fromNode,
toNode: toNode,
fromNode: fromNode
toNode: toNode
callback: callback
})
end function
@@ -19,7 +19,7 @@ end function
function NavigationKeyHandler(key as string, press as boolean) as object
if not press
return {
handled: false,
handled: false
node: invalid
}
end if
@@ -27,7 +27,7 @@ function NavigationKeyHandler(key as string, press as boolean) as object
navigations = m._navigation[key]
if navigations = invalid
return {
handled: false,
handled: false
node: invalid
}
end if
@@ -41,13 +41,13 @@ function NavigationKeyHandler(key as string, press as boolean) as object
item.callback()
end if
return {
handled: true,
handled: true
node: item.toNode
}
end if
end for
return {
handled: false,
handled: false
node: invalid
}
end function
@@ -1,13 +1,14 @@
import "pkg:/components/Dialog/DialogUtils.bs"
import "pkg:/components/NodeByRef/NodeByRef.bs"
import "pkg:/components/PlaylistView/PlaylistContentTask.bs"
import "pkg:/components/PlayQueue/Notifications/PlayQueueNotificationUtils.bs"
import "pkg:/components/VideoFeed/FeedLoadState.bs"
import "pkg:/components/VideoPlayer/VideoUtils.bs"
import "pkg:/source/asyncTask/asyncTask.bs"
import "pkg:/source/AsyncTask/AsyncTask.bs"
import "pkg:/source/AsyncTask/Tasks.bs"
import "pkg:/source/utils/ArrayUtils.bs"
import "pkg:/source/utils/ErrorUtils.bs"
import "pkg:/source/utils/Logging.bs"
import "pkg:/source/utils/RingBuffer.bs"
import "pkg:/source/utils/Types.bs"
' TODO:P1 prevent adding duplicates of the same video/playlist
@@ -17,6 +18,8 @@ function Init()
m.top.content = m.content
m.content.addField("index", "integer", false)
m.content.index = m.top.index
' TODO:P2 use actual queue nodes instead of internal buffer
m.watchedVideos = new RingBuffer(100)
end function
function Play(node as object, playlistIndex as integer)
@@ -53,7 +56,7 @@ function WrapWithIndexField(node as object) as object
end function
' TODO:P0 better model of the queue (Now playing, etc)
function GetQueue(unused as dynamic) as object
function GetQueue(_unused as dynamic) as object
queueNodes = m.content.getChildren(-1, 0)
items = []
for each node in queueNodes
@@ -65,37 +68,37 @@ function GetQueue(unused as dynamic) as object
nodeType = node.type
if nodeType = "video"
items.push({
type: nodeType,
videoId: node.videoId,
title: node.title,
author: node.author,
type: nodeType
videoId: node.videoId
title: node.title
author: node.author
thumbnail: node.thumbnail
})
else if node.type = "playlist"
items.push({
type: nodeType,
playlistId: node.playlistId,
title: node.title,
thumbnail: node.thumbnail,
type: nodeType
playlistId: node.playlistId
title: node.title
thumbnail: node.thumbnail
videoCountText: node.videoCountText
})
end if
end for
return {
index: m.top.index,
playlistIndex: m.top.playlistIndex,
index: m.top.index
playlistIndex: m.top.playlistIndex
items: items
}
end function
function Clear(unused as dynamic)
function Clear(_unused as dynamic)
m.content.removeChildrenIndex(m.content.getChildCount(), 0)
m.top.index = -1
m.top.playlistIndex = -1
end function
function PlayNextItem(unused as dynamic) as boolean
function PlayNextItem(_unused as dynamic) as boolean
childCount = m.content.getChildCount()
if childCount = 0
return false
@@ -138,7 +141,7 @@ function PlayItemAtCurrentIndex() as boolean
return false
end if
if node.type = "video"
VideoUtils.PlayVideo(node)
PlayVideo(node)
return true
else if node.type = "playlist"
if m.top.playlistIndex = -1
@@ -162,7 +165,7 @@ function PlayPlaylistAtCurrentIndex(playlist as object) as boolean
if playlistIndex < playlist.getChildCount()
child = playlist.getChild(playlistIndex)
VideoUtils.PlayVideo(child)
PlayVideo(child)
return true
end if
@@ -170,6 +173,14 @@ function PlayPlaylistAtCurrentIndex(playlist as object) as boolean
return true
end function
function PlayVideo(node as object)
videoId = node.videoId
if not m.watchedVideos.Contains(videoId)
m.watchedVideos.Push(videoId)
end if
VideoUtils.PlayVideo(node)
end function
function LoadPlaylist(playlist as object) as void
if playlist.loadState = FeedLoadState.Loading
return
@@ -177,8 +188,8 @@ function LoadPlaylist(playlist as object) as void
playlist.loadState = FeedLoadState.Loading
task = StartAsyncTask(PlaylistContentTask, {
content: playlist,
task = AsyncTask.Start(Tasks.PlaylistContentTask, {
content: playlist
invidious: m.top.invidious
}, OnPlaylistContentTaskResult)
m.pendingLoadTasks[task.id] = task
@@ -219,3 +230,11 @@ function OnIndexChange()
child.index = index
end for
end function
function watchedVideosContain(videoId as string) as boolean
return m.watchedVideos.Contains(videoId)
end function
function watchedVideosClear(_unused as dynamic)
m.watchedVideos = new RingBuffer(100)
end function
@@ -12,6 +12,8 @@
<function name="Clear" />
<function name="PlayNextItem" />
<function name="PlayItemAtIndex" />
<function name="watchedVideosContain" />
<function name="watchedVideosClear" />
</interface>
<children>
<ContentNode id="Content" />
@@ -61,11 +61,11 @@ function OnkeyEvent(key as string, press as boolean) as boolean
end function
function Close()
m.top.appController@.PopScreen(invalid)
m.top.appController@.PopScreen()
end function
function OnClearButtonSelected()
m.top.playQueue@.Clear(invalid)
m.top.playQueue@.Clear()
end function
function OnItemSelected() as void
@@ -66,6 +66,7 @@ function SetHighlight() as void
index = m.top.index
if playQueueIndex = index
' bs:disable-next-line LINT3023
m.top.thumbnailBlendColor = "#FFFFFFFF"
m.top.highlightUri = "pkg:/images/focus_grid.9.png"
else
@@ -35,7 +35,7 @@
</Poster>
<Poster
id="highlightPoster"
blendColor="0xFF0000"
blendColor="0xFF1C30"
width="164"
height="94" />
@@ -16,7 +16,7 @@ namespace PlayQueueViewUtils
playQueueView.jumpToItem = index
end if
playQueueView@.Show(invalid)
playQueueView@.Show()
return playQueueView
end function
@@ -27,7 +27,7 @@ function PlaylistContentTask(input as object) as object
if not response.IsSuccess() or metadata = invalid
contentNode.loadState = FeedLoadState.Error
return {
success: false,
success: false
error: response.ErrorMessage()
}
end if
@@ -5,7 +5,7 @@ namespace PlaylistUtils
appController = m.appController
end if
appController@.PushScreen(playlistView)
playlistView@.BindNode(invalid)
playlistView@.BindNode()
playlistView.content = contentNode
end function
end namespace
@@ -2,10 +2,11 @@ import "pkg:/components/ChannelView/ChannelUtils.bs"
import "pkg:/components/ContextMenu/ContextMenuUtils.bs"
import "pkg:/components/Dialog/DialogUtils.bs"
import "pkg:/components/Navigation/LongPress.bs"
import "pkg:/components/PlaylistView/PlaylistContentTask.bs"
import "pkg:/components/Services/Invidious/InvidiousToContentNode.bs"
import "pkg:/components/VideoFeed/FeedLoadState.bs"
import "pkg:/components/VideoPlayer/VideoUtils.bs"
import "pkg:/source/asyncTask/asyncTask.bs"
import "pkg:/source/AsyncTask/AsyncTask.bs"
import "pkg:/source/AsyncTask/Tasks.bs"
import "pkg:/source/utils/ErrorUtils.bs"
import "pkg:/source/utils/FocusManagement.bs"
import "pkg:/source/utils/Logging.bs"
@@ -91,9 +92,10 @@ end function
function Close()
if m.playlistLoadTask <> invalid
m.playlistLoadTask.cancel = true
m.playlistLoadTask = invalid
end if
m.appController@.PopScreen(invalid)
m.appController@.PopScreen()
end function
function OnItemFocused()
@@ -221,8 +223,8 @@ function LoadPlaylist() as void
end if
m.top.content.loadState = FeedLoadState.Loading
m.playlistLoadTask = StartAsyncTask(PlaylistContentTask, {
content: m.top.content,
m.playlistLoadTask = AsyncTask.Start(Tasks.PlaylistContentTask, {
content: m.top.content
invidious: m.top.invidious
}, OnPlaylistContentTaskResult)
end function
@@ -1,22 +1,38 @@
import "pkg:/source/asyncTask/asyncTask.bs"
import "pkg:/source/AsyncTask/AsyncTask.bs"
function Init()
m.displayNames = {
"version": "Playlet Version",
"lib_version": "Playlet Library Version",
"lib_version_latest": "Playlet Library Latest Version",
"lib_url": "Playlet Library URL",
"lib_url_type": "Playlet Library URL Type",
"git_commit_hash": "Playlet Git Commit Hash",
"lib_git_commit_hash": "Playlet Library Git Commit Hash",
"id": "App ID"
}
' TODO:P2 Add tooltip to each field with description of what it means
m.displayNames = [{
key: "app_version"
displayText: "Playlet App Version"
}, {
key: "lib_version"
displayText: "Playlet Library Version"
}, {
key: "lib_version_latest"
displayText: "Playlet Library Latest Version"
}, {
key: "lib_url"
displayText: "Playlet Library URL"
}, {
key: "lib_url_type"
displayText: "Playlet Library URL Type"
}, {
key: "app_git_commit_hash"
displayText: "Playlet App Git Commit Hash"
}, {
key: "lib_git_commit_hash"
displayText: "Playlet Library Git Commit Hash"
}, {
key: "id"
displayText: "App ID"
}]
m.keyValueList = m.top.findNode("KeyValueListContent")
end function
function OnNodeReady()
m.appInfo = m.applicationInfo@.GetAppInfo(invalid)
m.appInfo = m.applicationInfo@.GetAppInfo()
UpdateKeyValueList()
@@ -35,8 +51,8 @@ function UpdateKeyValueList()
m.keyValueList.removeChildIndex(0)
end while
for each item in m.appInfo
value = `${m.displayNames[item]}: ${m.appInfo[item]}`
for each item in m.displayNames
value = `${item.displayText}: ${m.appInfo[item.key]}`
contentNode = m.keyValueList.createChild("ContentNode")
contentNode.title = value
end for
@@ -17,7 +17,7 @@ function OnNodeReady()
SetNavigation(invalid, "back", m.navBar)
SetNavigation(invalid, "left", m.navBar)
m.rowList@.BindNode(invalid)
m.rowList@.BindNode()
OnBookmarksChange()
m.bookmarks.ObserveField("contentChange", FuncName(OnBookmarksChange))
@@ -41,7 +41,7 @@ function OnVisibleChange()
end if
end function
function Refresh(unused as dynamic)
function Refresh(_unused as dynamic)
m.isDirty = true
OnBookmarksChange()
end function
@@ -79,7 +79,7 @@ function SetRowListContent(bookmarksContent as object)
end for
feeds.push({
"title": bookmarkGroupNode.title,
"title": bookmarkGroupNode.title
"feedSources": feedSources
})
end for
@@ -1,3 +1,4 @@
import "HomeScreenUtils.bs"
import "pkg:/components/ContextMenu/ContextMenuUtils.bs"
import "pkg:/components/Navigation/Navigation.bs"
import "pkg:/source/utils/FocusManagement.bs"
@@ -13,8 +14,16 @@ function OnNodeReady()
SetNavigation(invalid, "back", m.navBar)
SetNavigation(invalid, "left", m.navBar)
m.rowList@.BindNode(invalid)
m.rowList.feeds = ParseJson(ReadAsciiFile(m.top.feedFile))
m.rowList@.BindNode()
' TODO:P1 home screen should only be refreshed when the user navigates to it
' (similar to bookmarks screen)
m.preferences.observeFieldScoped("misc.home_screen_layout", FuncName(OnHomeLayoutChange))
OnHomeLayoutChange()
end function
function OnHomeLayoutChange() as void
m.rowList.feeds = HomeScreenUtils.GetFeed(m.top.feedFile, m.preferences)
end function
function OnFocusChange() as void
@@ -2,6 +2,7 @@
<interface>
<field id="navBar" type="node" bind="/NavBar" />
<field id="invidious" type="node" bind="/Invidious" />
<field id="preferences" type="node" bind="/Preferences" />
<field id="feedFile" type="string" value="libpkg:/config/default_home_layout.yaml" />
</interface>
<children>
@@ -0,0 +1,28 @@
import "pkg:/source/utils/Types.bs"
namespace HomeScreenUtils
function GetFeed(feedFileName as string, preferences as object) as object
feed = ParseJson(ReadAsciiFile(feedFileName))
homeLayout = preferences["misc.home_screen_layout"]
if not IsArray(homeLayout) or homeLayout.Count() = 0
return feed
end if
feedItems = {}
for each item in feed
feedItems[item["id"]] = item
end for
filteredFeed = []
for each item in homeLayout
if item.enabled = true
filteredFeed.push(feedItems[item.id])
end if
end for
return filteredFeed
end function
end namespace
@@ -5,110 +5,110 @@ import "pkg:/source/utils/Types.bs"
function Init()
options = {
date: [{
title: "Any date",
title: "Any date"
value: ""
}, {
title: "Last hour",
title: "Last hour"
value: "hour"
}, {
title: "Today",
title: "Today"
value: "today"
}, {
title: "This week",
title: "This week"
value: "week"
}, {
title: "This month",
title: "This month"
value: "month"
}, {
title: "This year",
title: "This year"
value: "year"
}],
}]
type: [{
title: "Any type",
title: "Any type"
value: ""
}, {
title: "Video",
title: "Video"
value: "video"
}, {
title: "Playlist",
title: "Playlist"
value: "playlist"
}, {
title: "Channel",
title: "Channel"
value: "channel"
}, {
title: "Movie",
title: "Movie"
value: "movie"
}, {
title: "Show",
title: "Show"
value: "show"
}],
}]
duration: [{
title: "Any duration",
title: "Any duration"
value: ""
}, {
title: "Under 4 minutes",
title: "Under 4 minutes"
value: "short"
}, {
title: "4 - 20 minutes",
title: "4 - 20 minutes"
value: "medium"
}, {
title: "Over 20 minutes",
title: "Over 20 minutes"
value: "long"
}],
}]
features: [{
title: "Live",
title: "Live"
value: "live"
}, {
title: "4K",
title: "4K"
value: "4k"
}, {
title: "HD",
title: "HD"
value: "hd"
}, {
title: "Subtitles/CC",
title: "Subtitles/CC"
value: "subtitles"
}, {
title: "Creative Commons",
title: "Creative Commons"
value: "creative_commons"
}, {
title: "360°",
title: "360°"
value: "360"
}, {
title: "VR180",
title: "VR180"
value: "vr180"
}, {
title: "3D",
title: "3D"
value: "3d"
}, {
title: "HDR",
title: "HDR"
value: "hdr"
}, {
title: "Purchased",
title: "Purchased"
value: "purchased"
}, {
title: "Location",
title: "Location"
value: "location"
}],
}]
sort_by: [{
title: "Relevance",
title: "Relevance"
value: ""
}, {
title: "Upload date",
title: "Upload date"
value: "upload_date"
}, {
title: "View count",
title: "View count"
value: "view_count"
}, {
title: "Rating",
title: "Rating"
value: "rating"
}]
}
m.controls = {
date: m.top.findNode("UploadDateList"),
type: m.top.findNode("TypeList"),
duration: m.top.findNode("DurationList"),
features: m.top.findNode("FeaturesList"),
date: m.top.findNode("UploadDateList")
type: m.top.findNode("TypeList")
duration: m.top.findNode("DurationList")
features: m.top.findNode("FeaturesList")
sort_by: m.top.findNode("SortByList")
}
@@ -118,10 +118,10 @@ function Init()
end for
m.contentNodes = {
date: m.controls.date.content,
type: m.controls.type.content,
duration: m.controls.duration.content,
features: m.controls.features.content,
date: m.controls.date.content
type: m.controls.type.content
duration: m.controls.duration.content
features: m.controls.features.content
sort_by: m.controls.sort_by.content
}
@@ -266,5 +266,5 @@ function OnkeyEvent(key as string, press as boolean) as boolean
end function
function Close()
m.appController@.PopScreen(invalid)
m.appController@.PopScreen()
end function
@@ -1,11 +1,13 @@
import "pkg:/components/Navigation/Navigation.bs"
import "pkg:/components/Screens/SearchScreen/SearchSuggestionsTask.bs"
import "pkg:/components/Services/SearchHistory/SearchHistoryUtils.bs"
import "pkg:/source/asyncTask/asyncTask.bs"
import "pkg:/source/AsyncTask/AsyncTask.bs"
import "pkg:/source/AsyncTask/Tasks.bs"
import "pkg:/source/utils/CryptoUtils.bs"
import "pkg:/source/utils/ErrorUtils.bs"
import "pkg:/source/utils/FocusManagement.bs"
import "pkg:/source/utils/LoadingScreen.bs"
import "pkg:/source/utils/Logging.bs"
import "pkg:/source/utils/UrlUtils.bs"
function Init()
m.top.focusable = true
@@ -24,10 +26,10 @@ function Init()
textEditBox.voiceEnabled = true
m.top.filters = {
date: "",
type: "",
duration: "",
features: [],
date: ""
type: ""
duration: ""
features: []
sort_by: ""
}
@@ -35,7 +37,7 @@ function Init()
end function
function OnNodeReady()
m.rowlist@.BindNode(invalid)
m.rowlist@.BindNode()
m.keyboard.ObserveField("text", FuncName(OnTextChange))
m.suggestions.ObserveField("buttonFocused", FuncName(OnSearchButtonFocused))
m.suggestions.ObserveField("buttonSelected", FuncName(OnSearchButtonSelected))
@@ -97,9 +99,9 @@ function OnTextChange() as void
m.searchSuggestionsTask.cancel = true
end if
m.searchSuggestionsTask = StartAsyncTask(SearchSuggestionsTask, {
q: m.keyboard.text,
invidious: m.invidious,
m.searchSuggestionsTask = AsyncTask.Start(Tasks.SearchSuggestionsTask, {
q: m.keyboard.text
invidious: m.invidious
preferences: m.preferences
}, OnSearchSuggestionsTaskResults)
end function
@@ -150,7 +152,7 @@ function OnFiltersButtonSelected()
searchFilters = CreateObject("roSGNode", "SearchFilters")
m.appController@.PushScreen(searchFilters)
searchFilters.searchScreen = m.top
searchFilters@.BindNode(invalid)
searchFilters@.BindNode()
end function
function OnSearchButtonSelected()
@@ -205,10 +207,10 @@ function Search(text as string)
ShowLoadingScreen()
feedSource = {
"id": `inv_search_${CryptoUtils.GetMd5(text)}`,
"title": `Search - ${text}`,
"apiType": "Invidious",
"endpoint": "search",
"id": `inv_search_${CryptoUtils.GetMd5(text)}`
"title": `Search - ${text}`
"apiType": "Invidious"
"endpoint": "search"
"queryParams": {
"q": text
}
@@ -220,17 +222,15 @@ function Search(text as string)
if IsString(value) and value.len() > 0
feedSource.queryParams[filter] = value
else if IsArray(value) and value.Count() > 0
' TODO:P1 this is http client implementation details leaking
' We need a declarative way to set array types
feedSource.queryParams[filter] = {
value: value,
__arrayType: HttpClient.QueryParamArrayType.CommaSeparated
value: value
arrayType: UrlUtils.QueryParamArrayType.CommaSeparated
}
end if
end for
m.rowList.feeds = [{
"title": `Search - ${text}`,
"title": `Search - ${text}`
"feedSources": [feedSource]
}]
end function
@@ -26,7 +26,7 @@ function SearchSuggestionsTask(input as object) as object
end if
return {
q: q,
q: q
response: history
}
end function
@@ -0,0 +1,58 @@
import "pkg:/components/parts/AutoBind/OnNodeReadyNoOp.bs"
import "pkg:/source/utils/FocusManagement.bs"
import "pkg:/source/utils/Types.bs"
function Init()
m.top.focusable = true
m.top.itemSpacings = [8]
m.button = m.top.findNode("button")
m.button.observeField("buttonSelected", FuncName(OpenHomeScreenEditor))
end function
function OnFocusChange() as void
if not m.top.focus
return
end if
NodeSetFocus(m.button, true)
end function
function BindPreference(preferences as object, key as string)
if m.preferences <> invalid and m.key <> invalid
m.preferences.unobserveFieldScoped(m.key)
end if
m.preferences = preferences
m.key = key
if preferences <> invalid and key <> invalid
preferences.observeFieldScoped(key, FuncName(OnPreferenceChange))
OnPreferenceChange()
end if
end function
function OpenHomeScreenEditor()
editor = CreateObject("roSGNode", "HomeScreenEditor")
m.appController@.PushScreen(editor)
editor@.BindNode()
editor.value = m.top.value
editor.observeField("save", FuncName(OnSaveHomeScreenEditor))
end function
function OnSaveHomeScreenEditor(event as object)
editor = event.GetRoSGNode()
m.top.value = editor.value
end function
function OnPreferenceChange()
m.top.value = m.preferences[m.key]
end function
function OnValueChange() as void
if m.preferences = invalid or m.key = invalid
return
end if
m.preferences[m.key] = m.top.value
end function
@@ -0,0 +1,21 @@
<component name="EditHomeScreenControl" extends="LayoutGroup" includes="AutoBind,Focus">
<interface>
<field id="displayText" type="string" alias="Button.text" />
<field id="description" type="string" alias="DescriptionLabel.text" />
<field id="value" type="array" onChange="OnValueChange" />
<field id="appController" type="node" bind="/AppController" />
<function name="BindPreference" />
</interface>
<children>
<Button
id="button"
minWidth="300"
showFocusFootprint="true" />
<Label id="DescriptionLabel"
width="450"
color="0xb4b4b4ff"
wrap="true">
<Font role="font" uri="font:SystemFontFile" size="18" />
</Label>
</children>
</component>
@@ -0,0 +1,156 @@
import "pkg:/components/Navigation/Navigation.bs"
import "pkg:/components/parts/AutoBind/OnNodeReadyNoOp.bs"
import "pkg:/source/utils/MathUtils.bs"
import "pkg:/source/utils/Types.bs"
function Init()
m.homeLayout = {}
homeLayout = ParseJson(ReadAsciiFile("libpkg:/config/default_home_layout.yaml"))
for each item in homeLayout
m.homeLayout[item.id] = item
end for
m.checkList = m.top.findNode("checkList")
m.moveUpButton = m.top.findNode("moveUpButton")
m.moveDownButton = m.top.findNode("moveDownButton")
m.closeButton = m.top.findNode("closeButton")
m.saveButton = m.top.findNode("saveButton")
SetNavigation(m.checkList, "down", m.saveButton)
SetNavigation(m.saveButton, "up", m.checkList)
SetNavigation(m.closeButton, "up", m.checkList)
SetNavigation(m.saveButton, "right", m.closeButton)
SetNavigation(m.closeButton, "left", m.saveButton)
SetNavigation(m.moveUpButton, "left", m.checkList)
SetNavigation(m.moveDownButton, "left", m.checkList)
SetNavigation(m.checkList, "right", m.moveUpButton)
SetNavigation(m.moveUpButton, "down", m.moveDownButton)
SetNavigation(m.moveDownButton, "up", m.moveUpButton)
SetNavigation(m.moveDownButton, "down", m.closeButton)
m.moveUpButton.observeField("buttonSelected", FuncName(OnMoveUpButtonSelected))
m.moveDownButton.observeField("buttonSelected", FuncName(OnMoveDownButtonSelected))
m.saveButton.observeField("buttonSelected", FuncName(OnSaveButtonSelected))
m.closeButton.observeField("buttonSelected", FuncName(Close))
m.checkList.observeField("checkedState", FuncName(OnCheckedStateChange))
end function
function OnFocusChange() as void
if not m.top.focus
return
end if
NodeSetFocus(m.checkList, true)
end function
function OnkeyEvent(key as string, press as boolean) as boolean
if NavigationKeyHandler(key, press).handled
return true
end if
if key = "options" and press
' A pass-through to the app controller, so it can toggle picture-in-picture
return false
end if
if key = "back" and press
Close()
return true
end if
return true
end function
function OnValueChange()
content = m.checkList.content
value = m.top.value
nodes = []
checkedState = []
for each item in value
node = CreateObject("roSGNode", "ContentNode")
node.id = item.id
node.title = m.homeLayout[item.id].title
nodes.push(node)
checkedState.push(item.enabled)
end for
labelCount = content.getChildCount()
if labelCount > 0
content.removeChildrenIndex(labelCount, 0)
end if
content.appendChildren(nodes)
m.checkList.checkedState = checkedState
end function
function OnCheckedStateChange() as void
content = m.checkList.content
if content = invalid or content.getChildCount() = 0
return
end if
checkedState = m.checkList.checkedState
if checkedState = invalid or checkedState.Count() = 0
return
end if
value = []
checkboxes = content.getChildren(-1, 0)
for i = 0 to checkboxes.Count() - 1
checkbox = checkboxes[i]
value.push({
id: checkbox.id
enabled: checkedState[i]
})
end for
m.top.value = value
end function
function OnMoveUpButtonSelected() as void
MoveItem(-1)
end function
function OnMoveDownButtonSelected() as void
MoveItem(1)
end function
function MoveItem(offset as integer) as void
content = m.checkList.content
if content = invalid or content.getChildCount() = 0
return
end if
itemCount = content.getChildCount()
index = m.checkList.itemFocused
newIndex = MathUtils.Max(0, MathUtils.Min(index + offset, itemCount - 1))
if index = newIndex
return
end if
checkedState = m.checkList.checkedState
node = content.getChild(index)
content.insertChild(node, newIndex)
tmp = checkedState[index]
checkedState[index] = checkedState[newIndex]
checkedState[newIndex] = tmp
m.checkList.itemFocused = newIndex
m.checkList.jumpToItem = newIndex
m.checkList.checkedState = checkedState
end function
function OnSaveButtonSelected()
' Save the new layout to m.top.value
OnCheckedStateChange()
m.top.save = true
Close()
end function
function Close()
m.appController@.PopScreen()
end function
@@ -0,0 +1,53 @@
<component name="HomeScreenEditor" extends="Group" includes="AutoBind,Focus">
<interface>
<field id="value" type="array" onChange="OnValueChange" />
<field id="save" type="boolean" alwaysNotify="true" />
<field id="appController" type="node" bind="/AppController" />
</interface>
<children>
<Rectangle
width="1280"
height="720"
color="#000000"
opacity="0.5">
</Rectangle>
<Rectangle
width="960"
height="600"
translation="[160,60]"
color="#242424">
<CheckList
id="checkList"
vertFocusAnimationStyle="floatingFocus"
translation="[164,70]">
<ContentNode role="content" />
</CheckList>
<Button
id="moveUpButton"
text="Move up"
showFocusFootprint="true"
minWidth="220"
translation="[640,183]" />
<Button
id="moveDownButton"
text="Move down"
showFocusFootprint="true"
minWidth="220"
translation="[640,273]" />
<Button
id="closeButton"
text="Close"
showFocusFootprint="true"
minWidth="150"
translation="[500,500]" />
<Button
id="saveButton"
text="Save"
showFocusFootprint="true"
minWidth="150"
translation="[320,500]" />
</Rectangle>
</children>
</component>
@@ -1,3 +1,4 @@
import "pkg:/components/parts/AutoBind/OnNodeReadyNoOp.bs"
import "pkg:/source/utils/FocusManagement.bs"
import "pkg:/source/utils/Types.bs"
@@ -54,7 +55,7 @@ end function
function OpenInvidiousInstanceSettings()
settings = CreateObject("roSGNode", "InvidiousInstanceSettings")
m.appController@.PushScreen(settings)
settings@.BindNode(invalid)
settings@.BindNode()
settings.text = m.top.value
settings.observeField("save", FuncName(OnSaveInvidiousInstance))
end function
@@ -1,4 +1,6 @@
import "pkg:/components/Dialog/DialogPalette.bs"
import "pkg:/components/Navigation/Navigation.bs"
import "pkg:/components/parts/AutoBind/OnNodeReadyNoOp.bs"
import "pkg:/components/Services/Invidious/InvidiousService.bs"
import "pkg:/source/utils/Types.bs"
@@ -70,13 +72,14 @@ end function
function OnTestButtonSelected()
testing = CreateObject("roSGNode", "InvidiousInstanceTesting")
m.appController@.PushScreen(testing)
testing@.BindNode(invalid)
testing@.BindNode()
testing.instance = m.top.text
testing.run = true
end function
function OnEditButtonSelected()
keyboardDialog = createObject("roSGNode", "StandardKeyboardDialog")
SetPalette(keyboardDialog)
keyboardDialog.title = "Edit Instance"
keyboardDialog.message = [`Enter the instance url (e.g. ${Invidious.DEFAULT_INSTANCE})`]
keyboardDialog.text = m.top.text
@@ -103,5 +106,5 @@ function OnSaveButtonSelected()
end function
function Close()
m.appController@.PopScreen(invalid)
m.appController@.PopScreen()
end function
@@ -1,8 +1,10 @@
import "pkg:/components/Dialog/DialogUtils.bs"
import "pkg:/components/Navigation/Navigation.bs"
import "pkg:/components/Screens/SettingsScreen/InvidiousInstance/InvidiousInstanceTesting/InvidiousInstanceTestingTask.bs"
import "pkg:/source/asyncTask/asyncTask.bs"
import "pkg:/components/parts/AutoBind/OnNodeReadyNoOp.bs"
import "pkg:/source/AsyncTask/AsyncTask.bs"
import "pkg:/source/AsyncTask/Tasks.bs"
import "pkg:/source/utils/FocusManagement.bs"
import "pkg:/source/utils/StringUtils.bs"
import "pkg:/source/utils/Types.bs"
function Init()
@@ -47,7 +49,7 @@ function Close()
m.testingTask.cancel = true
end if
m.appController@.PopScreen(invalid)
m.appController@.PopScreen()
end function
function RunTestsTask()
@@ -57,8 +59,8 @@ function RunTestsTask()
m.testingTask.cancel = true
end if
m.testingTask = StartAsyncTask(InvidiousInstanceTestingTask, {
instance: m.top.instance,
m.testingTask = AsyncTask.Start(Tasks.InvidiousInstanceTestingTask, {
instance: m.top.instance
listNode: m.testList
})
end function
@@ -1,4 +1,5 @@
import "pkg:/components/Services/Invidious/InvidiousService.bs"
import "pkg:/components/Services/Invidious/InvidiousToContentNode.bs"
import "pkg:/source/services/HttpClient.bs"
import "pkg:/source/utils/ErrorUtils.bs"
import "pkg:/source/utils/StringUtils.bs"
@@ -29,6 +30,7 @@ function PrepareTests() as object
content.AppendChild(CreateTestNode("Fetch video details", CanFetchVideoDetails))
content.AppendChild(CreateTestNode("Fetch video comments", CanFetchVideoComments))
content.AppendChild(CreateTestNode("Fetch video captions", CanFetchVideoCaptions))
content.AppendChild(CreateTestNode("Fetch video thumbnails", CanFetchVideoThumbails))
return content
end function
@@ -36,9 +38,9 @@ function CreateTestNode(title as string, func as function) as object
testNode = CreateObject("roSGNode", "ContentNode")
testNode.title = title
testNode.AddFields({
func: FuncName(func),
state: "loading",
details: "",
func: FuncName(func)
state: "loading"
details: ""
duration: 0
})
m[testNode.func] = func
@@ -251,3 +253,61 @@ function CanFetchVideoCaptions(instance as string, testNode as object) as void
testNode.details = ErrorUtils.Format(e)
end try
end function
function CanFetchVideoThumbails(instance as string, testNode as object) as void
try
videoId = "jNQXAC9IVRw"
url = `${instance}${Invidious.VIDEOS_ENDPOINT}/${videoId}`
response = HttpClient.Get(url).NoCache().Await()
if not response.IsSuccess()
testNode.state = "failed"
testNode.details = response.ErrorMessage()
return
end if
json = response.Json()
if json = invalid
testNode.state = "failed"
testNode.details = `Invalid json from ${url}`
return
end if
videoThumbnails = json.videoThumbnails
if not IsArray(videoThumbnails) or videoThumbnails.Count() = 0
testNode.state = "failed"
testNode.details = `No thumbnails found in json from ${url}`
return
end if
contentNode = InvidiousContent.ToVideoContentNode(invalid, json, instance)
thumbnail = contentNode.thumbnail
if StringUtils.IsNullOrEmpty(thumbnail)
testNode.state = "failed"
testNode.details = `No thumbnail found in json from ${url}`
return
end if
' Note: we could do a HEAD request, but Invidious returns 200 even for invalid thumbnails
' To make sure we don't get a 200 for an invalid thumbnail, we do a GET request instead
response = HttpClient.Get(thumbnail).NoCache().Await()
if not response.IsSuccess()
testNode.state = "failed"
testNode.details = `${thumbnail} is not reachable\n${response.ErrorMessage(false)}`
return
end if
contentType = response.Headers()["Content-Type"]
if StringUtils.IsNullOrEmpty(contentType) or not contentType.StartsWith("image/")
testNode.state = "failed"
testNode.details = `Invalid thumbnail data ${thumbnail} (Content-Type is not image/*)`
return
end if
testNode.state = "passed"
testNode.details = `The instance can fetch video thumbnail for id "${videoId}" (${thumbnail})`
catch e
testNode.state = "failed"
testNode.details = ErrorUtils.Format(e)
end try
end function
@@ -1,6 +1,6 @@
import "pkg:/components/Dialog/DialogUtils.bs"
import "pkg:/components/Screens/SettingsScreen/InvidiousInstance/InvidiousPublicInstances/InvidiousPublicInstancesTask.bs"
import "pkg:/source/asyncTask/asyncTask.bs"
import "pkg:/source/AsyncTask/AsyncTask.bs"
import "pkg:/source/AsyncTask/Tasks.bs"
import "pkg:/source/utils/ErrorUtils.bs"
import "pkg:/source/utils/FocusManagement.bs"
import "pkg:/source/utils/Logging.bs"
@@ -43,7 +43,7 @@ function Refresh()
m.invidiousPublicInstancesTask.cancel = true
end if
m.invidiousPublicInstancesTask = StartAsyncTask(InvidiousPublicInstancesTask, {
m.invidiousPublicInstancesTask = AsyncTask.Start(Tasks.InvidiousPublicInstancesTask, {
listNode: m.instances
}, OnInvidiousPublicInstancesTaskResults)
@@ -12,7 +12,7 @@
translation="[190,60]" />
<Button
id="refreshButton"
minWidth="0"
minWidth="180"
text="Refresh"
translation="[340,130]" />
Loaded 100 of 272 files, more files were not shown because too many files have changed in this diff. Show more