Compare commits

...
102 Commits
Author SHA1 Message Date
Brahim Hadriche 5b452d527e Release v0.22.3 (#355) 2024-03-31 21:50:23 -04:00
Brahim Hadriche 900881e649 remove annoucement - bug is fixed 2024-03-31 21:40:03 -04:00
Brahim Hadriche 2a2cdd8652 Release v0.22.2 (#354) 2024-03-31 14:12:06 -04:00
Brahim Hadriche 15d06c0432 Push transpiled files 2024-03-31 14:09:08 -04:00
Brahim Hadriche ad99fbbf03 Update announcement 2024-03-31 14:08:25 -04:00
Brahim Hadriche d6005115a2 Release v0.22.1 (#353) 2024-03-30 19:43:31 -04:00
Brahim Hadriche c36745c6aa Transpiled files 2024-03-30 19:37:34 -04:00
Brahim Hadriche 595bd87970 Add outage announcement 2024-03-30 19:34:42 -04:00
fcf0334667 [chore] update dependencies (#352)
* update dependencies

* Update lint exceptions for colors

---------

Co-authored-by: iBicha <iBicha@users.noreply.github.com>
Co-authored-by: Brahim Hadriche <brahim.hadriche@gmail.com>
2024-03-29 22:13:56 -04:00
Brahim Hadriche a0b6175858 lounge log command index 2024-03-29 19:50:03 -04:00
Brahim Hadriche 99be2071d1 Simplify timed dialog 2024-03-29 12:48:03 -04:00
Brahim Hadriche 305ddaa737 Add some timestamps to logs 2024-03-29 11:30:54 -04:00
Brahim Hadriche 20816d09f7 Fix/lounge lost session (#351)
* Maybe a fix

* Update CHANGELOG.md

* status reset
2024-03-28 18:38:14 -04:00
Brahim Hadriche 839f49888f todo 2024-03-28 17:28:54 -04:00
Brahim Hadriche b67587df2b TimedDialog bug fix 2024-03-28 17:06:25 -04:00
Brahim Hadriche e5062c34d7 No history sync in tools 2024-03-27 12:39:33 -04:00
Brahim Hadriche 29f5373492 remove duplicate translation 2024-03-25 22:18:36 -04:00
Weblate (bot)andBrahim Hadriche f17e93936c Translated using Weblate (French (Canada)) (#344)
Currently translated at 100.0% (310 of 310 strings)

Translation: Playlet/Playlet
Translate-URL: https://hosted.weblate.org/projects/playlet/playlet/fr_CA/

Co-authored-by: Brahim Hadriche <brahim.hadriche@gmail.com>
2024-03-25 22:15:11 -04:00
Brahim Hadriche c69ab716f5 small refactor modals 2024-03-25 17:29:35 -04:00
Brahim Hadriche bd389473e5 Adjust spacing in settings 2024-03-25 16:45:44 -04:00
Brahim Hadriche cfa7662f2e Update CHANGELOG.md 2024-03-24 23:26:05 -04:00
Brahim Hadriche 609c4622fd Bookmarks to feed refactor 2024-03-24 23:23:23 -04:00
Brahim Hadriche 45262c6394 tweak to registry tool 2024-03-24 21:51:32 -04:00
Brahim Hadriche 7ce3b2636c Release v0.22.0 (#341) 2024-03-24 21:32:22 -04:00
Brahim Hadriche a75ce42373 Adjust queue clear button 2024-03-24 21:12:02 -04:00
Brahim Hadriche fd8b61ad44 Add support for channel releases (#340) 2024-03-24 15:30:43 -04:00
Brahim Hadriche 3391e3d787 Fix search sort filters (#338) 2024-03-24 14:37:40 -04:00
Brahim Hadriche 862fea74e7 Update screenshots 2024-03-24 12:38:23 -04:00
Brahim Hadriche de4f64d38f Small tweak 2024-03-24 12:34:09 -04:00
Brahim Hadriche aab99b2a2e Small fix for lounge api 2024-03-23 23:38:11 -04:00
Brahim Hadriche 51eb7bdfa2 Translation files 2024-03-23 18:34:13 -04:00
Brahim Hadriche 3d52d00bde Update README.md 2024-03-23 18:29:01 -04:00
Brahim Hadriche bd26e727c1 Playlet is now available in English and French 2024-03-23 18:02:57 -04:00
Brahim Hadriche 3b622f65f3 Localize loading messages 2024-03-23 17:14:55 -04:00
Brahim Hadriche 615439650e Locale for context menu (#337) 2024-03-23 14:30:32 -04:00
Brahim Hadriche 25330a6494 More translation work 2024-03-23 00:19:15 -04:00
github-actions[bot]andiBicha 37e429f648 update dependencies (#336)
Co-authored-by: iBicha <iBicha@users.noreply.github.com>
2024-03-22 21:50:19 -04:00
Brahim Hadriche 6e6ea94544 Bug fix 2024-03-22 21:49:16 -04:00
Brahim Hadricheandgithub-action linter 42dadec020 locale for web app (#334)
* locale for web app

* more translations

* Rename profiles service to avoid locale conflict

* More translation work

* Lint fix

---------

Co-authored-by: github-action linter <githubaction@githubaction.com>
2024-03-22 17:43:03 -04:00
Brahim Hadriche 019fde1e67 localize sort options 2024-03-21 21:02:26 -04:00
Brahim Hadriche fb0b1b8894 queue locale 2024-03-20 17:42:46 -04:00
Brahim Hadriche 66df27cf0b locale of publish date fix 2024-03-20 13:19:36 -04:00
Brahim Hadriche feb968a72e Notifications locale 2024-03-20 00:36:38 -04:00
Brahim Hadriche 9061275d6f Missed one 2024-03-19 23:28:32 -04:00
Brahim Hadriche 059167ac56 Changelog 2024-03-19 23:17:39 -04:00
Brahim Hadriche 7330b321a5 Localization part 3 (#333)
* TODO

* TODO

* Add some translations

* Remote screen and settings

* Video player and http client
2024-03-19 23:16:39 -04:00
Brahim Hadriche 9a7db6aab2 Localization part 2 (#332)
* More localization work

* instance testing translation

* Row cell translations

* safety check
2024-03-18 22:53:08 -04:00
Brahim Hadriche 48993dd9f5 Split locale enum, add duplicate values validation 2024-03-18 09:21:42 -04:00
Brahim Hadriche 7d9817994c Localization test (#331)
* Localization test

* More translations

* More translations

* Setup the tooling and validation for the localization

* More translations

* Docs
2024-03-17 22:22:53 -04:00
Brahim Hadriche 403ed94e97 Remove invalid properties 2024-03-17 00:13:00 -04:00
Brahim Hadriche 67252cd5d5 Add network throttling for debugging 2024-03-16 13:49:33 -04:00
Brahim Hadriche e4efc6832f Broadcast safe colors (#330)
* Broadcast safe colors

* changelog
2024-03-16 13:17:17 -04:00
github-actions[bot]andiBicha 13138740fb update dependencies (#329)
Co-authored-by: iBicha <iBicha@users.noreply.github.com>
2024-03-15 21:53:03 -04:00
Brahim Hadriche b37b89bffc Adjust icons 2024-03-13 17:19:28 -04:00
Brahim Hadriche 888f7da214 Buttons, mostly 2024-03-13 13:34:59 -04:00
Brahim Hadricheandgithub-action linter 750e24f724 ButtonEx (#319)
* Finish buttons

* optional animation

* Lint fix

* Remove test stuff

* Lint fix

* Use button

---------

Co-authored-by: github-action linter <githubaction@githubaction.com>
2024-03-12 18:00:07 -04:00
Brahim Hadriche bfd4f3e298 Sort channel videos and playlists (#328)
* Sort channel videos and playlists

* changelog
2024-03-12 16:59:50 -04:00
Brahim Hadriche 7b7801d7a5 Sort channel videos and playlists (#327) 2024-03-12 16:42:03 -04:00
Brahim Hadriche ffb84d1c89 [chore] deps and versions (java version) 2024-03-11 15:48:37 -04:00
Brahim Hadriche d29e51c7f2 [chore] deps and versions 2024-03-11 15:48:03 -04:00
Brahim Hadriche b72a6d4614 Use bold letters for the device display name 2024-03-10 12:19:59 -04:00
Brahim Hadriche 289b845876 Add cancellation support to instance testing 2024-03-10 11:48:11 -04:00
Brahim Hadriche 910d57795a Release v0.21.2 (#324) 2024-03-10 11:14:57 -04:00
Brahim Hadriche ef733d8d88 Fix deep linking 2024-03-10 11:06:16 -04:00
Brahim Hadriche 6ad42f3fcd update metadata 2024-03-09 23:11:28 -05:00
Brahim Hadriche 1ba5184d95 Release v0.21.1 (#323) 2024-03-09 22:59:04 -05:00
Brahim Hadriche 26ed985ecc Bug fixes 2024-03-09 22:55:07 -05:00
Brahim Hadriche 6b47440cb5 Add launch arg to clear 2024-03-09 19:09:11 -05:00
Brahim Hadriche ee3312763d Add a loading indicator to QR codes 2024-03-09 18:34:32 -05:00
Brahim Hadriche 7bb73e0fb6 Dev video player (#321) 2024-03-09 08:44:32 -05:00
f71ad7b873 [chore] update dependencies (#320)
* update dependencies

* no message

---------

Co-authored-by: iBicha <iBicha@users.noreply.github.com>
Co-authored-by: Brahim Hadriche <brahim.hadriche@gmail.com>
2024-03-08 23:30:09 -05:00
Brahim Hadriche 0f6329997d tweak optional chaining rule 2024-03-08 23:14:32 -05:00
Brahim Hadriche 58918f68fb Add a /watch endpoint for easier casting 2024-03-08 13:19:40 -05:00
Brahim Hadriche 8a63bc848d Disallow optional chaining operator 2024-03-08 12:06:41 -05:00
Brahim Hadriche 9315fa6cf7 Added subscriber count in the channel page 2024-03-07 23:12:35 -05:00
Brahim Hadriche 15841cf5bf Release v0.21.0 (#318) 2024-03-07 22:30:36 -05:00
Brahim Hadriche 9c7de8f41f Add user agent to player 2024-03-06 08:26:33 -05:00
Brahim Hadriche 405e1aa703 Revert "use region param in videos api endpoint" (#317)
This reverts commit 79d9e0f069.
2024-03-06 08:26:08 -05:00
Brahim Hadriche 79d9e0f069 use region param in videos api endpoint 2024-03-05 18:14:42 -05:00
Brahim Hadriche d8bfd8859e remove todo 2024-03-04 23:44:36 -05:00
Brahim Hadriche 1c8d075e87 Fix empty invidious instance in preferences 2024-03-04 13:03:59 -05:00
13bb21c1f7 [chore] update dependencies (#314)
* update dependencies

* revert rooibos

---------

Co-authored-by: iBicha <iBicha@users.noreply.github.com>
Co-authored-by: Brahim Hadriche <brahim.hadriche@gmail.com>
2024-03-04 12:40:43 -05:00
Brahim Hadricheandgithub-action linter 394dd23999 Multiple profiles (#312)
* Navbar user profile

* profiles stuff

* fix profile

* Lint fix

* Some ui experiments

* More ui work

* progress

* Lint fix

* migration, web api, wip

* profile view and web app

* web app and apis

* Invidious and profiles

* Lint fix

* bug fix

* Remove ActionContentNode

* Profile icon button, profile color

* Lint fix

* reset server url

* href that doesn't work

* remove activate button on active profile

* TODO

* Fin.

* Final touches

---------

Co-authored-by: github-action linter <githubaction@githubaction.com>
2024-03-04 09:04:34 -05:00
Brahim Hadriche 8e03ca0ea6 Fix empty search results bug 2024-02-27 20:45:32 -05:00
Brahim Hadriche aebdc579a9 Small cleanup 2024-02-27 20:04:12 -05:00
Brahim Hadriche 87e7d91169 Format fix 2024-02-27 17:20:15 -05:00
Brahim Hadriche c334736325 play next video on fail 2024-02-27 17:14:15 -05:00
Brahim Hadriche bb0a0725d6 Release 0.20.2 (#311) 2024-02-26 18:57:52 -05:00
Brahim Hadriche f2ffb42876 refactor url encoded form requests 2024-02-26 18:44:57 -05:00
Brahim Hadriche edbfc86e56 changelog 2024-02-26 09:47:18 -05:00
Brahim Hadriche b25eaafc82 Fix for sponsorblock highlight label 2024-02-26 09:46:20 -05:00
Brahim Hadriche ef9c653ad7 Device connected notification only show once every half hour per device to avoid spam 2024-02-25 22:16:01 -05:00
Andrey LazarevichandBrahim Hadriche e9f015bb19 OK button as Play/Pause (#307)
* OK button as Play/Pause

First OK press now shows Video UI.
It's achievable via hidden Roku Video node property `showUI`, which allows you to override how trickplay should be displayed by specifying parts of the UI to be rendered (like 'titleAndTime', 'trickplayBar', e.t.c). A timer is started every time custom UI is shown to prevent UI from staying forever.

Second OK press while UI is visible pauses the video (pause poster animation is not added yet).

However, since we shouldn't break default OK button actions, we must track whether user is seeking in video UI and if they do, fallback to Video internal OK handler.

Also, auto-formatted VideoPlayer.xml

* fix comment typo

* move HideUI function slightly higher

* Addressed the feedback:

* Add a workaround to leave Live video behavior intact (no pause, ok simply switches UI back and forth)
* Hide UI when minimizing to avoid a bug where title and time element could stay forver
* More aggressive `isSeeking` detection, so every left/right/ff/rw button press would cause us to fall back to default OK button handler

* More accurate liveNow handling

* Changelog

---------

Co-authored-by: Brahim Hadriche <brahim.hadriche@gmail.com>
2024-02-25 20:05:11 -05:00
Brahim Hadriche 544671f246 remove old todo 2024-02-25 19:55:13 -05:00
Brahim Hadriche f45ba30979 Colored logs for debugging (#308)
* Colored logs for debugging

* disable colors
2024-02-25 19:06:27 -05:00
Brahim Hadriche 4953e4481f Rename files for consistency 2024-02-24 19:08:43 -05:00
Brahim Hadriche c7b0815768 New focus 9 patch textures 2024-02-24 19:03:12 -05:00
Brahim Hadriche 4ab7f74a4e More adjustments to context menu 2024-02-24 16:58:18 -05:00
Brahim Hadriche 96916f6c37 Formatting 2024-02-24 11:44:03 -05:00
Brahim Hadriche eafad684b6 Small improvement 2024-02-24 11:40:52 -05:00
Brahim Hadriche 14d3e38aeb Tweaks to remote screen UI 2024-02-23 22:21:44 -05:00
afe281c094 [chore] update dependencies (#306)
* update dependencies

* Update package.json

* lock file

---------

Co-authored-by: iBicha <iBicha@users.noreply.github.com>
Co-authored-by: Brahim Hadriche <brahim.hadriche@gmail.com>
2024-02-23 20:04:14 -05:00
281 changed files with 8901 additions and 1954 deletions

No files matched your search

+3 -3
View File
@@ -24,10 +24,10 @@ jobs:
git config --local user.email "githubaction@githubaction.com"
git config --local user.name "github-action linter"
- name: Use Node.js 18.x
uses: actions/setup-node@v3
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 18.x
node-version: 20.x
cache: "npm"
- name: Install dependencies
+6 -6
View File
@@ -17,10 +17,10 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Use Node.js 18.x
uses: actions/setup-node@v3
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 18.x
node-version: 20.x
cache: "npm"
- name: Install dependencies
@@ -32,11 +32,11 @@ jobs:
- name: Build Playlet
run: npm run build:release:ci
- name: Use Java 17
uses: actions/setup-java@v3
- name: Use Java 21
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "17"
java-version: "21"
- name: Download the Static Channel Analysis CLI
run: |
+3 -3
View File
@@ -24,10 +24,10 @@ jobs:
git config --local user.name "github-action wiki updater"
working-directory: ./playlet.wiki
- name: Use Node.js 18.x
uses: actions/setup-node@v3
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 18.x
node-version: 20.x
cache: "npm"
- name: Install dependencies
+3 -3
View File
@@ -12,10 +12,10 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Use Node.js 18.x
uses: actions/setup-node@v3
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 18.x
node-version: 20.x
cache: "npm"
- name: Install dependencies
+3
View File
@@ -1,4 +1,7 @@
{
"files.associations": {
"**/locale/**/*.ts": "xml"
},
"brightscript.output.clearConsoleOnChannelStart": false,
"brightscript.bsdk": "node_modules/brighterscript",
"editor.formatOnSave": true,
+88 -2
View File
@@ -2,9 +2,95 @@
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
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).
## [0.22.3] - 2024-03-31
### Changed
- Removed announcement
## [0.22.2] - 2024-03-31
### Changed
- Updated announcement
## [0.22.1] - 2024-03-30
### Added
- Announcement dialog to indicate outage
### Fixed
- [Attempt] A bug where the lounge would randomly lose the session id, making it unable to cast, and spam the same error over and over
- Dialog with timer now stops as expected if any button is pressed
## [0.22.0] - 2024-03-24
### Added
- Context menu sort options for channel videos and playlists
- Localization support and French translations
- Channel releases
### Changed
- Colors to be more broadcast safe
### Fixed
- A bug where instance testing is not immediately cancelled when the testing page is closed
- A bug in the web app where "upcoming" videos show up as "live"
- Search sort filters
## [0.21.2] - 2024-03-10
### Fixed
- Deeplinking required for certification
## [0.21.1] - 2024-03-09
### Added
- Subscriber count in the channel page
### Fixed
- A bug where videos that did not premiere yet would error with a playback error
- A bug where a playback error dialog is dismissed too fast before playing the next video
## [0.21.0] - 2024-03-07
### Added
- Support for multiple profiles. You can now use multiple Invidious accounts.
- When a video error dialog shows, a timer with 10 seconds starts to play the next video
### Fixed
- A bug where the loading screen does not disappear if search results are empty.
- Empty invidious instance in preferences when default instance is being used
## [0.20.2] - 2024-02-26
### Added
- Small improvement in the context menu of the Playlist view
- Videos can be paused and resumed using the `OK` remote button
### Fixed
- `Device connected` notification only show once every 30 minutes per device to avoid spam
- SponsorBlock category "highlight" was not visible in chapter label
### Changed
- UI focus images are now with rounded corners, and with a slight glow
## [0.20.1] - 2024-02-23
### Fixed
@@ -96,7 +182,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- If you like to add these two feeds to your bookmarks:
- Search for `Funny` (or `News`)
- Set the `Sort by` filter to `Upload date`
- Press and hold the `Ok` button while a video from the search result is selected
- Press and hold the `OK` button while a video from the search result is selected
- Choose the `Add to "Search - Funny"` option
## [0.18.0] - 2023-12-28
+3
View File
@@ -9,6 +9,9 @@
<img alt="Current Release" src="https://img.shields.io/github/release/iBicha/playlet.svg"/>
<img alt="Total Downloads" src="https://img.shields.io/github/downloads/iBicha/playlet/latest/playlet-lib.zip.svg"/>
</a>
<a href="https://hosted.weblate.org/engage/playlet/">
<img src="https://hosted.weblate.org/widget/playlet/svg-badge.svg" alt="Translation status" />
</a>
<a href="/LICENSE">
<img alt="AGPL-3.0 license" src="https://img.shields.io/github/license/iBicha/playlet.svg"/>
</a>
+15 -1
View File
@@ -40,6 +40,18 @@
"regex": "\\b(?!_unused)unused\\b",
"regexFlags": "ig",
"message": "unused args should start with _ (e.g. _unused)"
},
{
"code": "NO_OPTIONAL_CHAINING",
"regex": "\\?[\\.|\\[|\\(|@]",
"regexFlags": "ig",
"message": "No optional chaning (var1?.property). Do a type check instead."
},
{
"code": "NO_TRANSLATE_STRING_LITERAL",
"regex": "\\bTr\\s*\\(\\s*\"[^\\\"]*\"\\s*\\)",
"regexFlags": "ig",
"message": "Tr(\"String\") is not allowed. Use Tr(Locale.Key) instead."
}
],
"files": [
@@ -50,6 +62,7 @@
"!**/*.psd",
"!**/*.svg",
"!**/*.svg.meta.json5",
"locale/**",
"config/**",
"lib/**",
"www/**",
@@ -73,7 +86,8 @@
"../tools/bs-plugins/logger-plugin.ts",
"../tools/bs-plugins/image-gen-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"
],
"retainStagingDir": true,
"require": [
+3 -1
View File
@@ -8,6 +8,7 @@
"!**/*.psd",
"!**/*.svg",
"!**/*.svg.meta.json5",
"locale/**",
"config/**",
"lib/**",
"www/**",
@@ -29,7 +30,8 @@
"../tools/bs-plugins/logger-plugin.ts",
"../tools/bs-plugins/image-gen-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"
],
"rooibos": {
"logLevel": 2,
+8 -2
View File
@@ -294,14 +294,20 @@ This is mostly useful to QA the `canary` release (see [Canary release](https://e
#### In case of a softlock
If the dev menu is used to load a custom Playlet lib url, but the lib does not have a functionality to revert back:
If the dev menu is used to load a custom Playlet lib url, but you couldn't revert back:
```bash
curl -d '' "http://$ROKU_DEV_TARGET:8060/launch/dev?clearPlayletLibUrls=true"
curl -d '' "http://$ROKU_DEV_TARGET:8060/launch/693751?clearPlayletLibUrls=true"
```
This will remove the custom lib, and revert to using default (latest release from Github).
If you need to clear all the data from the registry, use
```bash
curl -d '' "http://$ROKU_DEV_TARGET:8060/launch/693751?clearRegistry=true"
```
## CI/CD
On pull requests, a Github action will run `lint:fix` and `format:fix` and push changes to the PR branch, to keep things tidy.
+78 -13
View File
@@ -2,7 +2,7 @@ openapi: 3.0.0
info:
title: Playlet Web API
version: 0.20.1
version: 0.22.3
description:
Playlet Web API is a RESTful API for controlling the Playlet app on
Roku devices. The API is intended to be used by the Playlet web app, but can
@@ -322,14 +322,63 @@ paths:
schema:
type: string
format: uri
/invidious/logout:
/api/profiles:
get:
summary: Logout from Invidious
description: Logout from Invidious, and invalidate the token if any.
operationId: invidiousLogout
summary: Get profiles
description: Get the logged profiles, and the currently active profile.
operationId: getProfiles
responses:
"204":
description: No Content
"200":
description: OK
content:
application/json:
schema:
type: object
properties:
currentProfile:
type: string
profiles:
type: array
items:
$ref: "#/components/schemas/ProfileObject"
delete:
summary: Logout from a profile
description: Logout from a profile. This will remove the profile from the list of logged profiles.
operationId: logoutProfile
parameters:
- name: id
in: query
description: The ID of the profile to logout
required: true
schema:
type: string
responses:
"200":
description: OK
"400":
description: Bad Request
"404":
description: Not Found
/api/profiles/activate:
post:
summary: Activate a profile
description: Activate a profile. This will set the profile as the active profile.
operationId: activateProfile
requestBody:
content:
application/json:
schema:
type: object
properties:
id:
type: string
responses:
"200":
description: OK
"400":
description: Bad Request
"404":
description: Not Found
# Roku External Control Protocol (ECP)
/input/{appId}:
@@ -523,6 +572,8 @@ components:
type: string
friendly_name:
type: string
current_locale:
type: string
invidious:
type: object
properties:
@@ -530,14 +581,17 @@ components:
type: string
auth_url:
type: string
logged_in:
type: boolean
logged_in_instance:
type: string
logged_in_username:
type: string
preferences:
$ref: "#/components/schemas/PreferencesObject"
profiles:
type: object
properties:
currentProfile:
type: string
profiles:
type: array
items:
$ref: "#/components/schemas/ProfileObject"
PreferencesObject:
type: object
properties:
@@ -560,6 +614,17 @@ components:
type: boolean
sponsorblock.show_notifications:
type: boolean
ProfileObject:
type: object
properties:
id:
type: string
type:
type: string
username:
type: string
serverUrl:
type: string
# TODO:P1 add the rest of properties
VideoQueueObject:
type: object
+21
View File
@@ -12,6 +12,7 @@
- [Logger](#logger)
- [Type Gen](#type-gen)
- [Web Server](#web-server)
- [Locale validation](#locale-validation)
Playlet implements a few [Brighterscript Plugins](https://github.com/rokucommunity/brighterscript/blob/master/docs/plugins.md). The plugins inject themselves in the compilation process, allowing the modification of bs scripts, xml components, and even assets or the app manifest. Let's start with a simple one:
@@ -602,3 +603,23 @@ There one special annotation, and one special route:
- `*` matches all paths
So `@all(*)` would be a middleware that will be matched with any request.
## Locale validation
**[Source](/tools/bs-plugins/locale-validation-plugin.ts)**
### Why
Roku's built-in localization system has some undesired side effects: for example, it might translate node ids, which would break the relationship between the nodes.
This plugin enforces some rules to ensure translation files are kept up to date with code implementation.
See the next section for the validation rules.
### How
The plugin checks for the following:
- Translated words and sentenses are defined in an enum annotated with `@locale`
- All the values in the `@locale` enums must be provided in the English (`en_US`) translation. This is because `en_US` is the fallback translation when the current localte translations are not complete.
- `en_US` must have matching source and translation values, so it can act as a fallback translation.
- All `source` translations from all languages must be present in the `@locale` enums. This is to prevent renaming the values in the code without updating translation files.
- Translation `source` keys can't be used except for certain fields such as `"text"` and `"title"`. This is to prevent the accidental localization of non-display fields, such as node ids.
+10 -6
View File
@@ -14,13 +14,17 @@
| ------------------------- | --------------------------- |
| ![Channel](./channel.jpg) | ![Playlist](./playlist.jpg) |
| Settings | Invidious instances | Invidious testing |
| --------------------------- | ------------------------------------------------ | --------------------------------------------- |
| ![Settings](./settings.jpg) | ![Invidious instances](./invidious-settings.jpg) | ![Invidious testing](./invidious-testing.jpg) |
| Profiles | Settings |
| --------------------------- | --------------------------- |
| ![Profiles](./profiles.jpg) | ![Settings](./settings.jpg) |
| Remote | App info |
| ----------------------- | --------------------------- |
| ![Remote](./remote.jpg) | ![App info](./app-info.jpg) |
| Invidious instances | Invidious testing |
| ------------------------------------------------ | --------------------------------------------- |
| ![Invidious instances](./invidious-settings.jpg) | ![Invidious testing](./invidious-testing.jpg) |
| Remote | Info |
| ----------------------- | ------------------- |
| ![Remote](./remote.jpg) | ![Info](./info.jpg) |
## Playlet web app
Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 KiB

After

Width:  |  Height:  |  Size: 98 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 123 KiB

After

Width:  |  Height:  |  Size: 122 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 124 KiB

After

Width:  |  Height:  |  Size: 109 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 67 KiB

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 83 KiB

After

Width:  |  Height:  |  Size: 87 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 43 KiB

+598 -168
View File
File diff suppressed because it is too large. Load diff
+16 -15
View File
@@ -1,38 +1,39 @@
{
"name": "playlet",
"version": "0.20.1",
"version": "0.22.3",
"description": "Unofficial YouTube client for Roku",
"devDependencies": {
"@rokucommunity/bslint": "^0.8.17",
"@rokucommunity/bslint": "^0.8.20",
"@types/crypto-js": "^4.2.2",
"@types/fs-extra": "^11.0.4",
"@types/node": "^20.11.19",
"@types/node": "^20.11.30",
"@types/xml2js": "^0.4.14",
"argparse": "^2.0.1",
"brighterscript": "0.65.22",
"brighterscript-formatter": "^1.6.40",
"brighterscript": "0.65.27",
"brighterscript-formatter": "^1.7.1",
"convert-svg-to-png": "^0.6.4",
"cross-fetch": "^4.0.0",
"crypto-js": "^4.2.0",
"dotenv": "^16.4.4",
"express": "^4.18.2",
"dotenv": "^16.4.5",
"express": "^4.19.2",
"fs-extra": "^11.2.0",
"glob": "^10.3.10",
"glob": "^10.3.12",
"imap": "^0.8.19",
"ip": "^1.1.8",
"ip": "^2.0.1",
"json5": "^2.2.3",
"mailparser": "^3.6.7",
"roku-deploy": "^3.11.2",
"rooibos-roku": "5.10.0",
"mailparser": "^3.6.9",
"roku-deploy": "^3.12.0",
"rooibos-roku": "5.12.0",
"rounded-rect-9patch": "^1.0.1",
"semver": "^7.6.0",
"shelljs": "^0.8.5",
"ts-node": "^10.9.2",
"typescript": "^5.3.3",
"typescript": "^5.4.3",
"xml2js": "^0.6.2",
"yaml": "^2.3.4"
"yaml": "^2.4.1"
},
"engines": {
"node": "18"
"node": "20"
},
"scripts": {
"dev:web": "cd playlet-web && npm run dev",
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "playlet-app",
"version": "0.20.1",
"version": "0.22.3",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "playlet-app",
"version": "0.20.1"
"version": "0.22.3"
}
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "playlet-app",
"version": "0.20.1",
"version": "0.22.3",
"description": "Unofficial YouTube client for Roku",
"scripts": {
"prebuild": "rm -rf build/playlet-app",
Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.9 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

@@ -3,24 +3,24 @@
outputs: [
{
outputFilePath: 'images/channel-poster_fhd.png',
outputHash: '50729b5bdd2a7c0fd4a1d502812117d4',
outputHash: '49c39d7f33e37a8214bf05d7db016e97',
width: 540,
height: 405,
background: '#EEEEEE',
background: '#EBEBEB',
},
{
outputFilePath: 'images/channel-poster_hd.png',
outputHash: '8022dc6fa993ce3194c5aea37d6ea49a',
outputHash: '4968cb52fca911be47fa17e61f0af4a5',
width: 290,
height: 218,
background: '#EEEEEE',
background: '#EBEBEB',
},
{
outputFilePath: 'images/channel-poster_sd.png',
outputHash: '63b8f12ac155c29b4e85db17a2886817',
outputHash: 'e976889af6743044db344219ec44514c',
width: 246,
height: 140,
background: '#EEEEEE',
background: '#EBEBEB',
},
],
}
+2 -2
View File
@@ -2,8 +2,8 @@ title=Playlet
# Do not update version manually, it is auto updated from package.json
major_version=0
minor_version=20
build_version=00001
minor_version=22
build_version=00003
ui_resolutions=hd
+2 -2
View File
@@ -22,9 +22,9 @@ function DialogSetPalette(msgDialog as object)
DialogBackgroundColor: "#242424FF"
DialogFocusColor: "#CECECEFF"
DialogFocusItemColor: "#202020FF"
DialogSecondaryTextColor: "#DBDBDBFF"
DialogSecondaryTextColor: "#EBEBEBFF"
DialogSecondaryItemColor: "#FF1C30FF"
DialogTextColor: "#DBDBDBFF"
DialogTextColor: "#EBEBEBFF"
}
msgDialog.palette = palette
end function
+1
View File
@@ -22,6 +22,7 @@ function Main(args as object) as void
Logger.Init()
Registry.ClearPlayletLibUrlsIfNeeded(args)
Registry.ClearRegistryIfNeeded(args)
scene = screen.CreateScene("BootstrapScene")
screen.show()
+17
View File
@@ -14,6 +14,15 @@ namespace Registry
sec.Flush()
end function
function DeleteAll()
reg = CreateObject("roRegistry")
sectionNames = reg.GetSectionList()
for each sectionName in sectionNames
reg.Delete(sectionName)
end for
reg.Flush()
end function
function GetPlayletLibUrlsFromRegistry() as object
urlsJson = ReadKey("playlet_lib_urls", "Playlet")
if urlsJson = invalid
@@ -31,4 +40,12 @@ namespace Registry
Logger.Log("Cleared key playlet_lib_urls from registry")
end function
function ClearRegistryIfNeeded(launchArgs as object) as void
if launchArgs = invalid or launchArgs.clearRegistry = invalid
return
end if
DeleteAll()
Logger.Log("Cleared all data from registry")
end function
end namespace
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "playlet-lib",
"version": "0.20.1",
"version": "0.22.3",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "playlet-lib",
"version": "0.20.1"
"version": "0.22.3"
}
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "playlet-lib",
"version": "0.20.1",
"version": "0.22.3",
"description": "Unofficial YouTube client for Roku",
"scripts": {
"prebuild": "rm -rf build/playlet-lib",
@@ -3,6 +3,7 @@ import "pkg:/components/Navigation/LongPress.bs"
import "pkg:/components/VideoQueue/VideoQueueUtils.bs"
import "pkg:/components/VideoQueue/VideoQueueViewUtils.bs"
import "pkg:/source/utils/FocusManagement.bs"
import "pkg:/source/utils/Locale.bs"
import "pkg:/source/utils/Logging.bs"
import "pkg:/source/utils/StringUtils.bs"
import "pkg:/source/utils/Types.bs"
@@ -125,7 +126,7 @@ function onKeyEvent(key as string, press as boolean) as boolean
return true
end if
end if
dialog = DialogUtils.ShowDialogButtons("Do you want to exit Playlet?", "Exit", ["Exit", "Cancel"])
dialog = DialogUtils.ShowDialogButtons(Tr(Locale.Dialogs.ExitPlayletQuestion), Tr(Locale.Buttons.exit), [Tr(Locale.Buttons.exit), Tr(Locale.Buttons.Cancel)])
dialog.observeField("buttonSelected", FuncName(OnExitDialog), ["buttonSelected"])
return true
end if
@@ -0,0 +1,146 @@
import "pkg:/source/utils/MathUtils.bs"
import "pkg:/source/utils/Types.bs"
function Init()
m.backgroundNode = m.top.findNode("background")
m.labelNode = m.top.findNode("label")
m.iconNode = m.top.findNode("icon")
m.anchorNode = m.top.findNode("anchor")
m.focusAnimation = m.top.findNode("focusAnimation")
m.normalFont = m.top.findNode("normalFont")
m.boldFont = m.top.findNode("boldFont")
DoLayout()
OnDisabledChange()
m.top.observeField("focusedChild", FuncName(OnFocusedChild))
end function
function DoLayout() as void
minWidth = m.top.minWidth
height = m.top.height
padding = m.top.padding
textVisible = m.top.textVisible
iconVisible = m.top.iconVisible
if not textVisible and not iconVisible
m.top.width = minWidth
return
end if
contentWidth = 0
iconWidth = 0
iconHeight = 0
textWidth = 0
iconTextSpacing = 0
if iconVisible
iconWidth = m.top.iconWidth
iconHeight = m.top.iconHeight
contentWidth += iconWidth
end if
if textVisible
labelRect = m.labelNode.boundingRect()
textWidth = labelRect.width
contentWidth += textWidth
end if
if iconVisible and textVisible
iconTextSpacing = m.top.iconTextSpacing
contentWidth += iconTextSpacing
end if
contentWidth += padding[0] + padding[1]
width = MathUtils.Max(contentWidth, minWidth)
m.top.width = width
if iconVisible
x = (width - contentWidth) / 2 + padding[0]
y = (height - iconHeight) / 2
m.iconNode.translation = [x, y]
end if
if textVisible
x = (width - contentWidth) / 2 + padding[0] + iconWidth + iconTextSpacing
m.labelNode.height = height
m.labelNode.translation = [x, 0]
end if
OnAnchorChange()
end function
function OnAnchorChange()
width = m.top.width
height = m.top.height
anchor = m.top.anchor
m.anchorNode.scaleRotateCenter = [width / 2, height / 2]
m.anchorNode.translation = [-width * anchor[0], -height * anchor[1]]
end function
function OnDisabledChange()
disabled = m.top.disabled
if disabled
if m.top.textVisible
m.labelNode.color = m.top.disabledTextColor
m.labelNode.font = m.normalFont
end if
if m.top.iconVisible
m.iconNode.blendColor = m.top.disabledIconColor
end if
m.backgroundNode.blendColor = m.top.disabledBackgroundColor
else
OnButtonFocused()
end if
m.top.focusable = not disabled
end function
function OnFocusedChild()
m.top.buttonFocused = m.top.hasFocus()
end function
function OnButtonFocused()
buttonFocused = m.top.buttonFocused
textVisible = m.top.textVisible
iconVisible = m.top.iconVisible
if buttonFocused
if textVisible
m.labelNode.color = m.top.focusedTextColor
m.labelNode.font = m.boldFont
end if
if iconVisible
m.iconNode.blendColor = m.top.focusedIconColor
end if
m.backgroundNode.blendColor = m.top.focusedBackgroundColor
m.focusAnimation.control = "start"
else
if textVisible
m.labelNode.color = m.top.textColor
m.labelNode.font = m.normalFont
end if
if iconVisible
m.iconNode.blendColor = m.top.iconColor
end if
m.backgroundNode.blendColor = m.top.backgroundColor
end if
end function
function OnkeyEvent(key as string, press as boolean) as boolean
if not press
return false
end if
if key = "OK"
disabled = m.top.disabled
if not disabled
m.top.buttonSelected = true
end if
return true
end if
return false
end function
@@ -0,0 +1,60 @@
<component name="ButtonEx" extends="Group">
<interface>
<field id="text" type="string" alias="label.text" onChange="DoLayout" />
<field id="textVisible" type="boolean" alias="label.visible" onChange="DoLayout" />
<field id="textColor" type="color" value="#DDDDDD" />
<field id="focusedTextColor" type="color" value="#262626" />
<field id="disabledTextColor" type="color" value="#606060" />
<field id="normalFontSize" type="integer" alias="normalFont.size" onChange="DoLayout" />
<field id="boldFontSize" type="integer" alias="boldFont.size" onChange="DoLayout" />
<field id="iconTextSpacing" type="float" value="10" onChange="DoLayout" />
<field id="iconUri" type="uri" alias="icon.uri" />
<field id="iconVisible" type="boolean" alias="icon.visible" onChange="DoLayout" />
<field id="iconWidth" type="float" alias="icon.width" value="42" onChange="DoLayout" />
<field id="iconHeight" type="float" alias="icon.height" value="42" onChange="DoLayout" />
<field id="iconColor" type="color" value="#DDDDDD" />
<field id="focusedIconColor" type="color" value="#262626" />
<field id="disabledIconColor" type="color" value="#606060" />
<field id="backgroundColor" type="color" value="#3C3C3C" />
<field id="focusedBackgroundColor" type="color" value="#DDDDDD" />
<field id="disabledBackgroundColor" type="color" value="#292929" />
<field id="width" type="float" alias="background.width" onChange="DoLayout" />
<field id="minWidth" type="float" onChange="DoLayout" />
<field id="height" type="float" alias="background.height" onChange="DoLayout" value="58" />
<field id="padding" type="vector2d" value="[20,20]" onChange="DoLayout" />
<field id="anchor" type="vector2d" onChange="OnAnchorChange" />
<field id="disabled" type="boolean" onChange="OnDisabledChange" />
<field id="buttonSelected" type="boolean" alwaysNotify="true" />
<field id="buttonFocused" type="boolean" onChange="OnButtonFocused" />
</interface>
<children>
<Font id="normalFont" uri="font:SystemFontFile" size="24" />
<Font id="boldFont" uri="font:BoldSystemFontFile" size="24" />
<Group id="anchor">
<Poster
id="background"
uri="pkg:/images/button-ex.9.png">
<Poster id="icon" />
<Label
id="label"
horizAlign="center"
vertAlign="center" />
</Poster>
</Group>
<Animation
id="focusAnimation"
optional="true"
duration="0.15">
<Vector2DFieldInterpolator
id="scale"
key="[ 0.0, 0.5, 1.0 ]"
keyValue="[ [ 1.0, 1.0 ], [ 1.05, 1.05 ], [ 1.0, 1.0 ] ]"
fieldToInterp="anchor.scale" />
</Animation>
</children>
</component>
@@ -1,8 +1,11 @@
import "pkg:/components/ContextMenu/ContextMenuUtils.bs"
import "pkg:/components/Dialog/DialogUtils.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/FocusManagement.bs"
import "pkg:/source/utils/Locale.bs"
import "pkg:/source/utils/Logging.bs"
import "pkg:/source/utils/StringUtils.bs"
import "pkg:/source/utils/Types.bs"
@@ -16,6 +19,7 @@ function Init()
m.banner = m.top.findNode("banner")
m.thumbnail = m.top.findNode("thumbnail")
m.authorLabel = m.top.findNode("authorLabel")
m.subCountLabel = m.top.findNode("subCountLabel")
m.subscribeButton = m.top.findNode("subscribeButton")
m.rowList = m.top.FindNode("rowList")
m.rowList.focusable = true
@@ -26,6 +30,7 @@ function Init()
m.authorId = ""
InitializeTabs()
InitializeSortOptions()
end function
function OnNodeready()
@@ -34,7 +39,7 @@ function OnNodeready()
SetNavigation(m.rowList, "up", m.subscribeButton)
SetNavigation(m.subscribeButton, "down", m.rowList)
m.subscribeButton.text = "Subscribe"
m.subscribeButton.text = Tr(Locale.Buttons.Subscribe)
DisposableObserveFieldScoped(m.subscribeButton, "buttonSelected", FuncName(OnSubscribeButtonSelected))
SetSubscribeButtonVisibility()
@@ -60,6 +65,7 @@ function OnContentSet() as void
' NOTE: "_author" not "author". See PlaylistContentNode.xml for explanation.
m.authorLabel.text = content._author
m.subCountLabel.text = content.subCountText
m.banner.uri = content.banner
if StringUtils.IsNullOrEmpty(content.thumbnail)
m.thumbnail.uri = ""
@@ -170,25 +176,51 @@ end function
function InitializeTabs()
m.tabs = {
videos: function(authorId as string, author as string) as object
return CreateChannelFeed("Latest videos", "channel_videos", authorId, author)
"videos": function(authorId as string, author as string) as object
return CreateChannelFeed("Videos", "channel_videos", authorId, author)
end function
shorts: function(authorId as string, author as string) as object
"shorts": function(authorId as string, author as string) as object
return CreateChannelFeed("Shorts", "channel_shorts", authorId, author)
end function
streams: function(authorId as string, author as string) as object
"streams": function(authorId as string, author as string) as object
return CreateChannelFeed("Live", "channel_streams", authorId, author)
end function
podcasts: function(authorId as string, author as string) as object
"releases": function(authorId as string, author as string) as object
return CreateChannelFeed("Releases", "channel_releases", authorId, author)
end function
"podcasts": function(authorId as string, author as string) as object
return CreateChannelFeed("Podcasts", "channel_podcasts", authorId, author)
end function
playlists: function(authorId as string, author as string) as object
"playlists": function(authorId as string, author as string) as object
return CreateChannelFeed("Playlists", "channel_playlists", authorId, author)
end function
}
end function
function InitializeSortOptions()
m.sortOptions = {
"channel_videos": [{
"id": "newest"
"title": "Latest"
}, {
"id": "popular"
"title": "Popular"
}, {
"id": "oldest"
"title": "Oldest"
}]
"channel_playlists": [{
"id": "newest"
"title": "Date added (newest)"
}, {
"id": "last"
"title": "Last video added"
}]
}
end function
function CreateChannelFeed(title as string, endpoint as string, ucid as string, author as string) as object
title = Tr(title)
return {
title: title
feedSources: [{
@@ -207,7 +239,32 @@ function GetContextMenuOptionsForItem(video as object) as object
if StringUtils.IsNullOrEmpty(m.top.authorId)
return []
end if
return m.bookmarks@.GetMenuForChannel(m.top.content)
options = m.bookmarksService@.GetMenuForChannel(m.top.content)
options.Append(GetSortingContextMenuOptionsForItem(video))
return options
end function
function GetSortingContextMenuOptionsForItem(video as object) as object
feedContentNode = video.getParent()
if feedContentNode = invalid or not feedContentNode.hasField("feedSources")
return []
end if
feedSources = feedContentNode.feedSources
if feedSources = invalid or feedSources.Count() = 0
return []
end if
feedSource = feedSources[0]
endpoint = feedSource.endpoint
if not m.sortOptions.DoesExist(endpoint)
return []
end if
title = Tr(Locale.Dialogs.SortFeedBy).replace("%1", `"${feedSource.title}"`)
sortOptions = m.sortOptions[endpoint]
return [ContextMenuUtils.CreateOption(title + "...", m.top, "ShowSortDialog", [title, sortOptions, feedContentNode])]
end function
function IsLoggedIn() as boolean
@@ -236,10 +293,10 @@ function OnAuthorIdChange()
end function
function SetSubscribeButtonVisibility()
isLogged = IsLoggedIn()
m.subscribeButton.visible = isLogged and not StringUtils.IsNullOrEmpty(m.top.authorId)
m.subscribeButton.focusable = m.subscribeButton.visible
if not m.subscribeButton.visible and m.subscribeButton.hasFocus()
isEnabled = IsLoggedIn() and not StringUtils.IsNullOrEmpty(m.top.authorId)
m.subscribeButton.visible = isEnabled
m.subscribeButton.focusable = isEnabled
if not isEnabled and m.subscribeButton.hasFocus()
NodeSetFocus(m.rowList, true)
end if
end function
@@ -247,8 +304,56 @@ end function
function OnSubscriptionChanged()
isSubbed = IsSubscribed()
if isSubbed
m.subscribeButton.text = "Unsubscribe"
m.subscribeButton.text = Tr(Locale.Buttons.Unsubscribe)
else
m.subscribeButton.text = "Subscribe"
m.subscribeButton.text = Tr(Locale.Buttons.Subscribe)
end if
end function
function ShowSortDialog(title as string, sortOptions as object, feedContentNode as object)
buttons = []
for i = 0 to sortOptions.Count() - 1
buttons.Push(Tr(sortOptions[i].title))
end for
dialog = DialogUtils.ShowDialogButtons("", title, buttons)
dialog.addFields({
"feedContentNode": feedContentNode
"sortOptions": sortOptions
})
dialog.observeField("buttonSelected", FuncName(OnSortDialogResult), ["buttonSelected"])
end function
function OnSortDialogResult(event as object) as void
dialog = event.getRoSGNode()
sortOptions = dialog.sortOptions
buttonIndex = event.GetData()
if not IsInt(buttonIndex) or buttonIndex < 0 or buttonIndex >= sortOptions.Count()
return
end if
selected = sortOptions[buttonIndex]
feedContentNode = dialog.feedContentNode
feedSources = feedContentNode.feedSources
if feedSources = invalid or feedSources.Count() = 0
return
end if
selectedFeedSource = feedSources[0]
currentFeeds = m.rowList.feeds
for i = 0 to currentFeeds.Count() - 1
feed = currentFeeds[i]
feedSource = feed.feedSources[0]
if feedSource.id = selectedFeedSource.id
if feedSource.queryParams = invalid
feedSource.queryParams = {}
end if
feedSource.queryParams["sort_by"] = selected.id
m.rowList.feeds = currentFeeds
return
end if
end for
end function
@@ -4,7 +4,8 @@
<field id="authorId" type="string" onChange="OnAuthorIdChange" />
<field id="appController" type="node" bind="/AppController" />
<field id="invidious" type="node" bind="/Invidious" />
<field id="bookmarks" type="node" bind="/Bookmarks" />
<field id="bookmarksService" type="node" bind="/BookmarksService" />
<function name="ShowSortDialog" />
</interface>
<children>
<Rectangle
@@ -23,6 +24,7 @@
translation="[115,20]"
width="104"
height="104"
blendColor="#DDDDDDFF"
uri="pkg:/images/white-circle.png">
<CirclePoster
@@ -36,15 +38,18 @@
id="authorLabel"
translation="[115,40]"
font="font:MediumBoldSystemFont" />
<Label
id="subCountLabel"
translation="[115,70]"
font="font:SmallestSystemFont" />
</Poster>
<Button
<ButtonEx
id="subscribeButton"
iconUri=""
focusedIconUri=""
showFocusFootprint="true"
minWidth="200"
translation="[930,64]" />
iconVisible="false"
anchor="[0.5,0.5]"
padding="[30,30]"
translation="[1050,90]" />
<VideoRowList
itemComponentName="RowCell"
@@ -61,7 +66,7 @@
showRowLabel="[true]"
rowFocusAnimationStyle="floatingfocus"
variableWidthItems="true"
focusBitmapUri="pkg:/images/focus_grid.9.png" />
focusBitmapUri="pkg:/images/focus-glow-padding-19.9.png" />
<Animation
id="scrollAnimation"
@@ -1,6 +0,0 @@
<component name="ActionContentNode" extends="ContentNode">
<interface>
<field id="type" type="string" value="action" />
<field id="action" type="string" />
</interface>
</component>
@@ -3,6 +3,7 @@ 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/Locale.bs"
import "pkg:/source/utils/Logging.bs"
function LoadChannel(invidiousNode as object) as void
@@ -39,8 +40,8 @@ function OnChannelContentTaskResult(output as object) as void
error = ErrorUtils.Format(error)
LogError(error)
authorId = output.task.input.content.authorId
message = `Failed to load channel ${authorId}\n${error}`
DialogUtils.ShowDialog(message, "Channel load fail", true)
message = Tr(Locale.Dialogs.FailedToLoadChannel).Replace("%1", authorId) + `\n${error}`
DialogUtils.ShowDialog(message, Tr(Locale.Dialogs.ChannelLoadError), true)
return
end if
end function
@@ -3,6 +3,7 @@ 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/Locale.bs"
import "pkg:/source/utils/Logging.bs"
function LoadPlaylistPage(invidiousNode as object) as void
@@ -48,8 +49,8 @@ function OnPlaylistContentTaskResult(output as object) as void
error = ErrorUtils.Format(error)
LogError(error)
playlistId = output.task.input.content.playlistId
message = `Failed to load playlist ${playlistId}\n${error}`
DialogUtils.ShowDialog(message, "Playlist load fail", true)
message = Tr(Locale.Dialogs.FailedToLoadPlaylist).Replace("%1", playlistId) + `\n${error}`
DialogUtils.ShowDialog(message, Tr(Locale.Dialogs.PlaylistLoadError), true)
return
end if
end function
@@ -0,0 +1,12 @@
<component name="ProfileContentNode" extends="ContentNode">
<interface>
<field id="type" type="string" value="invidious" />
<field id="isSelected" type="boolean" alwaysNotify="true" />
<field id="username" type="string" />
<field id="serverUrl" type="string" />
<field id="accessToken" type="string" />
<field id="color" type="color" />
</interface>
</component>
@@ -71,8 +71,6 @@ import "pkg:/source/utils/Types.bs"
' - "Remove group from Bookmarks"
' - "Reload bookmarks" - DONE
'
' TODO:P1 Playlist item seletected from the bookmarks need to play as a playlist, not as a single video
' TODO:P1 Context menu might need to be scrollable (both horizontally and vertically)
' TODO:P1 Context menu might need sections. Example:
' In a Channel view, while selecting a playlist:
' - Channel
@@ -14,7 +14,7 @@ function OnItemHasFocus()
m.top.color = "#262626ff"
else
m.top.font = "font:SmallestSystemFont"
m.top.color = "#DBDBDBFF"
m.top.color = "#EBEBEBFF"
end if
end function
@@ -24,6 +24,6 @@ function OnFocusPercent()
m.top.color = "#262626FF"
else
m.top.font = "font:SmallestSystemFont"
m.top.color = "#DBDBDBFF"
m.top.color = "#EBEBEBFF"
end if
end function
@@ -4,9 +4,9 @@ function SetPalette(dialog as object)
DialogBackgroundColor: "#242424FF"
DialogFocusColor: "#CECECEFF"
DialogFocusItemColor: "#202020FF"
DialogSecondaryTextColor: "#DBDBDBFF"
DialogSecondaryTextColor: "#EBEBEBFF"
DialogSecondaryItemColor: "#FF1C30FF"
DialogTextColor: "#DBDBDBFF"
DialogTextColor: "#EBEBEBFF"
}
dialog.palette = palette
end function
@@ -1,6 +1,8 @@
import "pkg:/source/utils/Locale.bs"
namespace DialogUtils
function ShowDialog(message as dynamic, title as string, large = false as boolean) as object
return ShowDialogButtons(message, title, ["Ok"], large)
return ShowDialogButtons(message, title, [Tr(Locale.Buttons.OK)], large)
end function
function ShowDialogButtons(message as dynamic, title as string, buttons as object, large = false as boolean) as object
@@ -22,4 +24,33 @@ namespace DialogUtils
m.top.getScene().dialog = dialog
return dialog
end function
function ShowTimedDialogButtons(message as dynamic, title as string, buttons as object, defaultButton as integer, timeoutSeconds as integer, large = false as boolean) as object
dialog = CreateObject("roSGNode", "TimedDialog")
if GetInterface(message, "ifArray") = invalid
message = message.Tokenize(`\n`).ToArray()
end if
dialog.message = message
dialog.title = title
dialog.actualButtons = buttons
if large
if m._deviceDisplayWidth = invalid
deviceInfo = CreateObject("roDeviceInfo")
displaySize = deviceInfo.GetDisplaySize()
m._deviceDisplayWidth = displaySize.w
end if
dialog.width = m._deviceDisplayWidth - 100
end if
dialog.defaultButtonIndex = defaultButton
dialog.defaultActionTimeoutSeconds = timeoutSeconds
dialog.startCountdown = true
m.top.getScene().dialog = dialog
dialog.focusDefaultButton = true
return dialog
end function
end namespace
@@ -1,6 +1,5 @@
import "DialogPalette.bs"
import "pkg:/source/AsyncTask/AsyncTask.bs"
import "pkg:/source/AsyncTask/Tasks.bs"
import "pkg:/source/utils/Locale.bs"
import "pkg:/source/utils/StringUtils.bs"
import "pkg:/source/utils/Types.bs"
@@ -11,6 +10,9 @@ function Init()
m.top.width = "920"
m.top.observeFieldScoped("buttonSelected", FuncName(Close))
scanLabel = m.top.findNode("scanLabel")
scanLabel.text = Tr(Locale.Dialogs.ScanTheQrCode)
end function
function OnNodeReady()
@@ -19,7 +21,7 @@ function OnNodeReady()
if isValidAddress
m.top.url = `${address}/invidious/login`
else
m.urlLabel.text = "No IP address found"
m.urlLabel.text = Tr(Locale.Dialogs.IpAddressNotAvailable)
end if
m.invidious.observeFieldScoped("authToken", FuncName(OnAuthTokenChange))
@@ -33,14 +35,10 @@ function OnUrlSet()
url = m.top.url
m.urlLabel.text = url
AsyncTask.Start(Tasks.GenerateQrCodeTask, {
poster: m.qrCode
text: url
size: m.qrCode.loadWidth
padding: 10
})
m.qrCode.text = url
end function
function OnAuthTokenChange()
m.invidious.unobserveFieldScoped("authToken")
Close()
end function
@@ -7,8 +7,8 @@
<children>
<StdDlgTitleArea primaryTitle="Login to Invidious" />
<StdDlgContentArea>
<StdDlgTextItem
text="Login to Invidious in order to view Subscriptions, Playlists, and use the Watch history.&#xA;&#xA;Please note that an Invidious account is different from a YouTube account." />
<StdDlgTextItem text="Login to Invidious in order to view Subscriptions, Playlists, and use the Watch history." />
<StdDlgTextItem text="Please note that an Invidious account is different from a YouTube account." />
</StdDlgContentArea>
<StdDlgButtonArea id="buttonArea">
<StdDlgButton text="OK" />
@@ -20,17 +20,19 @@
extendToDialogEdge="false"
showDivider="false">
<Label
id="scanLabel"
text="Scan the QR Code"
horizAlign="center"
wrap="true" width="400">
<Font role="font" uri="font:SystemFontFile" size="24" />
</Label>
<Poster
<QrCodePoster
id="QrCodePoster"
width="300"
height="300"
loadWidth="300"
loadHeight="300"
padding="10"
translation="[50, 50]" />
<Label
id="urlLabel"
@@ -0,0 +1,117 @@
import "DialogPalette.bs"
import "pkg:/source/utils/FocusManagement.bs"
import "pkg:/source/utils/Logging.bs"
import "pkg:/source/utils/Types.bs"
function Init()
SetPalette(m.top)
m.top.observeField("buttonSelected", FuncName(OnButtonSelected))
m.top.observeField("wasClosed", FuncName(OnDialogClosed))
end function
function OnStartCountdown()
actualButtons = m.top.actualButtons
defaultButtonIndex = m.top.defaultButtonIndex
defaultActionTimeoutSeconds = m.top.defaultActionTimeoutSeconds
buttons = []
for i = 0 to actualButtons.Count() - 1
if i = defaultButtonIndex
buttons.push(`${actualButtons[i]} (${defaultActionTimeoutSeconds})`)
else
buttons.push(actualButtons[i])
end if
end for
m.top.buttons = buttons
CancelTimer()
m.timer = CreateObject("roSGNode", "Timer")
m.timer.repeat = true
m.timer.observeFieldScoped("fire", FuncName(TimerUpdateButtons))
m.currentCountDown = defaultActionTimeoutSeconds
m.timer.control = "start"
FindButtonComponent()
end function
function OnFocusDefaultButton() as void
FindButtonComponent()
if m.buttonComponents = invalid
return
end if
defaultButtonIndex = m.top.defaultButtonIndex
if m.buttonComponents.Count() <= defaultButtonIndex
return
end if
button = m.buttonComponents[defaultButtonIndex]
NodeSetFocus(button, true)
end function
function TimerUpdateButtons() as void
m.currentCountDown -= 1
if m.currentCountDown <= 0
m.top.actualButtonSelected = m.top.defaultButtonIndex
m.top.close = true
return
end if
SetDefaultButtonText(m.currentCountDown)
end function
function OnButtonSelected()
m.top.actualButtonSelected = m.top.buttonSelected
m.top.close = true
end function
function OnDialogClosed()
CancelTimer()
end function
function onKeyEvent(key as string, press as boolean) as boolean
if m.timer = invalid
return false
end if
CancelTimer()
FindButtonComponent()
SetDefaultButtonText(0)
return false
end function
function CancelTimer()
if m.timer <> invalid
m.timer.control = "stop"
m.timer.unobserveFieldScoped("fire")
m.timer = invalid
end if
end function
function SetDefaultButtonText(timeLeft as integer) as void
if m.buttonComponents = invalid
return
end if
defaultButtonIndex = m.top.defaultButtonIndex
if timeLeft > 0
m.buttonComponents[defaultButtonIndex].text = `${m.top.actualButtons[defaultButtonIndex]} (${timeLeft})`
else
m.buttonComponents[defaultButtonIndex].text = m.top.actualButtons[defaultButtonIndex]
end if
end function
function FindButtonComponent() as void
if m.buttonComponents <> invalid
return
end if
areas = m.top.getChildren(-1, 0)
for each area in areas
if area.subtype() = "StdDlgButtonArea"
m.buttonComponents = area.getChildren(-1, 0)
return
end if
end for
LogWarn("No buttons found in dialog")
end function
@@ -0,0 +1,11 @@
<component name="TimedDialog" extends="StandardMessageDialog">
<interface>
<field id="actualButtons" type="stringarray" />
<field id="defaultButtonIndex" type="integer" value="-1" />
<field id="defaultActionTimeoutSeconds" type="integer" value="10" />
<!-- Use actualButtonSelected because buttonSelected is read only and defaults to 0 -->
<field id="actualButtonSelected" type="integer" value="-1" />
<field id="startCountdown" type="boolean" alwaysNotify="true" onChange="OnStartCountdown" />
<field id="focusDefaultButton" type="boolean" alwaysNotify="true" onChange="OnFocusDefaultButton" />
</interface>
</component>
+2 -4
View File
@@ -29,10 +29,8 @@ function ProcessArguments(args as object) as void
return
end if
if not StringUtils.IsNullOrEmpty(args.contentId) and args.mediaType = "video"
if StringUtils.IsNullOrEmpty(args.videoId)
args.videoId = args.contentId
end if
if not StringUtils.IsNullOrEmpty(args.contentId) and StringUtils.IsNullOrEmpty(args.videoId)
args.videoId = args.contentId
end if
if args.timestamp <> invalid
+38 -6
View File
@@ -39,6 +39,7 @@ function LoggerLoop()
logsFile = m.top.folder + "/" + m.top.filename
previousLogsFile = m.top.folder + "/" + m.top.filenamePrevious
filenameStartup = m.top.filenameStartup
dateTime = CreateObject("roDateTime")
CreateDirectory(m.top.folder)
DeleteFile(previousLogsFile)
@@ -59,16 +60,16 @@ function LoggerLoop()
if msgType = "roSGNodeEvent"
field = msg.getField()
if field = "logLine"
OnLineLog(msg, logsFile, buffer)
OnLineLog(msg, dateTime, logsFile, buffer)
else if field = "systemLogEvent"
OnLineSysLog(msg, logsFile, buffer)
OnLineSysLog(msg, dateTime, logsFile, buffer)
end if
end if
end while
end function
function OnLineLog(event as object, logsFile as string, buffer as object)
line = event.getData()
function OnLineLog(event as object, dateTime as object, logsFile as string, buffer as object)
line = FormatTime(dateTime) + event.getData()
' bs:disable-next-line LINT3012
print line
@@ -76,15 +77,46 @@ function OnLineLog(event as object, logsFile as string, buffer as object)
buffer.AppendFile(logsFile)
end function
function OnLineSysLog(event as object, logsFile as string, buffer as object) as void
function OnLineSysLog(event as object, dateTime as object, logsFile as string, buffer as object) as void
info = event.getData()
if info.LogType <> "http.error"
return
end if
line = "[ERROR][SysLog] " + ToString(info)
line = FormatTime(dateTime) + "[ERROR][SysLog] " + ToString(info)
' bs:disable-next-line LINT3012
print line
buffer.FromAsciiString(line + `\n`)
buffer.AppendFile(logsFile)
end function
' Note: although the timestamp should be captured in the caller, not the logger,
' it is done here to avoid adding overhead to the caller thread.
function FormatTime(dateTime as object) as string
dateTime.Mark()
dateTime.ToLocalTime()
hours = dateTime.GetHours().ToStr()
if hours.Len() = 1
hours = "0" + hours
end if
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 + "]"
end function
@@ -22,8 +22,9 @@
<AppController id="AppController">
<Group id="Stack">
<AppRoot id="AppRoot">
<NavBar id="NavBar" focusIndex="1">
<NavBar id="NavBar" focusIndex="2">
<ContentNode role="items">
<NavBarItem screen="ProfileScreen" text="Profile" icon="pkg:/images/icons/user.png" padding="10" componentName="ProfileIconButton" />
<NavBarItem screen="SearchScreen" text="Search" icon="pkg:/images/icons/search.png" />
<NavBarItem screen="HomeScreen" text="Home" icon="pkg:/images/icons/home.png" />
<NavBarItem screen="BookmarksScreen" text="Bookmarks" icon="pkg:/images/icons/star.png" />
@@ -39,8 +40,9 @@
<VideoQueue id="VideoQueue" />
<ApplicationInfo id="ApplicationInfo" />
<Preferences id="Preferences" />
<Bookmarks id="Bookmarks" />
<BookmarksService id="BookmarksService" />
<SearchHistory id="SearchHistory" />
<ProfilesService id="ProfilesService" />
<Invidious id="Invidious" />
<PlayletWebServer id="WebServer" port="8888" />
<DialServer id="DialServer" />
+16 -4
View File
@@ -8,8 +8,15 @@
videoQueue="bind:./VideoQueue">
<Group id="Stack">
<AppRoot id="AppRoot">
<NavBar id="NavBar" focusIndex="1" appController="bind:/AppController">
<NavBar id="NavBar" focusIndex="2" appController="bind:/AppController">
<ContentNode role="items">
<NavBarItem
screen="ProfileScreen"
text="Profile"
icon="pkg:/images/icons/user.png"
padding="10"
componentName="ProfileIconButton">
</NavBarItem>
<NavBarItem
screen="SearchScreen"
text="Search"
@@ -59,14 +66,18 @@
<ApplicationInfo id="ApplicationInfo" />
<Preferences id="Preferences" />
<Bookmarks id="Bookmarks" />
<BookmarksService id="BookmarksService" />
<SearchHistory id="SearchHistory"
preferences="bind:../Preferences" />
<ProfilesService id="ProfilesService"
invidious="bind:../Invidious" />
<Invidious id="Invidious"
webServer="bind:../WebServer"
applicationInfo="bind:../ApplicationInfo"
preferences="bind:../Preferences" />
preferences="bind:../Preferences"
profilesService="bind:../ProfilesService" />
<!-- Tasks -->
<PlayletWebServer id="WebServer"
@@ -74,9 +85,10 @@
appController="bind:/AppController"
applicationInfo="bind:../ApplicationInfo"
invidious="bind:../Invidious"
profilesService="bind:../ProfilesService"
preferences="bind:../Preferences"
videoQueue="bind:../VideoQueue"
bookmarks="bind:../Bookmarks"
bookmarksService="bind:../BookmarksService"
loungeService="bind:../LoungeService" />
<DialServer id="DialServer"
webServer="bind:../WebServer"
@@ -24,18 +24,23 @@ function InitializeBindings()
"SearchHistory": {
"preferences": "../Preferences"
},
"ProfilesService": {
"invidious": "../Invidious"
},
"Invidious": {
"webServer": "../WebServer",
"applicationInfo": "../ApplicationInfo",
"preferences": "../Preferences"
"preferences": "../Preferences",
"profilesService": "../ProfilesService"
},
"WebServer": {
"appController": "/AppController",
"applicationInfo": "../ApplicationInfo",
"invidious": "../Invidious",
"profilesService": "../ProfilesService",
"preferences": "../Preferences",
"videoQueue": "../VideoQueue",
"bookmarks": "../Bookmarks",
"bookmarksService": "../BookmarksService",
"loungeService": "../LoungeService"
},
"DialServer": {
@@ -1,7 +1,8 @@
import "pkg:/source/utils/MathUtils.bs"
import "pkg:/source/utils/Types.bs"
' Based on https://github.com/jellyfin/jellyfin-roku/blob/unstable/components/IconButton.brs
function init()
function Init()
m.buttonBackground = m.top.findNode("buttonBackground")
m.buttonIcon = m.top.findNode("buttonIcon")
m.buttonText = m.top.findNode("buttonText")
@@ -40,17 +41,12 @@ function setIconSize()
height = m.top.height
width = m.top.width
if height > 0 and width > 0
' TODO: Use smallest number between them
m.buttonIcon.height = m.top.height
iconSize = MathUtils.Min(height, width) - m.top.padding
m.buttonIcon.height = iconSize
m.buttonIcon.width = iconSize
if m.top.padding > 0
m.buttonIcon.height = m.buttonIcon.height - m.top.padding
end if
m.buttonIcon.width = m.buttonIcon.height
m.buttonIcon.translation = [((width - m.buttonIcon.width) / 2), ((height - m.buttonIcon.height) / 2)]
m.buttonText.translation = [-5, height]
m.buttonIcon.translation = [((width - iconSize) / 2), ((height - iconSize) / 2)]
m.buttonText.translation = [-5, height + 2]
m.buttonText.width = width + 10
end if
end function
+3 -3
View File
@@ -29,15 +29,15 @@ function PopulateButtons() as void
buttons = []
for each item in navBarItems
button = CreateObject("roSGNode", "IconButton")
button = CreateObject("roSGNode", item.componentName)
button.background = "#242424FF"
button.focusBackground = "#FF1C30FF"
button.padding = 20
button.height = 50
button.width = 90
button.icon = item.icon
button.text = item.text
button.text = Tr(item.text)
button.padding = item.padding
buttons.push(button)
end for
@@ -3,5 +3,7 @@
<field id="screen" type="string" />
<field id="icon" type="string" />
<field id="text" type="string" />
<field id="padding" type="integer" value="20" />
<field id="componentName" type="string" value="IconButton" />
</interface>
</component>
@@ -0,0 +1,111 @@
import "pkg:/source/utils/Logging.bs"
import "pkg:/source/utils/MathUtils.bs"
import "pkg:/source/utils/StringUtils.bs"
import "pkg:/source/utils/Types.bs"
' TODO:P1 this file is a copy paste of IconButton. It should be refactored.
function Init()
m.buttonBackground = m.top.findNode("buttonBackground")
m.buttonIcon = m.top.findNode("buttonIcon")
m.buttonText = m.top.findNode("buttonText")
m.circlePoster = m.top.findNode("circlePoster")
m.circlePosterInner = m.top.findNode("circlePosterInner")
m.letterLabel = m.top.findNode("LetterLabel")
m.top.observeField("background", FuncName(onBackgroundChanged))
m.top.observeField("icon", FuncName(onIconChanged))
m.top.observeField("text", FuncName(onTextChanged))
m.top.observeField("height", FuncName(onHeightChanged))
m.top.observeField("width", FuncName(onWidthChanged))
m.top.observeField("padding", FuncName(onPaddingChanged))
profilesService = m.top.getScene().findNode("ProfilesService")
if profilesService <> invalid
m.profilesService = profilesService
profilesService.observeField("currentProfile", FuncName(OnCurrentProfile))
OnCurrentProfile()
end if
end function
function OnFocusChange()
if m.top.focus
m.buttonBackground.blendColor = m.top.focusBackground
else
m.buttonBackground.blendColor = m.top.background
end if
m.buttonBackground.visible = m.top.focus
m.buttonText.visible = m.top.focus
end function
function onBackgroundChanged()
m.buttonBackground.blendColor = m.top.background
end function
function onIconChanged()
m.buttonIcon.uri = m.top.icon
end function
function onTextChanged()
m.buttonText.text = m.top.text
end function
function setIconSize()
height = m.top.height
width = m.top.width
if height > 0 and width > 0
iconSize = MathUtils.Min(height, width) - m.top.padding
m.buttonIcon.height = iconSize
m.buttonIcon.width = iconSize
iconTranslation = [((width - iconSize) / 2), ((height - iconSize) / 2)]
m.buttonIcon.translation = iconTranslation
m.buttonText.translation = [-5, height + 2]
m.buttonText.width = width + 10
m.circlePoster.width = iconSize
m.circlePoster.height = iconSize
m.circlePoster.translation = iconTranslation
m.circlePosterInner.width = iconSize - 4
m.circlePosterInner.height = iconSize - 4
m.letterLabel.width = iconSize - 4
m.letterLabel.height = iconSize - 4
end if
end function
function onHeightChanged()
m.buttonBackground.height = m.top.height
setIconSize()
end function
function onWidthChanged()
m.buttonBackground.width = m.top.width - 10
m.buttonBackground.translation = [5, 0]
setIconSize()
end function
function onPaddingChanged()
setIconSize()
end function
function OnCurrentProfile() as void
currentProfile = m.profilesService.currentProfile
if currentProfile = invalid
m.circlePoster.visible = false
m.buttonIcon.visible = true
return
end if
username = currentProfile.username
if not StringUtils.IsNullOrEmpty(username)
m.LetterLabel.text = UCase(username.Left(1))
else
m.LetterLabel.text = ""
end if
m.circlePosterInner.blendColor = currentProfile.color
m.circlePoster.visible = true
m.buttonIcon.visible = false
end function
@@ -0,0 +1,41 @@
<component name="ProfileIconButton" extends="Group" includes="Focus">
<interface>
<field id="background" type="color" value="" />
<field id="focusBackground" type="color" value="" />
<field id="text" type="string" value="" />
<field id="padding" type="integer" value="-1" />
<field id="height" type="integer" value="" />
<field id="width" type="integer" value="" />
<field id="icon" type="string" value="" />
</interface>
<children>
<Poster id="buttonBackground" uri="pkg:/images/white.9.png" visible="false" />
<Poster id="buttonIcon" />
<Poster
id="circlePoster"
width="40"
height="40"
blendColor="#DDDDDDFF"
uri="pkg:/images/white-circle.png">
<Poster
id="circlePosterInner"
width="36"
height="36"
blendColor="#9696C8"
uri="pkg:/images/white-circle.png"
translation="[2,2]">
<Label
id="LetterLabel"
width="40"
height="40"
vertAlign="center"
horizAlign="center">
<Font role="font" uri="font:SystemFontFile" size="24" />
</Label>
</Poster>
</Poster>
<Label id="buttonText" color="#aaaaaa" font="font:SmallestSystemFont" vertAlign="center" horizAlign="center" visible="false" />
</children>
</component>
@@ -1,6 +1,5 @@
import "pkg:/components/ChannelView/ChannelUtils.bs"
import "pkg:/components/ContextMenu/ContextMenuUtils.bs"
import "pkg:/components/Dialog/DialogUtils.bs"
import "pkg:/components/Navigation/LongPress.bs"
import "pkg:/components/Services/Invidious/InvidiousToContentNode.bs"
import "pkg:/components/VideoFeed/FeedLoadState.bs"
@@ -143,9 +142,6 @@ function OnItemLongPressed(index as integer) as void
LogInfo("Long press: playlist:", playlistId, "video:", videoId)
' TODO:P1 handle case of opening the channel
' - Owner of a video
' - Owner of a playlist
contextMenuProviders = [m.top]
ContextMenuUtils.Open(contextMenuProviders, m.appController, video)
end function
@@ -167,18 +163,30 @@ function GetContextMenuOptionsForItem(video as object) as object
end if
options = [
ContextMenuUtils.CreateOption("Play", m.videoQueue, "FuncPlayPlaylist", [playlist, index]),
ContextMenuUtils.CreateOption("Queue", m.videoQueue, "FuncAddToQueuePlaylist", [playlist])
ContextMenuUtils.CreateOption("Play video", m.videoQueue, "FuncPlayVideo", [video]),
ContextMenuUtils.CreateOption("Queue video", m.videoQueue, "FuncAddToQueueVideo", [video]),
ContextMenuUtils.CreateOption(Tr(Locale.ContextMenu.PlayPlaylist), m.videoQueue, "FuncPlayPlaylist", [playlist, index]),
ContextMenuUtils.CreateOption(Tr(Locale.ContextMenu.QueuePlaylist), m.videoQueue, "FuncAddToQueuePlaylist", [playlist])
ContextMenuUtils.CreateOption(Tr(Locale.ContextMenu.PlayVideo), m.videoQueue, "FuncPlayVideo", [video]),
ContextMenuUtils.CreateOption(Tr(Locale.ContextMenu.QueueVideo), m.videoQueue, "FuncAddToQueueVideo", [video]),
]
if not StringUtils.IsNullOrEmpty(playlist.authorId)
options.push(ContextMenuUtils.CreateOption("Open channel", m.top, "OpenPlaylistChannel", [playlist]))
playlistAuthorId = playlist.authorId
videoAuthorId = video.authorId
if not StringUtils.IsNullOrEmpty(playlistAuthorId) or not StringUtils.IsNullOrEmpty(videoAuthorId)
if playlistAuthorId = videoAuthorId
options.push(ContextMenuUtils.CreateOption(Tr(Locale.ContextMenu.OpenChannel), m.top, "OpenPlaylistChannel", [playlist]))
else
if not StringUtils.IsNullOrEmpty(playlistAuthorId)
options.push(ContextMenuUtils.CreateOption(Tr(Locale.ContextMenu.OpenPlaylistChannel), m.top, "OpenPlaylistChannel", [playlist]))
end if
if not StringUtils.IsNullOrEmpty(videoAuthorId)
options.push(ContextMenuUtils.CreateOption(Tr(Locale.ContextMenu.OpenVideoChannel), m.top, "OpenVideoChannel", [video]))
end if
end if
end if
options.append(m.bookmarks@.GetMenuForPlaylist(playlist))
options.append(m.bookmarks@.GetMenuForVideo(video))
options.append(m.bookmarksService@.GetMenuForPlaylist(playlist))
options.append(m.bookmarksService@.GetMenuForVideo(video))
return options
end function
@@ -193,6 +201,16 @@ function OpenPlaylistChannel(playlist as object) as void
ChannelUtils.Open(channel)
end function
function OpenVideoChannel(video as object) as void
authorId = video.authorId
if StringUtils.IsNullOrEmpty(authorId)
LogWarn("Invalid authorId:", authorId)
return
end if
channel = InvidiousContent.ToChannelContentNode(invalid, { authorId: authorId }, invalid)
ChannelUtils.Open(channel)
end function
'TODO:P1 a playlist could have been opened from the bookmarks, which can be as old as 3 days
' We should make a request in this case, and let the cache handle freshness.
function LoadPlaylistIfNeeded() as void
@@ -4,8 +4,9 @@
<field id="appController" type="node" bind="/AppController" />
<field id="invidious" type="node" bind="/Invidious" />
<field id="videoQueue" type="node" bind="/VideoQueue" />
<field id="bookmarks" type="node" bind="/Bookmarks" />
<field id="bookmarksService" type="node" bind="/BookmarksService" />
<function name="OpenPlaylistChannel" />
<function name="OpenVideoChannel" />
</interface>
<children>
<Rectangle
@@ -56,8 +57,8 @@
numColumns="1"
numRows="5"
vertFocusAnimationStyle="floatingFocus"
translation="[620,90]" />
translation="[620,90]"
focusBitmapUri="pkg:/images/focus-glow-padding-27.9.png" />
</Poster>
</children>
</component>
@@ -0,0 +1,153 @@
import "pkg:/components/Navigation/Navigation.bs"
import "pkg:/source/utils/DisposableObserve.bs"
import "pkg:/source/utils/FocusManagement.bs"
import "pkg:/source/utils/Locale.bs"
import "pkg:/source/utils/StringUtils.bs"
import "pkg:/source/utils/Types.bs"
function Init()
m.activateButton = m.top.findNode("activateButton")
m.logoutButton = m.top.findNode("logoutButton")
m.closeButton = m.top.findNode("closeButton")
DisposableObserveField(m.activateButton, "buttonSelected", FuncName(Activate))
DisposableObserveField(m.logoutButton, "buttonSelected", FuncName(Logout))
DisposableObserveField(m.closeButton, "buttonSelected", FuncName(Close))
end function
function OnNodeReady()
SetNavigation(m.activateButton, "down", m.logoutButton)
SetNavigation(m.logoutButton, "down", m.closeButton)
SetNavigation(m.closeButton, "up", m.logoutButton)
SetNavigation(m.logoutButton, "up", m.activateButton)
DisposableObserveFieldScoped(m.profilesService, "currentProfile", FuncName(OnCunrrentProfileChanged))
DisposableObserveFieldScoped(m.profilesService, "onProfileLogout", FuncName(OnProfileLogout))
end function
function OnContentSet() as void
content = m.top.content
if content = invalid
return
end if
m.top.circlePosterInnerUri = "pkg:/images/white-circle.png"
m.top.circlePosterInnerBlendColor = content.color
username = content.username
m.top.username = username
if not StringUtils.IsNullOrEmpty(username)
m.top.letter = UCase(username.Left(1))
else
m.top.letter = ""
end if
m.top.serverUrl = content.serverUrl
m.top.crownVisible = content.isSelected
UpdateActivateButton()
end function
function OnFocusChange() as void
if not m.top.focus
return
end if
if m.activateButton.focusable
NodeSetFocus(m.activateButton, true)
else
NodeSetFocus(m.logoutButton, true)
end if
end function
function OnkeyEvent(key as string, press as boolean) as boolean
if NavigationKeyHandler(key, press).handled
return true
end if
if key = "options"
' A pass-through to the app controller, so it can toggle picture-in-picture
return false
end if
if key = "back" and press
Close()
return true
end if
return true
end function
function Activate() as void
content = m.top.content
if content = invalid
return
end if
profile = m.profilesService.content.getChild(0).findNode(content.id)
if profile = invalid
return
end if
m.top.content = invalid
m.profilesService@.SetCurrentProfile(profile)
Close()
end function
function Logout() as void
content = m.top.content
if content = invalid
return
end if
m.top.content = invalid
m.profilesService@.LogoutWithProfile(content)
Close()
end function
function Close()
m.top.appController@.PopScreen()
m.top.dispose = true
end function
function OnDispose()
DisposeObservers()
m.top.content = invalid
end function
function OnCunrrentProfileChanged() as void
content = m.top.content
if content = invalid
return
end if
m.top.crownVisible = content.isSelected
UpdateActivateButton()
end function
function OnProfileLogout() as void
content = m.top.content
if content = invalid
return
end if
profile = m.profilesService.content.getChild(0).findNode(content.id)
if profile = invalid
Close()
end if
end function
function UpdateActivateButton() as void
content = m.top.content
if content = invalid
return
end if
isSelected = content.isSelected
if isSelected
if m.activateButton.hasFocus()
NodeSetFocus(m.logoutButton, true)
end if
m.activateButton.text = Tr(Locale.Buttons.InUse)
m.activateButton.disabled = true
else
m.activateButton.text = Tr(Locale.Buttons.Activate)
m.activateButton.disabled = false
end if
end function
@@ -0,0 +1,100 @@
<component name="ProfileView" extends="Group" includes="AutoBind,Focus,Disposable">
<interface>
<field id="content" type="node" onChange="OnContentSet" />
<field id="letter" type="string" alias="LetterLabel.text" />
<field id="username" type="string" alias="UsernameLabel.text" />
<field id="serverUrl" type="string" alias="ServerLabel.text" />
<field id="circlePosterInnerUri" type="uri" alias="circlePosterInner.uri" />
<field id="circlePosterInnerBlendColor" type="uri" alias="circlePosterInner.blendColor" />
<field id="crownVisible" type="boolean" alias="CrownPoster.visible" />
<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="420"
translation="[280,150]"
color="#242424">
<Group translation="[100,90]">
<Poster
id="circlePoster"
width="160"
height="160"
translation="[20,20]"
blendColor="#DDDDDDFF"
uri="pkg:/images/white-circle.png">
<Poster
id="circlePosterInner"
width="152"
height="152"
blendColor="#9696C8"
uri="pkg:/images/white-circle.png"
translation="[4,4]">
<Label
id="LetterLabel"
width="152"
height="152"
vertAlign="center"
horizAlign="center">
<Font role="font" uri="font:SystemFontFile" size="120" />
</Label>
</Poster>
<Poster
id="CrownPoster"
width="60"
height="60"
translation="[50,-60]"
uri="pkg:/images/icons/crown.png"
visible="false">
</Poster>
</Poster>
<Label
id="UsernameLabel"
width="200"
horizAlign="center"
translation="[0,210]">
<Font role="font" uri="font:BoldSystemFontFile" size="26" />
</Label>
<Label
id="ServerLabel"
width="400"
horizAlign="center"
translation="[-100,250]">
<Font role="font" uri="font:SystemFontFile" size="18" />
</Label>
</Group>
<ButtonEx
id="activateButton"
iconVisible="false"
anchor="[0.5,0.5]"
text="Activate"
minWidth="200"
translation="[520,132]" />
<ButtonEx
id="logoutButton"
iconVisible="false"
anchor="[0.5,0.5]"
text="Logout"
minWidth="200"
translation="[520,210]" />
<ButtonEx
id="closeButton"
iconVisible="false"
anchor="[0.5,0.5]"
text="Close"
minWidth="200"
translation="[520,288]" />
</Rectangle>
</children>
</component>
@@ -0,0 +1,11 @@
namespace ProfileViewUtils
function Open(profile as object, appController as object)
profileView = CreateObject("roSGNode", "ProfileView")
appController@.PushScreen(profileView)
profileView@.BindNode()
profileView.content = profile
end function
end namespace
@@ -2,7 +2,7 @@ import "pkg:/source/QrCode/QrImage.bs"
import "pkg:/source/utils/StringUtils.bs"
@asynctask
function GenerateQrCodeTask(input as object)
function GenerateQrCodeTask(input as object) as object
poster = input.poster
mode = input.mode
text = input.text
@@ -24,7 +24,13 @@ function GenerateQrCodeTask(input as object)
qr = new QrCode.QRImage()
imagePath = qr.Generate(text, size, padding, mode)
if m.top.cancel
return invalid
end if
if not StringUtils.IsNullOrEmpty(imagePath)
poster.uri = imagePath
end if
return invalid
end function
@@ -0,0 +1,65 @@
import "pkg:/source/AsyncTask/AsyncTask.bs"
import "pkg:/source/AsyncTask/Tasks.bs"
import "pkg:/source/utils/StringUtils.bs"
import "pkg:/source/utils/Types.bs"
function Init()
m.busySpinner = m.top.findNode("busySpinner")
m.busySpinnerPoster = m.busySpinner.poster
m.busySpinnerPoster.uri = "pkg:/images/spinner.png"
m.top.observeField("width", FuncName(OnSizeChange))
m.top.observeField("height", FuncName(OnSizeChange))
OnSizeChange()
end function
function OnSizeChange()
width = m.top.width
height = m.top.height
m.busySpinnerPoster.width = width / 2
m.busySpinnerPoster.height = height / 2
m.busySpinner.translation = [width / 4, height / 4]
end function
function OnTextChange() as void
if m.qrCodeGenTask <> invalid
m.qrCodeGenTask.cancel = true
end if
text = m.top.text
width = m.top.loadWidth
if width = 0
width = m.top.width
end if
m.top.uri = ""
if StringUtils.IsNullOrEmpty(text)
m.busySpinner.control = "stop"
m.busySpinner.visible = false
return
end if
m.busySpinnerPoster.rotation = 0
m.busySpinner.visible = true
m.busySpinner.control = "start"
m.qrCodeGenTask = AsyncTask.Start(Tasks.GenerateQrCodeTask, {
poster: m.top
text: text
size: width
padding: m.top.padding
}, OnGenerateQrCodeTaskResult)
end function
function OnGenerateQrCodeTaskResult(output as object) as void
if output.cancelled
return
end if
m.busySpinner.control = "stop"
m.busySpinner.visible = false
end function
@@ -0,0 +1,12 @@
<component name="QrCodePoster" extends="Poster">
<interface>
<field id="text" type="string" onChange="OnTextChange" />
<field id="padding" type="integer" />
</interface>
<children>
<BusySpinner
id="busySpinner"
spinInterval="1"
visible="false" />
</children>
</component>
@@ -1,6 +1,8 @@
import "pkg:/components/ContextMenu/ContextMenuUtils.bs"
import "pkg:/components/Navigation/Navigation.bs"
import "pkg:/components/Services/BookmarksService/BookmarksServiceUtils.bs"
import "pkg:/source/utils/FocusManagement.bs"
import "pkg:/source/utils/Locale.bs"
import "pkg:/source/utils/Types.bs"
function Init()
@@ -20,7 +22,7 @@ function OnNodeReady()
m.rowList@.BindNode()
OnBookmarksChange()
m.bookmarks.ObserveField("contentChange", FuncName(OnBookmarksChange))
m.bookmarksService.ObserveField("contentChange", FuncName(OnBookmarksChange))
end function
function OnFocusChange() as void
@@ -53,13 +55,13 @@ function OnBookmarksChange() as void
end if
m.isDirty = false
hasBookmarks = m.bookmarks.content.getChildCount() > 0
hasBookmarks = m.bookmarksService.content.getChildCount() > 0
m.noBookmarks.visible = not hasBookmarks
m.yesBookmarks.visible = hasBookmarks
m.top.focusable = hasBookmarks
if hasBookmarks
SetRowListContent(m.bookmarks.content)
SetRowListContent(m.bookmarksService.content)
else
if m.rowList.hasFocus()
NodeSetFocus(m.navBar, true)
@@ -68,23 +70,7 @@ function OnBookmarksChange() as void
end function
function SetRowListContent(bookmarksContent as object)
bookmarkGroupNodes = bookmarksContent.getChildren(-1, 0)
feeds = []
for each bookmarkGroupNode in bookmarkGroupNodes
bookmarkNodes = bookmarkGroupNode.getChildren(-1, 0)
feedSources = []
for each bookmarkNode in bookmarkNodes
feedSources.push(bookmarkNode.feedSource)
end for
feeds.push({
"title": bookmarkGroupNode.title
"feedSources": feedSources
})
end for
m.rowList.feeds = feeds
m.rowList.feeds = BookmarksServiceUtils.BookmarksContentToFeed(bookmarksContent)
end function
function OnkeyEvent(key as string, press as boolean) as boolean
@@ -95,6 +81,6 @@ function OnkeyEvent(key as string, press as boolean) as boolean
end function
function GetContextMenuOptionsForItem(rowItem as object) as object
refreshItem = ContextMenuUtils.CreateOption("Refresh Bookmarks", m.top, "Refresh", [invalid])
refreshItem = ContextMenuUtils.CreateOption(Tr(Locale.ContextMenu.RefreshBookmarks), m.top, "Refresh", [invalid])
return [refreshItem]
end function
@@ -2,19 +2,31 @@
<interface>
<field id="navBar" type="node" bind="/NavBar" />
<field id="applicationInfo" type="node" bind="/ApplicationInfo" />
<field id="bookmarks" type="node" bind="/Bookmarks" />
<field id="bookmarksService" type="node" bind="/BookmarksService" />
<function name="Refresh" />
</interface>
<children>
<Group id="noBookmarks" visible="false">
<Label
height="720"
width="1280"
font="font:MediumBoldSystemFont"
horizAlign="center"
vertAlign="center"
text="You currently have no bookmarks.&#xA;&#xA;To add bookmarks, long-press 'OK' on a video, playlist or channel.&#xA;&#xA;Please note that Bookmarks is an experimental feature."
wrap="true" />
<LayoutGroup vertAlignment="center" itemSpacings="[25,25]" translation="[180,360]">
<Label
width="920"
horizAlign="center"
font="font:SmallSystemFont"
text="You currently have no bookmarks."
wrap="true" />
<Label
width="920"
horizAlign="center"
font="font:SmallSystemFont"
text="To add bookmarks, long-press 'OK' on a video, playlist or channel."
wrap="true" />
<Label
width="920"
horizAlign="center"
font="font:SmallSystemFont"
text="Please note that Bookmarks is an experimental feature."
wrap="true" />
</LayoutGroup>
</Group>
<Group id="yesBookmarks" visible="false">
<VideoRowList
@@ -31,7 +43,7 @@
showRowLabel="[true]"
rowFocusAnimationStyle="floatingfocus"
variableWidthItems="true"
focusBitmapUri="pkg:/images/focus_grid.9.png"
focusBitmapUri="pkg:/images/focus-glow-padding-19.9.png"
/>
</Group>
</children>
@@ -2,6 +2,7 @@ import "HomeScreenUtils.bs"
import "pkg:/components/ContextMenu/ContextMenuUtils.bs"
import "pkg:/components/Navigation/Navigation.bs"
import "pkg:/source/utils/FocusManagement.bs"
import "pkg:/source/utils/Locale.bs"
function Init()
m.top.focusable = true
@@ -41,6 +42,6 @@ function OnkeyEvent(key as string, press as boolean) as boolean
end function
function GetContextMenuOptionsForItem(rowItem as object) as object
refresh = ContextMenuUtils.CreateOption("Refresh Home", m.rowList, "Refresh", [invalid])
refresh = ContextMenuUtils.CreateOption(Tr(Locale.ContextMenu.RefreshHome), m.rowList, "Refresh", [invalid])
return [refresh]
end function
@@ -20,7 +20,7 @@
showRowLabel="[true]"
rowFocusAnimationStyle="floatingfocus"
variableWidthItems="true"
focusBitmapUri="pkg:/images/focus_grid.9.png"
focusBitmapUri="pkg:/images/focus-glow-padding-19.9.png"
/>
</children>
</component>
@@ -4,6 +4,13 @@ namespace HomeScreenUtils
function GetFeed(feedFileName as string, preferences as object) as object
feed = ParseJson(ReadAsciiFile(feedFileName))
for each item in feed
item.title = Tr(item.title)
for each feedSource in item.feedSources
feedSource.title = Tr(feedSource.title)
end for
end for
homeLayout = preferences["misc.home_screen_layout"]
if not IsArray(homeLayout) or homeLayout.Count() = 0
@@ -0,0 +1,2 @@
<component name="ProfileRowList" extends="RowList">
</component>
@@ -0,0 +1,69 @@
import "pkg:/source/utils/Locale.bs"
import "pkg:/source/utils/StringUtils.bs"
function Init()
m.normalFont = m.top.findNode("normalFont")
m.boldFont = m.top.findNode("boldFont")
end function
function OnContentSet() as void
content = m.top.itemContent
if content = invalid
return
end if
if content.type = "login"
m.top.circlePosterInnerUri = "pkg:/images/icons/user-200.png"
' bs:disable-next-line LINT3023
m.top.circlePosterInnerBlendColor = "#FFFFFFFF"
m.top.letter = ""
m.top.username = Tr(Locale.Buttons.Login)
m.top.serverUrl = ""
m.top.crownVisible = false
return
end if
m.top.circlePosterInnerUri = "pkg:/images/white-circle.png"
m.top.circlePosterInnerBlendColor = content.color
username = content.username
m.top.username = username
if not StringUtils.IsNullOrEmpty(username)
m.top.letter = UCase(username.Left(1))
else
m.top.letter = ""
end if
m.top.serverUrl = content.serverUrl
m.top.crownVisible = content.isSelected
end function
function OnRowListHasFocus()
if not m.top.rowListHasFocus
m.top.animate = false
end if
end function
function OnItemHasFocus()
m.top.animate = (m.top.itemHasFocus or m.top.focusPercent > 0.5) and m.top.rowListHasFocus
end function
function OnFocusPercent()
if m.top.focusPercent > 0.5 and m.top.rowListHasFocus
m.top.animate = true
else
m.top.animate = false
end if
end function
function OnAnimate()
animate = m.top.animate
m.top.shadowVisible = animate
m.top.serverLabelVisible = animate
m.top.circlePosterTranslation = [20, 20]
if animate
m.top.UsernameLabelFont = m.boldFont
m.top.animationControl = "start"
else
m.top.UsernameLabelFont = m.normalFont
m.top.animationControl = "stop"
end if
end function
@@ -0,0 +1,107 @@
<component name="ProfileRowListCell" extends="Group">
<interface>
<field id="itemContent" type="node" onChange="OnContentSet" />
<field id="letter" type="string" alias="LetterLabel.text" />
<field id="username" type="string" alias="UsernameLabel.text" />
<field id="serverUrl" type="string" alias="ServerLabel.text" />
<field id="circlePosterInnerUri" type="uri" alias="circlePosterInner.uri" />
<field id="circlePosterInnerBlendColor" type="uri" alias="circlePosterInner.blendColor" />
<field id="UsernameLabelFont" type="boolean" alias="UsernameLabel.font" />
<field id="rowListHasFocus" type="boolean" onChange="OnRowListHasFocus" />
<field id="itemHasFocus" type="boolean" onChange="OnItemHasFocus" />
<field id="focusPercent" type="float" onChange="OnFocusPercent" />
<field id="circlePosterTranslation" type="vector2d" alias="circlePoster.translation" />
<field id="animate" type="boolean" onChange="OnAnimate" />
<field id="animationControl" type="string" alias="floatAnimation.control" />
<field id="shadowVisible" type="boolean" alias="shadowPoster.visible" />
<field id="crownVisible" type="boolean" alias="CrownPoster.visible" />
<field id="serverLabelVisible" type="boolean" alias="ServerLabel.visible" />
</interface>
<children>
<Font id="normalFont" uri="font:SystemFontFile" size="24" />
<Font id="boldFont" uri="font:BoldSystemFontFile" size="26" />
<Group translation="[20,50]">
<Group
id="shadowScaler"
translation="[100,20]">
<Group translation="[-100,-20]">
<Poster
id="shadowPoster"
uri="pkg:/images/white-circle.png"
blendColor="#000000"
width="200"
height="40"
translation="[0,200]"
visible="false">
</Poster>
</Group>
</Group>
<Poster
id="circlePoster"
width="160"
height="160"
translation="[20,20]"
blendColor="#DDDDDDFF"
uri="pkg:/images/white-circle.png">
<Poster
id="circlePosterInner"
width="152"
height="152"
blendColor="#9696C8"
uri="pkg:/images/white-circle.png"
translation="[4,4]">
<Label
id="LetterLabel"
width="152"
height="152"
vertAlign="center"
horizAlign="center">
<Font role="font" uri="font:SystemFontFile" size="120" />
</Label>
</Poster>
<Poster
id="CrownPoster"
width="60"
height="60"
translation="[50,-60]"
uri="pkg:/images/icons/crown.png"
visible="false">
</Poster>
</Poster>
<Label
id="UsernameLabel"
width="200"
horizAlign="center"
translation="[0,250]">
</Label>
<Label
id="ServerLabel"
width="400"
horizAlign="center"
translation="[-100,310]"
visible="false">
<Font role="font" uri="font:SystemFontFile" size="18" />
</Label>
</Group>
<Animation
id="floatAnimation"
repeat="true"
duration="4"
easeFunction="inOutQuad">
<Vector2DFieldInterpolator
key="[ 0.0, 0.5, 0.55, 1.0 ]"
keyValue="[ [20,40], [20,10], [20,10], [20,40]]"
fieldToInterp="circlePoster.translation" />
<Vector2DFieldInterpolator
key="[ 0.0, 0.5, 0.55, 1.0 ]"
keyValue="[ [0.7,1], [1.05,1],[1.05,1] , [0.7,1] ]"
fieldToInterp="shadowScaler.scale" />
<FloatFieldInterpolator
key="[ 0.0, 0.5, 0.55, 1.0 ]"
keyValue="[0.3, 0.05 ,0.05, 0.3 ]"
fieldToInterp="shadowPoster.opacity" />
</Animation>
</children>
</component>
@@ -0,0 +1,63 @@
import "pkg:/components/Dialog/DialogUtils.bs"
import "pkg:/components/Navigation/Navigation.bs"
import "pkg:/components/ProfileView/ProfileViewUtils.bs"
import "pkg:/source/utils/FocusManagement.bs"
import "pkg:/source/utils/Types.bs"
function Init()
m.top.focusable = true
m.profileRowList = m.top.FindNode("ProfileRowList")
end function
function OnNodeReady()
SetNavigation(invalid, "back", m.navBar)
SetNavigation(invalid, "left", m.navBar)
m.profileRowList.content = m.profilesService.content
m.profileRowList.observeFieldScoped("rowItemSelected", FuncName(OnRowItemSelected))
m.profilesService.observeFieldScoped("currentProfile", FuncName(OnCurrentProfileChanged))
end function
function OnFocusChange() as void
if not m.top.focus
return
end if
NodeSetFocus(m.profileRowList, true)
end function
function OnkeyEvent(key as string, press as boolean) as boolean
if NavigationKeyHandler(key, press).handled
return true
end if
return false
end function
function OnRowItemSelected() as void
index = m.profileRowList.rowItemSelected[1]
row = m.profileRowList.content.GetChild(0)
selectedProfile = row.GetChild(index)
if selectedProfile.type = "login"
dialog = CreateObject("roSGNode", "LoginDialog")
dialog@.BindNode()
m.top.getScene().dialog = dialog
return
end if
ProfileViewUtils.Open(selectedProfile, m.appController)
end function
function OnCurrentProfileChanged() as void
currentProfile = m.profilesService.currentProfile
if currentProfile = invalid
return
end if
row = m.profileRowList.content.GetChild(0)
allProfiles = row.getChildren(-1, 0)
for i = 0 to allProfiles.Count() - 1
if currentProfile.id = allProfiles[i].id
m.profileRowList.jumpToRowItem = [0, i]
return
end if
end for
end function
@@ -0,0 +1,21 @@
<component name="ProfileScreen" extends="Group" includes="AutoBind,Focus">
<interface>
<field id="navBar" type="node" bind="/NavBar" />
<field id="profilesService" type="node" bind="/ProfilesService" />
<field id="appController" type="node" bind="/AppController" />
</interface>
<children>
<ProfileRowList
id="ProfileRowList"
translation="[0,160]"
numRows="2"
rowitemSize="[[240,340]]"
rowItemSpacing="[[0,0]]"
itemSize="[1280,500]"
focusXOffset="[200]"
itemComponentName="ProfileRowListCell"
rowFocusAnimationStyle="floatingfocus"
focusBitmapUri="pkg:/images/focus-glow-padding-19.9.png" />
</children>
</component>
@@ -1,12 +1,12 @@
import "pkg:/components/Dialog/DialogUtils.bs"
import "pkg:/components/Navigation/Navigation.bs"
import "pkg:/source/AsyncTask/AsyncTask.bs"
import "pkg:/source/AsyncTask/AsyncTask.bs"
import "pkg:/source/AsyncTask/Tasks.bs"
import "pkg:/source/AsyncTask/Tasks.bs"
import "pkg:/source/utils/ErrorUtils.bs"
import "pkg:/source/utils/FocusManagement.bs"
import "pkg:/source/utils/Locale.bs"
import "pkg:/source/utils/Logging.bs"
import "pkg:/source/utils/MathUtils.bs"
import "pkg:/source/utils/StringUtils.bs"
function Init()
@@ -18,8 +18,24 @@ function Init()
m.linkWithWifiPanel = m.top.findNode("LinkWithWiFiPanel")
m.linkWithTvPanel = m.top.findNode("LinkWithTvPanel")
m.webAppUrlLabel = m.top.findNode("WebAppUrlLabel")
m.webAppQrCodePoster = m.top.findNode("WebAppQrCodePoster")
m.wifiNameLabel = m.top.findNode("WifiNameLabel")
m.wifiInstructionWithDeviceNameLabel = m.top.findNode("WifiInstructionWithDeviceNameLabel")
m.linkCodeLabel = m.top.findNode("LinkCodeLabel")
m.wifiInstructionWithDeviceNameLabel.drawingStyles = {
"Bold": {
"fontSize": 22
"fontUri": "font:SmallBoldSystemFont"
"color": "#DDDDDDFF"
}
"default": {
"fontSize": 22
"fontUri": "font:SmallSystemFont"
"color": "#DDDDDDFF"
}
}
end function
function OnNodeReady()
@@ -46,6 +62,11 @@ function OnNodeReady()
m.linkWithWifiPanel.visible = false
m.linkWithTvPanel.observeField("visible", FuncName(OnLinkWithTvPanelVisibleChanged))
m.linkWithTvPanel.visible = false
m.webAppButton.observeField("contentWidth", FuncName(OnButtonSizeChange))
m.linkWithWifiButton.observeField("contentWidth", FuncName(OnButtonSizeChange))
m.linkWithTvButton.observeField("contentWidth", FuncName(OnButtonSizeChange))
OnButtonSizeChange()
end function
function OnFocusChange() as void
@@ -64,16 +85,20 @@ end function
function OnUrlSet()
url = m.top.url
urlLabel = m.top.findNode("urlLabel")
urlLabel.text = url
m.webAppUrlLabel.text = url
m.webAppQrCodePoster.text = url
end function
qrCodePoster = m.top.findNode("QrCodePoster")
AsyncTask.Start(Tasks.GenerateQrCodeTask, {
poster: qrCodePoster
text: url
size: qrCodePoster.loadWidth
padding: 20
})
function OnButtonSizeChange()
width1 = m.webAppButton.contentWidth
width2 = m.linkWithWifiButton.contentWidth
width3 = m.linkWithTvButton.contentWidth
width = MathUtils.Max(width1, MathUtils.Max(width2, width3))
m.webAppButton.minimumWidth = width
m.linkWithWifiButton.minimumWidth = width
m.linkWithTvButton.minimumWidth = width
end function
function OnkeyEvent(key as string, press as boolean) as boolean
@@ -124,10 +149,13 @@ function OnLinkWithWifiPanelVisibleChanged() as void
if connectionInfo.type = "WiFiConnection"
m.wifiNameLabel.text = connectionInfo.ssid
else if connectionInfo.type = "WiredConnection"
m.wifiNameLabel.text = "Wired connection"
m.wifiNameLabel.text = Tr(Locale.RemoteScreen.WiredConnection)
else
m.wifiNameLabel.text = "N/A"
end if
deviceName = `<Bold>"${m.loungeService.deviceName}"</Bold>`
m.wifiInstructionWithDeviceNameLabel.text = Tr(Locale.RemoteScreen.WifiInstruction3).Replace("%1", deviceName)
end function
function OnLinkWithTvPanelVisibleChanged()
@@ -147,6 +175,7 @@ function GeneratePairingCode()
m.linkCodeTask.cancel = true
end if
m.linkCodeLabel.text = Tr(Locale.RemoteScreen.Loading)
m.linkCodeTask = AsyncTask.Start(Tasks.LoungeGenerateManualPairingCodeTask, {
loungeService: m.loungeService
loungeToken: m.loungeService.loungeToken
@@ -174,8 +203,8 @@ function OnLoungeGenerateManualPairingCodeTaskResult(output as object) as void
error = ErrorUtils.Format(error)
LogError(error)
message = `Failed to generate manual pairing code\n${error}`
DialogUtils.ShowDialog(message, "Get TV code fail", true)
message = Tr(Locale.RemoteScreen.FailedToGeneratePairingCode) + `\n${error}`
DialogUtils.ShowDialog(message, Tr(Locale.RemoteScreen.TvCodeError), true)
return
end if
@@ -10,11 +10,13 @@
<Group id="noInternet" visible="false">
<Label
height="720"
width="1280"
font="font:MediumBoldSystemFont"
width="920"
font="font:SmallSystemFont"
horizAlign="center"
vertAlign="center"
text="Could not get IP address: are we connected to the internet?"
wrap="true"
translation="[180,0]"
/>
</Group>
<Group id="yesInternet" visible="false">
@@ -47,15 +49,16 @@
font="font:SmallBoldSystemFont"
horizAlign="center"
text="Scan the QR code" />
<Poster
id="QrCodePoster"
<QrCodePoster
id="WebAppQrCodePoster"
height="400"
width="400"
loadHeight="400"
loadWidth="400"
padding="20"
translation="[0,40]" />
<Label
id="UrlLabel"
id="WebAppUrlLabel"
height="30"
width="400"
font="font:SmallBoldSystemFont"
@@ -90,29 +93,29 @@
<Label
font="font:SmallSystemFont"
text="3." />
<Label
font="font:SmallSystemFont"
<MultiStyleLabel
id="WifiInstructionWithDeviceNameLabel"
width="380"
wrap="true"
text="Tap the cast icon and select this device." />
</LayoutGroup>
<Label
text="Roku connected to:"
translation="[0,220]">
<Font role="font" uri="font:SystemFontFile" size="20" />
</Label>
<Label
id="WifiNameLabel"
color="#4287f5"
translation="[0,250]">
<Font role="font" uri="font:BoldSystemFontFile" size="28" />
</Label>
</LayoutGroup>
<Label
text="Roku connected to:"
translation="[0,220]">
<Font role="font" uri="font:SystemFontFile" size="20" />
</Label>
<Label
id="WifiNameLabel"
color="#4287f5"
translation="[0,250]">
<Font role="font" uri="font:BoldSystemFontFile" size="28" />
</Label>
</Group>
<Group id="LinkWithTvPanel"
translation="[700,220]">
<LayoutGroup itemSpacings="[12]">
<LayoutGroup itemSpacings="[12,12,25]">
<LayoutGroup layoutDirection="horiz" itemSpacings="[15]">
<Label
font="font:SmallSystemFont"
@@ -131,7 +134,7 @@
font="font:SmallSystemFont"
width="380"
wrap="true"
text="Tap the Chromecast icon." />
text="Tap the cast icon." />
</LayoutGroup>
<LayoutGroup layoutDirection="horiz" itemSpacings="[15]">
<Label
@@ -141,18 +144,15 @@
font="font:SmallSystemFont"
width="380"
wrap="true"
text="Tap &quot;Link with TV code&quot; and enter the code below." />
text="Tap 'Link with TV code' and enter the code below." />
</LayoutGroup>
<Label
id="LinkCodeLabel"
font="font:LargeBoldSystemFont"
color="#4287f5">
<Font role="font" uri="font:BoldSystemFontFile" size="48" />
</Label>
</LayoutGroup>
<Label
id="LinkCodeLabel"
font="font:LargeBoldSystemFont"
color="#4287f5"
translation="[-30,180]"
width="460"
horizAlign="center">
<Font role="font" uri="font:BoldSystemFontFile" size="48" />
</Label>
</Group>
</Group>
</children>
@@ -1,105 +1,103 @@
import "pkg:/components/Navigation/Navigation.bs"
import "pkg:/source/utils/ArrayUtils.bs"
import "pkg:/source/utils/Locale.bs"
import "pkg:/source/utils/Types.bs"
function Init()
options = {
date: [{
title: "Any date"
title: Tr(Locale.SearchFilters.AnyDate)
value: ""
}, {
title: "Last hour"
title: Tr(Locale.SearchFilters.LastHour)
value: "hour"
}, {
title: "Today"
title: Tr(Locale.SearchFilters.Today)
value: "today"
}, {
title: "This week"
title: Tr(Locale.SearchFilters.ThisWeek)
value: "week"
}, {
title: "This month"
title: Tr(Locale.SearchFilters.ThisMonth)
value: "month"
}, {
title: "This year"
title: Tr(Locale.SearchFilters.ThisYear)
value: "year"
}]
type: [{
title: "Any type"
title: Tr(Locale.SearchFilters.AnyType)
value: ""
}, {
title: "Video"
title: Tr(Locale.SearchFilters.Video)
value: "video"
}, {
title: "Playlist"
title: Tr(Locale.SearchFilters.Playlist)
value: "playlist"
}, {
title: "Channel"
title: Tr(Locale.SearchFilters.Channel)
value: "channel"
}, {
title: "Movie"
title: Tr(Locale.SearchFilters.Movie)
value: "movie"
}, {
title: "Show"
value: "show"
}]
duration: [{
title: "Any duration"
title: Tr(Locale.SearchFilters.AnyDuration)
value: ""
}, {
title: "Under 4 minutes"
title: Tr(Locale.SearchFilters.Under4Minutes)
value: "short"
}, {
title: "4 - 20 minutes"
title: Tr(Locale.SearchFilters.FourTo20Minutes)
value: "medium"
}, {
title: "Over 20 minutes"
title: Tr(Locale.SearchFilters.Over20Minutes)
value: "long"
}]
features: [{
title: "Live"
title: Tr(Locale.Feed.Live)
value: "live"
}, {
title: "4K"
title: Tr(Locale.SearchFilters.FourK)
value: "4k"
}, {
title: "HD"
title: Tr(Locale.SearchFilters.HD)
value: "hd"
}, {
title: "Subtitles/CC"
title: Tr(Locale.SearchFilters.SubtitlesCC)
value: "subtitles"
}, {
title: "Creative Commons"
title: Tr(Locale.SearchFilters.CreativeCommons)
value: "creative_commons"
}, {
title: "360°"
title: Tr(Locale.SearchFilters.ThreeSixty)
value: "360"
}, {
title: "VR180"
title: Tr(Locale.SearchFilters.VR180)
value: "vr180"
}, {
title: "3D"
title: Tr(Locale.SearchFilters.ThreeD)
value: "3d"
}, {
title: "HDR"
title: Tr(Locale.SearchFilters.HDR)
value: "hdr"
}, {
title: "Purchased"
title: Tr(Locale.SearchFilters.Purchased)
value: "purchased"
}, {
title: "Location"
title: Tr(Locale.SearchFilters.Location)
value: "location"
}]
sort_by: [{
title: "Relevance"
sort: [{
title: Tr(Locale.SearchFilters.Relevance)
value: ""
}, {
title: "Upload date"
value: "upload_date"
title: Tr(Locale.SearchFilters.UploadDate)
value: "date"
}, {
title: "View count"
value: "view_count"
title: Tr(Locale.SearchFilters.ViewCount)
value: "views"
}, {
title: "Rating"
title: Tr(Locale.SearchFilters.Rating)
value: "rating"
}]
}
@@ -109,7 +107,7 @@ function Init()
type: m.top.findNode("TypeList")
duration: m.top.findNode("DurationList")
features: m.top.findNode("FeaturesList")
sort_by: m.top.findNode("SortByList")
sort: m.top.findNode("SortList")
}
for each filterKey in m.controls
@@ -122,12 +120,12 @@ function Init()
type: m.controls.type.content
duration: m.controls.duration.content
features: m.controls.features.content
sort_by: m.controls.sort_by.content
sort: m.controls.sort.content
}
PopulateLists(m.contentNodes, options)
navigationNodes = [m.controls.date, m.controls.type, m.controls.duration, m.controls.features, m.controls.sort_by]
navigationNodes = [m.controls.date, m.controls.type, m.controls.duration, m.controls.features, m.controls.sort]
for i = 0 to navigationNodes.count() - 2
SetNavigation(navigationNodes[i], "right", navigationNodes[i + 1])
end for
@@ -156,7 +154,7 @@ function OnNodeReady()
m.controls.type.ObserveField("checkedItem", FuncName(OnListChecked))
m.controls.duration.ObserveField("checkedItem", FuncName(OnListChecked))
m.controls.features.ObserveField("checkedState", FuncName(OnListChecked))
m.controls.sort_by.ObserveField("checkedItem", FuncName(OnListChecked))
m.controls.sort.ObserveField("checkedItem", FuncName(OnListChecked))
end function
function RefreshUI()
@@ -14,14 +14,14 @@
<Font id="ItemFont" uri="font:SystemFontFile" size="18" />
<Font id="ItemFocusedFont" uri="font:BoldSystemFontFile" size="18" />
<Rectangle
width="1116"
width="1200"
height="543"
translation="[82,84]"
translation="[40,84]"
color="#242424">
<LayoutGroup
layoutDirection="horiz"
translation="[35,20]">
translation="[20,20]">
<LayoutGroup horizAlignment="center" itemSpacings="[10,10]">
<Label
text="Upload date"
@@ -36,7 +36,7 @@
vertFocusAnimationStyle="floatingFocus"
font="dictionary:ItemFont"
focusedFont="dictionary:ItemFocusedFont"
itemSize="[140,42]">
itemSize="[170,42]">
<ContentNode role="content" />
</RadioButtonList>
</LayoutGroup>
@@ -74,7 +74,7 @@
vertFocusAnimationStyle="floatingFocus"
font="dictionary:ItemFont"
focusedFont="dictionary:ItemFocusedFont"
itemSize="[190,42]">
itemSize="[230,42]">
<ContentNode role="content" />
</RadioButtonList>
</LayoutGroup>
@@ -108,11 +108,11 @@
width="180"
height="1" />
<RadioButtonList
id="SortByList"
id="SortList"
vertFocusAnimationStyle="floatingFocus"
font="dictionary:ItemFont"
focusedFont="dictionary:ItemFocusedFont"
itemSize="[150,42]">
itemSize="[190,42]">
<ContentNode role="content" />
</RadioButtonList>
</LayoutGroup>
@@ -1,3 +1,4 @@
import "pkg:/components/Dialog/DialogUtils.bs"
import "pkg:/components/Navigation/Navigation.bs"
import "pkg:/components/Services/SearchHistory/SearchHistoryUtils.bs"
import "pkg:/source/AsyncTask/AsyncTask.bs"
@@ -6,6 +7,7 @@ import "pkg:/source/utils/CryptoUtils.bs"
import "pkg:/source/utils/ErrorUtils.bs"
import "pkg:/source/utils/FocusManagement.bs"
import "pkg:/source/utils/LoadingScreen.bs"
import "pkg:/source/utils/Locale.bs"
import "pkg:/source/utils/Logging.bs"
import "pkg:/source/utils/UrlUtils.bs"
@@ -32,7 +34,7 @@ function Init()
type: ""
duration: ""
features: []
sort_by: ""
sort: ""
}
m.top.ObserveField("filters", FuncName(OnFiltersChange))
@@ -195,22 +197,20 @@ function OnFiltersChange()
end if
end for
if filterCount > 0
m.filtersButton.text = `Filters (${filterCount})`
m.filtersButton.text = `${Tr(Locale.Buttons.Filters)} (${filterCount})`
else
m.filtersButton.text = "Filters"
m.filtersButton.text = Tr(Locale.Buttons.Filters)
end if
end function
function Search(text as string)
m.rowlist.UnobserveFieldScoped("someContentReady")
' TODO:P1 someContentReady only fires if there are search results.
' The case where search results are empty is not handled.
m.rowlist.ObserveFieldScoped("someContentReady", FuncName(OnSearchContentReady))
ShowLoadingScreen()
feedSource = {
"id": `inv_search_${CryptoUtils.GetMd5(text)}`
"title": `Search - ${text}`
"title": `${Tr(Locale.NavBar.Search)} - ${text}`
"apiType": "Invidious"
"endpoint": "search"
"queryParams": {
@@ -232,16 +232,22 @@ function Search(text as string)
end for
m.rowList.feeds = [{
"title": `Search - ${text}`
"title": `${Tr(Locale.NavBar.Search)} - ${text}`
"feedSources": [feedSource]
}]
end function
function OnSearchContentReady() as void
m.rowlist.UnobserveFieldScoped("someContentReady")
if not m.rowlist.someContentReady
DialogUtils.ShowDialog(Tr(Locale.Dialogs.NoResultsFoundMessage), Tr(Locale.Dialogs.NoResultsFound))
m.rowlist.feeds = invalid
m.rowlist.focusable = false
HideLoadingScreen()
return
end if
m.rowlist.UnobserveFieldScoped("someContentReady")
m.rowlist.focusable = true
m.currentNavigtionNode = m.rowList
NodeSetFocus(m.rowlist, true)
@@ -253,6 +259,7 @@ function OnSearchContentReady() as void
end function
function OnSearchError()
' Note: we don't display an error dialog, VideoRowListRowContentTask will do that.
m.rowlist.feeds = invalid
m.rowlist.focusable = false
HideLoadingScreen()
@@ -8,16 +8,13 @@
</interface>
<children>
<Group id="container">
<Button
<ButtonEx
id="filtersButton"
translation="[160,35]"
minWidth="0"
height="58"
showFocusFootprint="true"
iconUri="pkg:/images/icons/filters-white.png"
focusedIconUri="pkg:/images/icons/filters-black.png"
text="Filters">
</Button>
translation="[190,64]"
iconUri="pkg:/images/icons/filters.png"
anchor="[0,0.5]"
padding="[30,30]"
text="Filters" />
<DynamicMiniKeyboard
id="keyboard"
@@ -46,7 +43,7 @@
showRowLabel="[true]"
rowFocusAnimationStyle="floatingfocus"
variableWidthItems="true"
focusBitmapUri="pkg:/images/focus_grid.9.png"
focusBitmapUri="pkg:/images/focus-glow-padding-19.9.png"
/>
<Animation
id="scrollAnimation"
@@ -1,7 +1,9 @@
import "pkg:/source/utils/MathUtils.bs"
import "pkg:/source/utils/Types.bs"
function Init()
m.top.observeField("checkedState", FuncName(OnCheckedStateChange))
m.minItemWidth = m.top.itemSize[0]
end function
function OnValueChange()
@@ -15,3 +17,19 @@ function OnCheckedStateChange() as void
end if
m.top.value = checkedState[0]
end function
function OnTitleChange()
title = m.top.title
' TODO:P2 FIX THIS
' This is a gross estimate of the width of the text, because there isn't
' a simple way to measure using the font, and accurately estimate the width
' of the checkbox. I hate it, but I currently don't have the patience to
' do something else.
' The risks are, if the checkbox is too big, it will look ugly, and if it's
' too small, the text will be scrolling. Either way, it will be usable.
' A better way is to create a Checkbox from scratch, instead of using the CheckList
size = title.len() * 14 - 30
size = MathUtils.Max(size, m.minItemWidth)
m.top.itemSize = [size, m.top.itemSize[1]]
end function
@@ -1,6 +1,6 @@
<component name="Checkbox" extends="CheckList">
<interface>
<field id="title" type="string" alias="checkboxNode.title" />
<field id="title" type="string" alias="checkboxNode.title" onChange="OnTitleChange" />
<field id="value" type="boolean" onChange="OnValueChange" />
</interface>
<children>
@@ -1,6 +1,7 @@
import "pkg:/components/Dialog/DialogUtils.bs"
import "pkg:/components/Services/SearchHistory/SearchHistoryUtils.bs"
import "pkg:/source/utils/FocusManagement.bs"
import "pkg:/source/utils/Locale.bs"
function Init()
m.top.focusable = true
@@ -22,5 +23,5 @@ end function
function OnButtonSelected()
SearchHistoryUtils.Clear()
DialogUtils.ShowDialog("Search history cleared.", "Success")
DialogUtils.ShowDialog(Tr(Locale.Settings.SearchHistoryCleared), Tr(Locale.Generic.Success))
end function
@@ -35,6 +35,16 @@ function Init()
m.closeButton.observeField("buttonSelected", FuncName(Close))
m.checkList.observeField("checkedState", FuncName(OnCheckedStateChange))
SetButtonPositions()
end function
function SetButtonPositions()
saveButtonWidth = m.saveButton.width
closeButtonWidth = m.closeButton.width
buttonsWith = closeButtonWidth + saveButtonWidth + 20
m.saveButton.translation = [960 / 2 - buttonsWith / 2, m.saveButton.translation[1]]
m.closeButton.translation = [960 / 2 + buttonsWith / 2 - closeButtonWidth, m.closeButton.translation[1]]
end function
function OnFocusChange() as void
@@ -77,7 +87,7 @@ function OnValueChange()
end if
node = CreateObject("roSGNode", "ContentNode")
node.id = feed.id
node.title = feed.title
node.title = Tr(feed.title)
nodes.push(node)
checkedState.push(item.enabled)
end for
@@ -24,30 +24,33 @@
<ContentNode role="content" />
</CheckList>
<Button
<ButtonEx
id="moveUpButton"
iconVisible="false"
anchor="[0.5,0.5]"
text="Move up"
showFocusFootprint="true"
minWidth="220"
translation="[640,183]" />
<Button
translation="[750,220]" />
<ButtonEx
id="moveDownButton"
iconVisible="false"
anchor="[0.5,0.5]"
text="Move down"
showFocusFootprint="true"
minWidth="220"
translation="[640,273]" />
<Button
id="closeButton"
text="Close"
showFocusFootprint="true"
minWidth="150"
translation="[500,500]" />
<Button
translation="[750,300]" />
<ButtonEx
id="saveButton"
iconVisible="false"
text="Save"
showFocusFootprint="true"
minWidth="150"
translation="[320,500]" />
padding="[30,30]"
translation="[340,500]" />
<ButtonEx
id="closeButton"
iconVisible="false"
text="Close"
padding="[30,30]"
translation="[496,500]" />
</Rectangle>
</children>
</component>
@@ -1,5 +1,7 @@
import "pkg:/components/parts/AutoBind/OnNodeReadyNoOp.bs"
import "pkg:/components/Services/Invidious/InvidiousService.bs"
import "pkg:/source/utils/FocusManagement.bs"
import "pkg:/source/utils/StringUtils.bs"
import "pkg:/source/utils/Types.bs"
function Init()
@@ -7,6 +9,7 @@ function Init()
m.top.itemSpacings = [8]
m.button = m.top.findNode("button")
m.button.text = Invidious.DEFAULT_INSTANCE
AdjustButtonLabel(m.button)
m.button.observeField("buttonSelected", FuncName(OpenInvidiousInstanceSettings))
@@ -74,5 +77,12 @@ function OnValueChange() as void
return
end if
m.preferences[m.key] = m.top.value
value = m.top.value
m.preferences[m.key] = value
if StringUtils.IsNullOrEmpty(value)
m.button.text = Invidious.DEFAULT_INSTANCE
else
m.button.text = value
end if
end function
@@ -2,7 +2,7 @@
<interface>
<field id="displayText" type="string" alias="DisplayTextLabel.text" />
<field id="description" type="string" alias="DescriptionLabel.text" />
<field id="value" type="string" alias="Button.text" onChange="OnValueChange" />
<field id="value" type="string" onChange="OnValueChange" />
<field id="appController" type="node" bind="/AppController" />
<function name="BindPreference" />
</interface>
@@ -33,6 +33,28 @@ function Init()
m.currentNavigtionNode = m.editButton
m.textEditBox.hintText = `e.g. ${Invidious.DEFAULT_INSTANCE}`
SetButtonPositions()
SetPublicInstancesPosition()
m.publicInstances.observeField("width", FuncName(SetPublicInstancesPosition))
end function
function SetButtonPositions()
testButtonWidth = m.testButton.width
saveButtonWidth = m.saveButton.width
buttonsWith = testButtonWidth + saveButtonWidth + 20
m.testButton.translation = [960 / 2 - buttonsWith / 2, m.testButton.translation[1]]
m.saveButton.translation = [960 / 2 + buttonsWith / 2 - saveButtonWidth, m.saveButton.translation[1]]
end function
function SetPublicInstancesPosition() as void
width = m.publicInstances.width
if width = 0
return
end if
m.publicInstances.translation = [960 / 2 - width / 2, m.publicInstances.translation[1]]
end function
function OnFocusChange() as void
@@ -83,7 +105,7 @@ function OnEditButtonSelected()
keyboardDialog.title = "Edit Instance"
keyboardDialog.message = [`Enter the instance url (e.g. ${Invidious.DEFAULT_INSTANCE})`]
keyboardDialog.text = m.top.text
keyboardDialog.buttons = ["OK", "Cancel"]
keyboardDialog.buttons = [Tr(Locale.Buttons.OK), Tr(Locale.Buttons.Cancel)]
keyboardDialog.observeField("buttonSelected", FuncName(OnKeyboardButton))
m.top.getScene().dialog = keyboardDialog
@@ -18,58 +18,64 @@
color="#242424">
<Label
text="Invidious custom instance"
translation="[326,13]" />
horizAlign="center"
width="960"
translation="[0,13]" />
<TextEditBox
id="textEditBox"
width="480"
height="50"
translation="[200,50]" />
<Button
translation="[170,50]" />
<ButtonEx
id="editButton"
text=""
minWidth="64"
maxWidth="80"
height="48"
iconUri="pkg:/images/icons/edit-48-white.png"
focusedIconUri="pkg:/images/icons/edit-48-black.png"
showFocusFootprint="true"
translation="[692,50]" />
<Label
text="OR"
translation="[460,110]">
iconUri="pkg:/images/icons/edit.png"
height="50"
iconWidth="22"
iconHeight="22"
text="Edit"
translation="[670,50]" />
<LayoutGroup
layoutDirection="horiz"
horizAlignment="center"
vertAlignment="center"
itemSpacings="[30,30]"
translation="[480,125]">
<Rectangle
width="250"
height="1"
translation="[-282,10]" />
height="1" />
<Label
text="Or" />
<Rectangle
width="250"
height="1"
translation="[71,10]" />
height="1" />
</Label>
</LayoutGroup>
<Label
text="Invidious public instances"
translation="[328,145]" />
horizAlign="center"
width="960"
translation="[0,145]" />
<InvidiousPublicInstances
id="instances"
translation="[50,190]">
translation="[50,190]" />
</InvidiousPublicInstances>
<Button
<ButtonEx
id="testButton"
text="Test instance"
showFocusFootprint="true"
translation="[495,507]" />
<Button
iconVisible="false"
padding="[30,30]"
translation="[300,510]" />
<ButtonEx
id="saveButton"
text="Save"
showFocusFootprint="true"
minWidth="150"
translation="[768,507]" />
iconVisible="false"
padding="[30,30]"
translation="[545,510]" />
</Rectangle>
</children>
</component>
@@ -53,14 +53,15 @@ function Close()
end function
function RunTestsTask()
m.titleLabel.text = `Testing ${m.top.instance}`
instance = m.top.instance
m.titleLabel.text = Tr(Locale.InvidiousTesting.TestingInstance).Replace("%1", instance)
if m.testingTask <> invalid
m.testingTask.cancel = true
end if
m.testingTask = AsyncTask.Start(Tasks.InvidiousInstanceTestingTask, {
instance: m.top.instance
instance: instance
listNode: m.testList
})
end function
@@ -68,10 +69,21 @@ end function
function ShowTestDetails(event as object) as void
selected = m.testList.itemSelected
itemContent = m.testList.content.GetChild(selected)
if StringUtils.IsNullOrEmpty(itemContent.details)
details = itemContent.details
if StringUtils.IsNullOrEmpty(details)
return
end if
message = `Status: ${itemContent.state}\nTest duration: ${itemContent.duration}ms\nDetails: ${itemContent.details}`
DialogUtils.ShowDialog(message, `Test: ${itemContent.title}`)
state = itemContent.state
displayStates = {
"passed": Locale.InvidiousTesting.Passed
"failed": Locale.InvidiousTesting.Failed
}
message = Tr(Locale.InvidiousTesting.Status) + ": " + Tr(ValidString(displayStates[state])) + `\n`
message += Tr(Locale.InvidiousTesting.TestDuration) + ": " + `${itemContent.duration}ms\n`
message += Tr(Locale.InvidiousTesting.Details) + ": " + details
title = Tr(Locale.InvidiousTesting.Test) + ": " + itemContent.title
DialogUtils.ShowDialog(message, title)
end function
Loaded 100 of 281 files, more files were not shown because too many files have changed in this diff. Show more