Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0d1da36e28 | ||
|
|
c61c8aecc6 | ||
|
|
7a63b26c73 | ||
|
|
0d949b1752 | ||
|
|
33518607c5 | ||
|
|
8a47c02179 | ||
|
|
a1251c065d | ||
|
|
8882e3a03e | ||
|
|
3206d6a632 | ||
|
|
b49a2ee05a | ||
|
|
963b44c8c8 | ||
|
|
f3e60c639f | ||
|
|
c216714c5b | ||
|
|
460ae9a392 | ||
|
|
88c09618ce | ||
|
|
f858d3a848 | ||
|
|
079f93bddb | ||
|
|
0afd5964d4 | ||
|
|
9c76a468aa | ||
|
|
edfb388b9e | ||
|
|
5b07f031be | ||
|
|
d403b4902c | ||
|
|
112bad5d42 | ||
|
|
388cad36be | ||
|
|
091da296c4 | ||
|
|
621eb8245f | ||
|
|
29c78f6012 | ||
|
|
19f8b5221b | ||
|
|
88673c21fe | ||
|
|
051e94fff3 | ||
|
|
ddf16f01d5 | ||
|
|
97dda3e796 | ||
|
|
bc8a707a2d | ||
|
|
28cc6ea501 | ||
|
|
0c4d3fbb60 | ||
|
|
247d64ed82 | ||
|
|
568ff8824f | ||
|
|
3af6573779 | ||
|
|
79a8219883 | ||
|
|
24a12ea68d | ||
|
|
be33ecc2a4 | ||
|
|
72a55b5414 | ||
|
|
a1c9ae8884 | ||
|
|
292f15d3a9 | ||
|
|
5b1a108e61 | ||
|
|
2bc83ab796 | ||
|
|
9248b19db5 | ||
|
|
3a4feb9533 | ||
|
|
b9d9b8f8ca | ||
|
|
8eb300a1a0 | ||
|
|
06d357ad5c | ||
|
|
5fcd576fc7 | ||
|
|
0da51937f7 | ||
|
|
ee58858510 | ||
|
|
451669f4dd | ||
|
|
cb4b25b696 | ||
|
|
daaa2974b8 | ||
|
|
aae403b638 | ||
|
|
e82d7c380f | ||
|
|
74acd1edbc | ||
|
|
022e5aa10c | ||
|
|
a8e5c7cd81 | ||
|
|
573c8bf53d | ||
|
|
54b3b277dc | ||
|
|
87f355ab85 | ||
|
|
80627f3d13 | ||
|
|
03bb19522d | ||
|
|
75d92d3800 | ||
|
|
974ff39c09 | ||
|
|
15ba5f1704 | ||
|
|
3982909801 | ||
|
|
85b5c615b9 | ||
|
|
3227bf38b4 | ||
|
|
ba2fbaa0da | ||
|
|
c12436f464 | ||
|
|
e029d24061 | ||
|
|
ff663b6787 | ||
|
|
5acfe91944 | ||
|
|
7d217e49de | ||
|
|
a67080be61 | ||
|
|
21128d525d | ||
|
|
305905328d | ||
|
|
2e9594274e | ||
|
|
091d5d3c45 | ||
|
|
3a5cf0d3d7 | ||
|
|
ace3c6009a | ||
|
|
807c528086 | ||
|
|
2c22e97dbe | ||
|
|
840866ce06 | ||
|
|
007607e21c | ||
|
|
b4a4a688ca | ||
|
|
688206ef91 | ||
|
|
3acc1bf9c9 | ||
|
|
21b1a9ea81 | ||
|
|
3f252a9b11 | ||
|
|
c5146017a8 | ||
|
|
7f58809737 | ||
|
|
6748390ac4 | ||
|
|
d2fac255ed | ||
|
|
dbcfc46dad | ||
|
|
671719905b | ||
|
|
5417f5d61d | ||
|
|
ee0abc9891 | ||
|
|
bb7407f75f | ||
|
|
b101872906 | ||
|
|
8f42bfa675 | ||
|
|
b8d2008b98 | ||
|
|
36910ab5cf | ||
|
|
ae09f711df | ||
|
|
6401a93420 | ||
|
|
3039c00fdb | ||
|
|
8010765c8e | ||
|
|
62f96dea5e | ||
|
|
15a0177083 | ||
|
|
9f83391e37 | ||
|
|
f742826b8d | ||
|
|
763d7e1309 | ||
|
|
9ae59a1bd7 | ||
|
|
ae64f73c67 | ||
|
|
8329fef6c1 | ||
|
|
0c5aa6895a | ||
|
|
6a770b90b4 | ||
|
|
08a71b3699 | ||
|
|
9c50e5aa36 | ||
|
|
aa20fce137 | ||
|
|
4fc7d54a73 | ||
|
|
7ea8bf70b2 | ||
|
|
8f6bdb27ab | ||
|
|
0487916c7b | ||
|
|
73090f53de | ||
|
|
6ac29a5bbb | ||
|
|
1047a7882a | ||
|
|
09a6585618 | ||
|
|
612615e8ae | ||
|
|
3e66a800b4 | ||
|
|
7f2c5157e5 | ||
|
|
b42289125e | ||
|
|
7b674a610d | ||
|
|
3e410f9e0c | ||
|
|
53cb974446 | ||
|
|
55e65c42a6 | ||
|
|
e389772e87 | ||
|
|
302125b097 | ||
|
|
dbd6b17b03 | ||
|
|
9aa8bc4031 | ||
|
|
232af471f4 | ||
|
|
f9844d9d4d | ||
|
|
fb811a6240 | ||
|
|
daf7966f4b | ||
|
|
4363c068d6 | ||
|
|
714147a477 | ||
|
|
f505d01785 | ||
|
|
5f5b0bb8fd | ||
|
|
f5e715a782 | ||
|
|
edb9ae1135 | ||
|
|
d0e7a01512 | ||
|
|
777a5b7311 | ||
|
|
8a458fb38b | ||
|
|
47a7ea21e6 | ||
|
|
c9a0e96905 | ||
|
|
087c1c011a | ||
|
|
a9219f0ef9 | ||
|
|
ce43e5fca5 | ||
|
|
0ddd3cf0e2 | ||
|
|
e1c8b5284f | ||
|
|
62d66eb1f3 | ||
|
|
aa7888d994 | ||
|
|
8a88c281f4 | ||
|
|
b869275b2f | ||
|
|
2947188655 | ||
|
|
b0feb7b1b8 | ||
|
|
6e97cc5d9e | ||
|
|
d77d00a4eb | ||
|
|
afc3f66dda | ||
|
|
63cf9a5e56 | ||
|
|
f0d516d194 | ||
|
|
53f9f5140f | ||
|
|
c549dfe87e | ||
|
|
3a7472de19 | ||
|
|
aaece33083 | ||
|
|
5fc059f700 | ||
|
|
26285535ac | ||
|
|
140aebc1d5 | ||
|
|
9275a140ef | ||
|
|
a81063587f | ||
|
|
d271a168e4 | ||
|
|
bf77a583ca | ||
|
|
760b3f5c0b | ||
|
|
adcba1dbb4 | ||
|
|
37963ae41e | ||
|
|
84dc160db1 | ||
|
|
35b8657024 | ||
|
|
eb6e410a8f | ||
|
|
0c79787161 | ||
|
|
207f96c882 | ||
|
|
964e8a54ac | ||
|
|
30cc2b5323 | ||
|
|
6dc87ee374 | ||
|
|
2aa019a383 | ||
|
|
56af27bfb0 | ||
|
|
0cbf095352 | ||
|
|
f105494afe | ||
|
|
d9147e46dc | ||
|
|
48b0efc713 | ||
|
|
b29678ff15 | ||
|
|
34adf51ebb | ||
|
|
b657664546 | ||
|
|
92789b0566 | ||
|
|
0bed5598f4 | ||
|
|
5a2e8b1f4a | ||
|
|
4c90ce5953 | ||
|
|
31db879961 | ||
|
|
f5ceac4e09 | ||
|
|
694cb78947 | ||
|
|
72bf86f376 | ||
|
|
e204a027fe | ||
|
|
1797486279 | ||
|
|
3a0ab2fc48 | ||
|
|
5c66b91fe9 | ||
|
|
54a99935c7 | ||
|
|
f16681adeb | ||
|
|
638ce18aa8 | ||
|
|
9119438dc9 | ||
|
|
2b58c865e4 | ||
|
|
e356c82f0d | ||
|
|
7518831b65 | ||
|
|
f29f0b3654 | ||
|
|
b7c2bfc403 | ||
|
|
04a1c9a9c4 | ||
|
|
0250fe8f01 | ||
|
|
84304cd26e | ||
|
|
64cad65e1a | ||
|
|
933d425a19 | ||
|
|
fd42b65a75 | ||
|
|
1b07e599e7 | ||
|
|
3bc25cc2d1 | ||
|
|
7f8cdeb351 | ||
|
|
674ec708e7 | ||
|
|
b368b40721 | ||
|
|
10f9d1bf05 | ||
|
|
51b2f7793a | ||
|
|
3d6678fb72 | ||
|
|
75e6848df8 | ||
|
|
c70d00e156 | ||
|
|
19f304bd3e | ||
|
|
45a85f92b3 | ||
|
|
2a83b97a7c | ||
|
|
82dea9af37 | ||
|
|
9ef741292e | ||
|
|
8f8a8980df | ||
|
|
9f5efb0ba7 | ||
|
|
115b457241 | ||
|
|
673d6b3602 | ||
|
|
178fe4e25b | ||
|
|
626935d302 | ||
|
|
501ee5178b | ||
|
|
965ac9dfce | ||
|
|
9dbc0a7e66 | ||
|
|
db2bdd7112 | ||
|
|
7e11a056f9 | ||
|
|
08c16a9830 | ||
|
|
aaef0352cb | ||
|
|
5ea6e11345 | ||
|
|
141c80c618 | ||
|
|
5e26deea77 | ||
|
|
5884021e72 | ||
|
|
d8417ee90c | ||
|
|
63f8ba8617 | ||
|
|
a49f7e8d99 | ||
|
|
4926c3df5b | ||
|
|
c4fe623d17 | ||
|
|
d115c2ad62 | ||
|
|
8d74cb6e52 | ||
|
|
56872bfd8a | ||
|
|
e3c0c026f9 | ||
|
|
9d7b792f42 | ||
|
|
2fa06604a7 | ||
|
|
b1e64427dd | ||
|
|
a10f3df298 | ||
|
|
d70a07049a | ||
|
|
45983a67af | ||
|
|
03bb5ef3d5 | ||
|
|
3ca87dc1d4 | ||
|
|
13cd469400 | ||
|
|
c66f1376a1 | ||
|
|
840474c20c | ||
|
|
6095901939 | ||
|
|
04ed2f82c0 | ||
|
|
932a629793 | ||
|
|
0fb3759c50 | ||
|
|
7b4306914d | ||
|
|
fb2ac53ab6 | ||
|
|
fd00c7bb11 | ||
|
|
a244cdee05 | ||
|
|
8e71ededd2 | ||
|
|
8051458df7 | ||
|
|
4dae928a03 | ||
|
|
d054dd64a5 | ||
|
|
68aeec3d6f | ||
|
|
fc2ffd8c23 | ||
|
|
4906b69f4a | ||
|
|
2c513afafd | ||
|
|
8e156b27f9 | ||
|
|
58e2b48409 | ||
|
|
06326d084e | ||
|
|
0b5bed45cf | ||
|
|
957ac66d70 | ||
|
|
03679b781c | ||
|
|
002307c45b | ||
|
|
fcfda78f2c | ||
|
|
384f41ba99 | ||
|
|
e070fc2df1 | ||
|
|
51d63d2019 | ||
|
|
1eeaced04b | ||
|
|
891a5f8405 | ||
|
|
7ab98024c1 | ||
|
|
c2b6b75f94 | ||
|
|
2e09239123 | ||
|
|
fcae05a0da | ||
|
|
0bc5ab6117 | ||
|
|
cfd6bc8ec8 | ||
|
|
47896ae9dc | ||
|
|
9e3da6b67d | ||
|
|
4c94db2c03 | ||
|
|
8ff4847977 | ||
|
|
65a4a855a1 | ||
|
|
40e7014e55 | ||
|
|
d5f74d41c0 | ||
|
|
91081e09d5 | ||
|
|
e7fbe5c189 | ||
|
|
0151f4c81c | ||
|
|
e28c92c3d4 | ||
|
|
4676b45567 | ||
|
|
438050fcca | ||
|
|
70e2608e59 | ||
|
|
d2d875f124 | ||
|
|
6a1069337d | ||
|
|
eb67d9e4c0 | ||
|
|
6d9117a2a0 |
No files matched your search
@@ -24,10 +24,10 @@ jobs:
|
|||||||
git config --local user.email "githubaction@githubaction.com"
|
git config --local user.email "githubaction@githubaction.com"
|
||||||
git config --local user.name "github-action linter"
|
git config --local user.name "github-action linter"
|
||||||
|
|
||||||
- name: Use Node.js 20.x
|
- name: Use Node.js 22.x
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: 20.x
|
node-version: 22.x
|
||||||
cache: "npm"
|
cache: "npm"
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
|
|||||||
@@ -19,10 +19,10 @@ jobs:
|
|||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Use Node.js 20.x
|
- name: Use Node.js 22.x
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: 20.x
|
node-version: 22.x
|
||||||
cache: "npm"
|
cache: "npm"
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
|
|||||||
@@ -17,10 +17,10 @@ jobs:
|
|||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Use Node.js 20.x
|
- name: Use Node.js 22.x
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: 20.x
|
node-version: 22.x
|
||||||
cache: "npm"
|
cache: "npm"
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
|
|||||||
@@ -24,10 +24,10 @@ jobs:
|
|||||||
git config --local user.name "github-action wiki updater"
|
git config --local user.name "github-action wiki updater"
|
||||||
working-directory: ./playlet.wiki
|
working-directory: ./playlet.wiki
|
||||||
|
|
||||||
- name: Use Node.js 20.x
|
- name: Use Node.js 22.x
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: 20.x
|
node-version: 22.x
|
||||||
cache: "npm"
|
cache: "npm"
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
|
|||||||
@@ -12,10 +12,10 @@ jobs:
|
|||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Use Node.js 20.x
|
- name: Use Node.js 22.x
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: 20.x
|
node-version: 22.x
|
||||||
cache: "npm"
|
cache: "npm"
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
|
|||||||
@@ -8,3 +8,4 @@ node_modules
|
|||||||
playlet-lib/src/www
|
playlet-lib/src/www
|
||||||
playlet-app/src/lib/playlet-lib.zip
|
playlet-app/src/lib/playlet-lib.zip
|
||||||
release/
|
release/
|
||||||
|
playlet-web/stats.html
|
||||||
@@ -4,6 +4,7 @@
|
|||||||
},
|
},
|
||||||
"brightscript.output.clearConsoleOnChannelStart": false,
|
"brightscript.output.clearConsoleOnChannelStart": false,
|
||||||
"brightscript.bsdk": "node_modules/brighterscript",
|
"brightscript.bsdk": "node_modules/brighterscript",
|
||||||
|
"brightscript.format.sortImports": true,
|
||||||
"editor.formatOnSave": true,
|
"editor.formatOnSave": true,
|
||||||
"xml.format.maxLineWidth": 0,
|
"xml.format.maxLineWidth": 0,
|
||||||
"svelte.enable-ts-plugin": true,
|
"svelte.enable-ts-plugin": true,
|
||||||
|
|||||||
@@ -5,6 +5,403 @@ 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.1.0/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [0.43.2] - 2025-10-29
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Crash on older Roku OS version due to `roByteArray.Slice` not being available
|
||||||
|
|
||||||
|
## [0.43.1] - 2025-10-28
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Support for additional nodes parsing
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Trickplay storyboards on DRM videos
|
||||||
|
|
||||||
|
## [0.43.0] - 2025-10-26
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Support for DRM protected content (free with ads / purchased content)
|
||||||
|
- Only supported on Playlet backend (must be selected in settings)
|
||||||
|
- Must be logged in using a YouTube account (otherwise you would get a "Login to confirm your age" error)
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Build scripts and tools on windows
|
||||||
|
|
||||||
|
## [0.42.5] - 2025-10-21
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Crash when trying to display error messages with very long text
|
||||||
|
|
||||||
|
## [0.42.4] - 2025-10-17
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- German translations
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- A bug where title and duration of songs were missing an an album playlist
|
||||||
|
- Error when loading trending videos by retrying to load the feed
|
||||||
|
- Note: trending is removed from web and tv clients, they are being phased out.
|
||||||
|
|
||||||
|
## [0.42.3] - 2025-10-12
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Crash when logging early startup warnings
|
||||||
|
|
||||||
|
## [0.42.2] - 2025-10-09
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- A bug when invalidating tokens
|
||||||
|
- Issue with auto-generated subtitles aligned to the left by using TTML captions
|
||||||
|
- Crash when telemetry thread turned off and then back on
|
||||||
|
|
||||||
|
## [0.42.1] - 2025-10-04
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Bug: credentialTransferTokens should only be used with TV clients
|
||||||
|
- [Perf] reduce memory usage by freeing playlist videos when playlist view is closed
|
||||||
|
|
||||||
|
## [0.42.0] - 2025-09-30
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Support for different languages in the search keyboard
|
||||||
|
- Initial list: English, Deutsch, Español, Français, Português and Русский
|
||||||
|
- [More can be added later](https://github.com/iBicha/playlet/issues/362#issuecomment-3352455559).
|
||||||
|
|
||||||
|
## [0.41.21] - 2025-09-28
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Dash generation bug
|
||||||
|
- Track login errors and drm errors better
|
||||||
|
|
||||||
|
## [0.41.20] - 2025-09-21
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Capturing diagnostic events related to playback errors to further investigate
|
||||||
|
|
||||||
|
## [0.41.19] - 2025-09-21
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Capturing diagnostic events related to playback errors to further investigate
|
||||||
|
|
||||||
|
## [0.41.18] - 2025-09-20
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Various fixes and improvements
|
||||||
|
- Crash due to bad type casting
|
||||||
|
|
||||||
|
## [0.41.17] - 2025-09-19
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Various fixes and improvements
|
||||||
|
|
||||||
|
## [0.41.16] - 2025-09-19
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Various fixes and improvements
|
||||||
|
|
||||||
|
## [0.41.15] - 2025-09-19
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Rare crash when loading video feed
|
||||||
|
- Improve session data error handling
|
||||||
|
|
||||||
|
## [0.41.14] - 2025-09-18
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Try fetching multiple pages in the search, in case results are filtered out (e.g. shorts)
|
||||||
|
- Regression for `Attempt to play the next video when errors occur`
|
||||||
|
- Better handling for lounge lost sessions
|
||||||
|
|
||||||
|
## [0.41.13] - 2025-09-18
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Issue with `credentialTransferToken`s which caused "Login to confirm you're not a bot" even when logged in
|
||||||
|
- Adjust live video detection to reduce error rate happening on iOS client (another attempt)
|
||||||
|
- Attempt to play the next video when errors occur
|
||||||
|
- Remove manual video cache for Invidious to avoid stale streams
|
||||||
|
|
||||||
|
## [0.41.12] - 2025-09-17
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Fallback to 360p when dash streams are missing
|
||||||
|
|
||||||
|
## [0.41.11] - 2025-09-17
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Small fixes related to events
|
||||||
|
|
||||||
|
## [0.41.10] - 2025-09-16
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Disabled event batching
|
||||||
|
|
||||||
|
## [0.41.9] - 2025-09-16
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- "Open In YouTube" button in web app cast dialog
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Bug in dash storyboard
|
||||||
|
- Adjust live video detection to reduce error rate happening on iOS client
|
||||||
|
- Bug when parsing headers in telemetry
|
||||||
|
- Web app fixes and dependency updates
|
||||||
|
- Bug when casting a mix from web app
|
||||||
|
|
||||||
|
## [0.41.8] - 2025-09-07
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Bug in dash generation
|
||||||
|
- Bug in http server
|
||||||
|
|
||||||
|
## [0.41.7] - 2025-09-06
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Playback error when playing post live dvr videos
|
||||||
|
|
||||||
|
## [0.41.6] - 2025-09-06
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Various fixes and improvements
|
||||||
|
|
||||||
|
## [0.41.5] - 2025-09-05
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Various telemetry issues
|
||||||
|
|
||||||
|
## [0.41.4] - 2025-09-04
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Small improvements in parser
|
||||||
|
- Try force refresh visitor data when it fails
|
||||||
|
- Rate limit syslog errors
|
||||||
|
|
||||||
|
## [0.41.3] - 2025-09-03
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- A bug when generating dash manifest with missing stream url
|
||||||
|
- Invidious redirect fix in webapp
|
||||||
|
|
||||||
|
## [0.41.2] - 2025-09-03
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Various telemetry issues
|
||||||
|
- Ignore certain nodes in parser (such as movies, since they are not supported)
|
||||||
|
- A bug where video title is missing while loading
|
||||||
|
- A bug where loading a bookmarked playlist would fail
|
||||||
|
- Error playing videos when Invidious backend is selected, always proxy, but no instance provided
|
||||||
|
|
||||||
|
## [0.41.1] - 2025-08-29
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Reduce event count
|
||||||
|
|
||||||
|
## [0.41.0] - 2025-08-29
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Telemetry to collect anonymous diagnostics data. Can be turned off from the settings.
|
||||||
|
|
||||||
|
## [0.40.15] - 2025-08-28
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Shorts being merged with subscription videos, regardless of "Disable Shorts" preference.
|
||||||
|
- Gracefully handle STS_MISMATCH errors
|
||||||
|
|
||||||
|
## [0.40.14] - 2025-08-22
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Error loading feed when device language is Australian English (`en_AU`)
|
||||||
|
|
||||||
|
## [0.40.13] - 2025-08-19
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- A bug with playback when backend is set to "Invidious" but not instance is specified
|
||||||
|
|
||||||
|
## [0.40.12] - 2025-08-18
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Attempt to fix `no valid bitrates` and `Sign in to confirm you're not a bot` errors.
|
||||||
|
- Introduced a "Playlet support server" to allow handling sig/nsig decoding. These are not possible to do without a Javascript execution environment, so this was necessary.
|
||||||
|
- Live videos are not affected by this fix yet, but hopefully it reduce the amount of errors.
|
||||||
|
- Videos longer than 5 hours now work [https://github.com/iBicha/playlet/issues/500](https://github.com/iBicha/playlet/issues/500)
|
||||||
|
- Age restricted videos should play normally if logged in using a YouTube account.
|
||||||
|
|
||||||
|
## [0.40.10] - 2025-07-19
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- An option to export Playlet's state from the web app for easier debugging.
|
||||||
|
- This is a zip file that contains logs, the app state, and the registry (local storage)
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Generate a PoToken per video in the web app when using ytjs
|
||||||
|
|
||||||
|
## [0.40.9] - 2025-07-06
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- A bug preventing the removal of bookmarked private playlists
|
||||||
|
- [perf] Reduce number of rendezvous when reading invidious instance name
|
||||||
|
- Also fixes an edge case error when device loses connectivity
|
||||||
|
|
||||||
|
## [0.40.8] - 2025-06-22
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Invidious tests - `Me at the zoo` video was getting blocked
|
||||||
|
- Bug where logging out from inactive profile is not properly persisted
|
||||||
|
- Memory leak in MarkVideoWatchedTask
|
||||||
|
|
||||||
|
### Removed
|
||||||
|
|
||||||
|
- "Use dev video player" option from the settings
|
||||||
|
- `@asynctask` in favor of newer job system
|
||||||
|
|
||||||
|
## [0.40.7] - 2025-06-21
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Revert "Use iOS user agent in player"
|
||||||
|
|
||||||
|
## [0.40.6] - 2025-06-21
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Improve performance of video bookmarks, by avoiding `/player` endpoint and caching results
|
||||||
|
- Github link to create new issue not working in web app due to url being too long
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Added instructions to use web app as a workaround to current errors
|
||||||
|
|
||||||
|
## [0.40.5] - 2025-06-19
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- [perf] Added a job system to control background tasks.
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Issue with deep linking not working due to session data race condition
|
||||||
|
- A bug where playlists will not load the second page when not logged in
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Session data duration: increased to 14 days, to avoid Innertube errors
|
||||||
|
- Use iOS user agent in player
|
||||||
|
|
||||||
|
## [0.40.4] - 2025-06-17
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Few changes preparing for app store submission
|
||||||
|
|
||||||
|
## [0.40.3] - 2025-06-16
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Added a "hint" in the error message when playing a video and login is required.
|
||||||
|
- Various performance improvements
|
||||||
|
|
||||||
|
## [0.40.2] - 2025-06-12
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Channel sort options in Playlet backend (sort videos by Newest, Oldest, Popular)
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- [Perf] reverted a perf fix that wasn't helping
|
||||||
|
- A bug where "Open channel" didn't show up in videos and playlists from logged user
|
||||||
|
|
||||||
|
## [0.40.1] - 2025-06-07
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- A way to play longer videos using the web app (Play using ytjs)
|
||||||
|
- German translations
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- A bug where it says "(Failed to load)" when switching profiles
|
||||||
|
- A bug where searching in web app using iOS causes page to reload
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Session data duration: increased to 7 days, to avoid Innertube errors
|
||||||
|
|
||||||
|
## [0.40.0] - 2025-06-01
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- German translations
|
||||||
|
- Support for multi-accounts, such as brand accounts
|
||||||
|
- Support for manual skip in SponsorBlock
|
||||||
|
- Customize SponsorBlock categories from the settings
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Show videos watch progress in playlist view
|
||||||
|
- Missing localization in certain views
|
||||||
|
|
||||||
|
## [0.39.1] - 2025-05-23
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Regression with watch progress introduced in previous release
|
||||||
|
|
||||||
|
## [0.39.0] - 2025-05-23
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- New settings category: `Content Feed`
|
||||||
|
- New setting: `Disable Shorts`
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- A regression with thumbnails not showing from previous release
|
||||||
|
- Inability to login to Invidious when selected backend is Playlet (local)
|
||||||
|
|
||||||
## [0.38.2] - 2025-05-22
|
## [0.38.2] - 2025-05-22
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
@@ -736,7 +1133,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
|
|
||||||
- Xmas theme logo - can't publish it before end of year... ([link](https://blog.roku.com/developer/channel-store-blackouts-2023))
|
- Xmas theme logo - can't publish it before end of year... ([channel-store-blackouts-2023](https://blog.roku.com/developer/channel-store-blackouts-2023))
|
||||||
|
|
||||||
## [0.17.3] - 2023-12-13
|
## [0.17.3] - 2023-12-13
|
||||||
|
|
||||||
|
|||||||
@@ -2,11 +2,12 @@
|
|||||||
|
|
||||||
## Playlet
|
## Playlet
|
||||||
|
|
||||||
Playlet, the Roku app, does not collect any user information whatsoever.
|
Playlet, the Roku app, does not collect any user personal information whatsoever.
|
||||||
In fact, it does not have any servers capable of collecting any form of data.
|
|
||||||
|
|
||||||
Playlet does not show advertising, whether personalized or non personalized.
|
Playlet does not show advertising, whether personalized or non personalized.
|
||||||
|
|
||||||
|
Playlet may integrate with 3rd party telemetry services in order to capture anonymous diagnostics data. The only purpose of this data is to diagnose issues and improve the app.
|
||||||
|
|
||||||
## Invidious
|
## Invidious
|
||||||
|
|
||||||
Playlet may request information from one or more [Invidious](https://invidious.io/)
|
Playlet may request information from one or more [Invidious](https://invidious.io/)
|
||||||
@@ -16,7 +17,7 @@ is sent, which is used to enable the viewing of content.
|
|||||||
|
|
||||||
Please note that some of the [Invidious](https://invidious.io/) servers used
|
Please note that some of the [Invidious](https://invidious.io/) servers used
|
||||||
could be public instances hosted by volenteers. These instances are available
|
could be public instances hosted by volenteers. These instances are available
|
||||||
[here](https://api.invidious.io/).
|
at [api.invidious.io](https://api.invidious.io/).
|
||||||
|
|
||||||
While invidious does no data collection by default, and it is in fact built to
|
While invidious does no data collection by default, and it is in fact built to
|
||||||
be privacy driven, but in theory, from a Playlet request it is possible to
|
be privacy driven, but in theory, from a Playlet request it is possible to
|
||||||
|
|||||||
@@ -48,8 +48,8 @@ Can't install from the store? See [How to install Playlet as a sideloaded/dev ap
|
|||||||
|
|
||||||
- 🔥 No Ads (Not now, not ever)
|
- 🔥 No Ads (Not now, not ever)
|
||||||
- 🕵️ No Tracking
|
- 🕵️ No Tracking
|
||||||
- 🛡️ Privacy driven (uses [Invidious](https://invidious.io/) backend)
|
- 🛡️ Privacy driven (supports [Invidious](https://invidious.io/) backend)
|
||||||
- 🙋 User accounts (YouTube and Invidious accounts)
|
- 🙋 User accounts (supports YouTube and Invidious accounts)
|
||||||
- ⚔️ [SponsorBlock](https://sponsor.ajay.app/) integration (skips undesirable sections in videos)
|
- ⚔️ [SponsorBlock](https://sponsor.ajay.app/) integration (skips undesirable sections in videos)
|
||||||
- 📱 Browse, search, and cast from phone using the YouTube app or the browser
|
- 📱 Browse, search, and cast from phone using the YouTube app or the browser
|
||||||
- 🔮 Picture-in-picture mode
|
- 🔮 Picture-in-picture mode
|
||||||
@@ -83,13 +83,12 @@ Can't install from the store? See [How to install Playlet as a sideloaded/dev ap
|
|||||||
|
|
||||||
For everything related to Playlet app development, please see the [documentation](./docs/README.md)
|
For everything related to Playlet app development, please see the [documentation](./docs/README.md)
|
||||||
|
|
||||||
## Analytics and reporting
|
## Analytics and telemetry
|
||||||
|
|
||||||
We do not collect any usage data, anonymous or not. But Roku does, and you can find the data made available to Playlet in the [Wiki](https://github.com/iBicha/playlet/wiki).
|
Roku collects usage data, and you can find the data made available to Playlet in the [Wiki](https://github.com/iBicha/playlet/wiki).
|
||||||
Most software in the wild collect some data to make sure things work, and to prioritize features.
|
Playlet could run on variaty of devices, with different capabilities and screen sizes, and different Invidious instances, in addition to the experimentation YouTube does based on account and/or ip.
|
||||||
Because we don't do that, we wouldn't know if people using Playlet are facing issues, unless these issues get reported.
|
This is why it was necessary to collect telemetry/diagnostics data, in order to capture issues and fix them. However, you can disable this feature in the settings.
|
||||||
Playlet could run on variaty of devices, with different capabilities and screen sizes, and different Invidious instances.
|
But it's not enough, it's important to report any issues you encouter using Playlet, so they can be addressed.
|
||||||
That's why it's important to report any issues you encouter using Playlet, otherwise it's unlikely that they get addressed.
|
|
||||||
|
|
||||||
## Why Playlet
|
## Why Playlet
|
||||||
|
|
||||||
|
|||||||
@@ -74,24 +74,20 @@
|
|||||||
"lib/**",
|
"lib/**",
|
||||||
"www/**",
|
"www/**",
|
||||||
"manifest",
|
"manifest",
|
||||||
"!**/*.transpiled/**",
|
|
||||||
"!**/*.transpiled.*",
|
|
||||||
"!**/*.spec.bs",
|
"!**/*.spec.bs",
|
||||||
"!**/tests/**"
|
"!**/tests/**"
|
||||||
],
|
],
|
||||||
"lintConfig": "./config/bslint.jsonc",
|
"lintConfig": "./config/bslint.jsonc",
|
||||||
"plugins": [
|
"plugins": [
|
||||||
"@rokucommunity/bslint",
|
"@rokucommunity/bslint",
|
||||||
"../tools/bs-plugins/asynctask-plugin.ts",
|
"../tools/bs-plugins/jobsystem-plugin.ts",
|
||||||
"../tools/bs-plugins/manifest-edit-plugin.ts",
|
"../tools/bs-plugins/manifest-edit-plugin.ts",
|
||||||
"../tools/bs-plugins/component-includes-plugin.ts",
|
"../tools/bs-plugins/component-includes-plugin.ts",
|
||||||
"../tools/bs-plugins/bindings-plugin.ts",
|
"../tools/bs-plugins/bindings-plugin.ts",
|
||||||
"../tools/bs-plugins/oninit-plugin.ts",
|
"../tools/bs-plugins/oninit-plugin.ts",
|
||||||
"../tools/bs-plugins/track-transpiled-plugin.ts",
|
|
||||||
"../tools/bs-plugins/json-yaml-plugin.ts",
|
"../tools/bs-plugins/json-yaml-plugin.ts",
|
||||||
"../tools/bs-plugins/validation-plugin.ts",
|
"../tools/bs-plugins/validation-plugin.ts",
|
||||||
"../tools/bs-plugins/logger-plugin.ts",
|
"../tools/bs-plugins/logger-plugin.ts",
|
||||||
"../tools/bs-plugins/type-gen-plugin.ts",
|
|
||||||
"../tools/bs-plugins/web-server-plugin.ts",
|
"../tools/bs-plugins/web-server-plugin.ts",
|
||||||
"../tools/bs-plugins/locale-validation-plugin.ts",
|
"../tools/bs-plugins/locale-validation-plugin.ts",
|
||||||
"../tools/bs-plugins/proto-gen-plugin.ts"
|
"../tools/bs-plugins/proto-gen-plugin.ts"
|
||||||
|
|||||||
@@ -13,23 +13,19 @@
|
|||||||
"config/**",
|
"config/**",
|
||||||
"lib/**",
|
"lib/**",
|
||||||
"www/**",
|
"www/**",
|
||||||
"manifest",
|
"manifest"
|
||||||
"!**/*.transpiled/**",
|
|
||||||
"!**/*.transpiled.*"
|
|
||||||
],
|
],
|
||||||
"plugins": [
|
"plugins": [
|
||||||
"@rokucommunity/bslint",
|
"@rokucommunity/bslint",
|
||||||
"rooibos-roku",
|
"rooibos-roku",
|
||||||
"../tools/bs-plugins/asynctask-plugin.ts",
|
"../tools/bs-plugins/jobsystem-plugin.ts",
|
||||||
"../tools/bs-plugins/manifest-edit-plugin.ts",
|
"../tools/bs-plugins/manifest-edit-plugin.ts",
|
||||||
"../tools/bs-plugins/component-includes-plugin.ts",
|
"../tools/bs-plugins/component-includes-plugin.ts",
|
||||||
"../tools/bs-plugins/bindings-plugin.ts",
|
"../tools/bs-plugins/bindings-plugin.ts",
|
||||||
"../tools/bs-plugins/oninit-plugin.ts",
|
"../tools/bs-plugins/oninit-plugin.ts",
|
||||||
"../tools/bs-plugins/track-transpiled-plugin.ts",
|
|
||||||
"../tools/bs-plugins/json-yaml-plugin.ts",
|
"../tools/bs-plugins/json-yaml-plugin.ts",
|
||||||
"../tools/bs-plugins/validation-plugin.ts",
|
"../tools/bs-plugins/validation-plugin.ts",
|
||||||
"../tools/bs-plugins/logger-plugin.ts",
|
"../tools/bs-plugins/logger-plugin.ts",
|
||||||
"../tools/bs-plugins/type-gen-plugin.ts",
|
|
||||||
"../tools/bs-plugins/web-server-plugin.ts",
|
"../tools/bs-plugins/web-server-plugin.ts",
|
||||||
"../tools/bs-plugins/locale-validation-plugin.ts",
|
"../tools/bs-plugins/locale-validation-plugin.ts",
|
||||||
"../tools/bs-plugins/proto-gen-plugin.ts"
|
"../tools/bs-plugins/proto-gen-plugin.ts"
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
"named-function-style": "no-sub",
|
"named-function-style": "no-sub",
|
||||||
"anon-function-style": "no-sub",
|
"anon-function-style": "no-sub",
|
||||||
"aa-comma-style": "never",
|
"aa-comma-style": "never",
|
||||||
"no-print": "warn",
|
"no-print": "off",
|
||||||
"no-todo": "off",
|
"no-todo": "off",
|
||||||
"no-stop": "error",
|
"no-stop": "error",
|
||||||
"eol-last": "always",
|
"eol-last": "always",
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ These are mostly the steps when releasing a new version:
|
|||||||
- Wait for the PR to be created
|
- Wait for the PR to be created
|
||||||
- Inspect PR, wait for CI and merge
|
- Inspect PR, wait for CI and merge
|
||||||
- Wait for CI on main branch to create the `canary` release
|
- Wait for CI on main branch to create the `canary` release
|
||||||
- Edit `canary` release
|
- Edit [`canary`](https://github.com/iBicha/playlet/releases/tag/canary) release
|
||||||
- Tag: `v$VERSION`
|
- Tag: `v$VERSION`
|
||||||
- Title: `v$VERSION`
|
- Title: `v$VERSION`
|
||||||
- Body: the content from CHANGELOG.md for this version
|
- Body: the content from CHANGELOG.md for this version
|
||||||
|
|||||||
@@ -6,10 +6,8 @@
|
|||||||
- [Includes](#includes)
|
- [Includes](#includes)
|
||||||
- [@oninit](#oninit)
|
- [@oninit](#oninit)
|
||||||
- [Bindings](#bindings)
|
- [Bindings](#bindings)
|
||||||
- [Async Task Generator](#async-task-generator)
|
- [Job System Generator](#job-system-generator)
|
||||||
- [Tracking transpilied files](#tracking-transpilied-files)
|
|
||||||
- [Logger](#logger)
|
- [Logger](#logger)
|
||||||
- [Type Gen](#type-gen)
|
|
||||||
- [Web Server](#web-server)
|
- [Web Server](#web-server)
|
||||||
- [Locale validation](#locale-validation)
|
- [Locale validation](#locale-validation)
|
||||||
- [Protobuf Generator](#protobuf-generator)
|
- [Protobuf Generator](#protobuf-generator)
|
||||||
@@ -396,7 +394,7 @@ Notice how the function has `@oninit`, which means it will be called in the `Ini
|
|||||||
|
|
||||||
When the `bindings` field is set, the node registers itself to a global array of nodes that need binding.
|
When the `bindings` field is set, the node registers itself to a global array of nodes that need binding.
|
||||||
|
|
||||||
Next, once all nodes are registered, we need to call a function called `AutoBindSceneGraph()`. This need to be called once from the root node's `Init()` (concretely, [here](https://github.com/iBicha/playlet/blob/bea7fb209b2bd42aff620d06b416cf1e45988190/playlet-lib/src/components/MainScene.bs#L17))
|
Next, once all nodes are registered, we need to call a function called `AutoBindSceneGraph()`. This need to be called once from the root node's `Init()` (concretely, [here in MainScene.bs](https://github.com/iBicha/playlet/blob/bea7fb209b2bd42aff620d06b416cf1e45988190/playlet-lib/src/components/MainScene.bs#L17))
|
||||||
|
|
||||||
`AutoBindSceneGraph()` will loop through all the nodes that require binding, and use the information we assigned to `m.top.bindings` of each node to populate all the needed references.
|
`AutoBindSceneGraph()` will loop through all the nodes that require binding, and use the information we assigned to `m.top.bindings` of each node to populate all the needed references.
|
||||||
|
|
||||||
@@ -421,76 +419,54 @@ 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.
|
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.
|
||||||
|
|
||||||
## Async Task Generator
|
## Job System Generator
|
||||||
|
|
||||||
**[Source](/tools/bs-plugins/asynctask-plugin.ts)**
|
**[Source](/tools/bs-plugins/jobsystem-plugin.ts)**
|
||||||
|
|
||||||
This plugin generates `Task` components a scripts that makes it simpler to call a function in a background thread, and get the result in a callback function.
|
The Job System simplifies the creation of background jobs without the risk of creating too many threads.
|
||||||
|
It manages a number of Tasks which are capable of executing jobs from a queue.
|
||||||
|
|
||||||
### Why
|
### Why
|
||||||
|
|
||||||
To implement functionality that runs in background threads, [Task](https://developer.roku.com/en-ca/docs/references/scenegraph/control-nodes/task.md)s must be used.
|
To implement functionality that runs in background threads, [Tasks](https://developer.roku.com/en-ca/docs/references/scenegraph/control-nodes/task.md) must be used.
|
||||||
|
|
||||||
Setting up a task involves lots of boilerplate: setting up the task in an xml file, defining inputs and outputs, code to listen for a task to finish, and so on.
|
Setting up a task involves lots of boilerplate: setting up the task in an xml file, defining inputs and outputs, code to listen for a task to finish, and so on.
|
||||||
|
|
||||||
Additionally, there's no standard way to do error handling, cancellation, and so on.
|
Additionally, there's no standard way to do error handling and cancellation.
|
||||||
|
|
||||||
|
Another concern is managing too many threads across the application, and managing rendezvous(s).
|
||||||
|
|
||||||
### How
|
### How
|
||||||
|
|
||||||
Use a function with the attribute `@asynctask`.
|
Define a function in its own file called `ExecuteJob` annotated with `@job("JobName")`:
|
||||||
|
|
||||||
In a separate file, define the task function:
|
|
||||||
|
|
||||||
```brighterscript
|
```brighterscript
|
||||||
@asynctask
|
@job("MyJob")
|
||||||
function MyBackgroundTask(input as object) as object
|
function ExecuteJob() as void
|
||||||
myVar = input.myVar
|
' input is an associative array set when the job is queued.
|
||||||
|
input = JobGetInput()
|
||||||
|
|
||||||
value = DoWork(myVar)
|
value = DoWork(input.myVar)
|
||||||
|
|
||||||
return {
|
' optional
|
||||||
value: value
|
JobSuccessData({result: value})
|
||||||
}
|
|
||||||
end function
|
end function
|
||||||
```
|
```
|
||||||
|
|
||||||
And use the function like so
|
by doing this, the generator will generate a component named "MyJob" and will inherit from "BaseJob".
|
||||||
|
|
||||||
|
The job can now queued for execution:
|
||||||
|
|
||||||
```brighterscript
|
```brighterscript
|
||||||
import "pkg:/source/AsyncTask/Tasks.bs"
|
callback = JobSystem.CreateCallback()
|
||||||
import "pkg:/source/AsyncTask/AsyncTask.bs"
|
JobSystem.QueueJob(m.jobQueue, Jobs.MyJob, input, callback)
|
||||||
|
|
||||||
AsyncTask.Start(Tasks.MyBackgroundTask, {myVar: "some input"}, function(output as object) as void
|
|
||||||
if output.success
|
|
||||||
print(output.result.value)
|
|
||||||
end if
|
|
||||||
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.
|
And the job system will take care of queueing, scheduling, and scaling up the available tasks in order to execute jobs.
|
||||||
|
The job system creates job nodes inside task threads, which reduces the amount of rendezvous necessary. Some rendezvous are still necessary, such as when a task node is signaling that it is ready to take on a new job, or when the job is returning results to render thread.
|
||||||
|
The job system will auto scale up to a maximum number of tasks, in order to avoid `Too many threads` errors. Once the job system activity settles down, the job system will release task nodes that has been idle for a certain amount of time.
|
||||||
|
|
||||||
Although very useful, this pattern might not be the best for long running tasks (like the Web Server) or other tasks that require task reuse. This is because `AsyncTask.Start` create a new instance of the task every time.
|
Although very useful, this pattern might not be the best for long running tasks (like the Web Server) and it is simpler to create dedicated tasks for those.
|
||||||
|
|
||||||
## Tracking transpilied files
|
|
||||||
|
|
||||||
**[Source](/tools/bs-plugins/track-transpiled-plugin.ts)**
|
|
||||||
|
|
||||||
By now, you realize we make a lot of transformations to the source code through many plugins. As a sanity check, this plugin allows us to keep track of the transpiled files, so we can be sure that the output is what we expect.
|
|
||||||
|
|
||||||
### Why
|
|
||||||
|
|
||||||
This is useful to catch errors with the plugin usage, of bugs with the plugins themselves.
|
|
||||||
|
|
||||||
### How
|
|
||||||
|
|
||||||
When transpiling a file, say `MyComponent.xml`, the plugin will see if there is a `MyComponent.transpiled.xml` right next to it in the source.
|
|
||||||
If a file is found, then the transpiled file of `MyComponent.xml` will be copied back from the staging folder to `MyComponent.transpiled.xml`.
|
|
||||||
|
|
||||||
Additionally, if there's a folder `MyFolder` and `MyFolder.transpiled` in the source, then all transpiled files of `MyFolder` will also be copied back to `MyFolder.transpiled`. Keeping track of entire folders is primarily to track of transpiled files of test nodes and scripts.
|
|
||||||
|
|
||||||
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
|
## Logger
|
||||||
|
|
||||||
@@ -529,36 +505,6 @@ To understand more about what's being generated, download `playlet-lib.zip` from
|
|||||||
|
|
||||||
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)
|
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
|
|
||||||
```
|
|
||||||
|
|
||||||
## Web Server
|
## Web Server
|
||||||
|
|
||||||
**[Source](/tools/bs-plugins/web-server-plugin.ts)**
|
**[Source](/tools/bs-plugins/web-server-plugin.ts)**
|
||||||
|
|||||||
@@ -1,54 +1,55 @@
|
|||||||
{
|
{
|
||||||
"name": "playlet",
|
"name": "playlet",
|
||||||
"version": "0.38.2",
|
"version": "0.43.2",
|
||||||
"description": "Unofficial YouTube client for Roku",
|
"description": "Unofficial YouTube client for Roku",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@rokucommunity/bslint": "^0.8.31",
|
"@rokucommunity/bslint": "^0.8.37",
|
||||||
"@types/crypto-js": "^4.2.2",
|
"@types/crypto-js": "^4.2.2",
|
||||||
"@types/fs-extra": "^11.0.4",
|
"@types/fs-extra": "^11.0.4",
|
||||||
"@types/node": "^22.15.18",
|
"@types/node": "^24.9.1",
|
||||||
"@types/xml2js": "^0.4.14",
|
"@types/xml2js": "^0.4.14",
|
||||||
"argparse": "^2.0.1",
|
"argparse": "^2.0.1",
|
||||||
"brighterscript": "0.68.5",
|
"brighterscript": "0.70.2",
|
||||||
"brighterscript-formatter": "^1.7.14",
|
"brighterscript-formatter": "^1.7.19",
|
||||||
"cheerio": "1.0.0-rc.11",
|
"convert-svg-to-png": "^0.7.1",
|
||||||
"convert-svg-to-png": "^0.6.4",
|
|
||||||
"crypto-js": "^4.2.0",
|
"crypto-js": "^4.2.0",
|
||||||
"dotenv": "^16.5.0",
|
"dotenv": "^17.2.3",
|
||||||
"fs-extra": "^11.3.0",
|
"fs-extra": "^11.3.2",
|
||||||
"glob": "^11.0.2",
|
"glob": "^11.0.3",
|
||||||
"imap": "^0.8.19",
|
"imap": "^0.8.19",
|
||||||
"ip": "^2.0.1",
|
"ip": "^2.0.1",
|
||||||
"json5": "^2.2.3",
|
"json5": "^2.2.3",
|
||||||
"mailparser": "^3.7.2",
|
"mailparser": "^3.7.5",
|
||||||
"protocol-buffers-schema": "^3.6.0",
|
"protocol-buffers-schema": "^3.6.0",
|
||||||
"roku-deploy": "^3.12.5",
|
"puppeteer": "^24.26.1",
|
||||||
"roku-test-automation": "^2.0.13",
|
"roku-deploy": "^3.13.0",
|
||||||
"rooibos-roku": "5.15.7",
|
"roku-test-automation": "^2.2.1",
|
||||||
|
"rooibos-roku": "5.15.5",
|
||||||
"rounded-rect-9patch": "^1.1.2",
|
"rounded-rect-9patch": "^1.1.2",
|
||||||
"semver": "^7.7.2",
|
"semver": "^7.7.3",
|
||||||
"shelljs": "^0.10.0",
|
"shelljs": "^0.10.0",
|
||||||
"ts-node": "^10.9.2",
|
"ts-node": "^10.9.2",
|
||||||
"typescript": "5.8.3",
|
"typescript": "5.9.3",
|
||||||
|
"telnet-client": "^2.2.6",
|
||||||
"xml2js": "^0.6.2",
|
"xml2js": "^0.6.2",
|
||||||
"yaml": "^2.8.0"
|
"yaml": "^2.8.1"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "20"
|
"node": "22"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev:web": "cd playlet-web && npm run dev",
|
"dev:web": "cd playlet-web && npm run dev",
|
||||||
"prebuild": "rm -rf dist",
|
"prebuild": "node tools/rm.js dist",
|
||||||
"build:dev": "npm run build:web && npm run build:lib:dev && npm run build:app:dev",
|
"build:dev": "npm run prebuild && npm run build:web && npm run build:lib:dev && npm run build:app:dev",
|
||||||
"build:prod": "npm run build:web && npm run build:lib:prod && npm run build:app:prod",
|
"build:prod": "npm run prebuild && npm run build:web && npm run build:lib:prod && npm run build:app:prod",
|
||||||
"build:release": "npm run format:fix && npm run lint:fix && npm run version-sync && npm run manifest-git-hash && npm run build:prod",
|
"build:release": "npm run prebuild && npm run format:fix && npm run lint:fix && npm run version-sync && npm run manifest-git-hash && npm run build:prod",
|
||||||
"build:app:dev": "cd playlet-app && npm run build:dev",
|
"build:app:dev": "cd playlet-app && npm run build:dev",
|
||||||
"build:app:prod": "cd playlet-app && npm run build:prod",
|
"build:app:prod": "cd playlet-app && npm run build:prod",
|
||||||
"build:lib:dev": "cd playlet-lib && npm run build:dev",
|
"build:lib:dev": "cd playlet-lib && npm run build:dev",
|
||||||
"build:lib:prod": "cd playlet-lib && npm run build:prod",
|
"build:lib:prod": "cd playlet-lib && npm run build:prod",
|
||||||
"build:web": "cd playlet-web && npm run build",
|
"build:web": "cd playlet-web && npm run build",
|
||||||
"lint": "cd playlet-lib && npm run lint && cd ../playlet-app && npm run lint",
|
"lint": "cd playlet-lib && npm run lint && cd ../playlet-app && npm run lint && cd ../playlet-web && npm run lint",
|
||||||
"lint:fix": "cd playlet-lib && npm run lint:fix && cd ../playlet-app && npm run lint:fix",
|
"lint:fix": "cd playlet-lib && npm run lint:fix && cd ../playlet-app && npm run lint:fix && cd ../playlet-web && npm run lint",
|
||||||
"format": "cd playlet-lib && npm run format && cd ../playlet-app && npm run format",
|
"format": "cd playlet-lib && npm run format && cd ../playlet-app && npm run format",
|
||||||
"format:fix": "cd playlet-lib && npm run format:fix && cd ../playlet-app && npm run format:fix",
|
"format:fix": "cd playlet-lib && npm run format:fix && cd ../playlet-app && npm run format:fix",
|
||||||
"test": "npm run test:lib && npm run test:app",
|
"test": "npm run test:lib && npm run test:app",
|
||||||
@@ -62,11 +63,10 @@
|
|||||||
"manifest-git-hash": "node tools/update-manifest-git-hash.js",
|
"manifest-git-hash": "node tools/update-manifest-git-hash.js",
|
||||||
"sign-released-package": "node tools/sign-released-package.js",
|
"sign-released-package": "node tools/sign-released-package.js",
|
||||||
"screenshot": "node tools/screenshot.js",
|
"screenshot": "node tools/screenshot.js",
|
||||||
"generate-sponsorblock-config": "node tools/generate-sponsorblock-config.js",
|
|
||||||
"convert-images": "node tools/convert-images.js",
|
"convert-images": "node tools/convert-images.js",
|
||||||
"update-rale-component": "cd tools/RALE && rm TrackerTask.xml && curl -o TrackerTask.zip https://devtools.web.roku.com/roku-advanced-layout-editor/app/TrackerTask.zip && unzip TrackerTask.zip && rm TrackerTask.zip",
|
"update-rale-component": "cd tools/RALE && rm TrackerTask.xml && curl -o TrackerTask.zip https://devtools.web.roku.com/roku-advanced-layout-editor/app/TrackerTask.zip && unzip TrackerTask.zip && rm TrackerTask.zip",
|
||||||
"postinstall": "cd playlet-lib && npm install && cd ../playlet-app && npm install && cd ../playlet-web && npm install",
|
"postinstall": "cd playlet-lib && npm install && cd ../playlet-app && npm install && cd ../playlet-web && npm install",
|
||||||
"update-deps": "npx npm-check-updates --deep --upgrade --install always --reject tailwindcss,cheerio,brighterscript,daisyui",
|
"update-deps": "npx npm-check-updates --deep --upgrade --install always --reject rooibos-roku",
|
||||||
"registry:write": "node tools/registry.js --input registry.json",
|
"registry:write": "node tools/registry.js --input registry.json",
|
||||||
"registry:read": "node tools/registry.js --output registry.json",
|
"registry:read": "node tools/registry.js --output registry.json",
|
||||||
"registry:clear": "node tools/registry.js --clear",
|
"registry:clear": "node tools/registry.js --clear",
|
||||||
@@ -75,6 +75,6 @@
|
|||||||
"shutdown": "node tools/shutdown.js"
|
"shutdown": "node tools/shutdown.js"
|
||||||
},
|
},
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"@rollup/rollup-linux-x64-gnu": "^4.40.2"
|
"@rollup/rollup-linux-x64-gnu": "^4.52.5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "playlet-app",
|
"name": "playlet-app",
|
||||||
"version": "0.38.2",
|
"version": "0.43.2",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "playlet-app",
|
"name": "playlet-app",
|
||||||
"version": "0.38.2"
|
"version": "0.43.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,19 +1,19 @@
|
|||||||
{
|
{
|
||||||
"name": "playlet-app",
|
"name": "playlet-app",
|
||||||
"version": "0.38.2",
|
"version": "0.43.2",
|
||||||
"description": "Unofficial YouTube client for Roku",
|
"description": "Unofficial YouTube client for Roku",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"prebuild": "rm -rf ../build/playlet-app",
|
"prebuild": "node ../tools/rm.js ../build/playlet-app",
|
||||||
"prebuild:dev": "npm run prebuild",
|
"prebuild:dev": "npm run prebuild",
|
||||||
"prebuild:prod": "npm run prebuild",
|
"prebuild:prod": "npm run prebuild",
|
||||||
"build:dev": "bsc --create-package --debug --sourceMap=true --lintConfig ../config/bslint.jsonc",
|
"build:dev": "bsc --create-package --debug --sourceMap=true --lintConfig ../config/bslint.jsonc",
|
||||||
"build:prod": "bsc --create-package --sourceMap=false --lintConfig ../config/bslint.jsonc",
|
"build:prod": "bsc --create-package --sourceMap=false --lintConfig ../config/bslint.jsonc",
|
||||||
"postbuild:prod": "mkdir -p ../release && cp ../dist/playlet-app.zip ../release/playlet.zip && npm run squash-fs && npm run sign-package",
|
"postbuild:prod": "node ../tools/mkdir.js ../release && node ../tools/cp.js ../dist/playlet-app.zip ../release/playlet.zip && npm run squash-fs && npm run sign-package",
|
||||||
"squash-fs": "node ../tools/squash-fs.js --in-file ../release/playlet.zip --out-file ../release/playlet.squashfs.zip",
|
"squash-fs": "node ../tools/squash-fs.js --in-file ../release/playlet.zip --out-file ../release/playlet.squashfs.zip",
|
||||||
"sign-package": "node ../tools/sign-package.js --out-file playlet.squashfs.zip --out-dir ../release --staging-dir ../build/playlet-app",
|
"sign-package": "node ../tools/sign-package.js --out-file playlet.squashfs.zip --out-dir ../release --staging-dir ../build/playlet-app",
|
||||||
"lint": "bslint --project bsconfig.lint.json --lintConfig ../config/bslint.jsonc",
|
"lint": "bslint --project bsconfig.lint.json --lintConfig ../config/bslint.jsonc",
|
||||||
"lint:fix": "npm run lint -- --fix",
|
"lint:fix": "npm run lint -- --fix",
|
||||||
"format:base": "bsfmt \"src/**/*.brs\" \"src/**/*.bs\" \"!**/bslib.brs\" \"!**/roku_modules/**/*\" \"!**/*.transpiled/**\" \"!**/*.transpiled.*\" --bsfmt-path ../config/bsfmt.jsonc",
|
"format:base": "bsfmt \"src/**/*.brs\" \"src/**/*.bs\" \"!**/bslib.brs\" \"!**/roku_modules/**/*\" --bsfmt-path ../config/bsfmt.jsonc",
|
||||||
"format": "npm run format:base -- --check",
|
"format": "npm run format:base -- --check",
|
||||||
"format:fix": "npm run format:base -- --write",
|
"format:fix": "npm run format:base -- --write",
|
||||||
"test": "npm run test:build && npm run test:run",
|
"test": "npm run test:build && npm run test:run",
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
<field id="inputArgs" type="assocarray" alwaysNotify="true" />
|
<field id="inputArgs" type="assocarray" alwaysNotify="true" />
|
||||||
<field id="playletLibLoadedUrl" type="assocarray" />
|
<field id="playletLibLoadedUrl" type="assocarray" />
|
||||||
<field id="systemLogEvent" type="assocarray" alwaysNotify="true" />
|
<field id="systemLogEvent" type="assocarray" alwaysNotify="true" />
|
||||||
|
<field id="enableSystemLogType" type="string" />
|
||||||
</interface>
|
</interface>
|
||||||
<script type="text/brightscript" uri="pkg:/source/Dialog.bs" />
|
<script type="text/brightscript" uri="pkg:/source/Dialog.bs" />
|
||||||
<script type="text/brightscript" uri="pkg:/source/Manifest.bs" />
|
<script type="text/brightscript" uri="pkg:/source/Manifest.bs" />
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 9.9 KiB |
|
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 5.2 KiB |
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 35 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
@@ -3,21 +3,21 @@
|
|||||||
outputs: [
|
outputs: [
|
||||||
{
|
{
|
||||||
outputFilePath: 'images/splash-screen_fhd.jpg',
|
outputFilePath: 'images/splash-screen_fhd.jpg',
|
||||||
outputHash: '114d19754dea31c83f17355d8741ac35',
|
outputHash: '02283ce80f77a11e68914592873fc7b5',
|
||||||
width: 1920,
|
width: 1920,
|
||||||
height: 1080,
|
height: 1080,
|
||||||
background: '#242424',
|
background: '#242424',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
outputFilePath: 'images/splash-screen_hd.jpg',
|
outputFilePath: 'images/splash-screen_hd.jpg',
|
||||||
outputHash: '8592e44c5d00183af4c45402f6fd495c',
|
outputHash: '9b6a24534c5b82a98ca6a7c26f4838e3',
|
||||||
width: 1280,
|
width: 1280,
|
||||||
height: 720,
|
height: 720,
|
||||||
background: '#242424',
|
background: '#242424',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
outputFilePath: 'images/splash-screen_sd.jpg',
|
outputFilePath: 'images/splash-screen_sd.jpg',
|
||||||
outputHash: '5a5585def512912739a2fc771971fcdd',
|
outputHash: '4640d7c1c612035e31b074a3d1d5ae78',
|
||||||
width: 720,
|
width: 720,
|
||||||
height: 480,
|
height: 480,
|
||||||
background: '#242424',
|
background: '#242424',
|
||||||
|
|||||||
@@ -3,21 +3,21 @@
|
|||||||
outputs: [
|
outputs: [
|
||||||
{
|
{
|
||||||
outputFilePath: 'images/channel-poster_fhd.png',
|
outputFilePath: 'images/channel-poster_fhd.png',
|
||||||
outputHash: '1b224960fc8923434d9fd2fdd0262e02',
|
outputHash: '19feebe8de4e6598f5efa85aef59cd27',
|
||||||
width: 540,
|
width: 540,
|
||||||
height: 405,
|
height: 405,
|
||||||
background: '#EBEBEB',
|
background: '#EBEBEB',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
outputFilePath: 'images/channel-poster_hd.png',
|
outputFilePath: 'images/channel-poster_hd.png',
|
||||||
outputHash: 'e3177153969166fa5f7352f3e38db852',
|
outputHash: '3d3794a0a0455c48470b892818fd9c77',
|
||||||
width: 290,
|
width: 290,
|
||||||
height: 218,
|
height: 218,
|
||||||
background: '#EBEBEB',
|
background: '#EBEBEB',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
outputFilePath: 'images/channel-poster_sd.png',
|
outputFilePath: 'images/channel-poster_sd.png',
|
||||||
outputHash: '1dd56e1db02ca90beecc52e56160ad58',
|
outputHash: '96dd31a31b53c2eb8df31cc6554f00c4',
|
||||||
width: 246,
|
width: 246,
|
||||||
height: 140,
|
height: 140,
|
||||||
background: '#EBEBEB',
|
background: '#EBEBEB',
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ title=Playlet
|
|||||||
|
|
||||||
# Do not update version manually, it is auto updated from package.json
|
# Do not update version manually, it is auto updated from package.json
|
||||||
major_version=0
|
major_version=0
|
||||||
minor_version=38
|
minor_version=43
|
||||||
build_version=00002
|
build_version=00002
|
||||||
|
|
||||||
ui_resolutions=hd
|
ui_resolutions=hd
|
||||||
@@ -28,6 +28,9 @@ confirm_partner_button=1
|
|||||||
|
|
||||||
supports_input_launch=1
|
supports_input_launch=1
|
||||||
|
|
||||||
|
requires_widevine_drm=1
|
||||||
|
requires_widevine_version=1.0
|
||||||
|
|
||||||
playlet_lib_squashfs_remote_url=https://github.com/iBicha/playlet/releases/latest/download/playlet-lib.squashfs.pkg
|
playlet_lib_squashfs_remote_url=https://github.com/iBicha/playlet/releases/latest/download/playlet-lib.squashfs.pkg
|
||||||
playlet_lib_zip_remote_url=https://github.com/iBicha/playlet/releases/latest/download/playlet-lib.zip
|
playlet_lib_zip_remote_url=https://github.com/iBicha/playlet/releases/latest/download/playlet-lib.zip
|
||||||
playlet_lib_zip_embedded_url=pkg:/lib/playlet-lib.zip
|
playlet_lib_zip_embedded_url=pkg:/lib/playlet-lib.zip
|
||||||
|
|||||||
@@ -9,8 +9,7 @@ namespace Logger
|
|||||||
|
|
||||||
function Log(msg as string)
|
function Log(msg as string)
|
||||||
msg = "[APP] " + msg
|
msg = "[APP] " + msg
|
||||||
' bs:disable-next-line LINT3012
|
print msg
|
||||||
print(msg)
|
|
||||||
|
|
||||||
buffer = CreateObject("roByteArray")
|
buffer = CreateObject("roByteArray")
|
||||||
buffer.FromAsciiString(msg + `\n`)
|
buffer.FromAsciiString(msg + `\n`)
|
||||||
@@ -39,8 +38,7 @@ namespace Logger
|
|||||||
msg += `console_log:\n${lastExitInfo.console_log}\n`
|
msg += `console_log:\n${lastExitInfo.console_log}\n`
|
||||||
msg += `********** End Last Exit Info **********\n`
|
msg += `********** End Last Exit Info **********\n`
|
||||||
|
|
||||||
' bs:disable-next-line LINT3012
|
print msg
|
||||||
print(msg)
|
|
||||||
|
|
||||||
buffer = CreateObject("roByteArray")
|
buffer = CreateObject("roByteArray")
|
||||||
buffer.FromAsciiString(msg + `\n`)
|
buffer.FromAsciiString(msg + `\n`)
|
||||||
|
|||||||
@@ -51,11 +51,7 @@ function Main(args as object) as void
|
|||||||
|
|
||||||
systemLog = CreateObject("roSystemLog")
|
systemLog = CreateObject("roSystemLog")
|
||||||
systemLog.SetMessagePort(port)
|
systemLog.SetMessagePort(port)
|
||||||
' Although all types are enabled, they are filtered in Playlet Lib to avoid spamming the logs
|
scene.ObserveField("enableSystemLogType", port)
|
||||||
systemLog.EnableType("http.connect")
|
|
||||||
systemLog.EnableType("http.error")
|
|
||||||
systemLog.EnableType("http.complete")
|
|
||||||
systemLog.EnableType("bandwidth.minute")
|
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
' The following comment is to enable the SceneGraph inspector
|
' The following comment is to enable the SceneGraph inspector
|
||||||
@@ -83,6 +79,9 @@ function Main(args as object) as void
|
|||||||
if field = "exitChannel" and data = true
|
if field = "exitChannel" and data = true
|
||||||
return
|
return
|
||||||
end if
|
end if
|
||||||
|
if field = "enableSystemLogType"
|
||||||
|
systemLog.EnableType(data)
|
||||||
|
end if
|
||||||
else if msgType = "roInputEvent"
|
else if msgType = "roInputEvent"
|
||||||
scene.inputArgs = msg.getInfo()
|
scene.inputArgs = msg.getInfo()
|
||||||
end if
|
end if
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "playlet-lib",
|
"name": "playlet-lib",
|
||||||
"version": "0.38.2",
|
"version": "0.43.2",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "playlet-lib",
|
"name": "playlet-lib",
|
||||||
"version": "0.38.2"
|
"version": "0.43.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,21 +1,21 @@
|
|||||||
{
|
{
|
||||||
"name": "playlet-lib",
|
"name": "playlet-lib",
|
||||||
"version": "0.38.2",
|
"version": "0.43.2",
|
||||||
"description": "Unofficial YouTube client for Roku",
|
"description": "Unofficial YouTube client for Roku",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"prebuild": "rm -rf ../build/playlet-lib",
|
"prebuild": "node ../tools/rm.js ../build/playlet-lib",
|
||||||
"prebuild:dev": "npm run prebuild",
|
"prebuild:dev": "npm run prebuild",
|
||||||
"prebuild:prod": "npm run prebuild",
|
"prebuild:prod": "npm run prebuild",
|
||||||
"build:dev": "bsc --create-package --debug --sourceMap=true --lintConfig ../config/bslint.jsonc",
|
"build:dev": "bsc --create-package --debug --sourceMap=true --lintConfig ../config/bslint.jsonc",
|
||||||
"build:prod": "bsc --create-package --sourceMap=false --lintConfig ../config/bslint.jsonc",
|
"build:prod": "bsc --create-package --sourceMap=false --lintConfig ../config/bslint.jsonc",
|
||||||
"postbuild": "mkdir -p ../release && mkdir -p ../playlet-app/src/lib && cp ../dist/playlet-lib.zip ../playlet-app/src/lib/playlet-lib.zip",
|
"postbuild": "node ../tools/mkdir.js ../release && node ../tools/mkdir.js ../playlet-app/src/lib && node ../tools/cp.js ../dist/playlet-lib.zip ../playlet-app/src/lib/playlet-lib.zip",
|
||||||
"postbuild:dev": "npm run postbuild",
|
"postbuild:dev": "npm run postbuild",
|
||||||
"postbuild:prod": "npm run postbuild && cp ../dist/playlet-lib.zip ../release/playlet-lib.zip && npm run squash-fs && npm run sign-package",
|
"postbuild:prod": "npm run postbuild && node ../tools/cp.js ../dist/playlet-lib.zip ../release/playlet-lib.zip && npm run squash-fs && npm run sign-package",
|
||||||
"squash-fs": "node ../tools/squash-fs.js --in-file ../release/playlet-lib.zip --out-file ../release/playlet-lib.squashfs.zip",
|
"squash-fs": "node ../tools/squash-fs.js --in-file ../release/playlet-lib.zip --out-file ../release/playlet-lib.squashfs.zip",
|
||||||
"sign-package": "node ../tools/sign-package.js --out-file playlet-lib.squashfs.zip --out-dir ../release --staging-dir ../build/playlet-lib",
|
"sign-package": "node ../tools/sign-package.js --out-file playlet-lib.squashfs.zip --out-dir ../release --staging-dir ../build/playlet-lib",
|
||||||
"lint": "bslint --project bsconfig.lint.json --lintConfig ../config/bslint.jsonc",
|
"lint": "bslint --project bsconfig.lint.json --lintConfig ../config/bslint.jsonc",
|
||||||
"lint:fix": "npm run lint -- --fix",
|
"lint:fix": "npm run lint -- --fix",
|
||||||
"format:base": "bsfmt \"src/**/*.brs\" \"src/**/*.bs\" \"!**/bslib.brs\" \"!**/roku_modules/**/*\" \"!**/*.transpiled/**\" \"!**/*.transpiled.*\" --bsfmt-path ../config/bsfmt.jsonc",
|
"format:base": "bsfmt \"src/**/*.brs\" \"src/**/*.bs\" \"!**/bslib.brs\" \"!**/roku_modules/**/*\" --bsfmt-path ../config/bsfmt.jsonc",
|
||||||
"format": "npm run format:base -- --check",
|
"format": "npm run format:base -- --check",
|
||||||
"format:fix": "npm run format:base -- --write",
|
"format:fix": "npm run format:base -- --write",
|
||||||
"test": "npm run test:build && npm run test:run",
|
"test": "npm run test:build && npm run test:run",
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import "pkg:/components/ContextMenu/ContextMenuUtils.bs"
|
import "pkg:/components/ContextMenu/ContextMenuUtils.bs"
|
||||||
import "pkg:/components/Dialog/DialogUtils.bs"
|
import "pkg:/components/Dialog/DialogUtils.bs"
|
||||||
|
import "pkg:/components/JobSystem/Jobs.bs"
|
||||||
|
import "pkg:/components/JobSystem/JobSystem.bs"
|
||||||
import "pkg:/components/Navigation/Navigation.bs"
|
import "pkg:/components/Navigation/Navigation.bs"
|
||||||
import "pkg:/source/AsyncTask/AsyncTask.bs"
|
|
||||||
import "pkg:/source/AsyncTask/Tasks.bs"
|
|
||||||
import "pkg:/source/utils/DisposableObserve.bs"
|
import "pkg:/source/utils/DisposableObserve.bs"
|
||||||
import "pkg:/source/utils/FocusManagement.bs"
|
import "pkg:/source/utils/FocusManagement.bs"
|
||||||
import "pkg:/source/utils/Locale.bs"
|
import "pkg:/source/utils/Locale.bs"
|
||||||
@@ -83,7 +83,7 @@ function OnContentSet() as void
|
|||||||
end if
|
end if
|
||||||
end if
|
end if
|
||||||
|
|
||||||
content@.LoadChannel(m.invidious)
|
content@.LoadChannel(m.invidious, m.jobQueue)
|
||||||
|
|
||||||
authorId = ValidString(content.authorId)
|
authorId = ValidString(content.authorId)
|
||||||
author = ValidString(content._author)
|
author = ValidString(content._author)
|
||||||
@@ -101,9 +101,16 @@ function CreateChannelFeeds(authorId as string, author as string, tabs as object
|
|||||||
return invalid
|
return invalid
|
||||||
end if
|
end if
|
||||||
|
|
||||||
|
disableShorts = m.preferences["content_feed.disable_shorts"]
|
||||||
|
|
||||||
feeds = []
|
feeds = []
|
||||||
for i = 0 to tabs.count() - 1
|
for i = 0 to tabs.count() - 1
|
||||||
tabName = tabs[i]
|
tabName = tabs[i]
|
||||||
|
if tabName = "shorts" and disableShorts
|
||||||
|
LogInfo(`Skipping "Shorts" tab based on user settings`)
|
||||||
|
continue for
|
||||||
|
end if
|
||||||
|
|
||||||
if m.tabs.DoesExist(tabName)
|
if m.tabs.DoesExist(tabName)
|
||||||
if tabsParams <> invalid and tabsParams.DoesExist(tabName)
|
if tabsParams <> invalid and tabsParams.DoesExist(tabName)
|
||||||
params = tabsParams[tabName]
|
params = tabsParams[tabName]
|
||||||
@@ -155,30 +162,33 @@ end function
|
|||||||
function OnDispose()
|
function OnDispose()
|
||||||
m.rowList.dispose = true
|
m.rowList.dispose = true
|
||||||
DisposeObservers()
|
DisposeObservers()
|
||||||
if m.subscribeTask <> invalid
|
if m.subscribeJob <> invalid
|
||||||
m.subscribeTask.cancel = true
|
m.subscribeJob.cancel = true
|
||||||
m.subscribeTask = invalid
|
m.subscribeJob = invalid
|
||||||
end if
|
end if
|
||||||
if m.fetchSubscriptionStatusTask <> invalid
|
if m.fetchSubscriptionStatusJob <> invalid
|
||||||
m.fetchSubscriptionStatusTask.cancel = true
|
m.fetchSubscriptionStatusJob.cancel = true
|
||||||
m.fetchSubscriptionStatusTask = invalid
|
m.fetchSubscriptionStatusJob = invalid
|
||||||
end if
|
end if
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function OnSubscribeButtonSelected()
|
function OnSubscribeButtonSelected()
|
||||||
if m.subscribeTask <> invalid
|
if m.subscribeJob <> invalid
|
||||||
m.subscribeTask.cancel = true
|
m.subscribeJob.cancel = true
|
||||||
end if
|
end if
|
||||||
if m.fetchSubscriptionStatusTask <> invalid
|
if m.fetchSubscriptionStatusJob <> invalid
|
||||||
m.fetchSubscriptionStatusTask.cancel = true
|
m.fetchSubscriptionStatusJob.cancel = true
|
||||||
end if
|
end if
|
||||||
|
|
||||||
m.subscribeTask = AsyncTask.Start(Tasks.SubscribeTask, {
|
input = {
|
||||||
channelView: m.top
|
channelView: m.top
|
||||||
invidious: m.invidious
|
invidious: m.invidious
|
||||||
ucid: m.authorId
|
ucid: m.authorId
|
||||||
subscribe: not m.top.isSubscribed
|
subscribe: not m.top.isSubscribed
|
||||||
})
|
}
|
||||||
|
|
||||||
|
m.subscribeJob = JobSystem.CreateCallback()
|
||||||
|
JobSystem.QueueJob(m.jobQueue, Jobs.SubscribeJob, input, m.subscribeJob)
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function OnBannerLoadStatus() as void
|
function OnBannerLoadStatus() as void
|
||||||
@@ -342,14 +352,17 @@ function GetSortingContextMenuOptionsForItem(video as object) as object
|
|||||||
end if
|
end if
|
||||||
|
|
||||||
feedSource = feedSources[0]
|
feedSource = feedSources[0]
|
||||||
endpoint = feedSource.endpoint
|
sortOptions = feedSource.state.sortOptions
|
||||||
if not m.sortOptions.DoesExist(endpoint)
|
if not IsArray(sortOptions)
|
||||||
return []
|
endpoint = feedSource.endpoint
|
||||||
|
if not m.sortOptions.DoesExist(endpoint)
|
||||||
|
return []
|
||||||
|
end if
|
||||||
|
|
||||||
|
sortOptions = m.sortOptions[endpoint]
|
||||||
end if
|
end if
|
||||||
|
|
||||||
title = Tr(Locale.Dialogs.SortFeedBy).replace("%1", `"${feedSource.title}"`)
|
title = Tr(Locale.Dialogs.SortFeedBy).replace("%1", `"${feedSource.title}"`)
|
||||||
sortOptions = m.sortOptions[endpoint]
|
|
||||||
|
|
||||||
return [ContextMenuUtils.CreateOption(title + "...", m.top, "ShowSortDialog", [title, sortOptions, feedContentNode])]
|
return [ContextMenuUtils.CreateOption(title + "...", m.top, "ShowSortDialog", [title, sortOptions, feedContentNode])]
|
||||||
end function
|
end function
|
||||||
|
|
||||||
@@ -382,20 +395,24 @@ function FetchSubscriptionStatus() as void
|
|||||||
return
|
return
|
||||||
end if
|
end if
|
||||||
|
|
||||||
if m.fetchSubscriptionStatusTask <> invalid
|
if m.fetchSubscriptionStatusJob <> invalid
|
||||||
return
|
return
|
||||||
end if
|
end if
|
||||||
|
|
||||||
m.fetchSubscriptionStatusTask = AsyncTask.Start(Tasks.FetchSubscriptionStatusTask, {
|
input = {
|
||||||
channelView: m.top
|
channelView: m.top
|
||||||
ucid: authorId
|
ucid: authorId
|
||||||
authToken: m.invidious.authToken
|
authToken: m.invidious.authToken
|
||||||
invidious: m.invidious
|
invidious: m.invidious
|
||||||
})
|
}
|
||||||
|
|
||||||
|
m.fetchSubscriptionStatusJob = JobSystem.CreateCallback(OnFetchSubscriptionStatusDone)
|
||||||
|
JobSystem.QueueJob(m.jobQueue, Jobs.FetchSubscriptionStatusJob, input, m.fetchSubscriptionStatusJob)
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function OnFetchSubscriptionStatusResult(result as object) as void
|
function OnFetchSubscriptionStatusDone(event as object) as void
|
||||||
m.fetchSubscriptionStatusTask = invalid
|
JobSystem.UnobserveCallback(event.getRoSGNode())
|
||||||
|
m.fetchSubscriptionStatusJob = invalid
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function OnSubscriptionChanged()
|
function OnSubscriptionChanged()
|
||||||
|
|||||||
@@ -5,6 +5,8 @@
|
|||||||
<field id="isSubscribed" type="boolean" onChange="OnSubscriptionChanged" />
|
<field id="isSubscribed" type="boolean" onChange="OnSubscriptionChanged" />
|
||||||
<field id="appController" type="node" bind="/AppController" />
|
<field id="appController" type="node" bind="/AppController" />
|
||||||
<field id="invidious" type="node" bind="/Invidious" />
|
<field id="invidious" type="node" bind="/Invidious" />
|
||||||
|
<field id="preferences" type="node" bind="/Preferences" />
|
||||||
|
<field id="jobQueue" type="node" bind="/JobQueue" />
|
||||||
<field id="bookmarksService" type="node" bind="/BookmarksService" />
|
<field id="bookmarksService" type="node" bind="/BookmarksService" />
|
||||||
<function name="ShowSortDialog" />
|
<function name="ShowSortDialog" />
|
||||||
</interface>
|
</interface>
|
||||||
|
|||||||
@@ -1,38 +1,43 @@
|
|||||||
import "pkg:/components/Services/Innertube/InnertubeService.bs"
|
import "pkg:/components/Services/Innertube/InnertubeService.bs"
|
||||||
import "pkg:/components/Services/Invidious/InvidiousService.bs"
|
import "pkg:/components/Services/Invidious/InvidiousService.bs"
|
||||||
|
import "pkg:/source/utils/CancellationUtils.bs"
|
||||||
|
|
||||||
|
@job("FetchSubscriptionStatusJob")
|
||||||
|
function ExecuteJob() as void
|
||||||
|
input = JobGetInput()
|
||||||
|
|
||||||
@asynctask
|
|
||||||
function FetchSubscriptionStatusTask(input as object) as object
|
|
||||||
channelView = input.channelView
|
channelView = input.channelView
|
||||||
ucid = input.ucid
|
ucid = input.ucid
|
||||||
invidiousNode = input.invidious
|
invidiousNode = input.invidious
|
||||||
authToken = input.authToken
|
authToken = input.authToken
|
||||||
|
|
||||||
if m.top.cancel
|
if JobIsCancelled()
|
||||||
return invalid
|
JobCancel()
|
||||||
|
return
|
||||||
end if
|
end if
|
||||||
|
|
||||||
|
cancellation = JobGetCancellation()
|
||||||
isInnertubeProfile = authToken.profileNode.type = "youtube"
|
isInnertubeProfile = authToken.profileNode.type = "youtube"
|
||||||
if isInnertubeProfile
|
if isInnertubeProfile
|
||||||
subscriptionStatus = InnertubeService.GetSubscriptionStatusForChannel(ucid, {
|
subscriptionStatus = InnertubeService.GetSubscriptionStatusForChannel(ucid, {
|
||||||
cancellation: m.top.cancellation
|
cancellation: cancellation
|
||||||
accessToken: authToken.token
|
accessToken: authToken.token
|
||||||
|
onBehalfOfUser: authToken.activeIdentifyToken
|
||||||
})
|
})
|
||||||
|
|
||||||
if subscriptionStatus.error <> invalid
|
if subscriptionStatus.error <> invalid
|
||||||
LogError("Failed to fetch subscription status:", subscriptionStatus.error)
|
JobError("Failed to fetch subscription status: " + ToString(subscriptionStatus.error))
|
||||||
return invalid
|
return
|
||||||
end if
|
end if
|
||||||
channelView.isSubscribed = subscriptionStatus.isSubscribed
|
channelView.isSubscribed = subscriptionStatus.isSubscribed
|
||||||
else
|
else
|
||||||
service = new Invidious.InvidiousService(invidiousNode)
|
service = new Invidious.InvidiousService(invidiousNode)
|
||||||
subscriptionsRequest = service.GetSubscriptions(m.top.cancellation)
|
subscriptionsResponse = service.GetSubscriptions(cancellation)
|
||||||
if not subscriptionsRequest.IsSuccess()
|
if not subscriptionsResponse.IsSuccess()
|
||||||
error = subscriptionsRequest.ErrorMessage()
|
JobError("Failed to fetch subscriptions: " + subscriptionsResponse.ErrorMessage())
|
||||||
LogError("Failed to fetch subscriptions:", error)
|
return
|
||||||
return invalid
|
|
||||||
end if
|
end if
|
||||||
subscriptions = subscriptionsRequest.Json()
|
subscriptions = subscriptionsResponse.Json()
|
||||||
|
|
||||||
isSubscribed = false
|
isSubscribed = false
|
||||||
for each subscription in subscriptions
|
for each subscription in subscriptions
|
||||||
@@ -43,6 +48,4 @@ function FetchSubscriptionStatusTask(input as object) as object
|
|||||||
end for
|
end for
|
||||||
channelView.isSubscribed = isSubscribed
|
channelView.isSubscribed = isSubscribed
|
||||||
end if
|
end if
|
||||||
|
|
||||||
return invalid
|
|
||||||
end function
|
end function
|
||||||
@@ -1,30 +1,32 @@
|
|||||||
import "pkg:/components/Services/Invidious/InvidiousService.bs"
|
import "pkg:/components/Services/Invidious/InvidiousService.bs"
|
||||||
|
|
||||||
@asynctask
|
@job("SubscribeJob")
|
||||||
function SubscribeTask(input as object) as object
|
function ExecuteJob() as void
|
||||||
|
input = JobGetInput()
|
||||||
|
|
||||||
channelView = input.channelView
|
channelView = input.channelView
|
||||||
invidiousNode = input.invidious
|
invidiousNode = input.invidious
|
||||||
ucid = input.ucid
|
ucid = input.ucid
|
||||||
subscribe = input.subscribe
|
subscribe = input.subscribe
|
||||||
|
|
||||||
if m.top.cancel
|
if JobIsCancelled()
|
||||||
return invalid
|
JobCancel()
|
||||||
|
return
|
||||||
end if
|
end if
|
||||||
|
|
||||||
|
cancellation = JobGetCancellation()
|
||||||
service = new Invidious.InvidiousService(invidiousNode)
|
service = new Invidious.InvidiousService(invidiousNode)
|
||||||
|
|
||||||
if subscribe
|
if subscribe
|
||||||
response = service.Subscribe(ucid, m.top.cancellation)
|
response = service.Subscribe(ucid, cancellation)
|
||||||
else
|
else
|
||||||
response = service.Unsubscribe(ucid, m.top.cancellation)
|
response = service.Unsubscribe(ucid, cancellation)
|
||||||
end if
|
end if
|
||||||
|
|
||||||
if not response.IsSuccess()
|
if not response.IsSuccess()
|
||||||
error = response.ErrorMessage()
|
JobError("Failed to subscribe/unsubscribe to channel: " + response.ErrorMessage())
|
||||||
LogError("Failed to subscribe/unsubscribe to channel:", error)
|
return
|
||||||
return invalid
|
|
||||||
end if
|
end if
|
||||||
|
|
||||||
channelView.isSubscribed = subscribe
|
channelView.isSubscribed = subscribe
|
||||||
return invalid
|
|
||||||
end function
|
end function
|
||||||
@@ -44,19 +44,11 @@ function Update()
|
|||||||
end if
|
end if
|
||||||
|
|
||||||
if hours > 12
|
if hours > 12
|
||||||
hours = hours - 12
|
hours -= 12
|
||||||
end if
|
end if
|
||||||
|
|
||||||
hoursStr = hours.ToStr()
|
hoursStr = hours.ToStr("%02d")
|
||||||
minutesStr = minutes.ToStr()
|
minutesStr = minutes.ToStr("%02d")
|
||||||
|
|
||||||
if hours < 10
|
|
||||||
hoursStr = "0" + hoursStr
|
|
||||||
end if
|
|
||||||
|
|
||||||
if minutes < 10
|
|
||||||
minutesStr = "0" + minutesStr
|
|
||||||
end if
|
|
||||||
|
|
||||||
m.top.text = hoursStr + ":" + minutesStr + " " + ampm
|
m.top.text = hoursStr + ":" + minutesStr + " " + ampm
|
||||||
end function
|
end function
|
||||||
|
|||||||
@@ -1,39 +1,36 @@
|
|||||||
import "pkg:/components/Services/Invidious/InvidiousService.bs"
|
import "pkg:/components/Services/Invidious/InvidiousService.bs"
|
||||||
import "pkg:/components/Services/Invidious/InvidiousToContentNode.bs"
|
import "pkg:/components/Services/Invidious/InvidiousToContentNode.bs"
|
||||||
|
|
||||||
@asynctask
|
@job("ChannelContentJob")
|
||||||
function ChannelContentTask(input as object) as object
|
function ExecuteJob() as void
|
||||||
|
input = JobGetInput()
|
||||||
contentNode = input.content
|
contentNode = input.content
|
||||||
invidiousNode = input.invidious
|
invidiousNode = input.invidious
|
||||||
|
|
||||||
if m.top.cancel
|
if JobIsCancelled()
|
||||||
contentNode.loadState = FeedLoadState.None
|
contentNode.loadState = FeedLoadState.None
|
||||||
return invalid
|
JobCancel()
|
||||||
|
return
|
||||||
end if
|
end if
|
||||||
|
|
||||||
service = new Invidious.InvidiousService(invidiousNode)
|
service = new Invidious.InvidiousService(invidiousNode)
|
||||||
response = service.GetChannel(contentNode.authorId, m.top.cancellation)
|
cancellation = JobGetCancellation()
|
||||||
|
response = service.GetChannel(contentNode.authorId, cancellation)
|
||||||
|
|
||||||
if m.top.cancel
|
if JobIsCancelled()
|
||||||
contentNode.loadState = FeedLoadState.None
|
contentNode.loadState = FeedLoadState.None
|
||||||
return invalid
|
JobCancel()
|
||||||
|
return
|
||||||
end if
|
end if
|
||||||
|
|
||||||
metadata = response.Json()
|
metadata = response.Json()
|
||||||
|
|
||||||
if not response.IsSuccess() or metadata = invalid
|
if not response.IsSuccess() or metadata = invalid
|
||||||
contentNode.loadState = FeedLoadState.Error
|
contentNode.loadState = FeedLoadState.Error
|
||||||
return {
|
JobError(response.ErrorMessage())
|
||||||
success: false
|
return
|
||||||
error: response.ErrorMessage()
|
|
||||||
}
|
|
||||||
end if
|
end if
|
||||||
|
|
||||||
InvidiousContent.ToChannelContentNode(contentNode, metadata)
|
InvidiousContent.ToChannelContentNode(contentNode, metadata)
|
||||||
|
|
||||||
contentNode.loadState = FeedLoadState.Loaded
|
contentNode.loadState = FeedLoadState.Loaded
|
||||||
|
|
||||||
return {
|
|
||||||
success: true
|
|
||||||
}
|
|
||||||
end function
|
end function
|
||||||
@@ -1,50 +1,45 @@
|
|||||||
import "pkg:/components/Dialog/DialogUtils.bs"
|
import "pkg:/components/Dialog/DialogUtils.bs"
|
||||||
|
import "pkg:/components/JobSystem/Jobs.bs"
|
||||||
|
import "pkg:/components/JobSystem/JobSystem.bs"
|
||||||
import "pkg:/components/VideoFeed/FeedLoadState.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/ErrorUtils.bs"
|
||||||
import "pkg:/source/utils/Locale.bs"
|
import "pkg:/source/utils/Locale.bs"
|
||||||
import "pkg:/source/utils/Logging.bs"
|
import "pkg:/source/utils/Logging.bs"
|
||||||
|
|
||||||
function LoadChannel(invidiousNode as object) as void
|
function LoadChannel(invidiousNode as object, jobQueue as object) as void
|
||||||
loadState = m.top.loadState
|
loadState = m.top.loadState
|
||||||
if loadState = FeedLoadState.Loading or loadState = FeedLoadState.Loaded or loadState = FeedLoadState.Error
|
if loadState = FeedLoadState.Loading or loadState = FeedLoadState.Loaded or loadState = FeedLoadState.Error
|
||||||
return
|
return
|
||||||
end if
|
end if
|
||||||
|
|
||||||
if m.contentTask <> invalid
|
if m.channelContentJob <> invalid
|
||||||
m.contentTask.cancel = true
|
m.channelContentJob.cancel = true
|
||||||
end if
|
end if
|
||||||
|
|
||||||
m.top.loadState = FeedLoadState.Loading
|
m.top.loadState = FeedLoadState.Loading
|
||||||
m.contentTask = AsyncTask.Start(Tasks.ChannelContentTask, {
|
|
||||||
|
input = {
|
||||||
content: m.top
|
content: m.top
|
||||||
invidious: invidiousNode
|
invidious: invidiousNode
|
||||||
}, OnChannelContentTaskResult)
|
}
|
||||||
|
|
||||||
|
m.channelContentJob = JobSystem.CreateCallback(OnChannelContentJobDone)
|
||||||
|
JobSystem.QueueJob(jobQueue, Jobs.ChannelContentJob, input, m.channelContentJob)
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function OnChannelContentTaskResult(output as object) as void
|
function OnChannelContentJobDone(event as object) as void
|
||||||
m.contentTask = invalid
|
callback = event.getRoSGNode()
|
||||||
|
JobSystem.UnobserveCallback(callback)
|
||||||
|
m.channelContentJob = invalid
|
||||||
|
|
||||||
if output.cancelled
|
if callback.cancel or callback.success
|
||||||
return
|
return
|
||||||
end if
|
end if
|
||||||
|
|
||||||
if not output.success or not output.result.success
|
message = Tr(Locale.Dialogs.FailedToLoadChannel).Replace("%1", m.top.authorId) + `\n${callback.error}`
|
||||||
' output.error for unhandled exception
|
DialogUtils.ShowDialogEx({
|
||||||
error = output.error
|
message: message
|
||||||
if error = invalid
|
title: Tr(Locale.Dialogs.ChannelLoadError)
|
||||||
' output.result.error for network errors
|
large: true
|
||||||
error = output.result.error
|
})
|
||||||
end if
|
|
||||||
error = ErrorUtils.Format(error)
|
|
||||||
LogError(error)
|
|
||||||
authorId = output.task.input.content.authorId
|
|
||||||
message = Tr(Locale.Dialogs.FailedToLoadChannel).Replace("%1", authorId) + `\n${error}`
|
|
||||||
DialogUtils.ShowDialogEx({
|
|
||||||
message: message
|
|
||||||
title: Tr(Locale.Dialogs.ChannelLoadError)
|
|
||||||
large: true
|
|
||||||
})
|
|
||||||
end if
|
|
||||||
end function
|
end function
|
||||||
@@ -2,19 +2,22 @@ import "pkg:/components/Services/Invidious/InvidiousService.bs"
|
|||||||
import "pkg:/components/Services/Invidious/InvidiousToContentNode.bs"
|
import "pkg:/components/Services/Invidious/InvidiousToContentNode.bs"
|
||||||
import "pkg:/components/VideoFeed/FeedLoadState.bs"
|
import "pkg:/components/VideoFeed/FeedLoadState.bs"
|
||||||
|
|
||||||
@asynctask
|
@job("PlaylistContentJob")
|
||||||
function PlaylistContentTask(input as object) as object
|
function ExecuteJob() as void
|
||||||
|
input = JobGetInput()
|
||||||
contentNode = input.content
|
contentNode = input.content
|
||||||
invidiousNode = input.invidious
|
invidiousNode = input.invidious
|
||||||
singlePage = input.singlePage
|
singlePage = input.singlePage
|
||||||
|
|
||||||
if m.top.cancel
|
if JobIsCancelled()
|
||||||
contentNode.loadState = FeedLoadState.None
|
contentNode.loadState = FeedLoadState.None
|
||||||
return invalid
|
JobCancel()
|
||||||
|
return
|
||||||
end if
|
end if
|
||||||
|
|
||||||
service = new Invidious.InvidiousService(invidiousNode)
|
service = new Invidious.InvidiousService(invidiousNode)
|
||||||
instance = service.GetInstance()
|
instance = service.GetInstance()
|
||||||
|
cancellation = JobGetCancellation()
|
||||||
|
|
||||||
while true
|
while true
|
||||||
playlistId = contentNode.playlistId
|
playlistId = contentNode.playlistId
|
||||||
@@ -29,29 +32,26 @@ function PlaylistContentTask(input as object) as object
|
|||||||
end if
|
end if
|
||||||
end if
|
end if
|
||||||
|
|
||||||
response = service.GetPlaylist(playlistId, index, continuation, m.top.cancellation)
|
response = service.GetPlaylist(playlistId, index, continuation, cancellation)
|
||||||
|
|
||||||
if m.top.cancel
|
if JobIsCancelled()
|
||||||
contentNode.loadState = FeedLoadState.None
|
contentNode.loadState = FeedLoadState.None
|
||||||
return invalid
|
JobCancel()
|
||||||
|
return
|
||||||
end if
|
end if
|
||||||
|
|
||||||
metadata = response.Json()
|
metadata = response.Json()
|
||||||
|
|
||||||
if not response.IsSuccess() or metadata = invalid
|
if not response.IsSuccess() or metadata = invalid
|
||||||
contentNode.loadState = FeedLoadState.Error
|
contentNode.loadState = FeedLoadState.Error
|
||||||
return {
|
JobError(response.ErrorMessage())
|
||||||
success: false
|
return
|
||||||
error: response.ErrorMessage()
|
|
||||||
}
|
|
||||||
end if
|
end if
|
||||||
|
|
||||||
if metadata.DoesExist("error")
|
if metadata.DoesExist("error")
|
||||||
contentNode.loadState = FeedLoadState.Error
|
contentNode.loadState = FeedLoadState.Error
|
||||||
return {
|
JobError(metadata.error)
|
||||||
success: false
|
return
|
||||||
error: metadata.error
|
|
||||||
}
|
|
||||||
end if
|
end if
|
||||||
|
|
||||||
beforeChildCount = contentNode.getChildCount()
|
beforeChildCount = contentNode.getChildCount()
|
||||||
@@ -68,18 +68,12 @@ function PlaylistContentTask(input as object) as object
|
|||||||
|
|
||||||
if noMoreContinuation or noVideosAdded or reachedVideoCount
|
if noMoreContinuation or noVideosAdded or reachedVideoCount
|
||||||
contentNode.loadState = FeedLoadState.Loaded
|
contentNode.loadState = FeedLoadState.Loaded
|
||||||
return {
|
return
|
||||||
success: true
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
contentNode.loadState = FeedLoadState.LoadedPage
|
contentNode.loadState = FeedLoadState.LoadedPage
|
||||||
if singlePage
|
if singlePage
|
||||||
return {
|
return
|
||||||
success: true
|
|
||||||
}
|
|
||||||
end if
|
end if
|
||||||
end if
|
end if
|
||||||
end while
|
end while
|
||||||
|
|
||||||
return invalid
|
|
||||||
end function
|
end function
|
||||||
@@ -1,59 +1,57 @@
|
|||||||
import "pkg:/components/Dialog/DialogUtils.bs"
|
import "pkg:/components/Dialog/DialogUtils.bs"
|
||||||
|
import "pkg:/components/JobSystem/Jobs.bs"
|
||||||
|
import "pkg:/components/JobSystem/JobSystem.bs"
|
||||||
import "pkg:/components/VideoFeed/FeedLoadState.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/ErrorUtils.bs"
|
||||||
import "pkg:/source/utils/Locale.bs"
|
import "pkg:/source/utils/Locale.bs"
|
||||||
import "pkg:/source/utils/Logging.bs"
|
import "pkg:/source/utils/Logging.bs"
|
||||||
|
|
||||||
function LoadPlaylistPage(invidiousNode as object) as void
|
function LoadPlaylistPage(invidiousNode as object, jobQueue as object) as void
|
||||||
LoadPlaylist(invidiousNode, true)
|
LoadPlaylist(invidiousNode, jobQueue, true)
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function LoadPlaylistAll(invidiousNode as object) as void
|
function LoadPlaylistAll(invidiousNode as object, jobQueue as object) as void
|
||||||
LoadPlaylist(invidiousNode, false)
|
LoadPlaylist(invidiousNode, jobQueue, false)
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function LoadPlaylist(invidiousNode as object, singlePage as boolean) as void
|
function LoadPlaylist(invidiousNode as object, jobQueue as object, singlePage as boolean) as void
|
||||||
if m.contentTask <> invalid
|
|
||||||
m.contentTask.cancel = true
|
|
||||||
end if
|
|
||||||
|
|
||||||
loadState = m.top.loadState
|
loadState = m.top.loadState
|
||||||
if loadState = FeedLoadState.Loading or loadState = FeedLoadState.Loaded
|
if loadState = FeedLoadState.Loading or loadState = FeedLoadState.Loaded
|
||||||
return
|
return
|
||||||
end if
|
end if
|
||||||
|
|
||||||
|
if m.playlistContentJob <> invalid
|
||||||
|
m.playlistContentJob.cancel = true
|
||||||
|
m.top.isLoading = false
|
||||||
|
end if
|
||||||
|
|
||||||
m.top.loadState = FeedLoadState.Loading
|
m.top.loadState = FeedLoadState.Loading
|
||||||
m.contentTask = AsyncTask.Start(Tasks.PlaylistContentTask, {
|
|
||||||
|
input = {
|
||||||
content: m.top
|
content: m.top
|
||||||
invidious: invidiousNode
|
invidious: invidiousNode
|
||||||
singlePage: singlePage
|
singlePage: singlePage
|
||||||
}, OnPlaylistContentTaskResult)
|
}
|
||||||
|
|
||||||
|
m.top.isLoading = true
|
||||||
|
m.playlistContentJob = JobSystem.CreateCallback(OnPlaylistContentJobDone)
|
||||||
|
JobSystem.QueueJob(jobQueue, Jobs.PlaylistContentJob, input, m.playlistContentJob)
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function OnPlaylistContentTaskResult(output as object) as void
|
function OnPlaylistContentJobDone(event as object) as void
|
||||||
m.contentTask = invalid
|
callback = event.getRoSGNode()
|
||||||
|
JobSystem.UnobserveCallback(callback)
|
||||||
|
m.playlistContentJob = invalid
|
||||||
|
m.top.isLoading = false
|
||||||
|
|
||||||
if output.cancelled
|
if callback.cancel or callback.success
|
||||||
return
|
return
|
||||||
end if
|
end if
|
||||||
|
|
||||||
if not output.success or not output.result.success
|
message = Tr(Locale.Dialogs.FailedToLoadPlaylist).Replace("%1", m.top.playlistId) + `\n${callback.error}`
|
||||||
' output.error for unhandled exception
|
DialogUtils.ShowDialogEx({
|
||||||
error = output.error
|
message: message
|
||||||
if error = invalid
|
title: Tr(Locale.Dialogs.PlaylistLoadError)
|
||||||
' output.result.error for network errors
|
large: true
|
||||||
error = output.result.error
|
})
|
||||||
end if
|
|
||||||
error = ErrorUtils.Format(error)
|
|
||||||
LogError(error)
|
|
||||||
playlistId = output.task.input.content.playlistId
|
|
||||||
message = Tr(Locale.Dialogs.FailedToLoadPlaylist).Replace("%1", playlistId) + `\n${error}`
|
|
||||||
DialogUtils.ShowDialogEx({
|
|
||||||
message: message
|
|
||||||
title: Tr(Locale.Dialogs.PlaylistLoadError)
|
|
||||||
large: true
|
|
||||||
})
|
|
||||||
end if
|
|
||||||
end function
|
end function
|
||||||
@@ -5,6 +5,8 @@
|
|||||||
|
|
||||||
<field id="type" type="string" value="playlist" />
|
<field id="type" type="string" value="playlist" />
|
||||||
<field id="loadState" type="string" />
|
<field id="loadState" type="string" />
|
||||||
|
<!-- isLoading indicates if there's a background task running to fetch data -->
|
||||||
|
<field id="isLoading" type="boolean" />
|
||||||
<!-- index in a feed -->
|
<!-- index in a feed -->
|
||||||
<field id="feedSourcesIndex" type="integer" value="-1" />
|
<field id="feedSourcesIndex" type="integer" value="-1" />
|
||||||
<field id="continuation" type="string" />
|
<field id="continuation" type="string" />
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import "pkg:/source/AsyncTask/AsyncTask.bs"
|
import "pkg:/components/JobSystem/Jobs.bs"
|
||||||
import "pkg:/source/AsyncTask/Tasks.bs"
|
import "pkg:/components/JobSystem/JobSystem.bs"
|
||||||
import "pkg:/source/utils/Logging.bs"
|
import "pkg:/source/utils/Logging.bs"
|
||||||
import "pkg:/source/utils/StringUtils.bs"
|
import "pkg:/source/utils/StringUtils.bs"
|
||||||
import "pkg:/source/utils/TimeUtils.bs"
|
import "pkg:/source/utils/TimeUtils.bs"
|
||||||
@@ -31,16 +31,23 @@ function HasValidAccessToken(_unused as dynamic) as boolean
|
|||||||
end function
|
end function
|
||||||
|
|
||||||
function RefreshAccessToken() as void
|
function RefreshAccessToken() as void
|
||||||
if m.refreshTokenTask <> invalid
|
if m.profileRefreshTokenJob <> invalid
|
||||||
return
|
return
|
||||||
end if
|
end if
|
||||||
|
|
||||||
|
if m.scene = invalid
|
||||||
|
m.scene = m.top.getScene()
|
||||||
|
end if
|
||||||
if m.profilesService = invalid
|
if m.profilesService = invalid
|
||||||
m.profilesService = m.top.getScene().findNode("ProfilesService")
|
m.profilesService = m.scene.findNode("ProfilesService")
|
||||||
|
end if
|
||||||
|
if m.jobQueue = invalid
|
||||||
|
m.jobQueue = m.scene.findNode("JobQueue")
|
||||||
end if
|
end if
|
||||||
|
|
||||||
LogInfo("Refreshing access token for profile:", m.top.username)
|
LogInfo("Refreshing access token for profile:", m.top.username)
|
||||||
m.refreshTokenTask = AsyncTask.Start(Tasks.ProfileRefreshTokenTask, {
|
|
||||||
|
input = {
|
||||||
profile: m.top
|
profile: m.top
|
||||||
profilesService: m.profilesService
|
profilesService: m.profilesService
|
||||||
accessTokenObject: {
|
accessTokenObject: {
|
||||||
@@ -48,9 +55,13 @@ function RefreshAccessToken() as void
|
|||||||
clientSecret: m.top.clientSecret
|
clientSecret: m.top.clientSecret
|
||||||
refreshToken: m.top.refreshToken
|
refreshToken: m.top.refreshToken
|
||||||
}
|
}
|
||||||
}, OnProfileRefreshTokenTaskResult)
|
}
|
||||||
|
|
||||||
|
m.profileRefreshTokenJob = JobSystem.CreateCallback(OnProfileRefreshTokenJobDone)
|
||||||
|
JobSystem.QueueJob(m.jobQueue, Jobs.ProfileRefreshTokenJob, input, m.profileRefreshTokenJob)
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function OnProfileRefreshTokenTaskResult(output as object) as void
|
function OnProfileRefreshTokenJobDone(event as object) as void
|
||||||
m.refreshTokenTask = invalid
|
JobSystem.UnobserveCallback(event.getRoSGNode())
|
||||||
|
m.profileRefreshTokenJob = invalid
|
||||||
end function
|
end function
|
||||||
@@ -8,6 +8,7 @@
|
|||||||
<field id="accessToken" type="string" />
|
<field id="accessToken" type="string" />
|
||||||
|
|
||||||
<!-- Innertube fields -->
|
<!-- Innertube fields -->
|
||||||
|
<field id="activeIdentifyToken" type="string" />
|
||||||
<field id="thumbnail" type="uri" />
|
<field id="thumbnail" type="uri" />
|
||||||
<field id="refreshToken" type="string" />
|
<field id="refreshToken" type="string" />
|
||||||
<field id="scope" type="string" />
|
<field id="scope" type="string" />
|
||||||
|
|||||||
@@ -1,25 +1,25 @@
|
|||||||
import "pkg:/components/Services/Innertube/InnertubeService.bs"
|
import "pkg:/components/Services/Innertube/InnertubeService.bs"
|
||||||
import "pkg:/source/utils/ErrorUtils.bs"
|
import "pkg:/source/utils/ErrorUtils.bs"
|
||||||
|
|
||||||
@asynctask
|
@job("ProfileRefreshTokenJob")
|
||||||
function ProfileRefreshTokenTask(input as object) as object
|
function ExecuteJob() as void
|
||||||
|
input = JobGetInput()
|
||||||
profileNode = input.profile
|
profileNode = input.profile
|
||||||
accessTokenObject = input.accessTokenObject
|
accessTokenObject = input.accessTokenObject
|
||||||
profilesService = input.profilesService
|
profilesService = input.profilesService
|
||||||
try
|
try
|
||||||
if InnertubeService.AuthRefreshAccessToken(accessTokenObject)
|
cancellation = JobGetCancellation()
|
||||||
|
if InnertubeService.AuthRefreshAccessToken(accessTokenObject, cancellation)
|
||||||
profileNode.expiresIn = accessTokenObject.expiresIn
|
profileNode.expiresIn = accessTokenObject.expiresIn
|
||||||
profileNode.expiresTimestamp = accessTokenObject.expiresTimestamp
|
profileNode.expiresTimestamp = accessTokenObject.expiresTimestamp
|
||||||
profileNode.accessToken = accessTokenObject.accessToken
|
profileNode.accessToken = accessTokenObject.accessToken
|
||||||
profilesService@.SaveUserProfilesToRegistry()
|
profilesService@.SaveUserProfilesToRegistry()
|
||||||
else
|
else
|
||||||
LogError("Failed to refresh access token")
|
JobError("Failed to refresh access token")
|
||||||
profileNode.accessToken = invalid
|
profileNode.accessToken = invalid
|
||||||
end if
|
end if
|
||||||
catch error
|
catch error
|
||||||
LogError("Failed to refresh access token:", ErrorUtils.Format(error))
|
JobError("Failed to refresh access token: " + ErrorUtils.Format(error))
|
||||||
profileNode.accessToken = invalid
|
profileNode.accessToken = invalid
|
||||||
end try
|
end try
|
||||||
|
|
||||||
return invalid
|
|
||||||
end function
|
end function
|
||||||
@@ -5,6 +5,9 @@ import "pkg:/source/utils/Types.bs"
|
|||||||
|
|
||||||
namespace DialogUtils
|
namespace DialogUtils
|
||||||
|
|
||||||
|
' Very large messages can lead to execution timeout
|
||||||
|
const MESSAGE_LENGTH_LIMIT = 1000
|
||||||
|
|
||||||
function ShowDialogEx(options as object) as object
|
function ShowDialogEx(options as object) as object
|
||||||
currentDialog = m.top.getScene().dialog
|
currentDialog = m.top.getScene().dialog
|
||||||
alwaysOnTop = false
|
alwaysOnTop = false
|
||||||
@@ -23,12 +26,31 @@ namespace DialogUtils
|
|||||||
|
|
||||||
if options.DoesExist("message")
|
if options.DoesExist("message")
|
||||||
message = options.message
|
message = options.message
|
||||||
if GetInterface(message, "ifArray") = invalid
|
if IsString(message)
|
||||||
|
if message.Len() > MESSAGE_LENGTH_LIMIT
|
||||||
|
message = message.Left(MESSAGE_LENGTH_LIMIT) + "..."
|
||||||
|
end if
|
||||||
message = message.Tokenize(`\n`).ToArray()
|
message = message.Tokenize(`\n`).ToArray()
|
||||||
end if
|
end if
|
||||||
dialog.message = message
|
dialog.message = message
|
||||||
end if
|
end if
|
||||||
|
|
||||||
|
if options.DoesExist("bulletText")
|
||||||
|
bulletText = options.bulletText
|
||||||
|
if IsString(bulletText)
|
||||||
|
bulletText = bulletText.Tokenize(`\n`).ToArray()
|
||||||
|
end if
|
||||||
|
dialog.bulletText = bulletText
|
||||||
|
end if
|
||||||
|
|
||||||
|
if options.DoesExist("bottomMessage")
|
||||||
|
bottomMessage = options.bottomMessage
|
||||||
|
if IsString(bottomMessage)
|
||||||
|
bottomMessage = bottomMessage.Tokenize(`\n`).ToArray()
|
||||||
|
end if
|
||||||
|
dialog.bottomMessage = bottomMessage
|
||||||
|
end if
|
||||||
|
|
||||||
if options.DoesExist("title")
|
if options.DoesExist("title")
|
||||||
dialog.title = options.title
|
dialog.title = options.title
|
||||||
end if
|
end if
|
||||||
@@ -66,7 +88,10 @@ namespace DialogUtils
|
|||||||
end if
|
end if
|
||||||
|
|
||||||
dialog = CreateObject("roSGNode", "TimedDialog")
|
dialog = CreateObject("roSGNode", "TimedDialog")
|
||||||
if GetInterface(message, "ifArray") = invalid
|
if IsString(message)
|
||||||
|
if message.Len() > MESSAGE_LENGTH_LIMIT
|
||||||
|
message = message.Left(MESSAGE_LENGTH_LIMIT) + "..."
|
||||||
|
end if
|
||||||
message = message.Tokenize(`\n`).ToArray()
|
message = message.Tokenize(`\n`).ToArray()
|
||||||
end if
|
end if
|
||||||
dialog.message = message
|
dialog.message = message
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
showDivider="false">
|
showDivider="false">
|
||||||
<Label
|
<Label
|
||||||
id="scanLabel"
|
id="scanLabel"
|
||||||
text="Scan the QR Code"
|
text="Scan the QR code"
|
||||||
horizAlign="center"
|
horizAlign="center"
|
||||||
wrap="true" width="400">
|
wrap="true" width="400">
|
||||||
<Font role="font" uri="font:SystemFontFile" size="24" />
|
<Font role="font" uri="font:SystemFontFile" size="24" />
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
import "pkg:/source/utils/StringUtils.bs"
|
||||||
|
|
||||||
|
namespace YouTubeLoginAccountItemUtils
|
||||||
|
|
||||||
|
function CreateProfileContentNode(accountItem as object, accessToken as object) as object
|
||||||
|
profile = CreateObject("roSGNode", "ProfileContentNode")
|
||||||
|
profile.type = "youtube"
|
||||||
|
profile.serverUrl = "http://127.0.0.1:8888/playlet-invidious-backend"
|
||||||
|
username = accountItem.channelHandle
|
||||||
|
if StringUtils.IsNullOrEmpty(username)
|
||||||
|
username = accountItem.accountByline
|
||||||
|
end if
|
||||||
|
profile.username = username
|
||||||
|
profile.activeIdentifyToken = accountItem.activeIdentifyToken
|
||||||
|
profile.thumbnail = accountItem.accountPhoto
|
||||||
|
profile.accessToken = accessToken.accessToken
|
||||||
|
profile.refreshToken = accessToken.refreshToken
|
||||||
|
profile.scope = accessToken.scope
|
||||||
|
profile.tokenType = accessToken.tokenType
|
||||||
|
profile.expiresIn = accessToken.expiresIn
|
||||||
|
profile.expiresTimestamp = accessToken.expiresTimestamp
|
||||||
|
profile.clientId = accessToken.clientId
|
||||||
|
profile.clientSecret = accessToken.clientSecret
|
||||||
|
|
||||||
|
return profile
|
||||||
|
end function
|
||||||
|
end namespace
|
||||||
@@ -1,6 +1,10 @@
|
|||||||
import "pkg:/source/AsyncTask/AsyncTask.bs"
|
import "pkg:/components/Dialog/DialogUtils.bs"
|
||||||
import "pkg:/source/AsyncTask/Tasks.bs"
|
import "pkg:/components/JobSystem/Jobs.bs"
|
||||||
|
import "pkg:/components/JobSystem/JobSystem.bs"
|
||||||
|
import "pkg:/components/Screens/ProfileScreen/YouTubeAccountSelectionView/YouTubeAccountSelectionViewUtils.bs"
|
||||||
|
import "pkg:/source/utils/ErrorUtils.bs"
|
||||||
import "pkg:/source/utils/Locale.bs"
|
import "pkg:/source/utils/Locale.bs"
|
||||||
|
import "pkg:/source/utils/Logging.bs"
|
||||||
import "pkg:/source/utils/Types.bs"
|
import "pkg:/source/utils/Types.bs"
|
||||||
|
|
||||||
function Init()
|
function Init()
|
||||||
@@ -19,15 +23,52 @@ function Init()
|
|||||||
m.top.observeFieldScoped("buttonSelected", FuncName(Close))
|
m.top.observeFieldScoped("buttonSelected", FuncName(Close))
|
||||||
m.top.observeFieldScoped("wasClosed", FuncName(OnWasClosed))
|
m.top.observeFieldScoped("wasClosed", FuncName(OnWasClosed))
|
||||||
scanLabel = m.top.findNode("scanLabel")
|
scanLabel = m.top.findNode("scanLabel")
|
||||||
' TODO:P2 localize all dialog items
|
|
||||||
scanLabel.text = Tr(Locale.Dialogs.ScanTheQrCode)
|
scanLabel.text = Tr(Locale.Dialogs.ScanTheQrCode)
|
||||||
|
linkInstructionLabel = m.top.findNode("linkInstructionLabel")
|
||||||
|
linkInstructionLabel.text = Tr(Locale.Dialogs.OpenLinkAndEnterFollowingCode).replace("%1", `'https://yt.be/activate'`)
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function OnNodeReady()
|
function OnNodeReady()
|
||||||
m.task = AsyncTask.Start(Tasks.YouTubeLoginTask, {
|
input = {
|
||||||
dialog: m.top
|
dialog: m.top
|
||||||
profilesService: m.top.profilesService
|
profilesService: m.top.profilesService
|
||||||
})
|
}
|
||||||
|
|
||||||
|
m.youTubeLoginJob = JobSystem.CreateCallback(OnYouTubeLoginJobDone)
|
||||||
|
JobSystem.QueueJob(m.jobQueue, Jobs.YouTubeLoginJob, input, m.youTubeLoginJob)
|
||||||
|
end function
|
||||||
|
|
||||||
|
function OnYouTubeLoginJobDone(event as object) as void
|
||||||
|
JobSystem.UnobserveCallback(event.getRoSGNode())
|
||||||
|
m.youTubeLoginJob = invalid
|
||||||
|
|
||||||
|
info = event.getInfo()
|
||||||
|
if info.cancel
|
||||||
|
Close()
|
||||||
|
return
|
||||||
|
end if
|
||||||
|
|
||||||
|
if not info.success
|
||||||
|
DialogUtils.ShowDialogEx({
|
||||||
|
message: info.error
|
||||||
|
title: Tr(Locale.Generic.Error)
|
||||||
|
large: true
|
||||||
|
})
|
||||||
|
return
|
||||||
|
end if
|
||||||
|
|
||||||
|
data = info.data
|
||||||
|
' if accounts is invalid, we're going to assume a profile is already created.
|
||||||
|
if data = invalid or data.accounts = invalid or data.accessToken = invalid
|
||||||
|
Close()
|
||||||
|
return
|
||||||
|
end if
|
||||||
|
|
||||||
|
' The accountSelectionView will take over the creation of the profile.
|
||||||
|
accountSelectionView = YouTubeAccountSelectionViewUtils.Open(m.top.appController)
|
||||||
|
accountSelectionView.accessToken = data.accessToken
|
||||||
|
accountSelectionView.accounts = data.accounts
|
||||||
|
Close()
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function OnCodeSet(event as object)
|
function OnCodeSet(event as object)
|
||||||
@@ -40,9 +81,9 @@ function Close()
|
|||||||
end function
|
end function
|
||||||
|
|
||||||
function OnWasClosed()
|
function OnWasClosed()
|
||||||
if m.task <> invalid
|
if m.youTubeLoginJob <> invalid
|
||||||
m.task.cancel = true
|
m.youTubeLoginJob.cancel = true
|
||||||
m.task = invalid
|
m.youTubeLoginJob = invalid
|
||||||
end if
|
end if
|
||||||
end function
|
end function
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
<component name="YouTubeLoginDialog" extends="StandardDialog" initialFocus="buttonArea" includes="AutoBind">
|
<component name="YouTubeLoginDialog" extends="StandardDialog" initialFocus="buttonArea" includes="AutoBind">
|
||||||
<interface>
|
<interface>
|
||||||
<field id="profilesService" type="node" bind="/ProfilesService" />
|
<field id="profilesService" type="node" bind="/ProfilesService" />
|
||||||
|
<field id="appController" type="node" bind="/AppController" />
|
||||||
|
<field id="jobQueue" type="node" bind="/JobQueue" />
|
||||||
<field id="code" type="string" alias="codeLabel.text" />
|
<field id="code" type="string" alias="codeLabel.text" />
|
||||||
<field id="url" type="string" onChange="OnUrlSet" />
|
<field id="url" type="string" onChange="OnUrlSet" />
|
||||||
<field id="alwaysOnTop" type="boolean" />
|
<field id="alwaysOnTop" type="boolean" />
|
||||||
@@ -10,7 +12,8 @@
|
|||||||
|
|
||||||
<StdDlgTitleArea primaryTitle="Login to YouTube" />
|
<StdDlgTitleArea primaryTitle="Login to YouTube" />
|
||||||
<StdDlgContentArea>
|
<StdDlgContentArea>
|
||||||
<StdDlgTextItem text="Open the link 'https://yt.be/activate' and enter the following code:" />
|
<!-- bs:disable-next-line LOCALE_MISSING_TRANSLATIONS -->
|
||||||
|
<StdDlgTextItem id="linkInstructionLabel" text="Open the link 'https://yt.be/activate' and enter the following code:" />
|
||||||
<StdDlgTextItem id="codeLabel" text="Loading..." />
|
<StdDlgTextItem id="codeLabel" text="Loading..." />
|
||||||
</StdDlgContentArea>
|
</StdDlgContentArea>
|
||||||
<StdDlgButtonArea id="buttonArea">
|
<StdDlgButtonArea id="buttonArea">
|
||||||
@@ -24,7 +27,7 @@
|
|||||||
showDivider="false">
|
showDivider="false">
|
||||||
<Label
|
<Label
|
||||||
id="scanLabel"
|
id="scanLabel"
|
||||||
text="Scan the QR Code"
|
text="Scan the QR code"
|
||||||
horizAlign="center"
|
horizAlign="center"
|
||||||
wrap="true" width="400">
|
wrap="true" width="400">
|
||||||
<Font role="font" uri="font:SystemFontFile" size="24" />
|
<Font role="font" uri="font:SystemFontFile" size="24" />
|
||||||
@@ -37,11 +40,11 @@
|
|||||||
loadHeight="300"
|
loadHeight="300"
|
||||||
padding="10"
|
padding="10"
|
||||||
translation="[50, 50]" />
|
translation="[50, 50]" />
|
||||||
<Label
|
<!-- bs:disable-next-line LOCALE_MISSING_TRANSLATIONS -->
|
||||||
|
<Label text="https://yt.be/activate"
|
||||||
horizAlign="center"
|
horizAlign="center"
|
||||||
width="400"
|
width="400"
|
||||||
translation="[0, 380]"
|
translation="[0, 380]">
|
||||||
text="https://yt.be/activate">
|
|
||||||
<Font role="font" uri="font:MediumSystemFontFile" size="18" />
|
<Font role="font" uri="font:MediumSystemFontFile" size="18" />
|
||||||
</Label>
|
</Label>
|
||||||
</StdDlgSideCardArea>
|
</StdDlgSideCardArea>
|
||||||
|
|||||||
@@ -0,0 +1,76 @@
|
|||||||
|
import "pkg:/components/Dialog/DialogUtils.bs"
|
||||||
|
import "pkg:/components/Dialog/YouTubeLoginAccountItemUtils.bs"
|
||||||
|
import "pkg:/components/Services/Innertube/InnertubeService.bs"
|
||||||
|
import "pkg:/source/utils/CancellationUtils.bs"
|
||||||
|
import "pkg:/source/utils/Logging.bs"
|
||||||
|
|
||||||
|
@job("YouTubeLoginJob")
|
||||||
|
function ExecuteJob() as void
|
||||||
|
input = JobGetInput()
|
||||||
|
|
||||||
|
profilesNode = input.profilesService
|
||||||
|
dialogNode = input.dialog
|
||||||
|
|
||||||
|
cancellation = JobGetCancellation()
|
||||||
|
' TODO:P2 cache client identity
|
||||||
|
authCode = InnertubeService.AuthGetCode(cancellation)
|
||||||
|
|
||||||
|
if CancellationUtils.IsCancelled(cancellation)
|
||||||
|
JobCancel()
|
||||||
|
return
|
||||||
|
end if
|
||||||
|
|
||||||
|
if authCode.error <> invalid
|
||||||
|
JobError(authCode.error)
|
||||||
|
return
|
||||||
|
end if
|
||||||
|
|
||||||
|
url = InnertubeService.AuthGetActivationUrl(authCode)
|
||||||
|
|
||||||
|
LogInfo("Login url:", url)
|
||||||
|
|
||||||
|
dialogNode.url = url
|
||||||
|
dialogNode.code = authCode.userCode
|
||||||
|
|
||||||
|
accessToken = InnertubeService.AuthPollForAccessToken(authCode, cancellation)
|
||||||
|
|
||||||
|
if CancellationUtils.IsCancelled(cancellation)
|
||||||
|
JobCancel()
|
||||||
|
return
|
||||||
|
end if
|
||||||
|
|
||||||
|
if accessToken.error <> invalid
|
||||||
|
JobError(accessToken.error)
|
||||||
|
return
|
||||||
|
end if
|
||||||
|
|
||||||
|
accounts = InnertubeService.AuthListAccounts(accessToken.accessToken, cancellation)
|
||||||
|
|
||||||
|
if CancellationUtils.IsCancelled(cancellation)
|
||||||
|
JobCancel()
|
||||||
|
return
|
||||||
|
end if
|
||||||
|
|
||||||
|
if IsAssociativeArray(accounts) and accounts.error <> invalid
|
||||||
|
JobError(accounts.error)
|
||||||
|
return
|
||||||
|
end if
|
||||||
|
|
||||||
|
if not IsArray(accounts) or accounts.Count() = 0
|
||||||
|
JobError(Tr(Locale.Dialogs.NoValidAccountsFound))
|
||||||
|
return
|
||||||
|
end if
|
||||||
|
|
||||||
|
' If there is only one account, we can skip the selection screen
|
||||||
|
' and just create a profile
|
||||||
|
if accounts.Count() = 1
|
||||||
|
profile = YouTubeLoginAccountItemUtils.CreateProfileContentNode(accounts[0], accessToken)
|
||||||
|
profilesNode@.LoginWithProfile(profile)
|
||||||
|
return
|
||||||
|
end if
|
||||||
|
|
||||||
|
JobSuccessData({
|
||||||
|
accounts: accounts
|
||||||
|
accessToken: accessToken
|
||||||
|
})
|
||||||
|
end function
|
||||||
@@ -1,118 +0,0 @@
|
|||||||
import "pkg:/components/Dialog/DialogUtils.bs"
|
|
||||||
import "pkg:/components/Services/Innertube/InnertubeService.bs"
|
|
||||||
import "pkg:/source/utils/CancellationUtils.bs"
|
|
||||||
import "pkg:/source/utils/Logging.bs"
|
|
||||||
|
|
||||||
@asynctask
|
|
||||||
function YouTubeLoginTask(input as object) as object
|
|
||||||
profilesNode = input.profilesService
|
|
||||||
dialogNode = input.dialog
|
|
||||||
|
|
||||||
cancellation = m.top.cancellation
|
|
||||||
' TODO:P2 cache client identity
|
|
||||||
authCode = InnertubeService.AuthGetCode(cancellation)
|
|
||||||
|
|
||||||
if CancellationUtils.IsCancelled(cancellation)
|
|
||||||
return invalid
|
|
||||||
end if
|
|
||||||
|
|
||||||
if authCode.error <> invalid
|
|
||||||
LogError(authCode.error)
|
|
||||||
DialogUtils.ShowDialogEx({
|
|
||||||
title: "Error"
|
|
||||||
message: authCode.error
|
|
||||||
large: true
|
|
||||||
})
|
|
||||||
return invalid
|
|
||||||
end if
|
|
||||||
|
|
||||||
url = InnertubeService.AuthGetActivationUrl(authCode)
|
|
||||||
|
|
||||||
LogInfo("Login url:", url)
|
|
||||||
|
|
||||||
dialogNode.url = url
|
|
||||||
dialogNode.code = authCode.userCode
|
|
||||||
|
|
||||||
accessToken = InnertubeService.AuthPollForAccessToken(authCode, cancellation)
|
|
||||||
|
|
||||||
if CancellationUtils.IsCancelled(cancellation)
|
|
||||||
return invalid
|
|
||||||
end if
|
|
||||||
|
|
||||||
if accessToken.error <> invalid
|
|
||||||
LogError(accessToken.error)
|
|
||||||
DialogUtils.ShowDialogEx({
|
|
||||||
title: "Error"
|
|
||||||
message: accessToken.error
|
|
||||||
large: true
|
|
||||||
})
|
|
||||||
return invalid
|
|
||||||
end if
|
|
||||||
|
|
||||||
accounts = InnertubeService.AuthListAccounts(accessToken.accessToken, cancellation)
|
|
||||||
|
|
||||||
if CancellationUtils.IsCancelled(cancellation)
|
|
||||||
return invalid
|
|
||||||
end if
|
|
||||||
|
|
||||||
if IsAssociativeArray(accounts) and accounts.error <> invalid
|
|
||||||
LogError(accounts.error)
|
|
||||||
DialogUtils.ShowDialogEx({
|
|
||||||
title: "Error"
|
|
||||||
message: accounts.error
|
|
||||||
large: true
|
|
||||||
})
|
|
||||||
return invalid
|
|
||||||
end if
|
|
||||||
|
|
||||||
if not IsArray(accounts) or accounts.Count() = 0
|
|
||||||
LogError("No accounts found")
|
|
||||||
DialogUtils.ShowDialogEx({
|
|
||||||
title: "Error"
|
|
||||||
message: "No accounts found"
|
|
||||||
large: true
|
|
||||||
})
|
|
||||||
return invalid
|
|
||||||
end if
|
|
||||||
|
|
||||||
selectedAccount = invalid
|
|
||||||
for each account in accounts
|
|
||||||
if ValidBool(account.isSelected)
|
|
||||||
selectedAccount = account
|
|
||||||
exit for
|
|
||||||
end if
|
|
||||||
end for
|
|
||||||
|
|
||||||
if selectedAccount = invalid
|
|
||||||
selectedAccount = accounts[0]
|
|
||||||
end if
|
|
||||||
|
|
||||||
profile = CreateProfileContentNode(selectedAccount, accessToken)
|
|
||||||
profilesNode@.LoginWithProfile(profile)
|
|
||||||
|
|
||||||
dialogNode.close = true
|
|
||||||
|
|
||||||
return invalid
|
|
||||||
end function
|
|
||||||
|
|
||||||
function CreateProfileContentNode(account as object, accessToken as object) as object
|
|
||||||
profile = CreateObject("roSGNode", "ProfileContentNode")
|
|
||||||
profile.type = "youtube"
|
|
||||||
profile.serverUrl = "http://127.0.0.1:8888/playlet-invidious-backend"
|
|
||||||
username = account.channelHandle
|
|
||||||
if StringUtils.IsNullOrEmpty(username)
|
|
||||||
username = account.accountByline
|
|
||||||
end if
|
|
||||||
profile.username = username
|
|
||||||
profile.thumbnail = account.accountPhoto
|
|
||||||
profile.accessToken = accessToken.accessToken
|
|
||||||
profile.refreshToken = accessToken.refreshToken
|
|
||||||
profile.scope = accessToken.scope
|
|
||||||
profile.tokenType = accessToken.tokenType
|
|
||||||
profile.expiresIn = accessToken.expiresIn
|
|
||||||
profile.expiresTimestamp = accessToken.expiresTimestamp
|
|
||||||
profile.clientId = accessToken.clientId
|
|
||||||
profile.clientSecret = accessToken.clientSecret
|
|
||||||
|
|
||||||
return profile
|
|
||||||
end function
|
|
||||||
@@ -0,0 +1,122 @@
|
|||||||
|
import "pkg:/source/utils/AssertUtils.bs"
|
||||||
|
import "pkg:/source/utils/CancellationUtils.bs"
|
||||||
|
import "pkg:/source/utils/ErrorUtils.bs"
|
||||||
|
import "pkg:/source/utils/Logging.bs"
|
||||||
|
import "pkg:/source/utils/MessagePortUtils.bs"
|
||||||
|
|
||||||
|
function JobGetInput() as dynamic
|
||||||
|
if m._input = invalid
|
||||||
|
m._input = m.top.input
|
||||||
|
end if
|
||||||
|
return m._input
|
||||||
|
end function
|
||||||
|
|
||||||
|
function JobGetCallbackNode() as dynamic
|
||||||
|
if m._callback = invalid
|
||||||
|
input = JobGetInput()
|
||||||
|
if input = invalid
|
||||||
|
return invalid
|
||||||
|
end if
|
||||||
|
m._callback = input._callback
|
||||||
|
end if
|
||||||
|
|
||||||
|
return m._callback
|
||||||
|
end function
|
||||||
|
|
||||||
|
function JobGetCancellation() as dynamic
|
||||||
|
return CancellationUtils.CreateCancellation(JobGetCallbackNode(), "cancel", true)
|
||||||
|
end function
|
||||||
|
|
||||||
|
function JobSuccess() as void
|
||||||
|
callbackNode = JobGetCallbackNode()
|
||||||
|
if callbackNode = invalid
|
||||||
|
return
|
||||||
|
end if
|
||||||
|
callbackNode.success = true
|
||||||
|
callbackNode.done = true
|
||||||
|
m.jobStateSet = true
|
||||||
|
end function
|
||||||
|
|
||||||
|
function JobSuccessData(data as dynamic) as void
|
||||||
|
callbackNode = JobGetCallbackNode()
|
||||||
|
if callbackNode = invalid
|
||||||
|
return
|
||||||
|
end if
|
||||||
|
callbackNode.data = data
|
||||||
|
callbackNode.success = true
|
||||||
|
callbackNode.done = true
|
||||||
|
m.jobStateSet = true
|
||||||
|
end function
|
||||||
|
|
||||||
|
function JobError(error as dynamic) as void
|
||||||
|
error = ErrorUtils.Format(error)
|
||||||
|
LogError(error)
|
||||||
|
callbackNode = JobGetCallbackNode()
|
||||||
|
if callbackNode = invalid
|
||||||
|
return
|
||||||
|
end if
|
||||||
|
callbackNode.error = error
|
||||||
|
callbackNode.success = false
|
||||||
|
callbackNode.done = true
|
||||||
|
m.jobStateSet = true
|
||||||
|
end function
|
||||||
|
|
||||||
|
function JobCancel() as void
|
||||||
|
callbackNode = JobGetCallbackNode()
|
||||||
|
if callbackNode = invalid
|
||||||
|
return
|
||||||
|
end if
|
||||||
|
|
||||||
|
callbackNode.cancel = true
|
||||||
|
callbackNode.success = false
|
||||||
|
callbackNode.done = true
|
||||||
|
m.jobStateSet = true
|
||||||
|
end function
|
||||||
|
|
||||||
|
function JobIsCancelled() as boolean
|
||||||
|
callbackNode = JobGetCallbackNode()
|
||||||
|
if callbackNode = invalid
|
||||||
|
return false
|
||||||
|
end if
|
||||||
|
|
||||||
|
return callbackNode.cancel = true
|
||||||
|
end function
|
||||||
|
|
||||||
|
function Execute(_unused as dynamic) as void
|
||||||
|
#if DEBUG
|
||||||
|
AssertNodeThreadInfo()
|
||||||
|
#end if
|
||||||
|
|
||||||
|
callback = JobGetCallbackNode()
|
||||||
|
if callback <> invalid
|
||||||
|
callback.queueFields(true)
|
||||||
|
end if
|
||||||
|
|
||||||
|
try
|
||||||
|
ExecuteJob()
|
||||||
|
catch error
|
||||||
|
JobError(error)
|
||||||
|
end try
|
||||||
|
if not m.jobStateSet = true
|
||||||
|
JobSuccess()
|
||||||
|
end if
|
||||||
|
|
||||||
|
if callback <> invalid
|
||||||
|
callback.queueFields(false)
|
||||||
|
end if
|
||||||
|
|
||||||
|
m._input = invalid
|
||||||
|
m._callback = invalid
|
||||||
|
end function
|
||||||
|
|
||||||
|
function ExecuteJob() as void
|
||||||
|
throw "ExecuteJob abstract method must be implemented in derived class"
|
||||||
|
end function
|
||||||
|
|
||||||
|
function AssertNodeThreadInfo() as void
|
||||||
|
threadInfo = m.top.threadInfo()
|
||||||
|
|
||||||
|
Assert.AreEqual(threadInfo.currentThread.type, "Task", "threadInfo.currentThread.type must be 'Task' for this job. This is a bug.")
|
||||||
|
Assert.AreEqual(threadInfo.node.owningThread.id, threadInfo.currentThread.id, "This job must be executed on the same thread that created it. This is a bug.")
|
||||||
|
Assert.AreEqual(threadInfo.node.willRendezvousFromCurrentThread, "No", "threadInfo.node.willRendezvousFromCurrentThread must be 'No' for this job. This is a bug.")
|
||||||
|
end function
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
<component name="BaseJob" extends="Node">
|
||||||
|
<interface>
|
||||||
|
<field id="input" type="assocarray" />
|
||||||
|
|
||||||
|
<function name="Execute" />
|
||||||
|
</interface>
|
||||||
|
</component>
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<component name="JobCallback" extends="Node">
|
||||||
|
<interface>
|
||||||
|
<field id="done" type="boolean" />
|
||||||
|
<field id="success" type="boolean" />
|
||||||
|
<field id="error" type="string" />
|
||||||
|
<field id="data" type="assocarray" />
|
||||||
|
<!-- read/write field, can be used to cancel a job, and to check for cancellation. -->
|
||||||
|
<field id="cancel" type="boolean" />
|
||||||
|
</interface>
|
||||||
|
</component>
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
import "pkg:/source/utils/MessagePortUtils.bs"
|
||||||
|
import "pkg:/source/utils/Types.bs"
|
||||||
|
|
||||||
|
function Init()
|
||||||
|
m.jobQueueTaskReady = false
|
||||||
|
m.jobQueueTask = CreateObject("roSGNode", "JobQueueTask")
|
||||||
|
m.jobQueueTask.observeFieldScoped("ready", FuncName(OnJobQueueTaskReady))
|
||||||
|
m.jobQueueTask.control = "run"
|
||||||
|
m.top.observeField("shutdown", FuncName(OnShutdown))
|
||||||
|
m.top.observeField("request", FuncName(OnRequest))
|
||||||
|
end function
|
||||||
|
|
||||||
|
function OnJobQueueTaskReady(event as object) as void
|
||||||
|
jobQueueTask = event.getRoSGNode()
|
||||||
|
jobQueueTask.unobserveFieldScoped("ready")
|
||||||
|
|
||||||
|
m.jobQueueTaskReady = true
|
||||||
|
|
||||||
|
pendingRequestEvents = m.pendingRequestEvents
|
||||||
|
if pendingRequestEvents = invalid
|
||||||
|
return
|
||||||
|
end if
|
||||||
|
|
||||||
|
m.pendingRequestEvents = invalid
|
||||||
|
for each requestEvent in pendingRequestEvents
|
||||||
|
OnRequest(requestEvent)
|
||||||
|
end for
|
||||||
|
end function
|
||||||
|
|
||||||
|
function OnShutdown() as void
|
||||||
|
m.top.unobserveField("shutdown")
|
||||||
|
m.top.unobserveField("request")
|
||||||
|
m.jobQueueTaskReady = false
|
||||||
|
m.jobQueueTask.unobserveField("ready")
|
||||||
|
m.jobQueueTask.shutdown = true
|
||||||
|
m.jobQueueTask = invalid
|
||||||
|
m.pendingRequestEvents = invalid
|
||||||
|
end function
|
||||||
|
|
||||||
|
function OnRequest(event as object) as void
|
||||||
|
if not m.jobQueueTaskReady
|
||||||
|
if m.pendingRequestEvents = invalid
|
||||||
|
m.pendingRequestEvents = []
|
||||||
|
end if
|
||||||
|
m.pendingRequestEvents.push(event)
|
||||||
|
LogWarnNoTelemetry("JobQueue: Job queue task is not ready, request will be queued")
|
||||||
|
return
|
||||||
|
end if
|
||||||
|
|
||||||
|
request = event.getData()
|
||||||
|
if not IsAssociativeArray(request)
|
||||||
|
LogError("JobQueue: Invalid request data", request)
|
||||||
|
return
|
||||||
|
end if
|
||||||
|
|
||||||
|
m.jobQueueTask.request = request
|
||||||
|
end function
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<component name="JobQueue" extends="Node">
|
||||||
|
<interface>
|
||||||
|
<field id="request" type="assocarray" />
|
||||||
|
<field id="shutdown" type="boolean" />
|
||||||
|
</interface>
|
||||||
|
</component>
|
||||||
@@ -0,0 +1,116 @@
|
|||||||
|
import "pkg:/source/utils/Logging.bs"
|
||||||
|
import "pkg:/source/utils/MessagePortUtils.bs"
|
||||||
|
import "pkg:/source/utils/StringUtils.bs"
|
||||||
|
|
||||||
|
' Maximum number of JobTasks that can be created
|
||||||
|
' https://developer.roku.com/en-ca/docs/developer-program/core-concepts/threads.md
|
||||||
|
' "Developers should take steps to ensure that their apps always remain well under the 50-thread "warning" limit."
|
||||||
|
' Accounting for other types of long running Tasks in the app, this limit should be way lower than 50.
|
||||||
|
const MAX_JOB_TASK_COUNT = 30
|
||||||
|
' Minimum number of JobTasks that will be kept alive
|
||||||
|
const MIN_JOB_TASK_COUNT = 2
|
||||||
|
' Time in milliseconds to wait before scaling down JobTasks
|
||||||
|
const SCALE_DOWN_THRESHOLD_MS = 10000
|
||||||
|
|
||||||
|
function Init()
|
||||||
|
m.top.functionName = "JobQueueTaskLoop"
|
||||||
|
end function
|
||||||
|
|
||||||
|
function JobQueueTaskLoop() as void
|
||||||
|
messagePort = CreateObject("roMessagePort")
|
||||||
|
|
||||||
|
m.top.observeField("shutdown", messagePort)
|
||||||
|
m.top.observeField("request", messagePort)
|
||||||
|
|
||||||
|
m.top.ready = true
|
||||||
|
|
||||||
|
m.busyJobTasks = {}
|
||||||
|
m.idleJobTasks = []
|
||||||
|
|
||||||
|
requests = []
|
||||||
|
|
||||||
|
while true
|
||||||
|
while requests.count() > 0
|
||||||
|
if m.idleJobTasks.Count() > 0
|
||||||
|
ScheduleRequest(requests.Shift(), m.idleJobTasks.Pop())
|
||||||
|
continue while
|
||||||
|
end if
|
||||||
|
|
||||||
|
if m.idleJobTasks.Count() + m.busyJobTasks.Count() < MAX_JOB_TASK_COUNT
|
||||||
|
LogDebug("Creating a new JobTask. Idle:", m.idleJobTasks.Count(), ", Busy:", m.busyJobTasks.Count())
|
||||||
|
jobTask = CreateObject("roSGNode", "JobTask")
|
||||||
|
jobTaskId = "JobTask-" + StringUtils.RandomId()
|
||||||
|
jobTask.id = jobTaskId
|
||||||
|
jobTaskObject = {
|
||||||
|
id: jobTaskId
|
||||||
|
node: jobTask
|
||||||
|
}
|
||||||
|
m.busyJobTasks[jobTaskId] = jobTaskObject
|
||||||
|
MessagePortUtils.ObserveFieldScopedExSafe(jobTask, "ready", messagePort)
|
||||||
|
jobTask.control = "run"
|
||||||
|
else
|
||||||
|
#if DEBUG
|
||||||
|
LogWarnNoTelemetry("Cannot create new JobTask. Idle:", m.idleJobTasks.Count(), ", Busy:", m.busyJobTasks.Count())
|
||||||
|
#end if
|
||||||
|
end if
|
||||||
|
|
||||||
|
exit while
|
||||||
|
end while
|
||||||
|
|
||||||
|
scaleDownThresholdMs = m.idleJobTasks.Count() > MIN_JOB_TASK_COUNT ? SCALE_DOWN_THRESHOLD_MS : 0
|
||||||
|
message = wait(scaleDownThresholdMs, messagePort)
|
||||||
|
if message = invalid
|
||||||
|
if m.idleJobTasks.Count() > 0
|
||||||
|
jobTaskObject = m.idleJobTasks.Pop()
|
||||||
|
jobTaskObject.node.UnobserveFieldScoped("ready")
|
||||||
|
jobTaskObject.node.shutdown = true
|
||||||
|
LogDebug("Scaled down JobTasks. Idle:", m.idleJobTasks.Count(), ", Busy:", m.busyJobTasks.Count())
|
||||||
|
end if
|
||||||
|
continue while
|
||||||
|
end if
|
||||||
|
|
||||||
|
messageType = Type(message)
|
||||||
|
if messageType = "roSGNodeEvent"
|
||||||
|
field = message.GetField()
|
||||||
|
|
||||||
|
if field = "request"
|
||||||
|
request = message.GetData()
|
||||||
|
requests.Push(request)
|
||||||
|
else if field = "ready" and message.GetData()
|
||||||
|
jobTaskId = message.GetNode()
|
||||||
|
jobTaskObject = m.busyJobTasks[jobTaskId]
|
||||||
|
m.busyJobTasks.Delete(jobTaskId)
|
||||||
|
m.idleJobTasks.Push(jobTaskObject)
|
||||||
|
else if field = "shutdown" and message.GetData()
|
||||||
|
Shutdown()
|
||||||
|
return
|
||||||
|
end if
|
||||||
|
end if
|
||||||
|
end while
|
||||||
|
end function
|
||||||
|
|
||||||
|
function ScheduleRequest(request as dynamic, jobTaskObject as dynamic)
|
||||||
|
m.busyJobTasks[jobTaskObject.id] = jobTaskObject
|
||||||
|
jobTaskObject.node.request = request
|
||||||
|
end function
|
||||||
|
|
||||||
|
function Shutdown()
|
||||||
|
m.top.UnobserveFieldScoped("request")
|
||||||
|
m.top.UnobserveFieldScoped("shutdown")
|
||||||
|
m.top.request = invalid
|
||||||
|
m.top.ready = false
|
||||||
|
|
||||||
|
for each jobTaskId in m.busyJobTasks
|
||||||
|
jobTask = m.busyJobTasks[jobTaskId]
|
||||||
|
jobTask.node.UnobserveFieldScoped("ready")
|
||||||
|
jobTask.node.shutdown = true
|
||||||
|
end for
|
||||||
|
|
||||||
|
for each jobTask in m.idleJobTasks
|
||||||
|
jobTask.node.UnobserveFieldScoped("ready")
|
||||||
|
jobTask.node.shutdown = true
|
||||||
|
end for
|
||||||
|
|
||||||
|
m.busyJobTasks = invalid
|
||||||
|
m.idleJobTasks = invalid
|
||||||
|
end function
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
<component name="JobQueueTask" extends="Task">
|
||||||
|
<interface>
|
||||||
|
<field id="request" type="assocarray" />
|
||||||
|
<field id="shutdown" type="boolean" />
|
||||||
|
<field id="ready" type="boolean" />
|
||||||
|
</interface>
|
||||||
|
</component>
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
import "pkg:/source/utils/AssertUtils.bs"
|
||||||
|
import "pkg:/source/utils/StringUtils.bs"
|
||||||
|
|
||||||
|
namespace JobRequest
|
||||||
|
function Execute(request as object) as void
|
||||||
|
#if DEBUG
|
||||||
|
Assert.NotNullOrEmpty(request, "JobRequest.Execute: request cannot be null or empty")
|
||||||
|
Assert.NotNullOrEmpty(request.jobName, "JobRequest.Execute: request cannot be null or empty")
|
||||||
|
#end if
|
||||||
|
|
||||||
|
job = CreateObject("roSGNode", request.jobName)
|
||||||
|
if job = invalid
|
||||||
|
error = "Failed to create job node: " + request.jobName
|
||||||
|
LogError(error)
|
||||||
|
' Usually callback is fired by the job itself, but if it fails to create, we can call it here
|
||||||
|
if request.input <> invalid and request.input._callback <> invalid
|
||||||
|
request.input._callback.error = error
|
||||||
|
request.input._callback.success = false
|
||||||
|
request.input._callback.done = true
|
||||||
|
end if
|
||||||
|
return
|
||||||
|
end if
|
||||||
|
job.id = request.jobName + "-" + StringUtils.RandomId()
|
||||||
|
|
||||||
|
if request.input <> invalid
|
||||||
|
job.input = request.input
|
||||||
|
end if
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
LogDebug("Executing job:", request.jobName)
|
||||||
|
time = CreateObject("roTimespan")
|
||||||
|
#end if
|
||||||
|
|
||||||
|
job@.Execute()
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
LogDebug("Job executed:", request.jobName, "in", time.TotalMilliseconds(), "ms")
|
||||||
|
#end if
|
||||||
|
|
||||||
|
job.input = invalid
|
||||||
|
end function
|
||||||
|
end namespace
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
import "pkg:/source/utils/StringUtils.bs"
|
||||||
|
import "pkg:/source/utils/Types.bs"
|
||||||
|
|
||||||
|
namespace JobSystem
|
||||||
|
|
||||||
|
function CreateCallback(func = invalid as dynamic) as object
|
||||||
|
node = CreateObject("roSGNode", "JobCallback")
|
||||||
|
node.id = "JobCallback-" + StringUtils.RandomId()
|
||||||
|
if IsFunction(func)
|
||||||
|
node.observeFieldScoped("done", FuncName(func), ["success", "cancel", "error", "data"])
|
||||||
|
end if
|
||||||
|
return node
|
||||||
|
end function
|
||||||
|
|
||||||
|
function UnobserveCallback(callbackNode as object) as void
|
||||||
|
if callbackNode <> invalid
|
||||||
|
callbackNode.UnobserveFieldScoped("done")
|
||||||
|
end if
|
||||||
|
end function
|
||||||
|
|
||||||
|
function QueueJob(jobQueue as object, jobName as string, input = invalid as dynamic, callbackNode = invalid as dynamic) as void
|
||||||
|
if callbackNode <> invalid
|
||||||
|
if input = invalid
|
||||||
|
input = {}
|
||||||
|
end if
|
||||||
|
input._callback = callbackNode
|
||||||
|
end if
|
||||||
|
|
||||||
|
jobQueue.request = {
|
||||||
|
"jobName": jobName
|
||||||
|
"input": input
|
||||||
|
}
|
||||||
|
end function
|
||||||
|
|
||||||
|
end namespace
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
import "pkg:/components/JobSystem/JobRequest.bs"
|
||||||
|
import "pkg:/source/utils/Logging.bs"
|
||||||
|
import "pkg:/source/utils/StringUtils.bs"
|
||||||
|
|
||||||
|
function Init()
|
||||||
|
m.top.functionName = "JobTaskLoop"
|
||||||
|
end function
|
||||||
|
|
||||||
|
function JobTaskLoop() as void
|
||||||
|
msgPort = CreateObject("roMessagePort")
|
||||||
|
|
||||||
|
m.top.observeField("shutdown", msgPort)
|
||||||
|
m.top.observeField("request", msgPort)
|
||||||
|
|
||||||
|
m.top.ready = true
|
||||||
|
|
||||||
|
while true
|
||||||
|
msg = wait(0, msgPort)
|
||||||
|
msgType = type(msg)
|
||||||
|
|
||||||
|
if msgType = "roSGNodeEvent"
|
||||||
|
field = msg.GetField()
|
||||||
|
if field = "shutdown" and msg.getData()
|
||||||
|
m.top.request = invalid
|
||||||
|
return
|
||||||
|
end if
|
||||||
|
if field = "request"
|
||||||
|
request = msg.getData()
|
||||||
|
JobRequest.Execute(request)
|
||||||
|
m.top.ready = true
|
||||||
|
end if
|
||||||
|
end if
|
||||||
|
end while
|
||||||
|
end function
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
<component name="JobTask" extends="Task">
|
||||||
|
<interface>
|
||||||
|
<field id="ready" type="boolean" alwaysNotify="true" />
|
||||||
|
<field id="shutdown" type="boolean" />
|
||||||
|
<field id="request" type="assocarray" />
|
||||||
|
</interface>
|
||||||
|
</component>
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
import "pkg:/source/utils/CancellationUtils.bs"
|
||||||
|
import "pkg:/source/utils/Logging.bs"
|
||||||
|
|
||||||
|
@job("SimpleTestJob")
|
||||||
|
function ExecuteJob() as void
|
||||||
|
input = JobGetInput()
|
||||||
|
|
||||||
|
if JobIsCancelled()
|
||||||
|
JobCancel()
|
||||||
|
LogInfo("Job cancelled before execution")
|
||||||
|
return
|
||||||
|
end if
|
||||||
|
|
||||||
|
sleepTimeMs = ValidInt(input.sleep)
|
||||||
|
if sleepTimeMs > 0
|
||||||
|
callback = JobGetCallbackNode()
|
||||||
|
if callback <> invalid
|
||||||
|
messagePort = CreateObject("roMessagePort")
|
||||||
|
cancellation = CancellationUtils.CreateCancellation(callback, "cancel", true)
|
||||||
|
CancellationUtils.ObserveCancellationScoped(cancellation, messagePort)
|
||||||
|
message = wait(sleepTimeMs, messagePort)
|
||||||
|
CancellationUtils.UnobserveCancellationScoped(cancellation)
|
||||||
|
if CancellationUtils.IsCancellationEvent(cancellation, message)
|
||||||
|
LogInfo("Job cancelled during execution")
|
||||||
|
JobCancel()
|
||||||
|
return
|
||||||
|
end if
|
||||||
|
else
|
||||||
|
sleep(sleepTimeMs)
|
||||||
|
end if
|
||||||
|
end if
|
||||||
|
|
||||||
|
if not input.success
|
||||||
|
JobError("Simulated job error for testing purposes")
|
||||||
|
return
|
||||||
|
end if
|
||||||
|
|
||||||
|
LogInfo("Simulated job success for testing purposes")
|
||||||
|
end function
|
||||||
@@ -3,6 +3,11 @@ import "pkg:/source/utils/MessagePortUtils.bs"
|
|||||||
import "pkg:/source/utils/StringUtils.bs"
|
import "pkg:/source/utils/StringUtils.bs"
|
||||||
import "pkg:/source/utils/Types.bs"
|
import "pkg:/source/utils/Types.bs"
|
||||||
|
|
||||||
|
const FOLDER = "cachefs:/logs"
|
||||||
|
const FILENAME = "app_logs.txt"
|
||||||
|
const FILENAME_PREVIOUS = "app_logs_previous.txt"
|
||||||
|
const FILENAME_STARTUP = "cachefs:/playlet_startup_logs.txt"
|
||||||
|
|
||||||
function Init()
|
function Init()
|
||||||
m.top.functionName = "LoggerLoop"
|
m.top.functionName = "LoggerLoop"
|
||||||
|
|
||||||
@@ -11,7 +16,17 @@ function Init()
|
|||||||
m.top.ObserveField("logLine", port)
|
m.top.ObserveField("logLine", port)
|
||||||
|
|
||||||
scene = m.top.getScene()
|
scene = m.top.getScene()
|
||||||
MessagePortUtils.ObserveFieldScopedExSafe(scene, "systemLogEvent", port)
|
if scene.hasField("systemLogEvent")
|
||||||
|
MessagePortUtils.ObserveFieldScopedExSafe(scene, "systemLogEvent", port)
|
||||||
|
if scene.hasField("enableSystemLogType")
|
||||||
|
scene.enableSystemLogType = "http.error"
|
||||||
|
#if DEBUG
|
||||||
|
scene.enableSystemLogType = "http.connect"
|
||||||
|
scene.enableSystemLogType = "http.complete"
|
||||||
|
scene.enableSystemLogType = "bandwidth.minute"
|
||||||
|
#end if
|
||||||
|
end if
|
||||||
|
end if
|
||||||
|
|
||||||
m.port = port
|
m.port = port
|
||||||
|
|
||||||
@@ -36,24 +51,24 @@ function LoggerLoop()
|
|||||||
port = m.port
|
port = m.port
|
||||||
|
|
||||||
buffer = CreateObject("roByteArray")
|
buffer = CreateObject("roByteArray")
|
||||||
logsFile = m.top.folder + "/" + m.top.filename
|
logsFile = FOLDER + "/" + FILENAME
|
||||||
previousLogsFile = m.top.folder + "/" + m.top.filenamePrevious
|
previousLogsFile = FOLDER + "/" + FILENAME_PREVIOUS
|
||||||
filenameStartup = m.top.filenameStartup
|
|
||||||
dateTime = CreateObject("roDateTime")
|
dateTime = CreateObject("roDateTime")
|
||||||
|
|
||||||
CreateDirectory(m.top.folder)
|
CreateDirectory(FOLDER)
|
||||||
DeleteFile(previousLogsFile)
|
DeleteFile(previousLogsFile)
|
||||||
MoveFile(logsFile, previousLogsFile)
|
MoveFile(logsFile, previousLogsFile)
|
||||||
|
|
||||||
startUpLogs = ReadAsciiFile(filenameStartup)
|
startUpLogs = ReadAsciiFile(FILENAME_STARTUP)
|
||||||
if not StringUtils.IsNullOrEmpty(startUpLogs)
|
if not StringUtils.IsNullOrEmpty(startUpLogs)
|
||||||
line = `************* Startup Logs *************\n${startUpLogs}*********** End Startup Logs ***********\n`
|
line = `************* Startup Logs *************\n${startUpLogs}*********** End Startup Logs ***********\n`
|
||||||
' bs:disable-next-line LINT3012
|
|
||||||
print line
|
print line
|
||||||
buffer.FromAsciiString(line)
|
buffer.FromAsciiString(line)
|
||||||
buffer.AppendFile(logsFile)
|
buffer.AppendFile(logsFile)
|
||||||
end if
|
end if
|
||||||
|
|
||||||
|
m.eventThrottleTimer = CreateObject("roTimespan")
|
||||||
|
|
||||||
appMemoryMonitor = CreateObject("roAppMemoryMonitor")
|
appMemoryMonitor = CreateObject("roAppMemoryMonitor")
|
||||||
if appMemoryMonitor <> invalid and FindMemberFunction(appMemoryMonitor, "EnableMemoryWarningEvent") <> invalid
|
if appMemoryMonitor <> invalid and FindMemberFunction(appMemoryMonitor, "EnableMemoryWarningEvent") <> invalid
|
||||||
appMemoryMonitor.SetMessagePort(port)
|
appMemoryMonitor.SetMessagePort(port)
|
||||||
@@ -85,9 +100,7 @@ end function
|
|||||||
|
|
||||||
function OnLineLog(event as object, dateTime as object, logsFile as string, buffer as object)
|
function OnLineLog(event as object, dateTime as object, logsFile as string, buffer as object)
|
||||||
line = FormatTime(dateTime) + event.getData()
|
line = FormatTime(dateTime) + event.getData()
|
||||||
' bs:disable-next-line LINT3012
|
|
||||||
print line
|
print line
|
||||||
|
|
||||||
buffer.FromAsciiString(line + `\n`)
|
buffer.FromAsciiString(line + `\n`)
|
||||||
buffer.AppendFile(logsFile)
|
buffer.AppendFile(logsFile)
|
||||||
end function
|
end function
|
||||||
@@ -98,22 +111,40 @@ function OnLineSysLog(event as object, dateTime as object, logsFile as string, b
|
|||||||
return
|
return
|
||||||
end if
|
end if
|
||||||
line = FormatTime(dateTime) + "[ERROR][SysLog] " + ToString(info)
|
line = FormatTime(dateTime) + "[ERROR][SysLog] " + ToString(info)
|
||||||
' bs:disable-next-line LINT3012
|
|
||||||
print line
|
print line
|
||||||
|
|
||||||
buffer.FromAsciiString(line + `\n`)
|
buffer.FromAsciiString(line + `\n`)
|
||||||
buffer.AppendFile(logsFile)
|
buffer.AppendFile(logsFile)
|
||||||
|
|
||||||
|
fingerprint = `SysLog${info.Status}${info.LogType}${info.HttpCode}${info.Method}`
|
||||||
|
|
||||||
|
if ThrottleEvent("SysLogError", fingerprint, 60)
|
||||||
|
return
|
||||||
|
end if
|
||||||
|
|
||||||
|
LogTelemetryEvent({
|
||||||
|
level: "error"
|
||||||
|
message: line + `\nCurrentTime: ${m.eventThrottleTimer.TotalSeconds()}`
|
||||||
|
fingerprint: [fingerprint]
|
||||||
|
})
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function OnLineLogMonitorMemoryWarning(event as object, dateTime as object, logsFile as string, buffer as object) as void
|
function OnLineLogMonitorMemoryWarning(event as object, dateTime as object, logsFile as string, buffer as object) as void
|
||||||
info = event.getInfo()
|
info = event.getInfo()
|
||||||
line = FormatTime(dateTime) + "[WARN][AppMonitorMemory] " + ToString(info)
|
message = "[WARN][AppMonitorMemory] " + ToString(info)
|
||||||
|
line = FormatTime(dateTime) + message
|
||||||
' bs:disable-next-line LINT3012
|
|
||||||
print line
|
print line
|
||||||
|
|
||||||
buffer.FromAsciiString(line + `\n`)
|
buffer.FromAsciiString(line + `\n`)
|
||||||
buffer.AppendFile(logsFile)
|
buffer.AppendFile(logsFile)
|
||||||
|
|
||||||
|
if ThrottleEvent("AppMonitorMemoryWarning", message, 60)
|
||||||
|
return
|
||||||
|
end if
|
||||||
|
|
||||||
|
LogTelemetryEvent({
|
||||||
|
level: "warning"
|
||||||
|
message: line + `\nCurrentTime: ${m.eventThrottleTimer.TotalSeconds()}`
|
||||||
|
fingerprint: [message]
|
||||||
|
})
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function OnLineLogDeviceInfoMemoryWarning(event as object, dateTime as object, logsFile as string, buffer as object) as void
|
function OnLineLogDeviceInfoMemoryWarning(event as object, dateTime as object, logsFile as string, buffer as object) as void
|
||||||
@@ -122,19 +153,35 @@ function OnLineLogDeviceInfoMemoryWarning(event as object, dateTime as object, l
|
|||||||
return
|
return
|
||||||
end if
|
end if
|
||||||
|
|
||||||
' roDeviceInfoEvent can be a bit spammy, so only log if the memory level has changed
|
if ThrottleEvent("DeviceInfoMemoryWarning", info.generalMemoryLevel, 60)
|
||||||
if info.generalMemoryLevel = m.lastDeviceInfoMemoryLevel
|
|
||||||
return
|
return
|
||||||
end if
|
end if
|
||||||
m.lastDeviceInfoMemoryLevel = info.generalMemoryLevel
|
|
||||||
|
|
||||||
line = FormatTime(dateTime) + "[WARN][DeviceInfoMemory] " + ToString(info)
|
message = "[WARN][DeviceInfoMemory] " + ToString(info)
|
||||||
|
line = FormatTime(dateTime) + message
|
||||||
' bs:disable-next-line LINT3012
|
|
||||||
print line
|
print line
|
||||||
|
|
||||||
buffer.FromAsciiString(line + `\n`)
|
buffer.FromAsciiString(line + `\n`)
|
||||||
buffer.AppendFile(logsFile)
|
buffer.AppendFile(logsFile)
|
||||||
|
|
||||||
|
LogTelemetryEvent({
|
||||||
|
level: "warning"
|
||||||
|
message: line + `\nCurrentTime: ${m.eventThrottleTimer.TotalSeconds()}`
|
||||||
|
fingerprint: [message]
|
||||||
|
})
|
||||||
|
end function
|
||||||
|
|
||||||
|
' Returns true if the event should be throttled
|
||||||
|
function ThrottleEvent(key as string, fingerprint as string, throttleSeconds as integer) as boolean
|
||||||
|
lastSentTime = ValidInt(m[key])
|
||||||
|
currentTime = m.eventThrottleTimer.TotalSeconds()
|
||||||
|
|
||||||
|
if ((currentTime - lastSentTime) < throttleSeconds) and (m[key + "Fingerprint"] = fingerprint)
|
||||||
|
return true
|
||||||
|
end if
|
||||||
|
|
||||||
|
m[key] = currentTime
|
||||||
|
m[key + "Fingerprint"] = fingerprint
|
||||||
|
return false
|
||||||
end function
|
end function
|
||||||
|
|
||||||
' Note: although the timestamp should be captured in the caller, not the logger,
|
' Note: although the timestamp should be captured in the caller, not the logger,
|
||||||
@@ -143,27 +190,10 @@ function FormatTime(dateTime as object) as string
|
|||||||
dateTime.Mark()
|
dateTime.Mark()
|
||||||
dateTime.ToLocalTime()
|
dateTime.ToLocalTime()
|
||||||
|
|
||||||
hours = dateTime.GetHours().ToStr()
|
hours = dateTime.GetHours().ToStr("%02d")
|
||||||
if hours.Len() = 1
|
minutes = dateTime.GetMinutes().ToStr("%02d")
|
||||||
hours = "0" + hours
|
seconds = dateTime.GetSeconds().ToStr("%02d")
|
||||||
end if
|
milliseconds = dateTime.GetMilliseconds().ToStr("%03d")
|
||||||
|
|
||||||
minutes = dateTime.GetMinutes().ToStr()
|
|
||||||
if minutes.Len() = 1
|
|
||||||
minutes = "0" + minutes
|
|
||||||
end if
|
|
||||||
|
|
||||||
seconds = dateTime.GetSeconds().ToStr()
|
|
||||||
if seconds.Len() = 1
|
|
||||||
seconds = "0" + seconds
|
|
||||||
end if
|
|
||||||
|
|
||||||
milliseconds = dateTime.GetMilliseconds().ToStr()
|
|
||||||
if milliseconds.Len() = 1
|
|
||||||
milliseconds = "00" + milliseconds
|
|
||||||
else if milliseconds.Len() = 2
|
|
||||||
milliseconds = "0" + milliseconds
|
|
||||||
end if
|
|
||||||
|
|
||||||
return "[" + hours + ":" + minutes + ":" + seconds + "." + milliseconds + "]"
|
return "[" + hours + ":" + minutes + ":" + seconds + "." + milliseconds + "]"
|
||||||
end function
|
end function
|
||||||
@@ -2,9 +2,5 @@
|
|||||||
<interface>
|
<interface>
|
||||||
<field id="logLevel" type="int" value="2" />
|
<field id="logLevel" type="int" value="2" />
|
||||||
<field id="logLine" type="string" alwaysNotify="true" />
|
<field id="logLine" type="string" alwaysNotify="true" />
|
||||||
<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>
|
</interface>
|
||||||
</component>
|
</component>
|
||||||
@@ -33,14 +33,21 @@ function SetScenePalette(scene as object) as void
|
|||||||
scene.palette = palette
|
scene.palette = palette
|
||||||
end function
|
end function
|
||||||
|
|
||||||
|
const HAS_ANNOUNCEMENT = false
|
||||||
|
|
||||||
function MainSceneContainerChanged()
|
function MainSceneContainerChanged()
|
||||||
AutoBindSceneGraph()
|
AutoBindSceneGraph()
|
||||||
StartWebServer()
|
StartWebServer()
|
||||||
HideLoadingScreen()
|
HideLoadingScreen()
|
||||||
InitEcpArgs()
|
InitEcpArgs()
|
||||||
m.scene.signalBeacon("AppLaunchComplete")
|
if HAS_ANNOUNCEMENT
|
||||||
|
if not ShowAnnouncement()
|
||||||
|
m.scene.signalBeacon("AppLaunchComplete")
|
||||||
|
end if
|
||||||
|
else
|
||||||
|
m.scene.signalBeacon("AppLaunchComplete")
|
||||||
|
end if
|
||||||
CopyLoadingMessagesToCache()
|
CopyLoadingMessagesToCache()
|
||||||
ShowAnnouncement()
|
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function StartWebServer()
|
function StartWebServer()
|
||||||
@@ -54,29 +61,29 @@ function StartWebServer()
|
|||||||
m.dialServer@.StartServer()
|
m.dialServer@.StartServer()
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function ShowAnnouncement() as void
|
function ShowAnnouncement() as boolean
|
||||||
dialog = DialogUtils.ShowDialogOnce({
|
dialog = DialogUtils.ShowDialogOnce({
|
||||||
messageId: "1747362859"
|
messageId: "1755469284"
|
||||||
title: "Announcement - YouTube account support"
|
title: "Playback fixes - Canary build"
|
||||||
message: [
|
message: [
|
||||||
"YouTube account support is now available in Playlet!"
|
"Thank you for helping test the latest changes by using the Canary build of Playlet!"
|
||||||
`Subscriptions, playlists, watch history and "Recommended" are now available in the app.`
|
"If you encounter any issues with playback, please report them on the GitHub issue tracker."
|
||||||
"If you encounter any issues, please report them on GitHub."
|
|
||||||
"https://github.com/iBicha/playlet/issues"
|
"https://github.com/iBicha/playlet/issues"
|
||||||
"Thank you."
|
|
||||||
]
|
]
|
||||||
alwaysOnTop: true
|
alwaysOnTop: true
|
||||||
marginWidth: 180
|
large: true
|
||||||
})
|
})
|
||||||
|
|
||||||
if dialog = invalid
|
if dialog = invalid
|
||||||
return
|
return false
|
||||||
end if
|
end if
|
||||||
|
|
||||||
m.scene.signalBeacon("AppDialogInitiate")
|
m.scene.signalBeacon("AppDialogInitiate")
|
||||||
m.top.observeField("wasClosed", FuncName(OnAnnouncementDialogClosed))
|
dialog.observeField("wasClosed", FuncName(OnAnnouncementDialogClosed))
|
||||||
|
return true
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function OnAnnouncementDialogClosed()
|
function OnAnnouncementDialogClosed()
|
||||||
m.scene.signalBeacon("AppDialogComplete")
|
m.scene.signalBeacon("AppDialogComplete")
|
||||||
|
m.scene.signalBeacon("AppLaunchComplete")
|
||||||
end function
|
end function
|
||||||
@@ -1,78 +0,0 @@
|
|||||||
'import "pkg:/components/Dialog/DialogUtils.bs"
|
|
||||||
'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"
|
|
||||||
'import "pkg:/source/utils/Locale.bs"
|
|
||||||
|
|
||||||
function Init()
|
|
||||||
InitializeBindings() ' auto-generated!
|
|
||||||
m.scene = m.top.getScene()
|
|
||||||
SetScenePalette(m.scene)
|
|
||||||
' At this point, the "MainScene" node is not yet added to the scene, and does not have a parent yet.
|
|
||||||
' Let's wait until it has one.
|
|
||||||
m.MainSceneContainer = m.scene.findNode("MainSceneContainer")
|
|
||||||
m.MainSceneContainer.ObserveField("change", FuncName(MainSceneContainerChanged))
|
|
||||||
end function
|
|
||||||
|
|
||||||
function SetScenePalette(scene as object) as void
|
|
||||||
palette = scene.palette
|
|
||||||
if palette <> invalid
|
|
||||||
return
|
|
||||||
end if
|
|
||||||
palette = CreateObject("roSGNode", "RSGPalette")
|
|
||||||
palette.colors = {
|
|
||||||
DialogBackgroundColor: "#242424FF"
|
|
||||||
DialogFocusColor: "#CECECEFF"
|
|
||||||
DialogFocusItemColor: "#202020FF"
|
|
||||||
DialogSecondaryTextColor: "#EBEBEBFF"
|
|
||||||
DialogSecondaryItemColor: "#FF1C30FF"
|
|
||||||
DialogTextColor: "#EBEBEBFF"
|
|
||||||
}
|
|
||||||
scene.palette = palette
|
|
||||||
end function
|
|
||||||
|
|
||||||
function MainSceneContainerChanged()
|
|
||||||
AutoBindSceneGraph()
|
|
||||||
StartWebServer()
|
|
||||||
HideLoadingScreen()
|
|
||||||
InitEcpArgs()
|
|
||||||
m.scene.signalBeacon("AppLaunchComplete")
|
|
||||||
CopyLoadingMessagesToCache()
|
|
||||||
ShowAnnouncement()
|
|
||||||
end function
|
|
||||||
|
|
||||||
function StartWebServer()
|
|
||||||
m.loungeService = m.top.findNode("LoungeService")
|
|
||||||
m.loungeService.callfunc("StartService", invalid)
|
|
||||||
m.webServer = m.top.findNode("WebServer")
|
|
||||||
m.webServer.callfunc("StartServer", invalid)
|
|
||||||
m.dialServer = m.top.findNode("DialServer")
|
|
||||||
m.dialServer.callfunc("StartServer", invalid)
|
|
||||||
end function
|
|
||||||
|
|
||||||
function ShowAnnouncement() as void
|
|
||||||
dialog = DialogUtils_ShowDialogOnce({
|
|
||||||
messageId: "1747362859"
|
|
||||||
title: "Announcement - YouTube account support"
|
|
||||||
message: [
|
|
||||||
"YouTube account support is now available in Playlet!"
|
|
||||||
"Subscriptions, playlists, watch history and " + chr(34) + "Recommended" + chr(34) + " are now available in the app."
|
|
||||||
"If you encounter any issues, please report them on GitHub."
|
|
||||||
"https://github.com/iBicha/playlet/issues"
|
|
||||||
"Thank you."
|
|
||||||
]
|
|
||||||
alwaysOnTop: true
|
|
||||||
marginWidth: 180
|
|
||||||
})
|
|
||||||
if dialog = invalid
|
|
||||||
return
|
|
||||||
end if
|
|
||||||
m.scene.signalBeacon("AppDialogInitiate")
|
|
||||||
m.top.observeField("wasClosed", FuncName(OnAnnouncementDialogClosed))
|
|
||||||
end function
|
|
||||||
|
|
||||||
function OnAnnouncementDialogClosed()
|
|
||||||
m.scene.signalBeacon("AppDialogComplete")
|
|
||||||
end function
|
|
||||||
'//# sourceMappingURL=./MainScene.brs.map
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
<component name="MainScene" extends="Group">
|
|
||||||
<interface>
|
|
||||||
<field id="bindings" type="assocarray" onChange="OnBindingSetRegisterAutoBind" />
|
|
||||||
<field id="binding_done" type="boolean" onChange="OnNodeReady" />
|
|
||||||
<function name="BindNodeFieldsAndProps" />
|
|
||||||
<function name="BindScopeFields" />
|
|
||||||
<function name="BindNode" />
|
|
||||||
</interface>
|
|
||||||
<script type="text/brightscript" uri="pkg:/components/parts/AutoBind/AutoBind.part.brs" />
|
|
||||||
<script type="text/brightscript" uri="pkg:/components/MainScene_bindings.brs" />
|
|
||||||
<script type="text/brightscript" uri="pkg:/source/utils/NodePathUtils.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" />
|
|
||||||
<script type="text/brightscript" uri="pkg:/source/utils/Logging.brs" />
|
|
||||||
<script type="text/brightscript" uri="pkg:/components/Dialog/DialogUtils.brs" />
|
|
||||||
<script type="text/brightscript" uri="pkg:/source/utils/RegistryUtils.brs" />
|
|
||||||
<script type="text/brightscript" uri="pkg:/source/bslib.brs" />
|
|
||||||
<children>
|
|
||||||
<Logger id="Logger" />
|
|
||||||
<AppController id="AppController">
|
|
||||||
<Group id="Stack">
|
|
||||||
<AppRoot id="AppRoot">
|
|
||||||
<AppScreens id="AppScreens" />
|
|
||||||
<NavBar id="NavBar" initialFocus="2">
|
|
||||||
<ContentNode role="content">
|
|
||||||
<NavBarItemContent screen="ProfileScreen" text="Profile" isProfile="true" />
|
|
||||||
<NavBarItemContent screen="SearchScreen" text="Search" icon="pkg:/images/icons/search.png" />
|
|
||||||
<NavBarItemContent screen="HomeScreen" text="Home" icon="pkg:/images/icons/home.png" />
|
|
||||||
<NavBarItemContent screen="BookmarksScreen" text="Bookmarks" icon="pkg:/images/icons/star.png" />
|
|
||||||
<NavBarItemContent screen="SettingsScreen" text="Settings" icon="pkg:/images/icons/settings.png" />
|
|
||||||
<NavBarItemContent screen="RemoteScreen" text="Remote" icon="pkg:/images/icons/phone.png" />
|
|
||||||
<NavBarItemContent screen="AppInfoScreen" text="Info" icon="pkg:/images/icons/info.png" />
|
|
||||||
</ContentNode>
|
|
||||||
</NavBar>
|
|
||||||
</AppRoot>
|
|
||||||
</Group>
|
|
||||||
<Clock />
|
|
||||||
<VideoContainer id="VideoContainer" />
|
|
||||||
<Group id="Notifications" />
|
|
||||||
<VideoQueue id="VideoQueue" />
|
|
||||||
<ApplicationInfo id="ApplicationInfo" />
|
|
||||||
<Preferences id="Preferences" />
|
|
||||||
<BookmarksService id="BookmarksService" />
|
|
||||||
<SearchHistory id="SearchHistory" />
|
|
||||||
<ProfilesService id="ProfilesService" />
|
|
||||||
<Innertube id="Innertube" />
|
|
||||||
<Invidious id="Invidious" />
|
|
||||||
<PlayletWebServer id="WebServer" port="8888" />
|
|
||||||
<DialServer id="DialServer" />
|
|
||||||
<LoungeService id="LoungeService" />
|
|
||||||
</AppController>
|
|
||||||
</children>
|
|
||||||
</component>
|
|
||||||
<!--//# sourceMappingURL=./MainScene.xml.map -->
|
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
<children>
|
<children>
|
||||||
<!-- Logger should remain the first child, to make sure it is initialized first in the scene -->
|
<!-- Logger should remain the first child, to make sure it is initialized first in the scene -->
|
||||||
<Logger id="Logger" />
|
<Logger id="Logger" />
|
||||||
|
<JobQueue id="JobQueue" />
|
||||||
<AppController id="AppController"
|
<AppController id="AppController"
|
||||||
screensContainer="bind:./AppScreens"
|
screensContainer="bind:./AppScreens"
|
||||||
root="bind:./AppRoot"
|
root="bind:./AppRoot"
|
||||||
@@ -60,18 +61,22 @@
|
|||||||
invidious="bind:../Invidious"
|
invidious="bind:../Invidious"
|
||||||
notifications="bind:../Notifications"
|
notifications="bind:../Notifications"
|
||||||
preferences="bind:../Preferences"
|
preferences="bind:../Preferences"
|
||||||
loungeService="bind:../LoungeService" />
|
loungeService="bind:../LoungeService"
|
||||||
|
jobQueue="bind:/JobQueue" />
|
||||||
|
|
||||||
<ApplicationInfo id="ApplicationInfo" />
|
<ApplicationInfo id="ApplicationInfo"
|
||||||
|
jobQueue="bind:/JobQueue" />
|
||||||
<Preferences id="Preferences" />
|
<Preferences id="Preferences" />
|
||||||
<BookmarksService id="BookmarksService" />
|
<BookmarksService id="BookmarksService" />
|
||||||
<SearchHistory id="SearchHistory"
|
<SearchHistory id="SearchHistory"
|
||||||
preferences="bind:../Preferences" />
|
preferences="bind:../Preferences" />
|
||||||
|
|
||||||
<ProfilesService id="ProfilesService"
|
<ProfilesService id="ProfilesService"
|
||||||
invidious="bind:../Invidious" />
|
invidious="bind:../Invidious"
|
||||||
|
jobQueue="bind:/JobQueue" />
|
||||||
|
|
||||||
<Innertube id="Innertube" />
|
<Innertube id="Innertube"
|
||||||
|
jobQueue="bind:/JobQueue" />
|
||||||
<Invidious id="Invidious"
|
<Invidious id="Invidious"
|
||||||
webServer="bind:../WebServer"
|
webServer="bind:../WebServer"
|
||||||
applicationInfo="bind:../ApplicationInfo"
|
applicationInfo="bind:../ApplicationInfo"
|
||||||
@@ -89,7 +94,8 @@
|
|||||||
preferences="bind:../Preferences"
|
preferences="bind:../Preferences"
|
||||||
videoQueue="bind:../VideoQueue"
|
videoQueue="bind:../VideoQueue"
|
||||||
bookmarksService="bind:../BookmarksService"
|
bookmarksService="bind:../BookmarksService"
|
||||||
loungeService="bind:../LoungeService" />
|
loungeService="bind:../LoungeService"
|
||||||
|
jobQueue="bind:/JobQueue" />
|
||||||
<DialServer id="DialServer"
|
<DialServer id="DialServer"
|
||||||
webServer="bind:../WebServer"
|
webServer="bind:../WebServer"
|
||||||
loungeService="bind:../LoungeService" />
|
loungeService="bind:../LoungeService" />
|
||||||
@@ -97,6 +103,9 @@
|
|||||||
videoQueue="bind:../VideoQueue"
|
videoQueue="bind:../VideoQueue"
|
||||||
notifications="bind:../Notifications"
|
notifications="bind:../Notifications"
|
||||||
invidious="bind:../Invidious" />
|
invidious="bind:../Invidious" />
|
||||||
|
<Telemetry id="Telemetry"
|
||||||
|
preferences="bind:../Preferences"
|
||||||
|
applicationInfo="bind:../ApplicationInfo" />
|
||||||
</AppController>
|
</AppController>
|
||||||
</children>
|
</children>
|
||||||
</component>
|
</component>
|
||||||
@@ -1,62 +0,0 @@
|
|||||||
' This method is auto-generated!
|
|
||||||
function InitializeBindings()
|
|
||||||
m.top.bindings = {
|
|
||||||
fields: {
|
|
||||||
|
|
||||||
},
|
|
||||||
childProps: {
|
|
||||||
"AppController": {
|
|
||||||
"screensContainer": "./AppScreens",
|
|
||||||
"root": "./AppRoot",
|
|
||||||
"stack": "./Stack",
|
|
||||||
"videoQueue": "./VideoQueue"
|
|
||||||
},
|
|
||||||
"NavBar": {
|
|
||||||
"appController": "/AppController",
|
|
||||||
"screensContainer": "../AppScreens"
|
|
||||||
},
|
|
||||||
"VideoQueue": {
|
|
||||||
"appController": "/AppController",
|
|
||||||
"videoContainer": "../VideoContainer",
|
|
||||||
"innertube": "../Innertube",
|
|
||||||
"invidious": "../Invidious",
|
|
||||||
"notifications": "../Notifications",
|
|
||||||
"preferences": "../Preferences",
|
|
||||||
"loungeService": "../LoungeService"
|
|
||||||
},
|
|
||||||
"SearchHistory": {
|
|
||||||
"preferences": "../Preferences"
|
|
||||||
},
|
|
||||||
"ProfilesService": {
|
|
||||||
"invidious": "../Invidious"
|
|
||||||
},
|
|
||||||
"Invidious": {
|
|
||||||
"webServer": "../WebServer",
|
|
||||||
"applicationInfo": "../ApplicationInfo",
|
|
||||||
"preferences": "../Preferences",
|
|
||||||
"profilesService": "../ProfilesService"
|
|
||||||
},
|
|
||||||
"WebServer": {
|
|
||||||
"appController": "/AppController",
|
|
||||||
"applicationInfo": "../ApplicationInfo",
|
|
||||||
"innertube": "../Innertube",
|
|
||||||
"invidious": "../Invidious",
|
|
||||||
"profilesService": "../ProfilesService",
|
|
||||||
"preferences": "../Preferences",
|
|
||||||
"videoQueue": "../VideoQueue",
|
|
||||||
"bookmarksService": "../BookmarksService",
|
|
||||||
"loungeService": "../LoungeService"
|
|
||||||
},
|
|
||||||
"DialServer": {
|
|
||||||
"webServer": "../WebServer",
|
|
||||||
"loungeService": "../LoungeService"
|
|
||||||
},
|
|
||||||
"LoungeService": {
|
|
||||||
"videoQueue": "../VideoQueue",
|
|
||||||
"notifications": "../Notifications",
|
|
||||||
"invidious": "../Invidious"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
end function
|
|
||||||
'//# sourceMappingURL=./MainScene_bindings.brs.map
|
|
||||||
@@ -42,8 +42,7 @@
|
|||||||
<AppVersionLabel
|
<AppVersionLabel
|
||||||
fontUri="font:BoldSystemFontFile"
|
fontUri="font:BoldSystemFontFile"
|
||||||
fontSize="16"
|
fontSize="16"
|
||||||
translation="[0, 48]"
|
translation="[0, 48]" />
|
||||||
/>
|
|
||||||
</Poster>
|
</Poster>
|
||||||
|
|
||||||
<MarkupList
|
<MarkupList
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ namespace PlaylistUtils
|
|||||||
end if
|
end if
|
||||||
appController@.PushScreen(playlistView)
|
appController@.PushScreen(playlistView)
|
||||||
playlistView@.BindNode()
|
playlistView@.BindNode()
|
||||||
playlistView.content = contentNode
|
' Clone the playlist because the videos will be loaded as children.
|
||||||
|
' This allows the videos to be freed once the view is closed.
|
||||||
|
playlistView.content = contentNode.clone(false)
|
||||||
end function
|
end function
|
||||||
end namespace
|
end namespace
|
||||||
@@ -3,8 +3,6 @@ import "pkg:/components/ContextMenu/ContextMenuUtils.bs"
|
|||||||
import "pkg:/components/Navigation/LongPress.bs"
|
import "pkg:/components/Navigation/LongPress.bs"
|
||||||
import "pkg:/components/Services/Invidious/InvidiousToContentNode.bs"
|
import "pkg:/components/Services/Invidious/InvidiousToContentNode.bs"
|
||||||
import "pkg:/components/VideoFeed/FeedLoadState.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/ErrorUtils.bs"
|
||||||
import "pkg:/source/utils/FocusManagement.bs"
|
import "pkg:/source/utils/FocusManagement.bs"
|
||||||
import "pkg:/source/utils/Logging.bs"
|
import "pkg:/source/utils/Logging.bs"
|
||||||
@@ -13,6 +11,11 @@ import "pkg:/source/utils/StringUtils.bs"
|
|||||||
import "pkg:/source/utils/Types.bs"
|
import "pkg:/source/utils/Types.bs"
|
||||||
|
|
||||||
function Init()
|
function Init()
|
||||||
|
m.busySpinner = m.top.findNode("busySpinner")
|
||||||
|
m.busyspinner.poster.width = 100
|
||||||
|
m.busyspinner.poster.height = 100
|
||||||
|
m.busySpinner.poster.uri = "pkg:/images/spinner.png"
|
||||||
|
|
||||||
m.background = m.top.findNode("background")
|
m.background = m.top.findNode("background")
|
||||||
m.backgroundSmall = m.top.findNode("backgroundSmall")
|
m.backgroundSmall = m.top.findNode("backgroundSmall")
|
||||||
m.titleLabel = m.top.findNode("titleLabel")
|
m.titleLabel = m.top.findNode("titleLabel")
|
||||||
@@ -69,6 +72,7 @@ function OnContentSet() as void
|
|||||||
if itemFocused > -1 and content.getChildCount() > itemFocused
|
if itemFocused > -1 and content.getChildCount() > itemFocused
|
||||||
m.list.jumpToItem = itemFocused
|
m.list.jumpToItem = itemFocused
|
||||||
end if
|
end if
|
||||||
|
m.top.isLoading = content.isLoading or content.loadState = FeedLoadState.Loading
|
||||||
LoadPlaylistIfNeeded()
|
LoadPlaylistIfNeeded()
|
||||||
end function
|
end function
|
||||||
|
|
||||||
@@ -246,6 +250,17 @@ function LoadPlaylistIfNeeded() as void
|
|||||||
return
|
return
|
||||||
end if
|
end if
|
||||||
|
|
||||||
' TODO:P1 use a field instead of function call
|
m.top.content@.LoadPlaylistPage(m.top.invidious, m.top.jobQueue)
|
||||||
m.top.content@.LoadPlaylistPage(m.top.invidious)
|
end function
|
||||||
|
|
||||||
|
function OnLoadingChanged(event as object)
|
||||||
|
isLoading = event.GetData()
|
||||||
|
if isLoading
|
||||||
|
m.busyspinner.poster.rotation = 0
|
||||||
|
m.busySpinner.visible = true
|
||||||
|
m.busySpinner.control = "start"
|
||||||
|
else
|
||||||
|
m.busySpinner.visible = false
|
||||||
|
m.busySpinner.control = "stop"
|
||||||
|
end if
|
||||||
end function
|
end function
|
||||||
@@ -1,8 +1,10 @@
|
|||||||
<component name="PlaylistView" extends="Group" includes="AutoBind,Focus,ContextMenuProvider">
|
<component name="PlaylistView" extends="Group" includes="AutoBind,Focus,ContextMenuProvider">
|
||||||
<interface>
|
<interface>
|
||||||
<field id="content" type="node" onChange="OnContentSet" />
|
<field id="content" type="node" onChange="OnContentSet" />
|
||||||
|
<field id="isLoading" type="boolean" onChange="OnLoadingChanged" />
|
||||||
<field id="appController" type="node" bind="/AppController" />
|
<field id="appController" type="node" bind="/AppController" />
|
||||||
<field id="invidious" type="node" bind="/Invidious" />
|
<field id="invidious" type="node" bind="/Invidious" />
|
||||||
|
<field id="jobQueue" type="node" bind="/JobQueue" />
|
||||||
<field id="videoQueue" type="node" bind="/VideoQueue" />
|
<field id="videoQueue" type="node" bind="/VideoQueue" />
|
||||||
<field id="bookmarksService" type="node" bind="/BookmarksService" />
|
<field id="bookmarksService" type="node" bind="/BookmarksService" />
|
||||||
<function name="OpenPlaylistChannel" />
|
<function name="OpenPlaylistChannel" />
|
||||||
@@ -51,6 +53,12 @@
|
|||||||
font="font:SmallestSystemFont" />
|
font="font:SmallestSystemFont" />
|
||||||
</LayoutGroup>
|
</LayoutGroup>
|
||||||
|
|
||||||
|
<BusySpinner
|
||||||
|
id="busySpinner"
|
||||||
|
spinInterval="1"
|
||||||
|
translation="[45,620]"
|
||||||
|
visible="false" />
|
||||||
|
|
||||||
<MarkupGrid
|
<MarkupGrid
|
||||||
id="list"
|
id="list"
|
||||||
itemComponentName="PlaylistViewCell"
|
itemComponentName="PlaylistViewCell"
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import "pkg:/source/utils/MathUtils.bs"
|
||||||
import "pkg:/source/utils/StringUtils.bs"
|
import "pkg:/source/utils/StringUtils.bs"
|
||||||
import "pkg:/source/utils/TimeUtils.bs"
|
import "pkg:/source/utils/TimeUtils.bs"
|
||||||
import "pkg:/source/utils/Types.bs"
|
import "pkg:/source/utils/Types.bs"
|
||||||
@@ -5,6 +6,7 @@ import "pkg:/source/utils/Types.bs"
|
|||||||
function Init()
|
function Init()
|
||||||
m.durationRect = m.top.FindNode("durationRect")
|
m.durationRect = m.top.FindNode("durationRect")
|
||||||
m.durationLabel = m.top.FindNode("durationLabel")
|
m.durationLabel = m.top.FindNode("durationLabel")
|
||||||
|
m.progressRect = m.top.FindNode("progressRect")
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function OnContentSet() as void
|
function OnContentSet() as void
|
||||||
@@ -35,6 +37,8 @@ function OnContentSet() as void
|
|||||||
|
|
||||||
m.top.thumbnailUri = content.thumbnail
|
m.top.thumbnailUri = content.thumbnail
|
||||||
|
|
||||||
|
m.top.percentDurationWatched = content.percentDurationWatched
|
||||||
|
|
||||||
SetDurationText(content.lengthText)
|
SetDurationText(content.lengthText)
|
||||||
end function
|
end function
|
||||||
|
|
||||||
@@ -60,3 +64,12 @@ function SetDurationText(text as string) as void
|
|||||||
rect.width = size.width + 16
|
rect.width = size.width + 16
|
||||||
rect.translation = [rectParent.width - rect.width, rect.translation[1]]
|
rect.translation = [rectParent.width - rect.width, rect.translation[1]]
|
||||||
end function
|
end function
|
||||||
|
|
||||||
|
function OnPercentDurationWatched() as void
|
||||||
|
if m.progressRect = invalid
|
||||||
|
return
|
||||||
|
end if
|
||||||
|
|
||||||
|
percent = MathUtils.Clamp(m.top.percentDurationWatched, 0, 100) / 100.0
|
||||||
|
m.progressRect.scale = [percent, 1]
|
||||||
|
end function
|
||||||
@@ -6,6 +6,7 @@
|
|||||||
<field id="thumbnailUri" type="uri" alias="thumbnailPoster.uri" />
|
<field id="thumbnailUri" type="uri" alias="thumbnailPoster.uri" />
|
||||||
<field id="duration" type="string" alias="durationLabel.text" />
|
<field id="duration" type="string" alias="durationLabel.text" />
|
||||||
<field id="durationRectVisible" type="boolean" alias="durationRect.visible" />
|
<field id="durationRectVisible" type="boolean" alias="durationRect.visible" />
|
||||||
|
<field id="percentDurationWatched" type="float" onChange="OnPercentDurationWatched" />
|
||||||
</interface>
|
</interface>
|
||||||
<children>
|
<children>
|
||||||
<Poster
|
<Poster
|
||||||
@@ -29,6 +30,14 @@
|
|||||||
font="font:SmallestSystemFont"
|
font="font:SmallestSystemFont"
|
||||||
translation="[8, 0]" />
|
translation="[8, 0]" />
|
||||||
</Rectangle>
|
</Rectangle>
|
||||||
|
<Rectangle
|
||||||
|
id="progressRect"
|
||||||
|
width="190"
|
||||||
|
height="5"
|
||||||
|
color="#FF0000"
|
||||||
|
translation="[0, 102]"
|
||||||
|
scale="[0, 1]">
|
||||||
|
</Rectangle>
|
||||||
|
|
||||||
</Poster>
|
</Poster>
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
import "pkg:/source/QrCode/QrImage.bs"
|
import "pkg:/source/QrCode/QrImage.bs"
|
||||||
|
import "pkg:/source/QrCode/QrMode.bs"
|
||||||
import "pkg:/source/utils/StringUtils.bs"
|
import "pkg:/source/utils/StringUtils.bs"
|
||||||
|
|
||||||
@asynctask
|
@job("GenerateQrCodeJob")
|
||||||
function GenerateQrCodeTask(input as object) as object
|
function ExecuteJob() as void
|
||||||
|
input = JobGetInput()
|
||||||
|
|
||||||
poster = input.poster
|
poster = input.poster
|
||||||
mode = input.mode
|
mode = input.mode
|
||||||
text = input.text
|
text = input.text
|
||||||
@@ -24,13 +27,12 @@ function GenerateQrCodeTask(input as object) as object
|
|||||||
qr = new QrCode.QRImage()
|
qr = new QrCode.QRImage()
|
||||||
imagePath = qr.Generate(text, size, padding, mode)
|
imagePath = qr.Generate(text, size, padding, mode)
|
||||||
|
|
||||||
if m.top.cancel
|
if JobIsCancelled()
|
||||||
return invalid
|
JobCancel()
|
||||||
|
return
|
||||||
end if
|
end if
|
||||||
|
|
||||||
if not StringUtils.IsNullOrEmpty(imagePath)
|
if not StringUtils.IsNullOrEmpty(imagePath)
|
||||||
poster.uri = imagePath
|
poster.uri = imagePath
|
||||||
end if
|
end if
|
||||||
|
|
||||||
return invalid
|
|
||||||
end function
|
end function
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import "pkg:/source/AsyncTask/AsyncTask.bs"
|
import "pkg:/components/JobSystem/Jobs.bs"
|
||||||
import "pkg:/source/AsyncTask/Tasks.bs"
|
import "pkg:/components/JobSystem/JobSystem.bs"
|
||||||
import "pkg:/source/utils/Logging.bs"
|
import "pkg:/source/utils/Logging.bs"
|
||||||
import "pkg:/source/utils/StringUtils.bs"
|
import "pkg:/source/utils/StringUtils.bs"
|
||||||
import "pkg:/source/utils/Types.bs"
|
import "pkg:/source/utils/Types.bs"
|
||||||
@@ -44,8 +44,8 @@ function OnLoadStatusChange() as void
|
|||||||
end function
|
end function
|
||||||
|
|
||||||
function GenerateQrCode() as void
|
function GenerateQrCode() as void
|
||||||
if m.qrCodeGenTask <> invalid
|
if m.generateQrCodeJob <> invalid
|
||||||
m.qrCodeGenTask.cancel = true
|
m.generateQrCodeJob.cancel = true
|
||||||
end if
|
end if
|
||||||
|
|
||||||
text = m.top.text
|
text = m.top.text
|
||||||
@@ -64,16 +64,27 @@ function GenerateQrCode() as void
|
|||||||
|
|
||||||
m.top.isBusy = true
|
m.top.isBusy = true
|
||||||
|
|
||||||
m.qrCodeGenTask = AsyncTask.Start(Tasks.GenerateQrCodeTask, {
|
if m.jobQueue = invalid
|
||||||
|
m.jobQueue = m.top.getScene().findNode("JobQueue")
|
||||||
|
end if
|
||||||
|
|
||||||
|
input = {
|
||||||
poster: m.top
|
poster: m.top
|
||||||
text: text
|
text: text
|
||||||
size: width
|
size: width
|
||||||
padding: m.top.padding
|
padding: m.top.padding
|
||||||
}, OnGenerateQrCodeTaskResult)
|
}
|
||||||
|
|
||||||
|
m.generateQrCodeJob = JobSystem.CreateCallback(OnGenerateQrCodeJobDone)
|
||||||
|
JobSystem.QueueJob(m.jobQueue, Jobs.GenerateQrCodeJob, input, m.generateQrCodeJob)
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function OnGenerateQrCodeTaskResult(output as object) as void
|
function OnGenerateQrCodeJobDone(event as object) as void
|
||||||
if output.cancelled
|
JobSystem.UnobserveCallback(event.getRoSGNode())
|
||||||
|
m.generateQrCodeJob = invalid
|
||||||
|
|
||||||
|
info = event.getInfo()
|
||||||
|
if info.cancel
|
||||||
return
|
return
|
||||||
end if
|
end if
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import "pkg:/source/AsyncTask/AsyncTask.bs"
|
import "pkg:/source/utils/Types.bs"
|
||||||
|
|
||||||
function Init()
|
function Init()
|
||||||
' TODO:P2 Add tooltip to each field with description of what it means
|
' TODO:P2 Add tooltip to each field with description of what it means
|
||||||
|
|||||||
@@ -43,8 +43,7 @@
|
|||||||
showRowLabel="[true]"
|
showRowLabel="[true]"
|
||||||
rowFocusAnimationStyle="floatingfocus"
|
rowFocusAnimationStyle="floatingfocus"
|
||||||
variableWidthItems="true"
|
variableWidthItems="true"
|
||||||
focusBitmapUri="pkg:/images/focus-glow-padding-19.9.png"
|
focusBitmapUri="pkg:/images/focus-glow-padding-19.9.png" />
|
||||||
/>
|
|
||||||
</Group>
|
</Group>
|
||||||
</children>
|
</children>
|
||||||
</component>
|
</component>
|
||||||
@@ -9,7 +9,6 @@ function Init()
|
|||||||
m.top.focusable = true
|
m.top.focusable = true
|
||||||
m.rowList = m.top.FindNode("rowList")
|
m.rowList = m.top.FindNode("rowList")
|
||||||
m.rowList.screen = m.top
|
m.rowList.screen = m.top
|
||||||
m.pendingLoadTasks = {}
|
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function OnNodeReady()
|
function OnNodeReady()
|
||||||
|
|||||||
@@ -36,7 +36,9 @@
|
|||||||
focusBitmapUri="pkg:/images/focus-glow-padding-19.9.png">
|
focusBitmapUri="pkg:/images/focus-glow-padding-19.9.png">
|
||||||
<ContentNode role="content">
|
<ContentNode role="content">
|
||||||
<ContentNode>
|
<ContentNode>
|
||||||
|
<!-- bs:disable-next-line LOCALE_MISSING_TRANSLATIONS -->
|
||||||
<BackendTypeContentNode id="BackendTypeYouTube" title="YouTube" backendLogoUri="pkg:/images/youtube-logo.png" />
|
<BackendTypeContentNode id="BackendTypeYouTube" title="YouTube" backendLogoUri="pkg:/images/youtube-logo.png" />
|
||||||
|
<!-- bs:disable-next-line LOCALE_MISSING_TRANSLATIONS -->
|
||||||
<BackendTypeContentNode id="BackendTypeInvidious" title="Invidious" backendLogoUri="pkg:/images/invidious-logo.png" />
|
<BackendTypeContentNode id="BackendTypeInvidious" title="Invidious" backendLogoUri="pkg:/images/invidious-logo.png" />
|
||||||
</ContentNode>
|
</ContentNode>
|
||||||
</ContentNode>
|
</ContentNode>
|
||||||
|
|||||||
@@ -65,8 +65,7 @@
|
|||||||
id="backendTypePoster"
|
id="backendTypePoster"
|
||||||
width="60"
|
width="60"
|
||||||
height="60"
|
height="60"
|
||||||
translation="[110,110]"
|
translation="[110,110]" />
|
||||||
/>
|
|
||||||
</CirclePoster>
|
</CirclePoster>
|
||||||
<Poster
|
<Poster
|
||||||
id="CrownPoster"
|
id="CrownPoster"
|
||||||
|
|||||||
@@ -81,13 +81,12 @@ function LoginWithInvidious() as void
|
|||||||
end function
|
end function
|
||||||
|
|
||||||
function ShowLoginWithYouTubeDialog() as void
|
function ShowLoginWithYouTubeDialog() as void
|
||||||
' TODO:P2 localize
|
|
||||||
dialog = DialogUtils.ShowDialogEx({
|
dialog = DialogUtils.ShowDialogEx({
|
||||||
title: "Disclaimer"
|
title: Tr(Locale.Dialogs.Disclaimer)
|
||||||
message: [
|
message: [
|
||||||
"Playlet is a third-party app and is not affiliated with, endorsed by, or sponsored by YouTube or Google. All trademarks and registered trademarks mentioned are the property of their respective owners and are used only for identification purposes."
|
Tr(Locale.Dialogs.YouTubeLoginDisclaimer1)
|
||||||
"By using Playlet and signing in with your YouTube account, you acknowledge that you do so at your own risk. The developers of Playlet are not liable for any harm, including but not limited to data loss, account suspension or ban, hacking, or loss of content."
|
Tr(Locale.Dialogs.YouTubeLoginDisclaimer2)
|
||||||
"Use responsibly, especially if your YouTube account is tied to business or monetization."
|
Tr(Locale.Dialogs.YouTubeLoginDisclaimer3)
|
||||||
]
|
]
|
||||||
large: true
|
large: true
|
||||||
buttons: [
|
buttons: [
|
||||||
|
|||||||
@@ -52,8 +52,7 @@
|
|||||||
id="backendTypePoster"
|
id="backendTypePoster"
|
||||||
width="60"
|
width="60"
|
||||||
height="60"
|
height="60"
|
||||||
translation="[110,110]"
|
translation="[110,110]" />
|
||||||
/>
|
|
||||||
</CirclePoster>
|
</CirclePoster>
|
||||||
<Poster
|
<Poster
|
||||||
id="CrownPoster"
|
id="CrownPoster"
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
import "pkg:/source/utils/Types.bs"
|
||||||
|
|
||||||
|
function OnContentSet() as void
|
||||||
|
content = m.top.itemContent
|
||||||
|
if content = invalid
|
||||||
|
return
|
||||||
|
end if
|
||||||
|
|
||||||
|
accountItem = content.accountItem
|
||||||
|
if not IsAssociativeArray(accountItem)
|
||||||
|
return
|
||||||
|
end if
|
||||||
|
|
||||||
|
m.top.accountPhoto = accountItem.accountPhoto
|
||||||
|
m.top.text1 = accountItem.accountName
|
||||||
|
m.top.text2 = accountItem.channelHandle
|
||||||
|
end function
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
<component name="YouTubeAccountListItem" extends="Group">
|
||||||
|
<interface>
|
||||||
|
<field id="itemContent" type="node" onChange="OnContentSet" />
|
||||||
|
|
||||||
|
<field id="accountPhoto" type="uri" alias="accountPhoto.uri" />
|
||||||
|
<field id="text1" type="string" alias="text1Label.text" />
|
||||||
|
<field id="text2" type="string" alias="text2Label.text" />
|
||||||
|
</interface>
|
||||||
|
<children>
|
||||||
|
<LayoutGroup layoutDirection="horiz" translation="[0, 2]" itemSpacings="[10]">
|
||||||
|
<Poster
|
||||||
|
width="64"
|
||||||
|
height="64"
|
||||||
|
blendColor="#DDDDDDFF"
|
||||||
|
uri="pkg:/images/white-circle.png">
|
||||||
|
|
||||||
|
<CirclePoster
|
||||||
|
id="accountPhoto"
|
||||||
|
width="60"
|
||||||
|
height="60"
|
||||||
|
translation="[2,2]"
|
||||||
|
failedBitmapUri="pkg:/images/thumbnail-missing.jpg" />
|
||||||
|
</Poster>
|
||||||
|
|
||||||
|
<LayoutGroup layoutDirection="vert" translation="[8, 0]" itemSpacings="[10]">
|
||||||
|
<Label id="text1Label" font="font:SmallestBoldSystemFont" />
|
||||||
|
<Label id="text2Label" font="font:SmallestSystemFont" />
|
||||||
|
</LayoutGroup>
|
||||||
|
</LayoutGroup>
|
||||||
|
</children>
|
||||||
|
</component>
|
||||||
@@ -0,0 +1,100 @@
|
|||||||
|
import "pkg:/components/Dialog/YouTubeLoginAccountItemUtils.bs"
|
||||||
|
import "pkg:/components/parts/AutoBind/OnNodeReadyNoOp.bs"
|
||||||
|
import "pkg:/source/utils/FocusManagement.bs"
|
||||||
|
import "pkg:/source/utils/Locale.bs"
|
||||||
|
import "pkg:/source/utils/Logging.bs"
|
||||||
|
import "pkg:/source/utils/RemoteKeys.bs"
|
||||||
|
import "pkg:/source/utils/Types.bs"
|
||||||
|
|
||||||
|
function Init()
|
||||||
|
m.accountList = m.top.FindNode("accountList")
|
||||||
|
m.accountList.ObserveField("itemSelected", FuncName(OnAccountSelected))
|
||||||
|
end function
|
||||||
|
|
||||||
|
function OnFocusChange() as void
|
||||||
|
if not m.top.focus
|
||||||
|
return
|
||||||
|
end if
|
||||||
|
|
||||||
|
NodeSetFocus(m.accountList, true)
|
||||||
|
end function
|
||||||
|
|
||||||
|
function OnKeyEvent(key as string, press as boolean) as boolean
|
||||||
|
if key = RemoteKeys.Options or key = RemoteKeys.Play or key = RemoteKeys.Pause or key = RemoteKeys.PlayOnly
|
||||||
|
' A pass-through to the app controller, so it can toggle picture-in-picture and pause/play
|
||||||
|
return false
|
||||||
|
end if
|
||||||
|
|
||||||
|
if key = RemoteKeys.Back and press
|
||||||
|
Close()
|
||||||
|
return true
|
||||||
|
end if
|
||||||
|
|
||||||
|
return true
|
||||||
|
end function
|
||||||
|
|
||||||
|
function Close()
|
||||||
|
m.top.appController@.PopScreen()
|
||||||
|
end function
|
||||||
|
|
||||||
|
function OnAccountsChanged() as void
|
||||||
|
accounts = m.top.accounts
|
||||||
|
if not IsArray(accounts) or accounts.Count() = 0
|
||||||
|
m.accountList.content = invalid
|
||||||
|
LogError(Tr(Locale.Dialogs.NoValidAccountsFound))
|
||||||
|
Close()
|
||||||
|
return
|
||||||
|
end if
|
||||||
|
|
||||||
|
content = CreateObject("roSGNode", "ContentNode")
|
||||||
|
accountNodes = []
|
||||||
|
for each accountItem in accounts
|
||||||
|
if not IsAssociativeArray(accountItem)
|
||||||
|
continue for
|
||||||
|
end if
|
||||||
|
|
||||||
|
accountNode = CreateObject("roSGNode", "ContentNode")
|
||||||
|
accountNode.addField("accountItem", "assocarray", false)
|
||||||
|
accountNode.accountItem = accountItem
|
||||||
|
accountNodes.Push(accountNode)
|
||||||
|
end for
|
||||||
|
|
||||||
|
if accountNodes.Count() = 0
|
||||||
|
m.accountList.content = invalid
|
||||||
|
LogError(Tr(Locale.Dialogs.NoValidAccountsFound))
|
||||||
|
Close()
|
||||||
|
return
|
||||||
|
end if
|
||||||
|
|
||||||
|
content.appendChildren(accountNodes)
|
||||||
|
m.accountList.content = content
|
||||||
|
end function
|
||||||
|
|
||||||
|
function OnAccountSelected() as void
|
||||||
|
itemSelected = m.accountList.itemSelected
|
||||||
|
itemNode = m.accountList.content.GetChild(itemSelected)
|
||||||
|
if itemNode = invalid
|
||||||
|
LogError("Invalid item selected:", itemSelected)
|
||||||
|
Close()
|
||||||
|
return
|
||||||
|
end if
|
||||||
|
|
||||||
|
accountItem = itemNode.accountItem
|
||||||
|
if not IsAssociativeArray(accountItem)
|
||||||
|
LogError("Invalid account item selected:", accountItem)
|
||||||
|
Close()
|
||||||
|
return
|
||||||
|
end if
|
||||||
|
|
||||||
|
accessToken = m.top.accessToken
|
||||||
|
if accessToken = invalid or not IsAssociativeArray(accessToken)
|
||||||
|
LogError("No valid access token available for YouTube login.")
|
||||||
|
Close()
|
||||||
|
return
|
||||||
|
end if
|
||||||
|
|
||||||
|
profileNode = YouTubeLoginAccountItemUtils.CreateProfileContentNode(accountItem, accessToken)
|
||||||
|
m.top.profilesService@.LoginWithProfile(profileNode)
|
||||||
|
|
||||||
|
Close()
|
||||||
|
end function
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
<component name="YouTubeAccountSelectionView" extends="Group" includes="AutoBind,Focus">
|
||||||
|
<interface>
|
||||||
|
<field id="accessToken" type="assocarray" />
|
||||||
|
<field id="accounts" type="array" onChange="OnAccountsChanged" />
|
||||||
|
<field id="appController" type="node" bind="/AppController" />
|
||||||
|
<field id="profilesService" type="node" bind="/ProfilesService" />
|
||||||
|
</interface>
|
||||||
|
<children>
|
||||||
|
<Rectangle
|
||||||
|
width="1280"
|
||||||
|
height="720"
|
||||||
|
color="#000000"
|
||||||
|
opacity="0.5">
|
||||||
|
</Rectangle>
|
||||||
|
|
||||||
|
<Rectangle
|
||||||
|
width="720"
|
||||||
|
height="520"
|
||||||
|
translation="[280,100]"
|
||||||
|
color="#242424">
|
||||||
|
<Label
|
||||||
|
width="720"
|
||||||
|
horizAlign="center"
|
||||||
|
translation="[0,45]"
|
||||||
|
text="Who's watching?">
|
||||||
|
<Font role="font" uri="font:SystemFontFile" size="24" />
|
||||||
|
</Label>
|
||||||
|
|
||||||
|
<MarkupGrid
|
||||||
|
id="accountList"
|
||||||
|
itemComponentName="YouTubeAccountListItem"
|
||||||
|
itemSize="[640,70]"
|
||||||
|
itemSpacing="[0,20]"
|
||||||
|
numColumns="1"
|
||||||
|
numRows="4"
|
||||||
|
vertFocusAnimationStyle="floatingFocus"
|
||||||
|
translation="[40,120]"
|
||||||
|
focusBitmapUri="pkg:/images/focus-glow-padding-27.9.png" />
|
||||||
|
</Rectangle>
|
||||||
|
</children>
|
||||||
|
</component>
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
namespace YouTubeAccountSelectionViewUtils
|
||||||
|
|
||||||
|
function Open(appController as object) as object
|
||||||
|
youTubeAccountSelectionView = CreateObject("roSGNode", "YouTubeAccountSelectionView")
|
||||||
|
|
||||||
|
appController@.PushScreen(youTubeAccountSelectionView)
|
||||||
|
youTubeAccountSelectionView@.BindNode()
|
||||||
|
return youTubeAccountSelectionView
|
||||||
|
end function
|
||||||
|
|
||||||
|
end namespace
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import "pkg:/components/Dialog/DialogUtils.bs"
|
import "pkg:/components/Dialog/DialogUtils.bs"
|
||||||
|
import "pkg:/components/JobSystem/Jobs.bs"
|
||||||
|
import "pkg:/components/JobSystem/JobSystem.bs"
|
||||||
import "pkg:/components/Navigation/Navigation.bs"
|
import "pkg:/components/Navigation/Navigation.bs"
|
||||||
import "pkg:/source/AsyncTask/AsyncTask.bs"
|
|
||||||
import "pkg:/source/AsyncTask/Tasks.bs"
|
|
||||||
import "pkg:/source/utils/ErrorUtils.bs"
|
import "pkg:/source/utils/ErrorUtils.bs"
|
||||||
import "pkg:/source/utils/FocusManagement.bs"
|
import "pkg:/source/utils/FocusManagement.bs"
|
||||||
import "pkg:/source/utils/Locale.bs"
|
import "pkg:/source/utils/Locale.bs"
|
||||||
@@ -164,48 +164,47 @@ function OnLinkWithTvPanelVisibleChanged()
|
|||||||
if m.linkWithTvPanel.visible
|
if m.linkWithTvPanel.visible
|
||||||
GeneratePairingCode()
|
GeneratePairingCode()
|
||||||
else
|
else
|
||||||
if m.linkCodeTask <> invalid
|
if m.loungeGenerateManualPairingCodeJob <> invalid
|
||||||
m.linkCodeTask.cancel = true
|
m.loungeGenerateManualPairingCodeJob.cancel = true
|
||||||
m.linkCodeTask = invalid
|
m.loungeGenerateManualPairingCodeJob = invalid
|
||||||
end if
|
end if
|
||||||
m.linkCodeLabel.text = ""
|
m.linkCodeLabel.text = ""
|
||||||
end if
|
end if
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function GeneratePairingCode()
|
function GeneratePairingCode()
|
||||||
if m.linkCodeTask <> invalid
|
if m.loungeGenerateManualPairingCodeJob <> invalid
|
||||||
m.linkCodeTask.cancel = true
|
m.loungeGenerateManualPairingCodeJob.cancel = true
|
||||||
end if
|
end if
|
||||||
|
|
||||||
m.linkCodeLabel.text = Tr(Locale.RemoteScreen.Loading)
|
m.linkCodeLabel.text = Tr(Locale.RemoteScreen.Loading)
|
||||||
m.linkCodeTask = AsyncTask.Start(Tasks.LoungeGenerateManualPairingCodeTask, {
|
|
||||||
|
input = {
|
||||||
loungeService: m.loungeService
|
loungeService: m.loungeService
|
||||||
loungeToken: m.loungeService.loungeToken
|
loungeToken: m.loungeService.loungeToken
|
||||||
screenId: m.loungeService.screenId
|
screenId: m.loungeService.screenId
|
||||||
' Use deviceName as screenName
|
' Use deviceName as screenName
|
||||||
screenName: m.loungeService.deviceName
|
screenName: m.loungeService.deviceName
|
||||||
deviceId: m.loungeService.deviceId
|
deviceId: m.loungeService.deviceId
|
||||||
}, OnLoungeGenerateManualPairingCodeTaskResult)
|
}
|
||||||
|
|
||||||
|
m.loungeGenerateManualPairingCodeJob = JobSystem.CreateCallback(OnLoungeGenerateManualPairingCodeJobDone)
|
||||||
|
JobSystem.QueueJob(m.jobQueue, Jobs.LoungeGenerateManualPairingCodeJob, input, m.loungeGenerateManualPairingCodeJob)
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function OnLoungeGenerateManualPairingCodeTaskResult(output as object) as void
|
function OnLoungeGenerateManualPairingCodeJobDone(event as object) as void
|
||||||
m.linkCodeTask = invalid
|
callback = event.getRoSGNode()
|
||||||
|
JobSystem.UnobserveCallback(callback)
|
||||||
|
m.loungeGenerateManualPairingCodeJob = invalid
|
||||||
|
|
||||||
if output.cancelled
|
info = event.GetInfo()
|
||||||
|
|
||||||
|
if info.cancel
|
||||||
return
|
return
|
||||||
end if
|
end if
|
||||||
|
|
||||||
if not output.success or not output.result.success
|
if not info.success
|
||||||
' output.error for unhandled exception
|
message = Tr(Locale.RemoteScreen.FailedToGeneratePairingCode) + `\n${info.error}`
|
||||||
error = output.error
|
|
||||||
if error = invalid
|
|
||||||
' output.result.error for network errors
|
|
||||||
error = output.result.error
|
|
||||||
end if
|
|
||||||
error = ErrorUtils.Format(error)
|
|
||||||
LogError(error)
|
|
||||||
|
|
||||||
message = Tr(Locale.RemoteScreen.FailedToGeneratePairingCode) + `\n${error}`
|
|
||||||
DialogUtils.ShowDialogEx({
|
DialogUtils.ShowDialogEx({
|
||||||
message: message
|
message: message
|
||||||
title: Tr(Locale.RemoteScreen.TvCodeError)
|
title: Tr(Locale.RemoteScreen.TvCodeError)
|
||||||
@@ -214,18 +213,5 @@ function OnLoungeGenerateManualPairingCodeTaskResult(output as object) as void
|
|||||||
return
|
return
|
||||||
end if
|
end if
|
||||||
|
|
||||||
manualLinkCode = output.result.code
|
m.linkCodeLabel.text = info.data.code
|
||||||
if StringUtils.IsNullOrEmpty(manualLinkCode)
|
|
||||||
m.linkCodeLabel.text = ""
|
|
||||||
return
|
|
||||||
end if
|
|
||||||
|
|
||||||
' insert a space every 3 characters.
|
|
||||||
parts = []
|
|
||||||
for i = 0 to manualLinkCode.Len() - 1 step 3
|
|
||||||
parts.Push(manualLinkCode.Mid(i, 3))
|
|
||||||
end for
|
|
||||||
linkCode = parts.Join(" ")
|
|
||||||
|
|
||||||
m.linkCodeLabel.text = linkCode
|
|
||||||
end function
|
end function
|
||||||
@@ -3,6 +3,7 @@
|
|||||||
<field id="navBar" type="node" bind="/NavBar" />
|
<field id="navBar" type="node" bind="/NavBar" />
|
||||||
<field id="webServer" type="node" bind="/WebServer" />
|
<field id="webServer" type="node" bind="/WebServer" />
|
||||||
<field id="loungeService" type="node" bind="/LoungeService" />
|
<field id="loungeService" type="node" bind="/LoungeService" />
|
||||||
|
<field id="jobQueue" type="node" bind="/JobQueue" />
|
||||||
<field id="url" type="string" onChange="OnUrlSet" />
|
<field id="url" type="string" onChange="OnUrlSet" />
|
||||||
<field id="qrCodeUrl" type="string" onChange="OnUrlSet" />
|
<field id="qrCodeUrl" type="string" onChange="OnUrlSet" />
|
||||||
</interface>
|
</interface>
|
||||||
@@ -16,8 +17,7 @@
|
|||||||
vertAlign="center"
|
vertAlign="center"
|
||||||
text="Could not get IP address: are we connected to the internet?"
|
text="Could not get IP address: are we connected to the internet?"
|
||||||
wrap="true"
|
wrap="true"
|
||||||
translation="[145,0]"
|
translation="[145,0]" />
|
||||||
/>
|
|
||||||
</Group>
|
</Group>
|
||||||
<Group id="yesInternet" visible="false">
|
<Group id="yesInternet" visible="false">
|
||||||
<LayoutGroup
|
<LayoutGroup
|
||||||
@@ -83,9 +83,9 @@
|
|||||||
vertAlignment="center"
|
vertAlignment="center"
|
||||||
translation="[0,245]">
|
translation="[0,245]">
|
||||||
<LayoutGroup layoutDirection="horiz" itemSpacings="[15]">
|
<LayoutGroup layoutDirection="horiz" itemSpacings="[15]">
|
||||||
<Label
|
<!-- bs:disable-next-line LOCALE_MISSING_TRANSLATIONS -->
|
||||||
font="font:SmallSystemFont"
|
<Label text="1."
|
||||||
text="1." />
|
font="font:SmallSystemFont" />
|
||||||
<Label
|
<Label
|
||||||
font="font:SmallSystemFont"
|
font="font:SmallSystemFont"
|
||||||
width="380"
|
width="380"
|
||||||
@@ -93,9 +93,9 @@
|
|||||||
text="On your phone, connect to the same Wi-Fi network as this device." />
|
text="On your phone, connect to the same Wi-Fi network as this device." />
|
||||||
</LayoutGroup>
|
</LayoutGroup>
|
||||||
<LayoutGroup layoutDirection="horiz" itemSpacings="[15]">
|
<LayoutGroup layoutDirection="horiz" itemSpacings="[15]">
|
||||||
<Label
|
<!-- bs:disable-next-line LOCALE_MISSING_TRANSLATIONS -->
|
||||||
font="font:SmallSystemFont"
|
<Label text="2."
|
||||||
text="2." />
|
font="font:SmallSystemFont" />
|
||||||
<Label
|
<Label
|
||||||
font="font:SmallSystemFont"
|
font="font:SmallSystemFont"
|
||||||
width="380"
|
width="380"
|
||||||
@@ -103,14 +103,14 @@
|
|||||||
text="Open the YouTube app on your phone." />
|
text="Open the YouTube app on your phone." />
|
||||||
</LayoutGroup>
|
</LayoutGroup>
|
||||||
<LayoutGroup layoutDirection="horiz" itemSpacings="[15]">
|
<LayoutGroup layoutDirection="horiz" itemSpacings="[15]">
|
||||||
<Label
|
<!-- bs:disable-next-line LOCALE_MISSING_TRANSLATIONS -->
|
||||||
font="font:SmallSystemFont"
|
<Label text="3."
|
||||||
text="3." />
|
font="font:SmallSystemFont" />
|
||||||
<MultiStyleLabel
|
<!-- bs:disable-next-line LOCALE_MISSING_TRANSLATIONS -->
|
||||||
|
<MultiStyleLabel text="Tap the cast icon and select this device."
|
||||||
id="WifiInstructionWithDeviceNameLabel"
|
id="WifiInstructionWithDeviceNameLabel"
|
||||||
width="380"
|
width="380"
|
||||||
wrap="true"
|
wrap="true" />
|
||||||
text="Tap the cast icon and select this device." />
|
|
||||||
</LayoutGroup>
|
</LayoutGroup>
|
||||||
<Label
|
<Label
|
||||||
text="Roku connected to:"
|
text="Roku connected to:"
|
||||||
@@ -131,9 +131,9 @@
|
|||||||
vertAlignment="center"
|
vertAlignment="center"
|
||||||
translation="[0,245]">
|
translation="[0,245]">
|
||||||
<LayoutGroup layoutDirection="horiz" itemSpacings="[15]">
|
<LayoutGroup layoutDirection="horiz" itemSpacings="[15]">
|
||||||
<Label
|
<!-- bs:disable-next-line LOCALE_MISSING_TRANSLATIONS -->
|
||||||
font="font:SmallSystemFont"
|
<Label text="1."
|
||||||
text="1." />
|
font="font:SmallSystemFont" />
|
||||||
<Label
|
<Label
|
||||||
font="font:SmallSystemFont"
|
font="font:SmallSystemFont"
|
||||||
width="380"
|
width="380"
|
||||||
@@ -141,9 +141,9 @@
|
|||||||
text="On your phone, open the YouTube app." />
|
text="On your phone, open the YouTube app." />
|
||||||
</LayoutGroup>
|
</LayoutGroup>
|
||||||
<LayoutGroup layoutDirection="horiz" itemSpacings="[15]">
|
<LayoutGroup layoutDirection="horiz" itemSpacings="[15]">
|
||||||
<Label
|
<!-- bs:disable-next-line LOCALE_MISSING_TRANSLATIONS -->
|
||||||
font="font:SmallSystemFont"
|
<Label text="2."
|
||||||
text="2." />
|
font="font:SmallSystemFont" />
|
||||||
<Label
|
<Label
|
||||||
font="font:SmallSystemFont"
|
font="font:SmallSystemFont"
|
||||||
width="380"
|
width="380"
|
||||||
@@ -151,9 +151,9 @@
|
|||||||
text="Tap the cast icon." />
|
text="Tap the cast icon." />
|
||||||
</LayoutGroup>
|
</LayoutGroup>
|
||||||
<LayoutGroup layoutDirection="horiz" itemSpacings="[15]">
|
<LayoutGroup layoutDirection="horiz" itemSpacings="[15]">
|
||||||
<Label
|
<!-- bs:disable-next-line LOCALE_MISSING_TRANSLATIONS -->
|
||||||
font="font:SmallSystemFont"
|
<Label text="3."
|
||||||
text="3." />
|
font="font:SmallSystemFont" />
|
||||||
<Label
|
<Label
|
||||||
font="font:SmallSystemFont"
|
font="font:SmallSystemFont"
|
||||||
width="380"
|
width="380"
|
||||||
|
|||||||
@@ -0,0 +1,92 @@
|
|||||||
|
import "pkg:/components/Dialog/DialogUtils.bs"
|
||||||
|
import "pkg:/source/utils/Locale.bs"
|
||||||
|
import "pkg:/source/utils/Logging.bs"
|
||||||
|
import "pkg:/source/utils/Types.bs"
|
||||||
|
|
||||||
|
function Init()
|
||||||
|
CopyFile("libpkg:/images/icons/globe-white.png", "tmp:/globe-white.png")
|
||||||
|
CopyFile("libpkg:/images/icons/globe-black.png", "tmp:/globe-black.png")
|
||||||
|
|
||||||
|
m.languages = [
|
||||||
|
{ code: "en_US", name: "English" }
|
||||||
|
{ code: "de_DE", name: "Deutsch" }
|
||||||
|
{ code: "es_ES", name: "Español" }
|
||||||
|
{ code: "fr_FR", name: "Français" }
|
||||||
|
{ code: "pt_BR", name: "Português" }
|
||||||
|
{ code: "ru_RU", name: "Русский" }
|
||||||
|
]
|
||||||
|
|
||||||
|
languageKeys = {}
|
||||||
|
for each lang in m.languages
|
||||||
|
languageKeys[lang.code] = true
|
||||||
|
end for
|
||||||
|
m.languageKeys = languageKeys
|
||||||
|
end function
|
||||||
|
|
||||||
|
function OnNodeReady() as void
|
||||||
|
OnLanguagePreferenceChanged()
|
||||||
|
m.preferences.ObserveFieldScoped("search.keyboard_language", FuncName(OnLanguagePreferenceChanged))
|
||||||
|
end function
|
||||||
|
|
||||||
|
function keySelected(key as string) as boolean
|
||||||
|
if key = "LanguageSelect"
|
||||||
|
OnLanguageKeySelected()
|
||||||
|
return true
|
||||||
|
end if
|
||||||
|
|
||||||
|
LogDebug("Key selected:", key)
|
||||||
|
return false
|
||||||
|
end function
|
||||||
|
|
||||||
|
function OnLanguageKeySelected() as void
|
||||||
|
LogDebug("Language key selected")
|
||||||
|
|
||||||
|
buttons = []
|
||||||
|
for each lang in m.languages
|
||||||
|
buttons.Push(lang.name)
|
||||||
|
end for
|
||||||
|
|
||||||
|
dialog = DialogUtils.ShowDialogEx({
|
||||||
|
message: ""
|
||||||
|
title: Tr(Locale.Dialogs.SelectKeyboardLanguage)
|
||||||
|
buttons: buttons
|
||||||
|
})
|
||||||
|
if dialog = invalid
|
||||||
|
return
|
||||||
|
end if
|
||||||
|
|
||||||
|
dialog.observeField("buttonSelected", FuncName(OnLanguageSelected), ["buttonSelected"])
|
||||||
|
end function
|
||||||
|
|
||||||
|
function OnLanguageSelected(event as object) as void
|
||||||
|
buttonIndex = event.GetData()
|
||||||
|
|
||||||
|
if not IsInt(buttonIndex) or buttonIndex < 0 or buttonIndex >= m.languages.Count()
|
||||||
|
return
|
||||||
|
end if
|
||||||
|
|
||||||
|
lang = m.languages[buttonIndex]
|
||||||
|
SetCurrentLanguage(lang.code)
|
||||||
|
m.preferences["search.keyboard_language"] = lang.code
|
||||||
|
end function
|
||||||
|
|
||||||
|
function OnLanguagePreferenceChanged() as void
|
||||||
|
language = m.preferences["search.keyboard_language"]
|
||||||
|
if StringUtils.IsNullOrEmpty(language) or not ValidBool(m.languageKeys[language])
|
||||||
|
LogDebug("Invalid or missing keyboard language:", language, "defaulting to en_US")
|
||||||
|
language = "en_US"
|
||||||
|
m.preferences["search.keyboard_language"] = language
|
||||||
|
end if
|
||||||
|
|
||||||
|
SetCurrentLanguage(language)
|
||||||
|
end function
|
||||||
|
|
||||||
|
function SetCurrentLanguage(code as string) as void
|
||||||
|
if code = m.currentLanguage
|
||||||
|
return
|
||||||
|
end if
|
||||||
|
|
||||||
|
LogDebug("Setting keyboard language to", code)
|
||||||
|
m.currentLanguage = code
|
||||||
|
m.top.keyGrid.keyDefinitionUri = "libpkg:/config/search-kb-layout/" + code + ".json5"
|
||||||
|
end function
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<component name="SearchKeyboard" extends="DynamicCustomKeyboard" includes="AutoBind">
|
||||||
|
<interface>
|
||||||
|
<field id="preferences" type="node" bind="/Preferences" />
|
||||||
|
<function name="keySelected" />
|
||||||
|
</interface>
|
||||||
|
</component>
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
import "pkg:/components/Dialog/DialogUtils.bs"
|
import "pkg:/components/Dialog/DialogUtils.bs"
|
||||||
|
import "pkg:/components/JobSystem/Jobs.bs"
|
||||||
|
import "pkg:/components/JobSystem/JobSystem.bs"
|
||||||
import "pkg:/components/Navigation/Navigation.bs"
|
import "pkg:/components/Navigation/Navigation.bs"
|
||||||
import "pkg:/components/Services/SearchHistory/SearchHistoryUtils.bs"
|
import "pkg:/components/Services/SearchHistory/SearchHistoryUtils.bs"
|
||||||
import "pkg:/source/AsyncTask/AsyncTask.bs"
|
|
||||||
import "pkg:/source/AsyncTask/Tasks.bs"
|
|
||||||
import "pkg:/source/utils/CryptoUtils.bs"
|
import "pkg:/source/utils/CryptoUtils.bs"
|
||||||
import "pkg:/source/utils/ErrorUtils.bs"
|
import "pkg:/source/utils/ErrorUtils.bs"
|
||||||
import "pkg:/source/utils/FocusManagement.bs"
|
import "pkg:/source/utils/FocusManagement.bs"
|
||||||
@@ -24,8 +24,6 @@ function Init()
|
|||||||
|
|
||||||
m.rowList.screen = m.top
|
m.rowList.screen = m.top
|
||||||
|
|
||||||
m.keyboard.keyGrid.keyDefinitionUri = "libpkg:/config/search-keyboard-layout.json5"
|
|
||||||
|
|
||||||
textEditBox = m.keyboard.textEditBox
|
textEditBox = m.keyboard.textEditBox
|
||||||
textEditBox.voiceEntryType = "generic"
|
textEditBox.voiceEntryType = "generic"
|
||||||
textEditBox.voiceEnabled = true
|
textEditBox.voiceEnabled = true
|
||||||
@@ -43,6 +41,7 @@ end function
|
|||||||
|
|
||||||
function OnNodeReady()
|
function OnNodeReady()
|
||||||
m.rowlist@.BindNode()
|
m.rowlist@.BindNode()
|
||||||
|
m.keyboard@.BindNode()
|
||||||
m.keyboard.ObserveField("text", FuncName(OnTextChange))
|
m.keyboard.ObserveField("text", FuncName(OnTextChange))
|
||||||
m.suggestions.ObserveField("buttonFocused", FuncName(OnSearchButtonFocused))
|
m.suggestions.ObserveField("buttonFocused", FuncName(OnSearchButtonFocused))
|
||||||
m.suggestions.ObserveField("buttonSelected", FuncName(OnSearchButtonSelected))
|
m.suggestions.ObserveField("buttonSelected", FuncName(OnSearchButtonSelected))
|
||||||
@@ -100,36 +99,35 @@ function OnTextChange() as void
|
|||||||
return
|
return
|
||||||
end if
|
end if
|
||||||
|
|
||||||
if m.searchSuggestionsTask <> invalid
|
if m.searchSuggestionsJob <> invalid
|
||||||
m.searchSuggestionsTask.cancel = true
|
m.searchSuggestionsJob.cancel = true
|
||||||
end if
|
end if
|
||||||
|
|
||||||
m.searchSuggestionsTask = AsyncTask.Start(Tasks.SearchSuggestionsTask, {
|
input = {
|
||||||
q: m.keyboard.text
|
"q": m.keyboard.text
|
||||||
invidious: m.invidious
|
"invidious": m.invidious
|
||||||
preferences: m.preferences
|
"preferences": m.preferences
|
||||||
}, OnSearchSuggestionsTaskResults)
|
"searchScreen": m.top
|
||||||
|
}
|
||||||
|
|
||||||
|
m.searchSuggestionsJob = JobSystem.CreateCallback()
|
||||||
|
JobSystem.QueueJob(m.jobQueue, Jobs.SearchSuggestionsJob, input, m.searchSuggestionsJob)
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function OnSearchSuggestionsTaskResults(output as object) as void
|
function OnSearchSuggestions(event as object) as void
|
||||||
if m.searchSuggestionsTask <> invalid and m.searchSuggestionsTask.id = output.task.id
|
m.searchSuggestionsJob = invalid
|
||||||
m.searchSuggestionsTask = invalid
|
result = event.GetData()
|
||||||
end if
|
|
||||||
|
|
||||||
if output.cancelled
|
if not IsAssociativeArray(result)
|
||||||
return
|
return
|
||||||
end if
|
end if
|
||||||
|
|
||||||
if not output.success
|
|
||||||
LogError(ErrorUtils.Format(output.error))
|
|
||||||
return
|
|
||||||
end if
|
|
||||||
' In case this is an old request, discard suggestions
|
' In case this is an old request, discard suggestions
|
||||||
q = output.result.q
|
q = result.q
|
||||||
if q <> m.keyboard.text
|
if q <> m.keyboard.text
|
||||||
return
|
return
|
||||||
end if
|
end if
|
||||||
suggestions = output.result.response
|
suggestions = result.response
|
||||||
if suggestions = invalid
|
if suggestions = invalid
|
||||||
return
|
return
|
||||||
end if
|
end if
|
||||||
@@ -263,7 +261,7 @@ function OnSearchContentReady() as void
|
|||||||
end function
|
end function
|
||||||
|
|
||||||
function OnSearchError()
|
function OnSearchError()
|
||||||
' Note: we don't display an error dialog, VideoRowListRowContentTask will do that.
|
' Note: we don't display an error dialog, VideoRowListRowContentJob will do that.
|
||||||
m.rowlist.feeds = invalid
|
m.rowlist.feeds = invalid
|
||||||
m.rowlist.focusable = false
|
m.rowlist.focusable = false
|
||||||
HideLoadingScreen()
|
HideLoadingScreen()
|
||||||
|
|||||||
@@ -4,7 +4,9 @@
|
|||||||
<field id="invidious" type="node" bind="/Invidious" />
|
<field id="invidious" type="node" bind="/Invidious" />
|
||||||
<field id="appController" type="node" bind="/AppController" />
|
<field id="appController" type="node" bind="/AppController" />
|
||||||
<field id="preferences" type="node" bind="/Preferences" />
|
<field id="preferences" type="node" bind="/Preferences" />
|
||||||
|
<field id="jobQueue" type="node" bind="/JobQueue" />
|
||||||
<field id="filters" type="assocarray" />
|
<field id="filters" type="assocarray" />
|
||||||
|
<field id="searchSuggestions" type="assocarray" onChange="OnSearchSuggestions" />
|
||||||
</interface>
|
</interface>
|
||||||
<children>
|
<children>
|
||||||
<Group id="container">
|
<Group id="container">
|
||||||
@@ -16,18 +18,17 @@
|
|||||||
padding="[30,30]"
|
padding="[30,30]"
|
||||||
text="Filters" />
|
text="Filters" />
|
||||||
|
|
||||||
<DynamicMiniKeyboard
|
<SearchKeyboard
|
||||||
id="keyboard"
|
id="keyboard"
|
||||||
translation="[695,110]"
|
translation="[630,102]" />
|
||||||
/>
|
|
||||||
<ButtonGroup
|
<ButtonGroup
|
||||||
id="suggestions"
|
id="suggestions"
|
||||||
focusable="false"
|
focusable="false"
|
||||||
minWidth="400"
|
minWidth="400"
|
||||||
maxWidth="480"
|
maxWidth="480"
|
||||||
buttonHeight="50"
|
buttonHeight="50"
|
||||||
translation="[125,100]"
|
translation="[125,100]" />
|
||||||
/>
|
|
||||||
<VideoRowList
|
<VideoRowList
|
||||||
itemComponentName="RowCell"
|
itemComponentName="RowCell"
|
||||||
id="rowList"
|
id="rowList"
|
||||||
@@ -43,8 +44,7 @@
|
|||||||
showRowLabel="[true]"
|
showRowLabel="[true]"
|
||||||
rowFocusAnimationStyle="floatingfocus"
|
rowFocusAnimationStyle="floatingfocus"
|
||||||
variableWidthItems="true"
|
variableWidthItems="true"
|
||||||
focusBitmapUri="pkg:/images/focus-glow-padding-19.9.png"
|
focusBitmapUri="pkg:/images/focus-glow-padding-19.9.png" />
|
||||||
/>
|
|
||||||
<Animation
|
<Animation
|
||||||
id="scrollAnimation"
|
id="scrollAnimation"
|
||||||
duration="0.3">
|
duration="0.3">
|
||||||
|
|||||||
@@ -2,14 +2,17 @@ import "pkg:/components/Services/Innertube/InnertubeService.bs"
|
|||||||
import "pkg:/components/Services/Invidious/InvidiousService.bs"
|
import "pkg:/components/Services/Invidious/InvidiousService.bs"
|
||||||
import "pkg:/components/Services/SearchHistory/SearchHistoryUtils.bs"
|
import "pkg:/components/Services/SearchHistory/SearchHistoryUtils.bs"
|
||||||
|
|
||||||
@asynctask
|
@job("SearchSuggestionsJob")
|
||||||
function SearchSuggestionsTask(input as object) as object
|
function ExecuteJob() as void
|
||||||
|
input = JobGetInput()
|
||||||
q = input.q
|
q = input.q
|
||||||
invidiousNode = input.invidious
|
invidiousNode = input.invidious
|
||||||
preferencesNode = input.preferences
|
preferencesNode = input.preferences
|
||||||
|
seachScreenNode = input.searchScreen
|
||||||
|
|
||||||
if m.top.cancel
|
if JobIsCancelled()
|
||||||
return invalid
|
JobCancel()
|
||||||
|
return
|
||||||
end if
|
end if
|
||||||
|
|
||||||
if StringUtils.IsNullOrEmpty(q)
|
if StringUtils.IsNullOrEmpty(q)
|
||||||
@@ -26,8 +29,9 @@ function SearchSuggestionsTask(input as object) as object
|
|||||||
end if
|
end if
|
||||||
end if
|
end if
|
||||||
|
|
||||||
if m.top.cancel
|
if JobIsCancelled()
|
||||||
return invalid
|
JobCancel()
|
||||||
|
return
|
||||||
end if
|
end if
|
||||||
|
|
||||||
history = SearchHistoryUtils.GetSaved(preferencesNode, q)
|
history = SearchHistoryUtils.GetSaved(preferencesNode, q)
|
||||||
@@ -40,7 +44,7 @@ function SearchSuggestionsTask(input as object) as object
|
|||||||
end if
|
end if
|
||||||
end if
|
end if
|
||||||
|
|
||||||
return {
|
seachScreenNode.searchSuggestions = {
|
||||||
q: q
|
q: q
|
||||||
response: history
|
response: history
|
||||||
}
|
}
|
||||||
@@ -22,7 +22,8 @@ function BindPreference(_preferences as object, _key as string)
|
|||||||
end function
|
end function
|
||||||
|
|
||||||
function OnButtonSelected()
|
function OnButtonSelected()
|
||||||
CacheUtils.Clear()
|
jobQueue = m.top.getScene().findNode("JobQueue")
|
||||||
|
CacheUtils.Clear(jobQueue)
|
||||||
DialogUtils.ShowDialogEx({
|
DialogUtils.ShowDialogEx({
|
||||||
message: Tr(Locale.Settings.CacheCleared)
|
message: Tr(Locale.Settings.CacheCleared)
|
||||||
title: Tr(Locale.Generic.Success)
|
title: Tr(Locale.Generic.Success)
|
||||||
|
|||||||