Compare commits

..
42 Commits
Author SHA1 Message Date
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
221 changed files with 5771 additions and 1243 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,
+26 -2
View File
@@ -5,6 +5,30 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [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
@@ -33,7 +57,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Small improvement in the context menu of the Playlist view
- Videos can be paused and resumed using the `Ok` remote button
- Videos can be paused and resumed using the `OK` remote button
### Fixed
@@ -135,7 +159,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>
+9 -1
View File
@@ -46,6 +46,12 @@
"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": [
@@ -56,6 +62,7 @@
"!**/*.psd",
"!**/*.svg",
"!**/*.svg.meta.json5",
"locale/**",
"config/**",
"lib/**",
"www/**",
@@ -79,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,
+3 -1
View File
@@ -2,7 +2,7 @@ openapi: 3.0.0
info:
title: Playlet Web API
version: 0.21.1
version: 0.22.0
description:
Playlet Web API is a RESTful API for controlling the Playlet app on
Roku devices. The API is intended to be used by the Playlet web app, but can
@@ -572,6 +572,8 @@ components:
type: string
friendly_name:
type: string
current_locale:
type: string
invidious:
type: object
properties:
+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

+342 -27
View File
@@ -1,27 +1,27 @@
{
"name": "playlet",
"version": "0.21.1",
"version": "0.22.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "playlet",
"version": "0.21.1",
"version": "0.22.0",
"hasInstallScript": true,
"devDependencies": {
"@rokucommunity/bslint": "^0.8.19",
"@types/crypto-js": "^4.2.2",
"@types/fs-extra": "^11.0.4",
"@types/node": "^20.11.25",
"@types/node": "^20.11.30",
"@types/xml2js": "^0.4.14",
"argparse": "^2.0.1",
"brighterscript": "0.65.25",
"brighterscript": "0.65.26",
"brighterscript-formatter": "^1.7.0",
"convert-svg-to-png": "^0.6.4",
"cross-fetch": "^4.0.0",
"crypto-js": "^4.2.0",
"dotenv": "^16.4.5",
"express": "^4.18.3",
"express": "^4.19.1",
"fs-extra": "^11.2.0",
"glob": "^10.3.10",
"imap": "^0.8.19",
@@ -29,16 +29,17 @@
"json5": "^2.2.3",
"mailparser": "^3.6.9",
"roku-deploy": "^3.12.0",
"rooibos-roku": "5.10.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.4.2",
"typescript": "^5.4.3",
"xml2js": "^0.6.2",
"yaml": "^2.4.1"
},
"engines": {
"node": "18"
"node": "20"
}
},
"node_modules/@cspotcode/source-map-support": {
@@ -369,10 +370,16 @@
"@types/node": "*"
}
},
"node_modules/@types/mime-types": {
"version": "2.1.4",
"resolved": "https://registry.npmjs.org/@types/mime-types/-/mime-types-2.1.4.tgz",
"integrity": "sha512-lfU4b34HOri+kAY5UheuFMWPDOI+OPceBSHZKp69gEyTL/mmJ4cnU6Y/rlme3UL3GyOn6Y42hyIEw0/q8sWx5w==",
"dev": true
},
"node_modules/@types/node": {
"version": "20.11.25",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.25.tgz",
"integrity": "sha512-TBHyJxk2b7HceLVGFcpAUjsa5zIdsPWlR6XHfyGzd0SFu+/NFgQgMAl96MSDZgQDvJAvV6BKsFOrt6zIL09JDw==",
"version": "20.11.30",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.30.tgz",
"integrity": "sha512-dHM6ZxwlmuZaRmUPfv1p+KrdD1Dci04FbdEm/9wEMouFqxYoFl5aMkt0VMAUtYRQDyYvD41WJLukhq/ha3YuTw==",
"dev": true,
"dependencies": {
"undici-types": "~5.26.4"
@@ -579,12 +586,27 @@
"node": ">=0.8"
}
},
"node_modules/async-limiter": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz",
"integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==",
"dev": true
},
"node_modules/asynckit": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==",
"dev": true
},
"node_modules/at-least-node": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz",
"integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==",
"dev": true,
"engines": {
"node": ">= 4.0.0"
}
},
"node_modules/aws-sign2": {
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz",
@@ -728,9 +750,9 @@
}
},
"node_modules/brighterscript": {
"version": "0.65.25",
"resolved": "https://registry.npmjs.org/brighterscript/-/brighterscript-0.65.25.tgz",
"integrity": "sha512-sezfScxcXZfzEJ702HCMjfPsIH/x3mfLAFDObGU+xAC2E8m/zxrPOHKlD9Qpmdvd7/j4TgsujhiRQ1tnk8BzGA==",
"version": "0.65.26",
"resolved": "https://registry.npmjs.org/brighterscript/-/brighterscript-0.65.26.tgz",
"integrity": "sha512-VT1Dzj0K4A1vcmsmv63mcI4hD7W8yQ3ZPF0LLxpgSGj27UCxUquz99w1qCkgzhvLk0jIdV7wGj7vnH3kttrJKQ==",
"dev": true,
"dependencies": {
"@rokucommunity/bslib": "^0.1.1",
@@ -1076,6 +1098,12 @@
"node": "*"
}
},
"node_modules/buffer-from": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz",
"integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==",
"dev": true
},
"node_modules/bytes": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",
@@ -1275,6 +1303,21 @@
"integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==",
"dev": true
},
"node_modules/concat-stream": {
"version": "1.6.2",
"resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz",
"integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==",
"dev": true,
"engines": [
"node >= 0.8"
],
"dependencies": {
"buffer-from": "^1.0.0",
"inherits": "^2.0.3",
"readable-stream": "^2.2.2",
"typedarray": "^0.0.6"
}
},
"node_modules/content-disposition": {
"version": "0.5.4",
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz",
@@ -1464,9 +1507,9 @@
}
},
"node_modules/cookie": {
"version": "0.5.0",
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz",
"integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==",
"version": "0.6.0",
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.6.0.tgz",
"integrity": "sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw==",
"dev": true,
"engines": {
"node": ">= 0.6"
@@ -1893,9 +1936,9 @@
"dev": true
},
"node_modules/express": {
"version": "4.18.3",
"resolved": "https://registry.npmjs.org/express/-/express-4.18.3.tgz",
"integrity": "sha512-6VyCijWQ+9O7WuVMTRBTl+cjNNIzD5cY5mQ1WM8r/LEkI2u8EYpOotESNwzNlyCn3g+dmjKYI6BmNneSr/FSRw==",
"version": "4.19.1",
"resolved": "https://registry.npmjs.org/express/-/express-4.19.1.tgz",
"integrity": "sha512-K4w1/Bp7y8iSiVObmCrtq8Cs79XjJc/RU2YYkZQ7wpUu5ZyZ7MtPHkqoMz4pf+mgXfNvo2qft8D9OnrH2ABk9w==",
"dev": true,
"dependencies": {
"accepts": "~1.3.8",
@@ -1903,7 +1946,7 @@
"body-parser": "1.20.2",
"content-disposition": "0.5.4",
"content-type": "~1.0.4",
"cookie": "0.5.0",
"cookie": "0.6.0",
"cookie-signature": "1.0.6",
"debug": "2.6.9",
"depd": "2.0.0",
@@ -2376,6 +2419,36 @@
"integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==",
"dev": true
},
"node_modules/handlebars": {
"version": "4.7.8",
"resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.8.tgz",
"integrity": "sha512-vafaFqs8MZkRrSX7sFVUdo3ap/eNiLnb4IakshzvP56X5Nr1iGKAIqdX6tMlm6HcNRIkr6AxO5jFEoJzzpT8aQ==",
"dev": true,
"dependencies": {
"minimist": "^1.2.5",
"neo-async": "^2.6.2",
"source-map": "^0.6.1",
"wordwrap": "^1.0.0"
},
"bin": {
"handlebars": "bin/handlebars"
},
"engines": {
"node": ">=0.4.7"
},
"optionalDependencies": {
"uglify-js": "^3.1.4"
}
},
"node_modules/handlebars/node_modules/source-map": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
"dev": true,
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/har-schema": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz",
@@ -3176,6 +3249,27 @@
"node": "*"
}
},
"node_modules/minimist": {
"version": "1.2.8",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz",
"integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==",
"dev": true,
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/mkdirp": {
"version": "0.5.6",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz",
"integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==",
"dev": true,
"dependencies": {
"minimist": "^1.2.6"
},
"bin": {
"mkdirp": "bin/cmd.js"
}
},
"node_modules/mkdirp-classic": {
"version": "0.5.3",
"resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz",
@@ -3206,6 +3300,12 @@
"node": ">= 0.6"
}
},
"node_modules/neo-async": {
"version": "2.6.2",
"resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz",
"integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==",
"dev": true
},
"node_modules/node-fetch": {
"version": "2.6.12",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.12.tgz",
@@ -3226,6 +3326,167 @@
}
}
},
"node_modules/node-html-to-image": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/node-html-to-image/-/node-html-to-image-1.2.0.tgz",
"integrity": "sha512-Z+YvvY2PSc9xULWd2NtqfO4x9rNzEiNOjA1QjOdB/BShVA7ULMJ3YKaFbn0wVuFqYJ6WSaY7ruw9frcJpXQNVQ==",
"dev": true,
"dependencies": {
"handlebars": "^4.5.3",
"puppeteer": "^2.0.0"
}
},
"node_modules/node-html-to-image/node_modules/agent-base": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-5.1.1.tgz",
"integrity": "sha512-TMeqbNl2fMW0nMjTEPOwe3J/PRFP4vqeoNuQMG0HlMrtm5QxKqdvAkZ1pRBQ/ulIyDD5Yq0nJ7YbdD8ey0TO3g==",
"dev": true,
"engines": {
"node": ">= 6.0.0"
}
},
"node_modules/node-html-to-image/node_modules/debug": {
"version": "4.3.4",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
"integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
"dev": true,
"dependencies": {
"ms": "2.1.2"
},
"engines": {
"node": ">=6.0"
},
"peerDependenciesMeta": {
"supports-color": {
"optional": true
}
}
},
"node_modules/node-html-to-image/node_modules/extract-zip": {
"version": "1.7.0",
"resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-1.7.0.tgz",
"integrity": "sha512-xoh5G1W/PB0/27lXgMQyIhP5DSY/LhoCsOyZgb+6iMmRtCwVBo55uKaMoEYrDCKQhWvqEip5ZPKAc6eFNyf/MA==",
"dev": true,
"dependencies": {
"concat-stream": "^1.6.2",
"debug": "^2.6.9",
"mkdirp": "^0.5.4",
"yauzl": "^2.10.0"
},
"bin": {
"extract-zip": "cli.js"
}
},
"node_modules/node-html-to-image/node_modules/extract-zip/node_modules/debug": {
"version": "2.6.9",
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
"dev": true,
"dependencies": {
"ms": "2.0.0"
}
},
"node_modules/node-html-to-image/node_modules/extract-zip/node_modules/ms": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==",
"dev": true
},
"node_modules/node-html-to-image/node_modules/glob": {
"version": "7.2.3",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
"integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==",
"dev": true,
"dependencies": {
"fs.realpath": "^1.0.0",
"inflight": "^1.0.4",
"inherits": "2",
"minimatch": "^3.1.1",
"once": "^1.3.0",
"path-is-absolute": "^1.0.0"
},
"engines": {
"node": "*"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/node-html-to-image/node_modules/https-proxy-agent": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-4.0.0.tgz",
"integrity": "sha512-zoDhWrkR3of1l9QAL8/scJZyLu8j/gBkcwcaQOZh7Gyh/+uJQzGVETdgT30akuwkpL8HTRfssqI3BZuV18teDg==",
"dev": true,
"dependencies": {
"agent-base": "5",
"debug": "4"
},
"engines": {
"node": ">= 6.0.0"
}
},
"node_modules/node-html-to-image/node_modules/mime": {
"version": "2.6.0",
"resolved": "https://registry.npmjs.org/mime/-/mime-2.6.0.tgz",
"integrity": "sha512-USPkMeET31rOMiarsBNIHZKLGgvKc/LrjofAnBlOttf5ajRvqiRA8QsenbcooctK6d6Ts6aqZXBA+XbkKthiQg==",
"dev": true,
"bin": {
"mime": "cli.js"
},
"engines": {
"node": ">=4.0.0"
}
},
"node_modules/node-html-to-image/node_modules/ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
"dev": true
},
"node_modules/node-html-to-image/node_modules/puppeteer": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-2.1.1.tgz",
"integrity": "sha512-LWzaDVQkk1EPiuYeTOj+CZRIjda4k2s5w4MK4xoH2+kgWV/SDlkYHmxatDdtYrciHUKSXTsGgPgPP8ILVdBsxg==",
"deprecated": "< 21.5.0 is no longer supported",
"dev": true,
"hasInstallScript": true,
"dependencies": {
"@types/mime-types": "^2.1.0",
"debug": "^4.1.0",
"extract-zip": "^1.6.6",
"https-proxy-agent": "^4.0.0",
"mime": "^2.0.3",
"mime-types": "^2.1.25",
"progress": "^2.0.1",
"proxy-from-env": "^1.0.0",
"rimraf": "^2.6.1",
"ws": "^6.1.0"
},
"engines": {
"node": ">=8.16.0"
}
},
"node_modules/node-html-to-image/node_modules/rimraf": {
"version": "2.7.1",
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz",
"integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==",
"dev": true,
"dependencies": {
"glob": "^7.1.3"
},
"bin": {
"rimraf": "bin.js"
}
},
"node_modules/node-html-to-image/node_modules/ws": {
"version": "6.2.2",
"resolved": "https://registry.npmjs.org/ws/-/ws-6.2.2.tgz",
"integrity": "sha512-zmhltoSR8u1cnDsD43TX59mzoMZsLKqUweyYBAIvTngR3shc0W6aOZylZmq/7hqyVxPdi+5Ud2QInblgyE72fw==",
"dev": true,
"dependencies": {
"async-limiter": "~1.0.0"
}
},
"node_modules/nodemailer": {
"version": "6.9.11",
"resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.9.11.tgz",
@@ -4021,9 +4282,9 @@
}
},
"node_modules/rooibos-roku": {
"version": "5.10.0",
"resolved": "https://registry.npmjs.org/rooibos-roku/-/rooibos-roku-5.10.0.tgz",
"integrity": "sha512-Idiv3nWQOEr5V8z8oHcIovjcoBffgqRtTQ5B6K+x/cGAouKxyVJp0fsZ80xQvUul9IwHQ0XIPUYbNWCR3RQ3sA==",
"version": "5.12.0",
"resolved": "https://registry.npmjs.org/rooibos-roku/-/rooibos-roku-5.12.0.tgz",
"integrity": "sha512-fJofEoaD2fNGK7zurdwSBVIQQAbc0jo0Q8TKbJbip0FGPt+inMerFhsWyp7dgXiUaw4mX+S95g74NgHbll9O/g==",
"dev": true,
"dependencies": {
"source-map": "^0.7.3",
@@ -4069,6 +4330,35 @@
"integrity": "sha512-+a9MPUQrNGRrGU630OGbYVQ+11iOIovjCkqxajPa9w57Sd5ruK8WQNsslzpa0x/QJqC8kRc2DUxWjIFwoNm4ZQ==",
"dev": true
},
"node_modules/rounded-rect-9patch": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/rounded-rect-9patch/-/rounded-rect-9patch-1.0.1.tgz",
"integrity": "sha512-5sNv0pg8+QRd9DgnzD7alGJt/9UnJs+5xv4dLAT6CKfT6h4WMcGcyTIWoRuJminJ3T/4yo7tFwnJ8cOPGiBWMw==",
"dev": true,
"dependencies": {
"fs-extra": "^9.0.0",
"minimist": "^1.2.5",
"node-html-to-image": "^1.2.0"
},
"bin": {
"rounded-rect-9patch": "cli.js"
}
},
"node_modules/rounded-rect-9patch/node_modules/fs-extra": {
"version": "9.1.0",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz",
"integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==",
"dev": true,
"dependencies": {
"at-least-node": "^1.0.0",
"graceful-fs": "^4.2.0",
"jsonfile": "^6.0.1",
"universalify": "^2.0.0"
},
"engines": {
"node": ">=10"
}
},
"node_modules/run-parallel": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz",
@@ -4646,10 +4936,16 @@
"node": ">= 0.6"
}
},
"node_modules/typedarray": {
"version": "0.0.6",
"resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz",
"integrity": "sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==",
"dev": true
},
"node_modules/typescript": {
"version": "5.4.2",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.2.tgz",
"integrity": "sha512-+2/g0Fds1ERlP6JsakQQDXjZdZMM+rqpamFZJEKh4kwTIn3iDkgKtby0CeNd5ATNZ4Ry1ax15TMx0W2V+miizQ==",
"version": "5.4.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.3.tgz",
"integrity": "sha512-KrPd3PKaCLr78MalgiwJnA25Nm8HAmdwN3mYUYZgG/wizIo9EainNVQI9/yDavtVFRN2h3k8uf3GLHuhDMgEHg==",
"dev": true,
"bin": {
"tsc": "bin/tsc",
@@ -4665,6 +4961,19 @@
"integrity": "sha512-DffL94LsNOccVn4hyfRe5rdKa273swqeA5DJpMOeFmEn1wCDc7nAbbB0gXlgBCL7TNzeTv6G7XVWzan7iJtfig==",
"dev": true
},
"node_modules/uglify-js": {
"version": "3.17.4",
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.17.4.tgz",
"integrity": "sha512-T9q82TJI9e/C1TAxYvfb16xO120tMVFZrGA3f9/P4424DNu6ypK103y0GPFVa17yotwSyZW5iYXgjYHkGrJW/g==",
"dev": true,
"optional": true,
"bin": {
"uglifyjs": "bin/uglifyjs"
},
"engines": {
"node": ">=0.8.0"
}
},
"node_modules/unbzip2-stream": {
"version": "1.4.3",
"resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.4.3.tgz",
@@ -4887,6 +5196,12 @@
"integrity": "sha512-iBdZ57RDvnOR9AGBhML2vFZf7h8vmBjhoaZqODJBFWHVtKkDmKuHai3cx5PgVMrX5YDNp27AofYbAwctSS+vhQ==",
"dev": true
},
"node_modules/wordwrap": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz",
"integrity": "sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==",
"dev": true
},
"node_modules/wrap-ansi": {
"version": "6.2.0",
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz",
+8 -7
View File
@@ -1,21 +1,21 @@
{
"name": "playlet",
"version": "0.21.1",
"version": "0.22.0",
"description": "Unofficial YouTube client for Roku",
"devDependencies": {
"@rokucommunity/bslint": "^0.8.19",
"@types/crypto-js": "^4.2.2",
"@types/fs-extra": "^11.0.4",
"@types/node": "^20.11.25",
"@types/node": "^20.11.30",
"@types/xml2js": "^0.4.14",
"argparse": "^2.0.1",
"brighterscript": "0.65.25",
"brighterscript": "0.65.26",
"brighterscript-formatter": "^1.7.0",
"convert-svg-to-png": "^0.6.4",
"cross-fetch": "^4.0.0",
"crypto-js": "^4.2.0",
"dotenv": "^16.4.5",
"express": "^4.18.3",
"express": "^4.19.1",
"fs-extra": "^11.2.0",
"glob": "^10.3.10",
"imap": "^0.8.19",
@@ -23,16 +23,17 @@
"json5": "^2.2.3",
"mailparser": "^3.6.9",
"roku-deploy": "^3.12.0",
"rooibos-roku": "5.10.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.4.2",
"typescript": "^5.4.3",
"xml2js": "^0.6.2",
"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.21.1",
"version": "0.22.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "playlet-app",
"version": "0.21.1"
"version": "0.22.0"
}
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "playlet-app",
"version": "0.21.1",
"version": "0.22.0",
"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=21
build_version=00001
minor_version=22
build_version=00000
ui_resolutions=hd
+4 -2
View File
@@ -22,9 +22,11 @@ function DialogSetPalette(msgDialog as object)
DialogBackgroundColor: "#242424FF"
DialogFocusColor: "#CECECEFF"
DialogFocusItemColor: "#202020FF"
DialogSecondaryTextColor: "#DBDBDBFF"
' bs:disable-next-line LINT3023
DialogSecondaryTextColor: "#EBEBEBFF"
DialogSecondaryItemColor: "#FF1C30FF"
DialogTextColor: "#DBDBDBFF"
' bs:disable-next-line LINT3023
DialogTextColor: "#EBEBEBFF"
}
msgDialog.palette = palette
end function
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "playlet-lib",
"version": "0.21.1",
"version": "0.22.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "playlet-lib",
"version": "0.21.1"
"version": "0.22.0"
}
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "playlet-lib",
"version": "0.21.1",
"version": "0.22.0",
"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"
@@ -27,6 +30,7 @@ function Init()
m.authorId = ""
InitializeTabs()
InitializeSortOptions()
end function
function OnNodeready()
@@ -35,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()
@@ -172,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: [{
@@ -209,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
@@ -238,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
@@ -249,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
@@ -42,13 +44,12 @@
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"
@@ -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
@@ -14,7 +14,8 @@ function OnItemHasFocus()
m.top.color = "#262626ff"
else
m.top.font = "font:SmallestSystemFont"
m.top.color = "#DBDBDBFF"
' bs:disable-next-line LINT3023
m.top.color = "#EBEBEBFF"
end if
end function
@@ -24,6 +25,7 @@ function OnFocusPercent()
m.top.color = "#262626FF"
else
m.top.font = "font:SmallestSystemFont"
m.top.color = "#DBDBDBFF"
' bs:disable-next-line LINT3023
m.top.color = "#EBEBEBFF"
end if
end function
@@ -4,9 +4,11 @@ function SetPalette(dialog as object)
DialogBackgroundColor: "#242424FF"
DialogFocusColor: "#CECECEFF"
DialogFocusItemColor: "#202020FF"
DialogSecondaryTextColor: "#DBDBDBFF"
' bs:disable-next-line LINT3023
DialogSecondaryTextColor: "#EBEBEBFF"
DialogSecondaryItemColor: "#FF1C30FF"
DialogTextColor: "#DBDBDBFF"
' bs:disable-next-line LINT3023
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
@@ -1,4 +1,5 @@
import "DialogPalette.bs"
import "pkg:/source/utils/Locale.bs"
import "pkg:/source/utils/StringUtils.bs"
import "pkg:/source/utils/Types.bs"
@@ -9,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()
@@ -17,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))
@@ -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,6 +20,7 @@
extendToDialogEdge="false"
showDivider="false">
<Label
id="scanLabel"
text="Scan the QR Code"
horizAlign="center"
wrap="true" width="400">
+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
@@ -40,9 +40,9 @@
<VideoQueue id="VideoQueue" />
<ApplicationInfo id="ApplicationInfo" />
<Preferences id="Preferences" />
<Bookmarks id="Bookmarks" />
<BookmarksService id="BookmarksService" />
<SearchHistory id="SearchHistory" />
<Profiles id="Profiles" />
<ProfilesService id="ProfilesService" />
<Invidious id="Invidious" />
<PlayletWebServer id="WebServer" port="8888" />
<DialServer id="DialServer" />
+5 -5
View File
@@ -66,18 +66,18 @@
<ApplicationInfo id="ApplicationInfo" />
<Preferences id="Preferences" />
<Bookmarks id="Bookmarks" />
<BookmarksService id="BookmarksService" />
<SearchHistory id="SearchHistory"
preferences="bind:../Preferences" />
<Profiles id="Profiles"
<ProfilesService id="ProfilesService"
invidious="bind:../Invidious" />
<Invidious id="Invidious"
webServer="bind:../WebServer"
applicationInfo="bind:../ApplicationInfo"
preferences="bind:../Preferences"
profiles="bind:../Profiles" />
profilesService="bind:../ProfilesService" />
<!-- Tasks -->
<PlayletWebServer id="WebServer"
@@ -85,10 +85,10 @@
appController="bind:/AppController"
applicationInfo="bind:../ApplicationInfo"
invidious="bind:../Invidious"
profiles="bind:../Profiles"
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,23 +24,23 @@ function InitializeBindings()
"SearchHistory": {
"preferences": "../Preferences"
},
"Profiles": {
"ProfilesService": {
"invidious": "../Invidious"
},
"Invidious": {
"webServer": "../WebServer",
"applicationInfo": "../ApplicationInfo",
"preferences": "../Preferences",
"profiles": "../Profiles"
"profilesService": "../ProfilesService"
},
"WebServer": {
"appController": "/AppController",
"applicationInfo": "../ApplicationInfo",
"invidious": "../Invidious",
"profiles": "../Profiles",
"profilesService": "../ProfilesService",
"preferences": "../Preferences",
"videoQueue": "../VideoQueue",
"bookmarks": "../Bookmarks",
"bookmarksService": "../BookmarksService",
"loungeService": "../LoungeService"
},
"DialServer": {
+1 -1
View File
@@ -36,7 +36,7 @@ function PopulateButtons() as void
button.width = 90
button.icon = item.icon
button.text = item.text
button.text = Tr(item.text)
button.padding = item.padding
buttons.push(button)
@@ -20,10 +20,10 @@ function Init()
m.top.observeField("width", FuncName(onWidthChanged))
m.top.observeField("padding", FuncName(onPaddingChanged))
profiles = m.top.getScene().findNode("Profiles")
if profiles <> invalid
m.profiles = profiles
profiles.observeField("currentProfile", FuncName(OnCurrentProfile))
profilesService = m.top.getScene().findNode("ProfilesService")
if profilesService <> invalid
m.profilesService = profilesService
profilesService.observeField("currentProfile", FuncName(OnCurrentProfile))
OnCurrentProfile()
end if
end function
@@ -91,7 +91,7 @@ function onPaddingChanged()
end function
function OnCurrentProfile() as void
currentProfile = m.profiles.currentProfile
currentProfile = m.profilesService.currentProfile
if currentProfile = invalid
m.circlePoster.visible = false
m.buttonIcon.visible = true
@@ -15,12 +15,13 @@
id="circlePoster"
width="40"
height="40"
blendColor="#DDDDDDFF"
uri="pkg:/images/white-circle.png">
<Poster
id="circlePosterInner"
width="36"
height="36"
blendColor="#9696c8"
blendColor="#9696C8"
uri="pkg:/images/white-circle.png"
translation="[2,2]">
<Label
@@ -163,10 +163,10 @@ 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]),
]
playlistAuthorId = playlist.authorId
@@ -174,19 +174,19 @@ function GetContextMenuOptionsForItem(video as object) as object
if not StringUtils.IsNullOrEmpty(playlistAuthorId) or not StringUtils.IsNullOrEmpty(videoAuthorId)
if playlistAuthorId = videoAuthorId
options.push(ContextMenuUtils.CreateOption("Open channel", m.top, "OpenPlaylistChannel", [playlist]))
options.push(ContextMenuUtils.CreateOption(Tr(Locale.ContextMenu.OpenChannel), m.top, "OpenPlaylistChannel", [playlist]))
else
if not StringUtils.IsNullOrEmpty(playlistAuthorId)
options.push(ContextMenuUtils.CreateOption("Open playlist channel", m.top, "OpenPlaylistChannel", [playlist]))
options.push(ContextMenuUtils.CreateOption(Tr(Locale.ContextMenu.OpenPlaylistChannel), m.top, "OpenPlaylistChannel", [playlist]))
end if
if not StringUtils.IsNullOrEmpty(videoAuthorId)
options.push(ContextMenuUtils.CreateOption("Open video channel", m.top, "OpenVideoChannel", [video]))
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
@@ -4,7 +4,7 @@
<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>
@@ -1,6 +1,7 @@
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"
@@ -8,7 +9,6 @@ function Init()
m.activateButton = m.top.findNode("activateButton")
m.logoutButton = m.top.findNode("logoutButton")
m.closeButton = m.top.findNode("closeButton")
m.buttonGroup = m.top.findNode("buttonGroup")
DisposableObserveField(m.activateButton, "buttonSelected", FuncName(Activate))
DisposableObserveField(m.logoutButton, "buttonSelected", FuncName(Logout))
@@ -21,8 +21,8 @@ function OnNodeReady()
SetNavigation(m.closeButton, "up", m.logoutButton)
SetNavigation(m.logoutButton, "up", m.activateButton)
DisposableObserveFieldScoped(m.profiles, "currentProfile", FuncName(OnCunrrentProfileChanged))
DisposableObserveFieldScoped(m.profiles, "onProfileLogout", FuncName(OnProfileLogout))
DisposableObserveFieldScoped(m.profilesService, "currentProfile", FuncName(OnCunrrentProfileChanged))
DisposableObserveFieldScoped(m.profilesService, "onProfileLogout", FuncName(OnProfileLogout))
end function
function OnContentSet() as void
@@ -81,13 +81,13 @@ function Activate() as void
return
end if
profile = m.profiles.content.getChild(0).findNode(content.id)
profile = m.profilesService.content.getChild(0).findNode(content.id)
if profile = invalid
return
end if
m.top.content = invalid
m.profiles@.SetCurrentProfile(profile)
m.profilesService@.SetCurrentProfile(profile)
Close()
end function
@@ -98,7 +98,7 @@ function Logout() as void
end if
m.top.content = invalid
m.profiles@.LogoutWithProfile(content)
m.profilesService@.LogoutWithProfile(content)
Close()
end function
@@ -127,7 +127,7 @@ function OnProfileLogout() as void
return
end if
profile = m.profiles.content.getChild(0).findNode(content.id)
profile = m.profilesService.content.getChild(0).findNode(content.id)
if profile = invalid
Close()
end if
@@ -144,17 +144,10 @@ function UpdateActivateButton() as void
if m.activateButton.hasFocus()
NodeSetFocus(m.logoutButton, true)
end if
parent = m.activateButton.getParent()
if parent <> invalid
m.buttonGroup.removeChild(m.activateButton)
end if
m.activateButton.focusable = false
m.activateButton.text = Tr(Locale.Buttons.InUse)
m.activateButton.disabled = true
else
parent = m.activateButton.getParent()
if parent = invalid
m.buttonGroup.insertChild(m.activateButton, 0)
end if
m.activateButton.focusable = true
m.activateButton.text = Tr(Locale.Buttons.Activate)
m.activateButton.disabled = false
end if
end function
@@ -9,7 +9,7 @@
<field id="crownVisible" type="boolean" alias="CrownPoster.visible" />
<field id="appController" type="node" bind="/AppController" />
<field id="profiles" type="node" bind="/Profiles" />
<field id="profilesService" type="node" bind="/ProfilesService" />
</interface>
<children>
<Rectangle
@@ -30,12 +30,13 @@
width="160"
height="160"
translation="[20,20]"
blendColor="#DDDDDDFF"
uri="pkg:/images/white-circle.png">
<Poster
id="circlePosterInner"
width="152"
height="152"
blendColor="#9696c8"
blendColor="#9696C8"
uri="pkg:/images/white-circle.png"
translation="[4,4]">
<Label
@@ -72,26 +73,28 @@
</Label>
</Group>
<LayoutGroup
id="buttonGroup"
translation="[420,94]"
itemSpacings="[20,20]">
<Button
id="activateButton"
text="Activate"
minWidth="200"
showFocusFootprint="true" />
<Button
id="logoutButton"
text="Logout"
minWidth="200"
showFocusFootprint="true" />
<Button
id="closeButton"
text="Close"
minWidth="200"
showFocusFootprint="true" />
</LayoutGroup>
<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>
@@ -1,6 +1,7 @@
import "pkg:/components/ContextMenu/ContextMenuUtils.bs"
import "pkg:/components/Navigation/Navigation.bs"
import "pkg:/source/utils/FocusManagement.bs"
import "pkg:/source/utils/Locale.bs"
import "pkg:/source/utils/Types.bs"
function Init()
@@ -20,7 +21,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 +54,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)
@@ -95,6 +96,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
@@ -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
@@ -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
@@ -1,3 +1,4 @@
import "pkg:/source/utils/Locale.bs"
import "pkg:/source/utils/StringUtils.bs"
function Init()
@@ -16,7 +17,7 @@ function OnContentSet() as void
' bs:disable-next-line LINT3023
m.top.circlePosterInnerBlendColor = "#FFFFFFFF"
m.top.letter = ""
m.top.username = "Login"
m.top.username = Tr(Locale.Buttons.Login)
m.top.serverUrl = ""
m.top.crownVisible = false
return
@@ -43,12 +43,13 @@
width="160"
height="160"
translation="[20,20]"
blendColor="#DDDDDDFF"
uri="pkg:/images/white-circle.png">
<Poster
id="circlePosterInner"
width="152"
height="152"
blendColor="#9696c8"
blendColor="#9696C8"
uri="pkg:/images/white-circle.png"
translation="[4,4]">
<Label
@@ -13,9 +13,9 @@ function OnNodeReady()
SetNavigation(invalid, "back", m.navBar)
SetNavigation(invalid, "left", m.navBar)
m.profileRowList.content = m.profiles.content
m.profileRowList.content = m.profilesService.content
m.profileRowList.observeFieldScoped("rowItemSelected", FuncName(OnRowItemSelected))
m.profiles.observeFieldScoped("currentProfile", FuncName(OnCurrentProfileChanged))
m.profilesService.observeFieldScoped("currentProfile", FuncName(OnCurrentProfileChanged))
end function
function OnFocusChange() as void
@@ -47,7 +47,7 @@ function OnRowItemSelected() as void
end function
function OnCurrentProfileChanged() as void
currentProfile = m.profiles.currentProfile
currentProfile = m.profilesService.currentProfile
if currentProfile = invalid
return
end if
@@ -1,7 +1,7 @@
<component name="ProfileScreen" extends="Group" includes="AutoBind,Focus">
<interface>
<field id="navBar" type="node" bind="/NavBar" />
<field id="profiles" type="node" bind="/Profiles" />
<field id="profilesService" type="node" bind="/ProfilesService" />
<field id="appController" type="node" bind="/AppController" />
</interface>
@@ -4,7 +4,9 @@ import "pkg:/source/AsyncTask/AsyncTask.bs"
import "pkg:/source/AsyncTask/Tasks.bs"
import "pkg:/source/utils/ErrorUtils.bs"
import "pkg:/source/utils/FocusManagement.bs"
import "pkg:/source/utils/Locale.bs"
import "pkg:/source/utils/Logging.bs"
import "pkg:/source/utils/MathUtils.bs"
import "pkg:/source/utils/StringUtils.bs"
function Init()
@@ -21,6 +23,23 @@ function Init()
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"
' TODO:P2 DDDDDDFF is the default for labels, but the linter is not happy about it
' We need to figure out if the linter has wrong values or not
' bs:disable-next-line LINT3023
"color": "#DDDDDDFF"
}
"default": {
"fontSize": 22
"fontUri": "font:SmallSystemFont"
' bs:disable-next-line LINT3023
"color": "#DDDDDDFF"
}
}
end function
function OnNodeReady()
@@ -47,6 +66,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
@@ -69,6 +93,18 @@ function OnUrlSet()
m.webAppQrCodePoster.text = url
end function
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
navigation = NavigationKeyHandler(key, press)
if navigation.handled
@@ -117,12 +153,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
m.wifiInstructionWithDeviceNameLabel.text = `Tap the cast icon and select "${m.loungeService.deviceName}"`
deviceName = `<Bold>"${m.loungeService.deviceName}"</Bold>`
m.wifiInstructionWithDeviceNameLabel.text = Tr(Locale.RemoteScreen.WifiInstruction3).Replace("%1", deviceName)
end function
function OnLinkWithTvPanelVisibleChanged()
@@ -142,7 +179,7 @@ function GeneratePairingCode()
m.linkCodeTask.cancel = true
end if
m.linkCodeLabel.text = "Loading..."
m.linkCodeLabel.text = Tr(Locale.RemoteScreen.Loading)
m.linkCodeTask = AsyncTask.Start(Tasks.LoungeGenerateManualPairingCodeTask, {
loungeService: m.loungeService
loungeToken: m.loungeService.loungeToken
@@ -170,8 +207,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">
@@ -91,30 +93,29 @@
<Label
font="font:SmallSystemFont"
text="3." />
<Label
<MultiStyleLabel
id="WifiInstructionWithDeviceNameLabel"
font="font:SmallSystemFont"
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"
@@ -133,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
@@ -143,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>
@@ -7,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"
@@ -33,7 +34,7 @@ function Init()
type: ""
duration: ""
features: []
sort_by: ""
sort: ""
}
m.top.ObserveField("filters", FuncName(OnFiltersChange))
@@ -196,9 +197,9 @@ 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
@@ -209,7 +210,7 @@ function Search(text as string)
feedSource = {
"id": `inv_search_${CryptoUtils.GetMd5(text)}`
"title": `Search - ${text}`
"title": `${Tr(Locale.NavBar.Search)} - ${text}`
"apiType": "Invidious"
"endpoint": "search"
"queryParams": {
@@ -231,7 +232,7 @@ function Search(text as string)
end for
m.rowList.feeds = [{
"title": `Search - ${text}`
"title": `${Tr(Locale.NavBar.Search)} - ${text}`
"feedSources": [feedSource]
}]
end function
@@ -240,7 +241,7 @@ function OnSearchContentReady() as void
m.rowlist.UnobserveFieldScoped("someContentReady")
if not m.rowlist.someContentReady
DialogUtils.ShowDialog("We didn't find any results for your search. Please try again with a different query or different filters.", "No results found")
DialogUtils.ShowDialog(Tr(Locale.Dialogs.NoResultsFoundMessage), Tr(Locale.Dialogs.NoResultsFound))
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"
@@ -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>
@@ -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
@@ -12,32 +12,33 @@
opacity="0.5">
</Rectangle>
<Rectangle
width="960"
width="1160"
height="600"
translation="[160,60]"
translation="[60,60]"
color="#242424">
<Label
id="titleLabel"
width="960"
width="1160"
horizAlign="center"
text=""
translation="[0,20]" />
<MarkupGrid
id="testList"
itemSize="[860,40]"
itemSize="[1060,40]"
itemSpacing="[0,20]"
numColumns="1"
numRows="7"
vertFocusAnimationStyle="floatingFocus"
translation="[50,80]"
itemComponentName="InvidiousInstanceTestingItem" />
<Button
<ButtonEx
id="closeButton"
text="Close"
minWidth="160"
showFocusFootprint="true"
translation="[400,506]" />
iconVisible="false"
anchor="[0.5,0.5]"
padding="[30,30]"
translation="[580,530]" />
</Rectangle>
</children>
</component>
@@ -13,14 +13,16 @@
translation="[5,0]" />
<Label
id="nameLabel"
width="450"
width="660"
translation="[60,10]" />
<Label
id="detailsLabel"
visible="false"
horizAlign="right"
width="300"
width="400"
text="Press 'OK' for details"
translation="[560,10]" />
translation="[660,12]">
<Font role="font" uri="font:SystemFontFile" size="20" />
</Label>
</children>
</component>
@@ -2,6 +2,7 @@ import "pkg:/components/Services/Invidious/InvidiousService.bs"
import "pkg:/components/Services/Invidious/InvidiousToContentNode.bs"
import "pkg:/source/services/HttpClient.bs"
import "pkg:/source/utils/ErrorUtils.bs"
import "pkg:/source/utils/Locale.bs"
import "pkg:/source/utils/StringUtils.bs"
@asynctask
@@ -16,7 +17,7 @@ function InvidiousInstanceTestingTask(input as object) as object
content = PrepareTests()
listNode.content = content
RunTests(instance, content)
RunTests(instance, content, m.top.cancellation)
return invalid
end function
@@ -25,12 +26,12 @@ function PrepareTests() as object
content = CreateObject("roSGNode", "ContentNode")
' TODO:P2 test if video data is reachable (head?)
' TODO:P2 test if video data is reachable in proxy mode (local=true)
content.AppendChild(CreateTestNode("Valid url", IsValidUrl))
content.AppendChild(CreateTestNode("Instance reachable", IsReachable))
content.AppendChild(CreateTestNode("Fetch video details", CanFetchVideoDetails))
content.AppendChild(CreateTestNode("Fetch video comments", CanFetchVideoComments))
content.AppendChild(CreateTestNode("Fetch video captions", CanFetchVideoCaptions))
content.AppendChild(CreateTestNode("Fetch video thumbnails", CanFetchVideoThumbails))
content.AppendChild(CreateTestNode(Tr(Locale.InvidiousTesting.ValidUrl), IsValidUrl))
content.AppendChild(CreateTestNode(Tr(Locale.InvidiousTesting.InstanceReachable), IsReachable))
content.AppendChild(CreateTestNode(Tr(Locale.InvidiousTesting.FetchVideoDetails), CanFetchVideoDetails))
content.AppendChild(CreateTestNode(Tr(Locale.InvidiousTesting.FetchVideoComments), CanFetchVideoComments))
content.AppendChild(CreateTestNode(Tr(Locale.InvidiousTesting.FetchVideoCaptions), CanFetchVideoCaptions))
content.AppendChild(CreateTestNode(Tr(Locale.InvidiousTesting.FetchVideoThumbnails), CanFetchVideoThumbails))
return content
end function
@@ -47,14 +48,14 @@ function CreateTestNode(title as string, func as function) as object
return testNode
end function
function RunTests(instance as string, content as object) as void
function RunTests(instance as string, content as object, cancellation as object) as void
testNodes = content.getChildren(-1, 0)
timer = CreateObject("roTimespan")
for each testNode in testNodes
timer.Mark()
m[testNode.func](instance, testNode)
m[testNode.func](instance, testNode, cancellation)
testNode.duration = timer.TotalMilliseconds()
testNode.title = `${testNode.title} (${testNode.duration}ms)`
@@ -69,31 +70,31 @@ function RunTests(instance as string, content as object) as void
end for
end function
function IsValidUrl(instance as string, testNode as object) as void
function IsValidUrl(instance as string, testNode as object, cancellation as object) as void
try
if not instance.StartsWith("http://") and not instance.StartsWith("https://")
testNode.state = "failed"
testNode.details = "Url must start with http:// or https://"
testNode.details = Tr(Locale.InvidiousTesting.UrlMustStartWith)
return
end if
if instance.EndsWith("/")
testNode.state = "failed"
testNode.details = "Url must not end with /"
testNode.details = Tr(Locale.InvidiousTesting.UrlMustNotEndWith)
return
end if
testNode.state = "passed"
testNode.details = "The url seems to be of a valid format"
testNode.details = Tr(Locale.InvidiousTesting.UrlSeemsValid)
catch e
testNode.state = "failed"
testNode.details = ErrorUtils.Format(e)
end try
end function
function IsReachable(instance as string, testNode as object) as void
function IsReachable(instance as string, testNode as object, cancellation as object) as void
try
url = `${instance}${Invidious.STATS_ENDPOINT}`
response = HttpClient.Get(url).NoCache().Await()
response = HttpClient.Get(url).NoCache().Cancellation(cancellation).Await()
if not response.IsSuccess()
testNode.state = "failed"
testNode.details = response.ErrorMessage()
@@ -103,33 +104,33 @@ function IsReachable(instance as string, testNode as object) as void
json = response.Json()
if json = invalid
testNode.state = "failed"
testNode.details = `Invalid json from ${url}`
testNode.details = Tr(Locale.InvidiousTesting.InvalidJsonFrom).Replace("%1", url)
return
end if
software = json.software
if software = invalid
testNode.state = "failed"
testNode.details = `Invalid json from ${url} (couldn't read $.software)`
testNode.details = Tr(Locale.InvidiousTesting.InvalidJsonFromCouldntRead).Replace("%1", url).Replace("%2", "$.software")
return
end if
name = software.name
if not IsString(name)
testNode.state = "failed"
testNode.details = `Invalid json from ${url} (couldn't read $.software.name)`
testNode.details = Tr(Locale.InvidiousTesting.InvalidJsonFromCouldntRead).Replace("%1", url).Replace("%2", "$.software.name")
return
end if
version = software.version
if not IsString(version)
testNode.state = "failed"
testNode.details = `Invalid json from ${url} (couldn't read software.version)`
testNode.details = Tr(Locale.InvidiousTesting.InvalidJsonFromCouldntRead).Replace("%1", url).Replace("%2", "$.software.version")
return
end if
testNode.state = "passed"
testNode.details = `The instance is reachable and running ${name} version ${version}`
testNode.details = Tr(Locale.InvidiousTesting.TheInstanceIsReachableAndRunning).Replace("%1", name).Replace("%2", version)
catch e
testNode.state = "failed"
testNode.details = ErrorUtils.Format(e)
@@ -137,11 +138,11 @@ function IsReachable(instance as string, testNode as object) as void
end function
function CanFetchVideoDetails(instance as string, testNode as object) as void
function CanFetchVideoDetails(instance as string, testNode as object, cancellation as object) as void
try
videoId = "jNQXAC9IVRw"
url = `${instance}${Invidious.VIDEOS_ENDPOINT}/${videoId}`
response = HttpClient.Get(url).NoCache().Await()
response = HttpClient.Get(url).NoCache().Cancellation(cancellation).Await()
if not response.IsSuccess()
testNode.state = "failed"
@@ -152,30 +153,30 @@ function CanFetchVideoDetails(instance as string, testNode as object) as void
json = response.Json()
if json = invalid
testNode.state = "failed"
testNode.details = `Invalid json from ${url}`
testNode.details = Tr(Locale.InvidiousTesting.InvalidJsonFrom).Replace("%1", url)
return
end if
title = json.title
if not IsString(title)
testNode.state = "failed"
testNode.details = `Invalid json from ${url} (couldn't read title)`
testNode.details = Tr(Locale.InvidiousTesting.InvalidJsonFromCouldntRead).Replace("%1", url).Replace("%2", "$.title")
return
end if
testNode.state = "passed"
testNode.details = `The instance can fetch video details for id "${videoId}" (${title})`
testNode.details = Tr(Locale.InvidiousTesting.TheInstanceCanFetchVideoDetails).Replace("%1", videoId).Replace("%2", title)
catch e
testNode.state = "failed"
testNode.details = ErrorUtils.Format(e)
end try
end function
function CanFetchVideoComments(instance as string, testNode as object) as void
function CanFetchVideoComments(instance as string, testNode as object, cancellation as object) as void
try
videoId = "jNQXAC9IVRw"
url = `${instance}/api/v1/comments/${videoId}`
response = HttpClient.Get(url).NoCache().Await()
response = HttpClient.Get(url).NoCache().Cancellation(cancellation).Await()
if not response.IsSuccess()
testNode.state = "failed"
@@ -186,38 +187,38 @@ function CanFetchVideoComments(instance as string, testNode as object) as void
json = response.Json()
if json = invalid
testNode.state = "failed"
testNode.details = `Invalid json from ${url}`
testNode.details = Tr(Locale.InvidiousTesting.InvalidJsonFrom).Replace("%1", url)
return
end if
commentCount = json.commentCount
if not IsInt(commentCount)
testNode.state = "failed"
testNode.details = `Invalid json from ${url} (couldn't read commentCount)`
testNode.details = Tr(Locale.InvidiousTesting.InvalidJsonFromCouldntRead).Replace("%1", url).Replace("%2", "$.commentCount")
return
end if
comments = json.comments
if not IsArray(comments)
testNode.state = "failed"
testNode.details = `Invalid json from ${url} (couldn't read comments)`
testNode.details = Tr(Locale.InvidiousTesting.InvalidJsonFromCouldntRead).Replace("%1", url).Replace("%2", "$.comments")
return
end if
testNode.state = "passed"
testNode.details = `The instance can fetch video comments for id "${videoId}" (${commentCount} comments)`
testNode.details = Tr(Locale.InvidiousTesting.TheInstanceCanFetchVideoComments).Replace("%1", videoId).Replace("%2", `${commentCount}`)
catch e
testNode.state = "failed"
testNode.details = ErrorUtils.Format(e)
end try
end function
function CanFetchVideoCaptions(instance as string, testNode as object) as void
function CanFetchVideoCaptions(instance as string, testNode as object, cancellation as object) as void
try
videoId = "jNQXAC9IVRw"
label = "English"
url = `${instance}/api/v1/captions/${videoId}?label=${label}`
response = HttpClient.Get(url).NoCache().Await()
response = HttpClient.Get(url).NoCache().Cancellation(cancellation).Await()
if not response.IsSuccess()
testNode.state = "failed"
@@ -229,36 +230,36 @@ function CanFetchVideoCaptions(instance as string, testNode as object) as void
contentType = headers["Content-Type"]
if StringUtils.IsNullOrEmpty(contentType) or not contentType.StartsWith("text/vtt")
testNode.state = "failed"
testNode.details = `Invalid caption data ${url} (Content-Type is not text/vtt)`
testNode.details = Tr(Locale.InvidiousTesting.InvalidCaptionDataContentType).Replace("%1", url)
return
end if
text = response.Text()
if StringUtils.IsNullOrEmpty(text) or not text.StartsWith("WEBVTT")
testNode.state = "failed"
testNode.details = `Invalid caption data from ${url} (response is not a valid vtt file)`
testNode.details = Tr(Locale.InvidiousTesting.InvalidCaptionDataNotWebVtt).Replace("%1", url)
return
end if
if text.InStr(`All right, so here we are, in front of the\nelephants`) = -1
testNode.state = "failed"
testNode.details = `Did not find expected text in caption data from ${url}`
testNode.details = Tr(Locale.InvidiousTesting.ExpectedTextNotFoundInCaptionData).Replace("%1", url)
return
end if
testNode.state = "passed"
testNode.details = `The instance can fetch video ${label} captions for id "${videoId}"`
testNode.details = Tr(Locale.InvidiousTesting.TheInstanceCanFetchVideoCaptions).Replace("%1", label).Replace("%2", videoId)
catch e
testNode.state = "failed"
testNode.details = ErrorUtils.Format(e)
end try
end function
function CanFetchVideoThumbails(instance as string, testNode as object) as void
function CanFetchVideoThumbails(instance as string, testNode as object, cancellation as object) as void
try
videoId = "jNQXAC9IVRw"
url = `${instance}${Invidious.VIDEOS_ENDPOINT}/${videoId}`
response = HttpClient.Get(url).NoCache().Await()
response = HttpClient.Get(url).NoCache().Cancellation(cancellation).Await()
if not response.IsSuccess()
testNode.state = "failed"
@@ -269,14 +270,14 @@ function CanFetchVideoThumbails(instance as string, testNode as object) as void
json = response.Json()
if json = invalid
testNode.state = "failed"
testNode.details = `Invalid json from ${url}`
testNode.details = Tr(Locale.InvidiousTesting.InvalidJsonFrom).Replace("%1", url)
return
end if
videoThumbnails = json.videoThumbnails
if not IsArray(videoThumbnails) or videoThumbnails.Count() = 0
testNode.state = "failed"
testNode.details = `No thumbnails found in json from ${url}`
testNode.details = Tr(Locale.InvidiousTesting.NoThumbnailsFoundInJson).Replace("%1", url)
return
end if
@@ -284,28 +285,28 @@ function CanFetchVideoThumbails(instance as string, testNode as object) as void
thumbnail = contentNode.thumbnail
if StringUtils.IsNullOrEmpty(thumbnail)
testNode.state = "failed"
testNode.details = `No thumbnail found in json from ${url}`
testNode.details = Tr(Locale.InvidiousTesting.NoThumbnailsFoundInJson).Replace("%1", url)
return
end if
' Note: we could do a HEAD request, but Invidious returns 200 even for invalid thumbnails
' To make sure we don't get a 200 for an invalid thumbnail, we do a GET request instead
response = HttpClient.Get(thumbnail).NoCache().Await()
response = HttpClient.Get(thumbnail).NoCache().Cancellation(cancellation).Await()
if not response.IsSuccess()
testNode.state = "failed"
testNode.details = `${thumbnail} is not reachable\n${response.ErrorMessage(false)}`
testNode.details = Tr(Locale.InvidiousTesting.ThumbnailNotReachable).Replace("%1", thumbnail) + `\n` + response.ErrorMessage(false)
return
end if
contentType = response.Headers()["Content-Type"]
if StringUtils.IsNullOrEmpty(contentType) or not contentType.StartsWith("image/")
testNode.state = "failed"
testNode.details = `Invalid thumbnail data ${thumbnail} (Content-Type is not image/*)`
testNode.details = Tr(Locale.InvidiousTesting.InvalidThumbnailData).Replace("%1", thumbnail)
return
end if
testNode.state = "passed"
testNode.details = `The instance can fetch video thumbnail for id "${videoId}" (${thumbnail})`
testNode.details = Tr(Locale.InvidiousTesting.TheInstanceCanFetchVideoThumbnails).Replace("%1", videoId).Replace("%2", thumbnail)
catch e
testNode.state = "failed"
testNode.details = ErrorUtils.Format(e)
@@ -3,7 +3,9 @@ import "pkg:/source/AsyncTask/AsyncTask.bs"
import "pkg:/source/AsyncTask/Tasks.bs"
import "pkg:/source/utils/ErrorUtils.bs"
import "pkg:/source/utils/FocusManagement.bs"
import "pkg:/source/utils/Locale.bs"
import "pkg:/source/utils/Logging.bs"
import "pkg:/source/utils/MathUtils.bs"
function Init()
m.failedLabel = m.top.findNode("failedLabel")
@@ -16,11 +18,58 @@ function Init()
m.busyspinner.poster.height = 100
m.busySpinner.poster.uri = "pkg:/images/spinner.png"
InitHeader()
m.instances.ObserveField("itemSelected", FuncName(OnInstanceSelected))
m.refreshButton.ObserveField("buttonSelected", FuncName(Refresh))
Refresh()
end function
function InitHeader()
fields = ["name", "version", "users", "signup", "location", "health"]
fieldLabels = ["nameLabel", "versionLabel", "usersLabel", "signupLabel", "locationLabel", "healthLabel"]
fieldWidths = {
"name": 240
"version": 220
"users": 80
"signup": 70
"location": 65
"health": 65
}
totalWidth = 0
for i = 0 to fields.Count() - 1
field = fields[i]
label = m.instancesHeader.findNode(fieldLabels[i])
label.text = Tr(field)
rect = label.boundingRect()
rectWidth = rect.width
if i < fields.Count() - 1
rectWidth += 10
end if
width = MathUtils.Max(rectWidth, fieldWidths[field])
fieldWidths[field] = width
label.width = width
totalWidth += width
end for
m.fieldWidths = fieldWidths
m.top.width = totalWidth
end function
function OnWidthChange() as void
width = m.top.width
if width = 0
return
end if
m.instances.itemSize = [width, m.instances.itemSize[1]]
m.busySpinner.translation = [width / 2 - 50, m.busySpinner.translation[1]]
m.failedLabel.width = width
m.refreshButton.translation = [width / 2, m.refreshButton.translation[1]]
end function
function OnFocusChange() as void
if not m.top.focus
return
@@ -45,6 +94,7 @@ function Refresh()
m.invidiousPublicInstancesTask = AsyncTask.Start(Tasks.InvidiousPublicInstancesTask, {
listNode: m.instances
fieldWidths: m.fieldWidths
}, OnInvidiousPublicInstancesTaskResults)
m.busySpinner.visible = true
@@ -71,8 +121,8 @@ function OnInvidiousPublicInstancesTaskResults(output as object) as void
error = ErrorUtils.Format(error)
LogError(output.error)
message = `Failed to load Invidious public instances\n${error}`
DialogUtils.ShowDialog(message, "Invidious public instances load error", true)
message = Tr(Locale.Dialogs.FailedToLoadInvidiousPublicInstances) + `\n${error}`
DialogUtils.ShowDialog(message, Tr(Locale.Dialogs.InvidiousPublicInstancesLoadError), true)
m.failedLabel.visible = true
m.refreshButton.visible = true
@@ -1,6 +1,7 @@
<component name="InvidiousPublicInstances" extends="Group" includes="Focus">
<interface>
<field id="instance" type="string" />
<field id="width" type="float" onChange="OnWidthChange" />
</interface>
<children>
<BusySpinner
@@ -10,23 +11,19 @@
<Label
id="failedLabel"
text="Failed to load Invidious public instances."
translation="[190,60]" />
<Button
id="refreshButton"
minWidth="180"
text="Refresh"
translation="[340,130]" />
horizAlign="center"
translation="[0,60]"
width="960" />
<InvidiousPublicInstancesListItem id="instancesHeader">
<InvidiousPublicInstancesListItemContent
role="itemContent"
name="name"
version="version"
users="users"
signup="signup"
location="location"
health="health" />
</InvidiousPublicInstancesListItem>
<ButtonEx
id="refreshButton"
iconVisible="false"
text="Refresh"
anchor="[0.5,0]"
padding="[30,30]"
translation="[430,130]" />
<InvidiousPublicInstancesListItem id="instancesHeader" />
<MarkupGrid
id="instances"
@@ -1,5 +1,8 @@
function OnContentSet() as void
content = m.top.itemContent
if content = invalid
return
end if
m.top.name = content.name
m.top.version = content.version
@@ -8,4 +11,19 @@ function OnContentSet() as void
m.top.location = content.location
m.top.flag = content.flag
m.top.health = content.health
fieldWidths = content.fieldWidths
labels = {
"name": "nameLabelWidth"
"version": "versionLabelWidth"
"users": "usersLabelWidth"
"signup": "signupLabelWidth"
"location": "locationLabelWidth"
"health": "healthLabelWidth"
}
for each label in labels
m.top[labels[label]] = fieldWidths[label]
end for
end function
@@ -1,6 +1,7 @@
<component name="InvidiousPublicInstancesListItem" extends="Group">
<interface>
<field id="itemContent" type="node" onChange="OnContentSet" />
<field id="name" type="string" alias="nameLabel.text" />
<field id="version" type="string" alias="versionLabel.text" />
<field id="users" type="string" alias="usersLabel.text" />
@@ -8,41 +9,24 @@
<field id="location" type="string" alias="locationLabel.text" />
<field id="flag" type="string" alias="flagEmoji.uri" />
<field id="health" type="string" alias="healthLabel.text" />
<field id="nameLabelWidth" type="float" alias="nameLabel.width" />
<field id="versionLabelWidth" type="float" alias="versionLabel.width" />
<field id="usersLabelWidth" type="float" alias="usersLabel.width" />
<field id="signupLabelWidth" type="float" alias="signupLabel.width" />
<field id="locationLabelWidth" type="float" alias="locationLabel.width" />
<field id="healthLabelWidth" type="float" alias="healthLabel.width" />
</interface>
<children>
<Label
id="nameLabel"
font="font:SmallestSystemFont"
width="240" />
<Label
id="versionLabel"
font="font:SmallestSystemFont"
width="220"
translation="[240,0]" />
<Label
id="usersLabel"
font="font:SmallestSystemFont"
width="100"
translation="[460,0]" />
<Label
id="signupLabel"
font="font:SmallestSystemFont"
width="90"
translation="[550,0]" />
<Label
id="locationLabel"
font="font:SmallestSystemFont"
width="100"
translation="[650,0]" />
<Poster
id="flagEmoji"
width="16"
height="16"
translation="[650,0]" />
<Label
id="healthLabel"
font="font:SmallestSystemFont"
width="60"
translation="[750,0]" />
<LayoutGroup layoutDirection="horiz">
<Label id="nameLabel" font="font:SmallestSystemFont" />
<Label id="versionLabel" font="font:SmallestSystemFont" />
<Label id="usersLabel" font="font:SmallestSystemFont" />
<Label id="signupLabel" font="font:SmallestSystemFont" />
<Label id="locationLabel" font="font:SmallestSystemFont">
<Poster id="flagEmoji" width="16" height="16" />
</Label>
<Label id="healthLabel" font="font:SmallestSystemFont" />
</LayoutGroup>
</children>
</component>
@@ -8,5 +8,6 @@
<field id="flag" type="string" />
<field id="health" type="string" />
<field id="uri" type="string" />
<field id="fieldWidths" type="assocarray" />
</interface>
</component>
@@ -5,6 +5,7 @@ import "pkg:/source/utils/Logging.bs"
@asynctask
function InvidiousPublicInstancesTask(input as object) as object
listNode = input.listNode
fieldWidths = input.fieldWidths
if m.top.cancel
return invalid
@@ -29,7 +30,7 @@ function InvidiousPublicInstancesTask(input as object) as object
content = CreateObject("roSGNode", "ContentNode")
for each instance in instances
item = CreateListItemContent(instance)
item = CreateListItemContent(instance, fieldWidths)
if item = invalid
continue for
end if
@@ -61,7 +62,7 @@ function FilterInstances(instances as object) as object
return filtered
end function
function CreateListItemContent(instance as object) as object
function CreateListItemContent(instance as object, fieldWidths as object) as object
if not IsArray(instance) or instance.Count() < 2
LogWarn("Invalid instance:", instance)
return invalid
@@ -72,12 +73,13 @@ function CreateListItemContent(instance as object) as object
name: instance[0]
version: DrillIntoObject(instance[1], ["stats", "software", "version"], "N/A")
users: DrillIntoObject(instance[1], ["stats", "usage", "users", "total"], "N/A")
signup: DrillIntoObject(instance[1], ["stats", "openRegistrations"], false) ? "Yes" : "No"
signup: Tr(DrillIntoObject(instance[1], ["stats", "openRegistrations"], false) ? "Yes" : "No")
' Leave 5 spaces for the flag, just to simplify the layout
location: ` ${DrillIntoObject(instance[1], ["region"], "N/A")}`
flag: GetFlagUrl(DrillIntoObject(instance[1], ["flag"], ""))
health: DrillIntoObject(instance[1], ["monitor", "30dRatio", "ratio"], "N/A")
uri: instance[1].uri
fieldWidths: fieldWidths
})
return item
@@ -57,7 +57,7 @@ function OnOptionsChange()
for i = 0 to options.Count() - 1
option = options[i].displayText
node = CreateObject("roSGNode", "ContentNode")
node.title = option
node.title = Tr(option)
m.radioButtonListContent.appendChild(node)
end for
@@ -1,3 +1,4 @@
import "pkg:/source/utils/MathUtils.bs"
import "pkg:/source/utils/Types.bs"
function Init()
@@ -21,7 +22,10 @@ function Resize()
width = rect.width + m.top.padding * 2
height = rect.height + m.top.padding * 2
m.top.minWidth = width < m.top.minimumWidth ? m.top.minimumWidth : width
m.top.contentWidth = width
m.top.contentHeight = height
m.top.minWidth = MathUtils.Max(m.top.minimumWidth, width)
m.top.height = height
m.container.translation = [m.top.padding, m.top.padding]
@@ -1,7 +1,9 @@
<component name="SettingCategory" extends="Button">
<interface>
<field id="padding" type="integer" value="15" onChange="Resize" />
<field id="minimumWidth" type="integer" value="280" onChange="Resize" />
<field id="padding" type="float" value="15" onChange="Resize" />
<field id="minimumWidth" type="float" value="280" onChange="Resize" />
<field id="contentWidth" type="float" />
<field id="contentHeight" type="float" />
<field id="displayText" type="string" alias="DisplayTextLabel.text" onChange="Resize" />
<field id="description" type="string" alias="DescriptionLabel.text" onChange="Resize" />
<field id="textColor2" type="Color" value="0xb4b4b4ff" />
@@ -9,13 +11,11 @@
</interface>
<children>
<LayoutGroup id="Container" itemSpacings="[5]">
<SimpleLabel
id="DisplayTextLabel"
fontUri="font:SystemFontFile"
fontSize="34" />
<SimpleLabel id="DescriptionLabel"
fontUri="font:SystemFontFile"
fontSize="18"
<Label id="DisplayTextLabel">
<Font role="font" uri="font:SystemFontFile" size="34" />
</Label>
<Label id="DescriptionLabel"
font="font:SmallestSystemFont"
translation="[0,42]" />
</LayoutGroup>
</children>
@@ -20,7 +20,7 @@ function OnNodeReady()
startX = 150
startY = 100
controlsX = 400
controlsX = 450
categorySpacing = 80
controlSpacing = 30
@@ -73,8 +73,8 @@ end function
function CreateCategoryNode(item as object, container as object, startX as integer, startY as integer) as object
node = container.createChild("SettingCategory")
node.translation = [startX, startY]
node.displayText = item.displayText
node.description = item.description
node.displayText = Tr(item.displayText)
node.description = Tr(item.description)
return {
node: node
rect: node.boundingRect()
@@ -152,30 +152,30 @@ end function
function CreateBooleanControl(item as object, container as object) as object
node = container.createChild("BooleanControl")
node.displayText = item.displayText
node.description = item.description
node.displayText = Tr(item.displayText)
node.description = Tr(item.description)
return node
end function
function CreateRadioControl(item as object, container as object) as object
node = container.createChild("RadioControl")
node.displayText = item.displayText
node.description = item.description
node.displayText = Tr(item.displayText)
node.description = Tr(item.description)
node.options = item.options
return node
end function
function CreateStringControl(item as object, container as object) as object
node = container.createChild("StringControl")
node.displayText = item.displayText
node.description = item.description
node.displayText = Tr(item.displayText)
node.description = Tr(item.description)
return node
end function
function CreateNumberComponent(item as object, container as object) as object
node = container.createChild("NumberControl")
node.displayText = item.displayText
node.description = item.description
node.displayText = Tr(item.displayText)
node.description = Tr(item.description)
if IsInt(item.min)
node.min = item.min
end if
@@ -188,10 +188,10 @@ end function
function CreateRokuComponent(item as object, container as object) as object
node = container.createChild(item.rokuComponent)
if node.hasField("displayText")
node.displayText = item.displayText
node.displayText = Tr(item.displayText)
end if
if node.hasField("description")
node.description = item.description
node.description = Tr(item.description)
end if
return node
end function
@@ -1,5 +1,6 @@
import "pkg:/components/Dialog/DialogPalette.bs"
import "pkg:/source/utils/FocusManagement.bs"
import "pkg:/source/utils/Locale.bs"
import "pkg:/source/utils/Types.bs"
function Init()
@@ -70,7 +71,7 @@ function ShowEditKeyboard()
keyboardDialog.title = m.top.displayText
keyboardDialog.message = [m.top.description]
keyboardDialog.text = m.top.value
keyboardDialog.buttons = ["OK", "Cancel"]
keyboardDialog.buttons = [Tr(Locale.Buttons.OK), Tr(Locale.Buttons.Cancel)]
keyboardDialog.observeField("buttonSelected", FuncName(OnKeyboardButton))
m.top.getScene().dialog = keyboardDialog
@@ -1,14 +1,11 @@
import "pkg:/components/ContextMenu/ContextMenuUtils.bs"
import "pkg:/source/utils/CryptoUtils.bs"
import "pkg:/source/utils/Locale.bs"
import "pkg:/source/utils/Logging.bs"
import "pkg:/source/utils/RegistryUtils.bs"
import "pkg:/source/utils/StringUtils.bs"
import "pkg:/source/utils/Types.bs"
const VIDEOS_GROUP = "Videos"
const CHANNELS_GROUP = "Channels"
const PLAYLISTS_GROUP = "Playlists"
function Init()
m.top.content = m.top.findNode("content")
m.bookmarksString = ""
@@ -140,7 +137,7 @@ function AddPlaylistBookmarkWithSpread(id as string, groupName as string)
feedSource = {
"id": `inv_playlist_${id}`
"title": `${groupName} videos`
"title": `${groupName} ${Tr(Locale.Feed.Videos)}`
"apiType": "Invidious"
"endpoint": "playlist"
"pathParams": {
@@ -177,7 +174,7 @@ function AddChannelBookmarkWithSpread(id as string, groupName as string)
feedSource = {
"id": `inv_channel_videos_${id}`
"title": `${groupName} videos`
"title": `${groupName} ${Tr(Locale.Feed.Videos)}`
"apiType": "Invidious"
"endpoint": "channel_videos"
"pathParams": {
@@ -241,10 +238,14 @@ function GetMenuForVideo(videoNode as object) as object
isInBookmarks = bookmark <> invalid
if isInBookmarks
bookmarkGroup = bookmark.getParent()
item = ContextMenuUtils.CreateOption(`Remove from "${bookmarkGroup.title}" bookmarks`, m.top, "RemoveBookmark", [videoId])
title = Tr(Locale.ContextMenu.RemoveFromBookmarks).Replace("%1", `"${bookmarkGroup.title}"`)
item = ContextMenuUtils.CreateOption(title, m.top, "RemoveBookmark", [videoId])
menu.push(item)
else
item = ContextMenuUtils.CreateOption(`Add to "${VIDEOS_GROUP}" bookmark`, m.top, "AddVideoBookmark", [videoId, VIDEOS_GROUP])
' "Videos" exists in feed
group = Tr(Locale.Feed.Videos)
title = Tr(Locale.ContextMenu.AddToBookmark).Replace("%1", `"${group}"`)
item = ContextMenuUtils.CreateOption(title, m.top, "AddVideoBookmark", [videoId, group])
menu.push(item)
end if
return menu
@@ -261,13 +262,18 @@ function GetMenuForPlaylist(playlistNode as object) as object
isInBookmarks = bookmark <> invalid
if isInBookmarks
bookmarkGroup = bookmark.getParent()
item = ContextMenuUtils.CreateOption(`Remove from "${bookmarkGroup.title}" bookmarks`, m.top, "RemoveBookmark", [playlistId])
title = Tr(Locale.ContextMenu.RemoveFromBookmarks).Replace("%1", `"${bookmarkGroup.title}"`)
item = ContextMenuUtils.CreateOption(title, m.top, "RemoveBookmark", [playlistId])
menu.push(item)
else
item = ContextMenuUtils.CreateOption(`Add to "${PLAYLISTS_GROUP}" bookmark`, m.top, "AddPlaylistBookmark", [playlistId, PLAYLISTS_GROUP])
' "Playlists" exists in feed
group = Tr(Locale.Feed.Playlists)
title = Tr(Locale.ContextMenu.AddToBookmark).Replace("%1", `"${group}"`)
item = ContextMenuUtils.CreateOption(title, m.top, "AddPlaylistBookmark", [playlistId, group])
menu.push(item)
item = ContextMenuUtils.CreateOption(`Add to "${playlistNode.title}" bookmark`, m.top, "AddPlaylistBookmarkWithSpread", [playlistId, playlistNode.title])
title = Tr(Locale.ContextMenu.AddToBookmark).Replace("%1", `"${playlistNode.title}"`)
item = ContextMenuUtils.CreateOption(title, m.top, "AddPlaylistBookmarkWithSpread", [playlistId, playlistNode.title])
menu.push(item)
end if
return menu
@@ -284,13 +290,17 @@ function GetMenuForChannel(channelNode as object) as object
isInBookmarks = bookmark <> invalid
if isInBookmarks
bookmarkGroup = bookmark.getParent()
item = ContextMenuUtils.CreateOption(`Remove from "${bookmarkGroup.title}" bookmarks`, m.top, "RemoveBookmark", [authorId])
title = Tr(Locale.ContextMenu.RemoveFromBookmarks).Replace("%1", `"${bookmarkGroup.title}"`)
item = ContextMenuUtils.CreateOption(title, m.top, "RemoveBookmark", [authorId])
menu.push(item)
else
item = ContextMenuUtils.CreateOption(`Add to "${CHANNELS_GROUP}" bookmark`, m.top, "AddChannelBookmark", [authorId, CHANNELS_GROUP])
group = Tr(Locale.Bookmarks.Channels)
title = Tr(Locale.ContextMenu.AddToBookmark).Replace("%1", `"${group}"`)
item = ContextMenuUtils.CreateOption(title, m.top, "AddChannelBookmark", [authorId, group])
menu.push(item)
item = ContextMenuUtils.CreateOption(`Add to "${channelNode._author}" bookmark`, m.top, "AddChannelBookmarkWithSpread", [authorId, channelNode._author])
title = Tr(Locale.ContextMenu.AddToBookmark).Replace("%1", `"${channelNode._author}"`)
item = ContextMenuUtils.CreateOption(title, m.top, "AddChannelBookmarkWithSpread", [authorId, channelNode._author])
menu.push(item)
end if
return menu
@@ -316,17 +326,19 @@ function GetMenuForParentFeedSource(itemNode as object) as object
return []
end if
title = feedSource.title
feedSourceTitle = feedSource.title
feedSourceId = feedSource.id
menu = []
isInBookmarks = m.top.content.findNode(feedSourceId) <> invalid
if isInBookmarks
item = ContextMenuUtils.CreateOption(`Remove "${feedSource.title}" from bookmarks`, m.top, "RemoveBookmark", [feedSourceId])
title = Tr(Locale.ContextMenu.RemoveFromBookmarks).Replace("%1", `"${feedSourceTitle}"`)
item = ContextMenuUtils.CreateOption(title, m.top, "RemoveBookmark", [feedSourceId])
menu.push(item)
else
item = ContextMenuUtils.CreateOption(`Add to "${title}" bookmark`, m.top, "AddFeedSourceBookmark", [feedSource, feedSourceId, title])
title = Tr(Locale.ContextMenu.AddToBookmark).Replace("%1", `"${feedSourceTitle}"`)
item = ContextMenuUtils.CreateOption(title, m.top, "AddFeedSourceBookmark", [feedSource, feedSourceId, feedSourceTitle])
menu.push(item)
end if
return menu
@@ -1,4 +1,4 @@
<component name="Bookmarks" extends="Node" includes="ContextMenuProvider">
<component name="BookmarksService" extends="Node" includes="ContextMenuProvider">
<interface>
<field id="__version" type="integer" value="1" />
<field id="content" type="node" />
@@ -3,7 +3,7 @@
<field id="applicationInfo" type="node" />
<field id="preferences" type="node" />
<field id="webServer" type="node" />
<field id="profiles" type="node" />
<field id="profilesService" type="node" />
<field id="authToken" type="assocarray" onChange="OnAuthTokenChange" />
<field id="apiDefinitions" type="assocarray" />
@@ -510,7 +510,7 @@ namespace Invidious
end if
LogInfo("Deleting Invidious token...")
m.invidiousNode.profiles@.LogoutWithAccessToken(authToken.token)
m.invidiousNode.profilesService@.LogoutWithAccessToken(authToken.token)
end function
function VerifyTokenScope(token as string) as boolean
@@ -1,4 +1,6 @@
import "pkg:/components/VideoFeed/FeedLoadState.bs"
import "pkg:/source/utils/Locale.bs"
import "pkg:/source/utils/LocaleUtils.bs"
import "pkg:/source/utils/StringUtils.bs"
import "pkg:/source/utils/TimeUtils.bs"
@@ -41,7 +43,7 @@ namespace InvidiousContent
node.lengthText = TimeUtils.GetFormattedTime(item.lengthSeconds)
node.liveNow = VideoIsLive(item)
VideoSetPremiereTimestampText(node, item)
SetIfExists(node, "publishedText", item, "publishedText")
node.publishedText = VideoGetPublishedText(item)
VideoSetThumbnail(node, item, instance)
SetIfExists(node, "title", item, "title")
SetIfExists(node, "timestamp", item, "timestamp")
@@ -172,10 +174,58 @@ namespace InvidiousContent
return videoItem.isUpcoming = true and ValidInt(videoItem.premiereTimestamp) <> 0
end function
function VideoSetPremiereTimestampText(node as object, videoItem as object)
function VideoSetPremiereTimestampText(node as object, videoItem as object) as void
if VideoIsUpcoming(videoItem)
node.isUpcoming = true
node.premiereTimestampText = `Premeres in ${TimeUtils.GetFormattedTimeLeft(videoItem.premiereTimestamp)}`
timestamp = videoItem.premiereTimestamp
if timestamp = invalid
node.premiereTimestampText = "N/A"
return
end if
currentTime = TimeUtils.Now().AsSeconds()
timeLeft = timestamp - currentTime
if timeLeft <= 0
node.premiereTimestampText = Tr(Locale.RowCell.PremieringNow)
return
end if
if timeLeft < 60
if timeLeft = 1
node.premiereTimestampText = Tr(Locale.RowCell.PremieresInOneSecond)
else
node.premiereTimestampText = Tr(Locale.RowCell.PremieresInNSeconds).Replace("^n", timeLeft.toStr())
end if
return
end if
if timeLeft < 3600
minutes = timeLeft \ 60
if minutes = 1
node.premiereTimestampText = Tr(Locale.RowCell.PremieresInOneMinute)
else
node.premiereTimestampText = Tr(Locale.RowCell.PremieresInNMinutes).Replace("^n", minutes.toStr())
end if
return
end if
if timeLeft < 86400
hours = timeLeft \ 3600
if hours = 1
node.premiereTimestampText = Tr(Locale.RowCell.PremieresInOneHour)
else
node.premiereTimestampText = Tr(Locale.RowCell.PremieresInNHours).Replace("^n", hours.toStr())
end if
return
end if
days = timeLeft \ 86400
if days = 1
node.premiereTimestampText = Tr(Locale.RowCell.PremieresInOneDay)
else
node.premiereTimestampText = Tr(Locale.RowCell.PremieresInNDays).Replace("^n", days.toStr())
end if
end if
end function
@@ -184,30 +234,8 @@ namespace InvidiousContent
if viewCount = invalid
return ""
end if
if viewCount < 1000
return `${FormatFloat(viewCount)} views`
end if
viewCount = viewCount / 1000
if viewCount < 1000
return `${FormatFloat(viewCount)}K views`
end if
viewCount = viewCount / 1000
if viewCount < 1000
return `${FormatFloat(viewCount)}M views`
end if
viewCount = viewCount / 1000
return `${FormatFloat(viewCount)}B views`
end function
function FormatFloat(X as float) as float
X = X * 10
X = X + 0.5
X = Fix(X)
X = X / 10
return X
return LocaleUtils.GetFormattedPluralString(viewCount, Locale.RowCell.ZeroViews, Locale.RowCell.OneView, Locale.RowCell.NViews)
end function
function PlaylistSetThumbnail(node as object, nodeField as string, playlistItem as object, instance as dynamic, quality = "medium" as string) as void
@@ -251,40 +279,76 @@ namespace InvidiousContent
function GetVideoCountText(item as object) as string
videoCount = ValidInt(item.videoCount)
if videoCount = 1
return "1 video"
end if
return `${videoCount} videos`
return LocaleUtils.GetPluralString(videoCount, Locale.RowCell.ZeroVideos, Locale.RowCell.OneVideo, Locale.RowCell.NVideos)
end function
function GetChannelSubCountText(channel as object) as string
subCount = ValidInt(channel.subCount)
if subCount = 1
return "1 subscriber"
end if
if subCount < 1000
return `${subCount} subscribers`
end if
subCount = subCount / 1000
if subCount < 1000
return `${FormatFloat(subCount)}K subscribers`
end if
subCount = subCount / 1000
if subCount < 1000
return `${FormatFloat(subCount)}M subscribers`
end if
subCount = subCount / 1000
return `${FormatFloat(subCount)}B subscribers`
return LocaleUtils.GetFormattedPluralString(subCount, Locale.RowCell.ZeroSubscribers, Locale.RowCell.OneSubscriber, Locale.RowCell.NSubscribers)
end function
function PlaylistGetViewCountText(playlistItem as object) as string
return VideoGetViewCountText(playlistItem)
end function
function VideoGetPublishedText(videoItem as object) as string
published = ValidInt(videoItem.published)
if published = 0
return ValidString(videoItem.publishedText)
end if
span = TimeUtils.Now().AsSeconds() - published
if span < 1
return ValidString(videoItem.publishedText)
end if
total_days = span \ 86400
if total_days > 365
years = total_days \ 365
if years = 1
return Tr(Locale.RowCell.OneYearAgo)
else
return Tr(Locale.RowCell.NYearsAgo).Replace("^n", years.toStr())
end if
else if total_days > 30
months = total_days \ 30
if months = 1
return Tr(Locale.RowCell.OneMonthAgo)
else
return Tr(Locale.RowCell.NMonthsAgo).Replace("^n", months.toStr())
end if
else if total_days > 7
weeks = total_days \ 7
if weeks = 1
return Tr(Locale.RowCell.OneWeekAgo)
else
return Tr(Locale.RowCell.NWeeksAgo).Replace("^n", weeks.toStr())
end if
else if total_days > 0
if total_days = 1
return Tr(Locale.RowCell.OneDayAgo)
else
return Tr(Locale.RowCell.NDaysAgo).Replace("^n", total_days.toStr())
end if
else if span > 3600
hours = span \ 3600
if hours = 1
return Tr(Locale.RowCell.OneHourAgo)
else
return Tr(Locale.RowCell.NHoursAgo).Replace("^n", hours.toStr())
end if
else if span > 60
minutes = span \ 60
if minutes = 1
return Tr(Locale.RowCell.OneMinuteAgo)
else
return Tr(Locale.RowCell.NMinutesAgo).Replace("^n", minutes.toStr())
end if
else
return Tr(Locale.RowCell.OneMinuteAgo)
end if
end function
function PlaylistGetUpdatedText(playlistItem as object) as string
updated = playlistItem.updated
if not IsInt(updated)
@@ -295,32 +359,46 @@ namespace InvidiousContent
return ""
end if
count = ""
total_days = span \ 86400
if total_days > 365
years = total_days \ 365
count = years > 1 ? `${years} years` : "1 year"
if years = 1
return Tr(Locale.RowCell.UpdatedOneYearAgo)
else
return Tr(Locale.RowCell.UpdatedNYearsAgo).Replace("^n", years.toStr())
end if
else if total_days > 30
months = total_days \ 30
count = months > 1 ? `${months} months` : "1 month"
if months = 1
return Tr(Locale.RowCell.UpdatedOneMonthAgo)
else
return Tr(Locale.RowCell.UpdatedNMonthsAgo).Replace("^n", months.toStr())
end if
else if total_days > 7
weeks = total_days \ 7
count = weeks > 1 ? `${weeks} weeks` : "1 week"
if weeks = 1
return Tr(Locale.RowCell.UpdatedOneWeekAgo)
else
return Tr(Locale.RowCell.UpdatedNWeeksAgo).Replace("^n", weeks.toStr())
end if
else if total_days > 1
count = `${total_days} days`
return Tr(Locale.RowCell.UpdatedNDaysAgo).Replace("^n", total_days.toStr())
else if span > 3600
hours = span \ 3600
count = hours > 1 ? `${hours} hours` : "1 hour"
if hours = 1
return Tr(Locale.RowCell.UpdatedOneHourAgo)
else
return Tr(Locale.RowCell.UpdatedNHoursAgo).Replace("^n", hours.toStr())
end if
else if span > 60
minutes = span \ 60
count = minutes > 1 ? `${minutes} minutes` : "1 minute"
if minutes = 1
return Tr(Locale.RowCell.UpdatedOneMinuteAgo)
else
return Tr(Locale.RowCell.UpdatedNMinutesAgo).Replace("^n", minutes.toStr())
end if
else
count = span > 1 ? `${span} seconds` : "1 second"
return Tr(Locale.RowCell.UpdatedOneMinuteAgo)
end if
if StringUtils.IsNullOrEmpty(count)
return ""
end if
return `Updated ${count} ago`
end function
end namespace
Loaded 100 of 221 files, more files were not shown because too many files have changed in this diff. Show more