Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ba59aad767 | ||
|
|
36ae525154 | ||
|
|
5ef130bc51 | ||
|
|
39591abc34 | ||
|
|
84bd50d970 | ||
|
|
fd0259615b | ||
|
|
e53ad785c6 | ||
|
|
cbda8dbf9b | ||
|
|
242298911c | ||
|
|
8f1d3778d8 | ||
|
|
192401c847 | ||
|
|
132e3ec3e3 | ||
|
|
3570f011c4 | ||
|
|
482daf5e12 | ||
|
|
64f5985aae | ||
|
|
a1aed7d253 | ||
|
|
f581d568d9 | ||
|
|
54b0acbe8f | ||
|
|
6e4262e6a5 | ||
|
|
4c90cf1e98 | ||
|
|
72f547cc22 | ||
|
|
1cee5d61ab | ||
|
|
d87337d389 | ||
|
|
2ba2115da7 | ||
|
|
49be599c32 | ||
|
|
8d5646aeb3 | ||
|
|
07b0e422ff | ||
|
|
35325bfae2 | ||
|
|
c122d286dc | ||
|
|
66208d941d | ||
|
|
9cf6626efb | ||
|
|
69c87228af | ||
|
|
2502eae462 | ||
|
|
b0e0c2d09d | ||
|
|
5982b5a75f | ||
|
|
51966cb33f | ||
|
|
bfe8a3c860 | ||
|
|
ef17ff44af | ||
|
|
826228e939 | ||
|
|
b77519493d | ||
|
|
6a46d4cd09 | ||
|
|
382cbe33d3 | ||
|
|
e9b57c9c08 | ||
|
|
457242057d | ||
|
|
665f76701d | ||
|
|
258726fadb | ||
|
|
215a23c91d | ||
|
|
19ecc25852 | ||
|
|
0ae524f88c | ||
|
|
8bf16bfbd5 | ||
|
|
0acb7031d3 | ||
|
|
0ddc9a48aa | ||
|
|
3ac4d959d3 | ||
|
|
19de693298 | ||
|
|
46af79c2ae | ||
|
|
fd077a0d1a | ||
|
|
981e95b0d4 | ||
|
|
8883a59fcb | ||
|
|
662cb4b634 | ||
|
|
7269fdff7d | ||
|
|
710e892545 | ||
|
|
7dd5561faa | ||
|
|
d40a12d1f1 | ||
|
|
1170f422ec | ||
|
|
2639267e1f | ||
|
|
3b35adeae9 | ||
|
|
e8b6cd1588 | ||
|
|
0377f075be | ||
|
|
89034378fb | ||
|
|
9ae8601a32 | ||
|
|
61327401b0 | ||
|
|
94a017a878 | ||
|
|
eb3d1724e4 | ||
|
|
9d95834ebb |
No files matched your search
@@ -3,6 +3,7 @@ name: Release
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: ["main"]
|
branches: ["main"]
|
||||||
|
workflow_dispatch: {}
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
@@ -63,6 +64,11 @@ jobs:
|
|||||||
latest_release=$(awk 'BEGIN { RS="## \\[" } NR==2 { print "## ["$0 }' CHANGELOG.md)
|
latest_release=$(awk 'BEGIN { RS="## \\[" } NR==2 { print "## ["$0 }' CHANGELOG.md)
|
||||||
echo -e "\n$latest_release" >> docs/canary-changelog.md
|
echo -e "\n$latest_release" >> docs/canary-changelog.md
|
||||||
|
|
||||||
|
# A bug in gh cli causes the release to be created as a draft, and not released.
|
||||||
|
# See https://github.com/cli/cli/issues/8458
|
||||||
|
- name: Wait 10 seconds
|
||||||
|
run: sleep 10
|
||||||
|
|
||||||
- name: Create Canary release
|
- name: Create Canary release
|
||||||
run: gh release create canary ./release/playlet.zip ./release/playlet-lib.zip --notes-file docs/canary-changelog.md --prerelease --title Canary
|
run: gh release create canary ./release/playlet.zip ./release/playlet-lib.zip --notes-file docs/canary-changelog.md --prerelease --title Canary
|
||||||
env:
|
env:
|
||||||
|
|||||||
@@ -25,12 +25,12 @@ jobs:
|
|||||||
run: npm run update-deps
|
run: npm run update-deps
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci
|
run: npm i
|
||||||
|
|
||||||
- name: Create Pull Request
|
- name: Create Pull Request
|
||||||
uses: peter-evans/create-pull-request@v5
|
uses: peter-evans/create-pull-request@v5
|
||||||
with:
|
with:
|
||||||
commit-message: "update dependencies"
|
commit-message: "update dependencies"
|
||||||
branch: shore/update-deps
|
branch: chore/update-deps
|
||||||
title: "[shore] update dependencies"
|
title: "[chore] update dependencies"
|
||||||
body: "Weekly pull request to update dependencies."
|
body: "Weekly pull request to update dependencies."
|
||||||
@@ -5,6 +5,47 @@ All notable changes to this project will be documented in this file.
|
|||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [0.18.0] - 2023-12-28
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Medium video quality in the settings (For most videos, this is 360p)
|
||||||
|
- Invidious watch history feed
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- (Regression) Issue where auto-play keeps playing the same videos in a loop
|
||||||
|
- Small search box styling bug for Safari
|
||||||
|
- A bug where the skipping of a sponsored section at the end of a video leads to an infinite loop
|
||||||
|
- A couple of bugs when listing Invidious public instances
|
||||||
|
|
||||||
|
### Removed
|
||||||
|
|
||||||
|
- Xmas theme logo - can't publish it before end of year... ([link](https://blog.roku.com/developer/channel-store-blackouts-2023))
|
||||||
|
|
||||||
|
## [0.17.3] - 2023-12-13
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Xmas theme logo
|
||||||
|
|
||||||
|
## [0.17.2] - 2023-12-10
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Loading message
|
||||||
|
|
||||||
|
## [0.17.1] - 2023-12-08
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- An instance test to make sure thumbnails are reachable
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- A rare error when video player is closed but does not have valid content
|
||||||
|
- A rare error that can occur with loading indicators causing a crash
|
||||||
|
|
||||||
## [0.17.0] - 2023-11-17
|
## [0.17.0] - 2023-11-17
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|||||||
@@ -3,11 +3,16 @@
|
|||||||
"createPackage": false,
|
"createPackage": false,
|
||||||
"diagnosticFilters": [
|
"diagnosticFilters": [
|
||||||
{
|
{
|
||||||
"src": "**/roku_modules/**/*.*"
|
"src": "**/*.part.xml",
|
||||||
},
|
"codes": [
|
||||||
1090
|
// 1067 - Cannot find function with name '${name}' in component scope
|
||||||
|
// This is to prevent errors where the onChange function is not found in the component scope
|
||||||
|
1067
|
||||||
|
]
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"diagnosticLevel": "error",
|
"diagnosticLevel": "error",
|
||||||
|
// The validation regex rules are validated using the validation-plugin.ts plugin
|
||||||
"validation": [
|
"validation": [
|
||||||
{
|
{
|
||||||
"code": "NO_SET_FOCUS",
|
"code": "NO_SET_FOCUS",
|
||||||
@@ -20,6 +25,21 @@
|
|||||||
"regex": "\\.observeField(scoped)?\\s*\\(\\s*\"\\w+\"\\s*,\\s*\"\\w+\"\\s*\\)",
|
"regex": "\\.observeField(scoped)?\\s*\\(\\s*\"\\w+\"\\s*,\\s*\"\\w+\"\\s*\\)",
|
||||||
"regexFlags": "ig",
|
"regexFlags": "ig",
|
||||||
"message": "observeField(\"field\", \"callback\") is not allowed. Use observeField(\"field\", FuncName(callback)) instead."
|
"message": "observeField(\"field\", \"callback\") is not allowed. Use observeField(\"field\", FuncName(callback)) instead."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": "NO_INVALID_CALLFUNC_ARG",
|
||||||
|
"regex": "@\\.\\w+\\(invalid\\)",
|
||||||
|
"regexFlags": "ig",
|
||||||
|
"message": "the arg invalid in @.func(invalid) is not needed. Just use @.func() instead."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
// Tagging unused variables (Available since Roku OS 11.0) – Variables can explicitly
|
||||||
|
// be marked as unused by prepending an underscore to the value (for example, sub myTask(_x)).
|
||||||
|
// https://developer.roku.com/en-ca/docs/references/brightscript/language/expressions-variables-types.md#types
|
||||||
|
"code": "UNUSED_ARG_STARTS_WITH_UNDERSCORE",
|
||||||
|
"regex": "\\b(?!_unused)unused\\b",
|
||||||
|
"regexFlags": "ig",
|
||||||
|
"message": "unused args should start with _ (e.g. _unused)"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"files": [
|
"files": [
|
||||||
@@ -56,10 +76,5 @@
|
|||||||
"require": [
|
"require": [
|
||||||
"ts-node/register"
|
"ts-node/register"
|
||||||
],
|
],
|
||||||
"rokuLog": {
|
|
||||||
"insertPkgPath": true,
|
|
||||||
"removeComments": false,
|
|
||||||
"strip": false
|
|
||||||
},
|
|
||||||
"sourceMap": true
|
"sourceMap": true
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"extends": "bsconfig.base.json",
|
"extends": "bsconfig.base.jsonc",
|
||||||
"files": [
|
"files": [
|
||||||
"source/**",
|
"source/**",
|
||||||
"components/**",
|
"components/**",
|
||||||
+21
-12
@@ -5,23 +5,32 @@
|
|||||||
"**/bslib.brs"
|
"**/bslib.brs"
|
||||||
],
|
],
|
||||||
"rules": {
|
"rules": {
|
||||||
"aa-comma-style": "no-dangling",
|
// Code style
|
||||||
"anon-function-style": "no-sub",
|
|
||||||
"assign-all-paths": "warn",
|
|
||||||
"block-if-style": "no-then",
|
|
||||||
"case-sensitivity": "warn",
|
|
||||||
"condition-style": "no-group",
|
|
||||||
"consistent-return": "error",
|
|
||||||
"eol-last": "always",
|
|
||||||
"inline-if-style": "never",
|
"inline-if-style": "never",
|
||||||
|
"block-if-style": "no-then",
|
||||||
|
"condition-style": "no-group",
|
||||||
"named-function-style": "no-sub",
|
"named-function-style": "no-sub",
|
||||||
|
"anon-function-style": "no-sub",
|
||||||
|
"aa-comma-style": "never",
|
||||||
"no-print": "warn",
|
"no-print": "warn",
|
||||||
"no-stop": "error",
|
|
||||||
"no-todo": "off",
|
"no-todo": "off",
|
||||||
|
"no-stop": "error",
|
||||||
|
"eol-last": "always",
|
||||||
|
// Strictness
|
||||||
"type-annotations": "all",
|
"type-annotations": "all",
|
||||||
"unreachable-code": "warn",
|
// Color
|
||||||
|
"color-format": "hash-hex",
|
||||||
|
"color-case": "upper",
|
||||||
|
"color-alpha": "always",
|
||||||
|
"color-alpha-defaults": "allowed",
|
||||||
|
"color-cert": "always",
|
||||||
|
// Code flow
|
||||||
|
"assign-all-paths": "error",
|
||||||
|
"unsafe-path-loop": "error",
|
||||||
"unsafe-iterators": "error",
|
"unsafe-iterators": "error",
|
||||||
"unsafe-path-loop": "warn",
|
"unreachable-code": "warn",
|
||||||
"unused-variable": "warn"
|
"case-sensitivity": "error",
|
||||||
|
"unused-variable": "error",
|
||||||
|
"consistent-return": "error"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+1
-1
@@ -256,7 +256,7 @@ The web app uses [Svelte](https://svelte.dev/), [Vite](https://vitejs.dev/) and
|
|||||||
|
|
||||||
Since modifying the web app code requires building all three projects (Playlet, Playlet lib, and Playlet web app) this makes the iteration speed very slow, and we lose the benefits of web development, such as hot reloads.
|
Since modifying the web app code requires building all three projects (Playlet, Playlet lib, and Playlet web app) this makes the iteration speed very slow, and we lose the benefits of web development, such as hot reloads.
|
||||||
|
|
||||||
For that reason, the recommended iteration when working on the dev app is:
|
For that reason, the recommended iteration when working on the web app is:
|
||||||
|
|
||||||
1. Start `Playlet (dev)` (by selecting `Playlet (dev)` and pressing Play in VS Code)
|
1. Start `Playlet (dev)` (by selecting `Playlet (dev)` and pressing Play in VS Code)
|
||||||
1. Once Playlet starts, switch to `Playlet Web (dev)` and press play. Do not stop `Playlet (dev)`
|
1. Once Playlet starts, switch to `Playlet Web (dev)` and press play. Do not stop `Playlet (dev)`
|
||||||
|
|||||||
+1
-1
@@ -42,7 +42,7 @@ These are mostly the steps when releasing a new version:
|
|||||||
|
|
||||||
For releasing to the store (when needed), this is done following a Playlet lib release:
|
For releasing to the store (when needed), this is done following a Playlet lib release:
|
||||||
|
|
||||||
- Switch to main branch and pull changes - **match commit corresponding to the release.**
|
- Switch to main branch and pull changes, **including tags** - **match commit corresponding to the release.**
|
||||||
- `npm run build:release:ci`
|
- `npm run build:release:ci`
|
||||||
- This makes sure to have a valid app in the staging folder
|
- This makes sure to have a valid app in the staging folder
|
||||||
- `npm run sign-released-package`
|
- `npm run sign-released-package`
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ openapi: 3.0.0
|
|||||||
|
|
||||||
info:
|
info:
|
||||||
title: Playlet Web API
|
title: Playlet Web API
|
||||||
version: 0.17.0
|
version: 0.18.0
|
||||||
description:
|
description:
|
||||||
Playlet Web API is a RESTful API for controlling the Playlet app on
|
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
|
Roku devices. The API is intended to be used by the Playlet web app, but can
|
||||||
|
|||||||
+39
-1
@@ -9,6 +9,7 @@
|
|||||||
- [Bindings](#bindings)
|
- [Bindings](#bindings)
|
||||||
- [Async Task Generator](#async-task-generator)
|
- [Async Task Generator](#async-task-generator)
|
||||||
- [Tracking transpilied files](#tracking-transpilied-files)
|
- [Tracking transpilied files](#tracking-transpilied-files)
|
||||||
|
- [Logger](#logger)
|
||||||
|
|
||||||
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:
|
Playlet implements a few [Brighterscript Plugins](https://github.com/rokucommunity/brighterscript/blob/master/docs/plugins.md). The plugins inject themselves in the compilation process, allowing the modification of bs scripts, xml components, and even assets or the app manifest. Let's start with a simple one:
|
||||||
|
|
||||||
@@ -427,7 +428,7 @@ myNode = CreateObject("roSGNode", "MyComponent")
|
|||||||
' Add it to the right parent
|
' Add it to the right parent
|
||||||
myParentNode.appendChild(myNode)
|
myParentNode.appendChild(myNode)
|
||||||
' Trigger the binding manually
|
' Trigger the binding manually
|
||||||
myNode@.BindNode(invalid)
|
myNode@.BindNode()
|
||||||
```
|
```
|
||||||
|
|
||||||
calling `BindNode` will trigger all the binding steps just for this node. But it is expected that all its dependencies are already in the scene and can be found.
|
calling `BindNode` will trigger all the binding steps just for this node. But it is expected that all its dependencies are already in the scene and can be found.
|
||||||
@@ -499,3 +500,40 @@ Additionally, if there's a folder `MyFolder` and `MyFolder.transpiled` in the so
|
|||||||
To reduce the noise of this plugin, it only runs when we're making a test build.
|
To reduce the noise of this plugin, it only runs when we're making a test build.
|
||||||
|
|
||||||
Because we continiously make test build in Github actions, the tracked transpilied files will be automatically added to PRs, so that we notice if outputs do not look right.
|
Because we continiously make test build in Github actions, the tracked transpilied files will be automatically added to PRs, so that we notice if outputs do not look right.
|
||||||
|
|
||||||
|
## Logger
|
||||||
|
|
||||||
|
**[Source](/tools/bs-plugins/logger-plugin.ts)**
|
||||||
|
|
||||||
|
### Why
|
||||||
|
|
||||||
|
The logger plugin does some code transformation to log calls, which can add caller path at compile time, or the filename, based on debug/release configuration.
|
||||||
|
|
||||||
|
### How
|
||||||
|
|
||||||
|
The logger plugin searches for calls to the predefined functions `LogError`, `LogWarn`, `LogInfo` and `LogDebug`. Once found, it does the following (we take `LogError` as an example):
|
||||||
|
|
||||||
|
- It replaces calls of `LogError` with `LogErrorX` where X is the number of arguments.
|
||||||
|
- For example, it replaces `LogError("Cannot complete operation:", error)` with `LogError2("Cannot complete operation:", error)`
|
||||||
|
- Based on usage, it generates `LogErrorX` functions used. Example:
|
||||||
|
|
||||||
|
```
|
||||||
|
function LogError2(arg0, arg1) as void
|
||||||
|
logger = m.global.logger
|
||||||
|
if logger.logLevel < 0
|
||||||
|
return
|
||||||
|
end if
|
||||||
|
m.global.logger.logLine = "[ERROR]" + ToString(arg0) + " " + ToString(arg1)
|
||||||
|
end function
|
||||||
|
```
|
||||||
|
|
||||||
|
- Finally, it adds the caller file and line number to the args.
|
||||||
|
- `LogError("Cannot complete operation:", error)` is replaced with `LogError(CALLER, "Cannot complete operation:", error)`
|
||||||
|
- `CALLER` would be the full path to the source .bs file and line number, for easier debugging
|
||||||
|
- In release mode, `CALLER` would be only the file name and line number, without the full path. This is so that dev directory does not get "leaked" in releases.
|
||||||
|
|
||||||
|
This is implemented to make it easy to identify where logs came from, and to generate log functions with the right number of parameters based on usage. This way we do not need all combination of functions (`LogError`, `LogWarn`, `LogInfo` and `LogDebug` multiplied by number of parameters, `LogError1`, `LogError2`, `LogError3`, and so on). Since brightscript does not support function templates or function overloading, it is either this method, or use optional parameters (but then we would have to check which parameter was passed, and which was is using the default value.) and end up with a log function with logs of if's else'es.
|
||||||
|
|
||||||
|
To understand more about what's being generated, download `playlet-lib.zip` from [releases](https://github.com/iBicha/playlet/releases), extract, and inspect the file `source/utils/Logging.brs`. You will see it contains log functions in the form `LogVerbX`, that are generated based on usage.
|
||||||
|
|
||||||
|
To give credit where credit is due, some of the ideas here (like adding the source location to the log) came from [roku-log](https://github.com/georgejecook/roku-log)
|
||||||
Generated
+39
-39
@@ -1,39 +1,39 @@
|
|||||||
{
|
{
|
||||||
"name": "playlet",
|
"name": "playlet",
|
||||||
"version": "0.17.0",
|
"version": "0.18.0",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "playlet",
|
"name": "playlet",
|
||||||
"version": "0.17.0",
|
"version": "0.18.0",
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@rokucommunity/bslint": "^0.8.12",
|
"@rokucommunity/bslint": "^0.8.13",
|
||||||
"@types/crypto-js": "^4.2.1",
|
"@types/crypto-js": "^4.2.1",
|
||||||
"@types/fs-extra": "^11.0.4",
|
"@types/fs-extra": "^11.0.4",
|
||||||
"@types/node": "^20.9.0",
|
"@types/node": "^20.10.5",
|
||||||
"@types/xml2js": "^0.4.14",
|
"@types/xml2js": "^0.4.14",
|
||||||
"argparse": "^2.0.1",
|
"argparse": "^2.0.1",
|
||||||
"brighterscript": "^0.65.9",
|
"brighterscript": "0.65.14",
|
||||||
"brighterscript-formatter": "^1.6.35",
|
"brighterscript-formatter": "^1.6.36",
|
||||||
"convert-svg-to-png": "^0.6.4",
|
"convert-svg-to-png": "^0.6.4",
|
||||||
"cross-fetch": "^4.0.0",
|
"cross-fetch": "^4.0.0",
|
||||||
"crypto-js": "^4.2.0",
|
"crypto-js": "^4.2.0",
|
||||||
"dotenv": "^16.3.1",
|
"dotenv": "^16.3.1",
|
||||||
"express": "^4.18.2",
|
"express": "^4.18.2",
|
||||||
"fs-extra": "^11.1.1",
|
"fs-extra": "^11.2.0",
|
||||||
"glob": "^10.3.10",
|
"glob": "^10.3.10",
|
||||||
"imap": "^0.8.19",
|
"imap": "^0.8.19",
|
||||||
"ip": "^1.1.8",
|
"ip": "^1.1.8",
|
||||||
"json5": "^2.2.3",
|
"json5": "^2.2.3",
|
||||||
"mailparser": "^3.6.5",
|
"mailparser": "^3.6.5",
|
||||||
"roku-deploy": "^3.10.4",
|
"roku-deploy": "^3.11.2",
|
||||||
"rooibos-roku": "^5.8.0",
|
"rooibos-roku": "^5.8.0",
|
||||||
"semver": "^7.5.4",
|
"semver": "^7.5.4",
|
||||||
"shelljs": "^0.8.5",
|
"shelljs": "^0.8.5",
|
||||||
"ts-node": "^10.9.1",
|
"ts-node": "^10.9.2",
|
||||||
"typescript": "^5.2.2",
|
"typescript": "^5.3.3",
|
||||||
"xml2js": "^0.6.2",
|
"xml2js": "^0.6.2",
|
||||||
"yaml": "^2.3.4"
|
"yaml": "^2.3.4"
|
||||||
},
|
},
|
||||||
@@ -276,9 +276,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/@rokucommunity/bslint": {
|
"node_modules/@rokucommunity/bslint": {
|
||||||
"version": "0.8.12",
|
"version": "0.8.13",
|
||||||
"resolved": "https://registry.npmjs.org/@rokucommunity/bslint/-/bslint-0.8.12.tgz",
|
"resolved": "https://registry.npmjs.org/@rokucommunity/bslint/-/bslint-0.8.13.tgz",
|
||||||
"integrity": "sha512-0kU6sHpjEq51f54ajzscxzLT5Tq7SjF8FPszr7pRMSmUHHIDmTu5e1vDu8gS5UzWM+RGhXHqa3EXXt789B6sdQ==",
|
"integrity": "sha512-EC5tQdtRFTJxOo+9lnZz6yLcsyctuchCzUNJX391ZgCN0EKJTjGigyqTsdsFprINmr0pBojUiys/ZpS/Bv3ROQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"fs-extra": "^10.0.0",
|
"fs-extra": "^10.0.0",
|
||||||
@@ -370,9 +370,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@types/node": {
|
"node_modules/@types/node": {
|
||||||
"version": "20.9.0",
|
"version": "20.10.5",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.9.0.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.5.tgz",
|
||||||
"integrity": "sha512-nekiGu2NDb1BcVofVcEKMIwzlx4NjHlcjhoxxKBNLtz15Y1z7MYf549DFvkHSId02Ax6kGwWntIBPC3l/JZcmw==",
|
"integrity": "sha512-nNPsNE65wjMxEKI93yOP+NPGGBJz/PoN3kZsVLee0XMiJolxSekEVD8wRwBUBqkwc7UWop0edW50yrCQW4CyRw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"undici-types": "~5.26.4"
|
"undici-types": "~5.26.4"
|
||||||
@@ -728,9 +728,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/brighterscript": {
|
"node_modules/brighterscript": {
|
||||||
"version": "0.65.9",
|
"version": "0.65.14",
|
||||||
"resolved": "https://registry.npmjs.org/brighterscript/-/brighterscript-0.65.9.tgz",
|
"resolved": "https://registry.npmjs.org/brighterscript/-/brighterscript-0.65.14.tgz",
|
||||||
"integrity": "sha512-cjJmftkY+2A5HrGIbmRz2fylywEwj3+Y/EXeSx4TJsEvOW0/M61G5gHRdGyqPF/TMEGlPHGlTBAmPdOMi85+xw==",
|
"integrity": "sha512-DVbFFp/ESu3Ow1LNsELTrmf4S/8bmXUTP9Z3R3VW21WRed392pur9ZU+tiz8w0Z0BaKjPOi+JD13P+PWkEq8zw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@rokucommunity/bslib": "^0.1.1",
|
"@rokucommunity/bslib": "^0.1.1",
|
||||||
@@ -756,7 +756,7 @@
|
|||||||
"parse-ms": "^2.1.0",
|
"parse-ms": "^2.1.0",
|
||||||
"readline": "^1.3.0",
|
"readline": "^1.3.0",
|
||||||
"require-relative": "^0.8.7",
|
"require-relative": "^0.8.7",
|
||||||
"roku-deploy": "^3.10.4",
|
"roku-deploy": "^3.11.2",
|
||||||
"serialize-error": "^7.0.1",
|
"serialize-error": "^7.0.1",
|
||||||
"source-map": "^0.7.4",
|
"source-map": "^0.7.4",
|
||||||
"vscode-languageserver": "7.0.0",
|
"vscode-languageserver": "7.0.0",
|
||||||
@@ -771,12 +771,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/brighterscript-formatter": {
|
"node_modules/brighterscript-formatter": {
|
||||||
"version": "1.6.35",
|
"version": "1.6.36",
|
||||||
"resolved": "https://registry.npmjs.org/brighterscript-formatter/-/brighterscript-formatter-1.6.35.tgz",
|
"resolved": "https://registry.npmjs.org/brighterscript-formatter/-/brighterscript-formatter-1.6.36.tgz",
|
||||||
"integrity": "sha512-OtExVLvgfZ7QlBDFpNqDUZQiSbO8sNO1l0wEfkspYJzPbhbhKYL2NEEL9OSTzUJYCrO/I8ZL7bo57ZGNQlcNBQ==",
|
"integrity": "sha512-f9Y3Re6egB1MCUftph8AT8RxWTtXmeMjwigRv1biNGmEuGeSOipoBnCbwY4U1CFz46L7W39/TL4n1JMV9URD6w==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"brighterscript": "^0.65.9",
|
"brighterscript": "^0.65.12",
|
||||||
"glob-all": "^3.3.0",
|
"glob-all": "^3.3.0",
|
||||||
"jsonc-parser": "^3.0.0",
|
"jsonc-parser": "^3.0.0",
|
||||||
"source-map": "^0.7.3",
|
"source-map": "^0.7.3",
|
||||||
@@ -1997,9 +1997,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/fastq": {
|
"node_modules/fastq": {
|
||||||
"version": "1.15.0",
|
"version": "1.16.0",
|
||||||
"resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz",
|
"resolved": "https://registry.npmjs.org/fastq/-/fastq-1.16.0.tgz",
|
||||||
"integrity": "sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==",
|
"integrity": "sha512-ifCoaXsDrsdkWTtiNJX5uzHDsrck5TzfKKDcuFFTIrrc/BS076qgEIfoIy1VeZqViznfKiysPYTh/QeHtnIsYA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"reusify": "^1.0.4"
|
"reusify": "^1.0.4"
|
||||||
@@ -2142,9 +2142,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/fs-extra": {
|
"node_modules/fs-extra": {
|
||||||
"version": "11.1.1",
|
"version": "11.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.2.0.tgz",
|
||||||
"integrity": "sha512-MGIE4HOvQCeUCzmlHs0vXpih4ysz4wg9qiSAu6cd42lVwPbTM1TjV7RusoyQqMmk/95gdQZX72u+YW+c3eEpFQ==",
|
"integrity": "sha512-PmDi3uwK5nFuXh7XDTlVnS17xJS7vW36is2+w3xcv8SVxiB4NyATf4ctkVY5bkSjX0Y4nbvZCq1/EjtEyr9ktw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"graceful-fs": "^4.2.0",
|
"graceful-fs": "^4.2.0",
|
||||||
@@ -3923,9 +3923,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/roku-deploy": {
|
"node_modules/roku-deploy": {
|
||||||
"version": "3.10.4",
|
"version": "3.11.2",
|
||||||
"resolved": "https://registry.npmjs.org/roku-deploy/-/roku-deploy-3.10.4.tgz",
|
"resolved": "https://registry.npmjs.org/roku-deploy/-/roku-deploy-3.11.2.tgz",
|
||||||
"integrity": "sha512-Drl0c78HjZejaC0zovm4f/pJRCw0DbbBzR5Pe+ADKlMfOSJuF4UvNaejJzgbTcGXKkeztgOBvu5xxpOL7gqhWQ==",
|
"integrity": "sha512-3JDlnbTxv6Xk5GVolQoA3+d34MLZXXwZWMySprHwazZoWLP3LvulYHP92YvFOJAo/aI4IZp/TFA8kR82IrmHKA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"chalk": "^2.4.2",
|
"chalk": "^2.4.2",
|
||||||
@@ -4525,9 +4525,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/ts-node": {
|
"node_modules/ts-node": {
|
||||||
"version": "10.9.1",
|
"version": "10.9.2",
|
||||||
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz",
|
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz",
|
||||||
"integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==",
|
"integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@cspotcode/source-map-support": "^0.8.0",
|
"@cspotcode/source-map-support": "^0.8.0",
|
||||||
@@ -4599,9 +4599,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/typescript": {
|
"node_modules/typescript": {
|
||||||
"version": "5.2.2",
|
"version": "5.3.3",
|
||||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz",
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz",
|
||||||
"integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==",
|
"integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"bin": {
|
"bin": {
|
||||||
"tsc": "bin/tsc",
|
"tsc": "bin/tsc",
|
||||||
|
|||||||
+9
-9
@@ -1,33 +1,33 @@
|
|||||||
{
|
{
|
||||||
"name": "playlet",
|
"name": "playlet",
|
||||||
"version": "0.17.0",
|
"version": "0.18.0",
|
||||||
"description": "Unofficial Youtube client for Roku",
|
"description": "Unofficial Youtube client for Roku",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@rokucommunity/bslint": "^0.8.12",
|
"@rokucommunity/bslint": "^0.8.13",
|
||||||
"@types/crypto-js": "^4.2.1",
|
"@types/crypto-js": "^4.2.1",
|
||||||
"@types/fs-extra": "^11.0.4",
|
"@types/fs-extra": "^11.0.4",
|
||||||
"@types/node": "^20.9.0",
|
"@types/node": "^20.10.5",
|
||||||
"@types/xml2js": "^0.4.14",
|
"@types/xml2js": "^0.4.14",
|
||||||
"argparse": "^2.0.1",
|
"argparse": "^2.0.1",
|
||||||
"brighterscript": "^0.65.9",
|
"brighterscript": "0.65.14",
|
||||||
"brighterscript-formatter": "^1.6.35",
|
"brighterscript-formatter": "^1.6.36",
|
||||||
"convert-svg-to-png": "^0.6.4",
|
"convert-svg-to-png": "^0.6.4",
|
||||||
"cross-fetch": "^4.0.0",
|
"cross-fetch": "^4.0.0",
|
||||||
"crypto-js": "^4.2.0",
|
"crypto-js": "^4.2.0",
|
||||||
"dotenv": "^16.3.1",
|
"dotenv": "^16.3.1",
|
||||||
"express": "^4.18.2",
|
"express": "^4.18.2",
|
||||||
"fs-extra": "^11.1.1",
|
"fs-extra": "^11.2.0",
|
||||||
"glob": "^10.3.10",
|
"glob": "^10.3.10",
|
||||||
"imap": "^0.8.19",
|
"imap": "^0.8.19",
|
||||||
"ip": "^1.1.8",
|
"ip": "^1.1.8",
|
||||||
"json5": "^2.2.3",
|
"json5": "^2.2.3",
|
||||||
"mailparser": "^3.6.5",
|
"mailparser": "^3.6.5",
|
||||||
"roku-deploy": "^3.10.4",
|
"roku-deploy": "^3.11.2",
|
||||||
"rooibos-roku": "^5.8.0",
|
"rooibos-roku": "^5.8.0",
|
||||||
"semver": "^7.5.4",
|
"semver": "^7.5.4",
|
||||||
"shelljs": "^0.8.5",
|
"shelljs": "^0.8.5",
|
||||||
"ts-node": "^10.9.1",
|
"ts-node": "^10.9.2",
|
||||||
"typescript": "^5.2.2",
|
"typescript": "^5.3.3",
|
||||||
"xml2js": "^0.6.2",
|
"xml2js": "^0.6.2",
|
||||||
"yaml": "^2.3.4"
|
"yaml": "^2.3.4"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"extends": "../config/bsconfig.base.json",
|
"extends": "../config/bsconfig.base.jsonc",
|
||||||
"rootDir": "src/",
|
"rootDir": "src/",
|
||||||
"stagingDir": "../build/playlet-app",
|
"stagingDir": "../build/playlet-app",
|
||||||
"outFile": "../dist/playlet-app.zip"
|
"outFile": "../dist/playlet-app.zip"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"extends": "../config/bsconfig.tests.base.json",
|
"extends": "../config/bsconfig.tests.base.jsonc",
|
||||||
"rootDir": "src/",
|
"rootDir": "src/",
|
||||||
"stagingDir": "../build/playlet-app-tests",
|
"stagingDir": "../build/playlet-app-tests",
|
||||||
"outFile": "../build/playlet-app-tests.zip"
|
"outFile": "../build/playlet-app-tests.zip"
|
||||||
|
|||||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "playlet-app",
|
"name": "playlet-app",
|
||||||
"version": "0.17.0",
|
"version": "0.18.0",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "playlet-app",
|
"name": "playlet-app",
|
||||||
"version": "0.17.0"
|
"version": "0.18.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "playlet-app",
|
"name": "playlet-app",
|
||||||
"version": "0.17.0",
|
"version": "0.18.0",
|
||||||
"description": "Unofficial Youtube client for Roku",
|
"description": "Unofficial Youtube client for Roku",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"prebuild": "rm -rf build/playlet-app",
|
"prebuild": "rm -rf build/playlet-app",
|
||||||
|
|||||||
@@ -1,13 +1,18 @@
|
|||||||
|
import "LoadingMessages.bs"
|
||||||
|
|
||||||
function Init() as void
|
function Init() as void
|
||||||
m.top.backgroundColor = "0x242424FF"
|
m.scene = m.top.getScene()
|
||||||
|
m.top.backgroundColor = "#242424FF"
|
||||||
m.top.backgroundURI = ""
|
m.top.backgroundURI = ""
|
||||||
|
|
||||||
m.loadingIndicator = m.top.findNode("LoadingIndicator")
|
m.loadingIndicator = m.top.findNode("LoadingIndicator")
|
||||||
m.loadingIndicator.visible = true
|
|
||||||
m.global.addFields({
|
m.global.addFields({
|
||||||
loadingIndicator: m.loadingIndicator
|
loadingIndicator: m.loadingIndicator
|
||||||
})
|
})
|
||||||
|
|
||||||
|
m.loadingIndicator.visible = true
|
||||||
|
m.loadingIndicator.message = GetLoadingMessage()
|
||||||
|
|
||||||
m.playletLibUrls = GetPlayletLibUrls()
|
m.playletLibUrls = GetPlayletLibUrls()
|
||||||
m.playletLibUrlIndex = 0
|
m.playletLibUrlIndex = 0
|
||||||
|
|
||||||
@@ -42,14 +47,8 @@ function LoadPlayletLib() as void
|
|||||||
end if
|
end if
|
||||||
|
|
||||||
RemoveComponentLibrary()
|
RemoveComponentLibrary()
|
||||||
m.lib = m.top.getScene().createChild("ComponentLibrary")
|
|
||||||
' bs:disable-next-line NO_OBSERVE_STRING_CALLBACK
|
|
||||||
m.lib.observeField("loadStatus", "OnLoadStatusChanged")
|
|
||||||
|
|
||||||
uri = m.playletLibUrls[m.playletLibUrlIndex].link
|
uri = m.playletLibUrls[m.playletLibUrlIndex].link
|
||||||
' bs:disable-next-line LINT3012
|
LoadComponentLibrary(uri)
|
||||||
?"Loading Playlet lib from " uri
|
|
||||||
m.lib.uri = uri
|
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function OnLoadStatusChanged() as void
|
function OnLoadStatusChanged() as void
|
||||||
@@ -58,9 +57,8 @@ function OnLoadStatusChanged() as void
|
|||||||
RemoveComponentLibrary()
|
RemoveComponentLibrary()
|
||||||
' bs:disable-next-line LINT3012
|
' bs:disable-next-line LINT3012
|
||||||
?"Playlet lib loaded from " libUrl.link
|
?"Playlet lib loaded from " libUrl.link
|
||||||
scene = m.top.getScene()
|
m.scene.playletLibLoadedUrl = libUrl
|
||||||
scene.playletLibLoadedUrl = libUrl
|
container = m.scene.findNode("MainSceneContainer")
|
||||||
container = scene.findNode("MainSceneContainer")
|
|
||||||
container.createChild("PlayletLib:MainScene")
|
container.createChild("PlayletLib:MainScene")
|
||||||
return
|
return
|
||||||
end if
|
end if
|
||||||
@@ -79,11 +77,20 @@ function RemoveComponentLibrary() as void
|
|||||||
return
|
return
|
||||||
end if
|
end if
|
||||||
|
|
||||||
scene = m.top.getScene()
|
m.lib.unobserveField("loadStatus")
|
||||||
scene.removeChild(m.lib)
|
m.scene.removeChild(m.lib)
|
||||||
m.lib = invalid
|
m.lib = invalid
|
||||||
end function
|
end function
|
||||||
|
|
||||||
|
function LoadComponentLibrary(uri as string)
|
||||||
|
m.lib = m.scene.createChild("ComponentLibrary")
|
||||||
|
' bs:disable-next-line NO_OBSERVE_STRING_CALLBACK
|
||||||
|
m.lib.observeField("loadStatus", "OnLoadStatusChanged")
|
||||||
|
' bs:disable-next-line LINT3012
|
||||||
|
?"Loading Playlet lib from " uri
|
||||||
|
m.lib.uri = uri
|
||||||
|
end function
|
||||||
|
|
||||||
function ShowPlayletLibLoadErrorDialog()
|
function ShowPlayletLibLoadErrorDialog()
|
||||||
message = [
|
message = [
|
||||||
"Could not load Playlet component library from any of the following urls:",
|
"Could not load Playlet component library from any of the following urls:",
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
function GetLoadingMessage() as string
|
||||||
|
messages = GetLoadingMessagesFromCache()
|
||||||
|
if messages = invalid or messages.count() = 0
|
||||||
|
messages = [
|
||||||
|
"Now loading Playlet...",
|
||||||
|
"One moment please...",
|
||||||
|
"Downloading the internet...",
|
||||||
|
"Unclogging the tubes...",
|
||||||
|
"Warming up the flux capacitor...",
|
||||||
|
"Loading, ehm, stuff...",
|
||||||
|
"Restoring quantum entanglement...",
|
||||||
|
"Searching for kitten videos...",
|
||||||
|
"One Mississippi... two Mississippi...",
|
||||||
|
"Checking the TV's extended warranty...",
|
||||||
|
"Deleting system32...",
|
||||||
|
"Updating: 3 hours 32 minutes remaining...",
|
||||||
|
"Asking ChatGPT for humorous loading messages...",
|
||||||
|
"Loading today's sponsor... NordVPN!",
|
||||||
|
"Don't worry, this is normal...",
|
||||||
|
"Don't forget to like and subscribe...",
|
||||||
|
"Shoveling coal into the server...",
|
||||||
|
"Counting down from infinity...",
|
||||||
|
]
|
||||||
|
end if
|
||||||
|
index = GetRandom(0, messages.count() - 1)
|
||||||
|
return messages[index]
|
||||||
|
end function
|
||||||
|
|
||||||
|
function GetLoadingMessagesFromCache() as object
|
||||||
|
messagesFile = ReadAsciiFile("cachefs:/loading_messages_v1.json")
|
||||||
|
if messagesFile = invalid or messagesFile = ""
|
||||||
|
return invalid
|
||||||
|
end if
|
||||||
|
return ParseJson(messagesFile)
|
||||||
|
end function
|
||||||
|
|
||||||
|
function GetRandom(min as integer, max as integer) as integer
|
||||||
|
dateTime = CreateObject("roDateTime")
|
||||||
|
random = Rnd(max) + dateTime.GetMilliseconds()
|
||||||
|
return min + (random mod (max - min + 1))
|
||||||
|
end function
|
||||||
@@ -1,4 +1,7 @@
|
|||||||
<component name="LoadingIndicator" extends="Group">
|
<component name="LoadingIndicator" extends="Group">
|
||||||
|
<interface>
|
||||||
|
<field id="message" type="string" alias="messageLabel.text" />
|
||||||
|
</interface>
|
||||||
<children>
|
<children>
|
||||||
<Rectangle
|
<Rectangle
|
||||||
width="1280"
|
width="1280"
|
||||||
@@ -9,6 +12,16 @@
|
|||||||
id="busySpinner"
|
id="busySpinner"
|
||||||
inheritParentOpacity="false"
|
inheritParentOpacity="false"
|
||||||
spinInterval="1" />
|
spinInterval="1" />
|
||||||
|
<Label
|
||||||
|
id="messageLabel"
|
||||||
|
inheritParentOpacity="false"
|
||||||
|
width="1280"
|
||||||
|
height="200"
|
||||||
|
horizAlign="center"
|
||||||
|
translation="[0,460]"
|
||||||
|
wrap="true">
|
||||||
|
<Font role="font" uri="font:SystemFontFile" size="28" />
|
||||||
|
</Label>
|
||||||
</Rectangle>
|
</Rectangle>
|
||||||
</children>
|
</children>
|
||||||
</component>
|
</component>
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 9.5 KiB After Width: | Height: | Size: 9.9 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 5.1 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.3 KiB |
@@ -3,24 +3,24 @@
|
|||||||
outputs: [
|
outputs: [
|
||||||
{
|
{
|
||||||
outputFilePath: 'images/channel-poster_fhd.png',
|
outputFilePath: 'images/channel-poster_fhd.png',
|
||||||
outputHash: 'd644a0db84deed0bcc41a41d08a4ef75',
|
outputHash: '50729b5bdd2a7c0fd4a1d502812117d4',
|
||||||
width: 540,
|
width: 540,
|
||||||
height: 405,
|
height: 405,
|
||||||
background: '#FFFFFF',
|
background: '#EEEEEE',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
outputFilePath: 'images/channel-poster_hd.png',
|
outputFilePath: 'images/channel-poster_hd.png',
|
||||||
outputHash: 'd07a4ffaa021b55528bee91710f4e9d2',
|
outputHash: '8022dc6fa993ce3194c5aea37d6ea49a',
|
||||||
width: 290,
|
width: 290,
|
||||||
height: 218,
|
height: 218,
|
||||||
background: '#FFFFFF',
|
background: '#EEEEEE',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
outputFilePath: 'images/channel-poster_sd.png',
|
outputFilePath: 'images/channel-poster_sd.png',
|
||||||
outputHash: '66a311c639f89ff009e4624468282b2f',
|
outputHash: '63b8f12ac155c29b4e85db17a2886817',
|
||||||
width: 246,
|
width: 246,
|
||||||
height: 140,
|
height: 140,
|
||||||
background: '#FFFFFF',
|
background: '#EEEEEE',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
@@ -2,7 +2,7 @@ title=Playlet
|
|||||||
|
|
||||||
# Do not update version manually, it is auto updated from package.json
|
# Do not update version manually, it is auto updated from package.json
|
||||||
major_version=0
|
major_version=0
|
||||||
minor_version=17
|
minor_version=18
|
||||||
build_version=00000
|
build_version=00000
|
||||||
|
|
||||||
ui_resolutions=hd
|
ui_resolutions=hd
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
function ShowErrorDialog(message as object, bulletText as object, bottomMessage as object)
|
function ShowErrorDialog(message as object, bulletText as object, bottomMessage as object)
|
||||||
' TODO:P2 a null check on StandardMessageDialog, only available on 10.0 and later
|
' Note: dialog can be null since StandardMessageDialog is only available on 10.0 and later
|
||||||
dialog = CreateObject("roSGNode", "StandardMessageDialog")
|
dialog = CreateObject("roSGNode", "StandardMessageDialog")
|
||||||
|
SetPalette(dialog)
|
||||||
dialog.message = message
|
dialog.message = message
|
||||||
dialog.bulletText = bulletText
|
dialog.bulletText = bulletText
|
||||||
dialog.bottomMessage = bottomMessage
|
dialog.bottomMessage = bottomMessage
|
||||||
@@ -15,6 +16,19 @@ function ShowErrorDialog(message as object, bulletText as object, bottomMessage
|
|||||||
m.top.getScene().dialog = dialog
|
m.top.getScene().dialog = dialog
|
||||||
end function
|
end function
|
||||||
|
|
||||||
|
function SetPalette(dialog as object)
|
||||||
|
palette = createObject("roSGNode", "RSGPalette")
|
||||||
|
palette.colors = {
|
||||||
|
DialogBackgroundColor: "#242424FF"
|
||||||
|
DialogFocusColor: "#CECECEFF"
|
||||||
|
DialogFocusItemColor: "#202020FF"
|
||||||
|
DialogSecondaryTextColor: "#DBDBDBFF"
|
||||||
|
DialogSecondaryItemColor: "#FF1C30FF"
|
||||||
|
DialogTextColor: "#DBDBDBFF"
|
||||||
|
}
|
||||||
|
dialog.palette = palette
|
||||||
|
end function
|
||||||
|
|
||||||
function OnButtonSelected()
|
function OnButtonSelected()
|
||||||
m.top.getScene().dialog.close = true
|
m.top.getScene().dialog.close = true
|
||||||
end function
|
end function
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"extends": "../config/bsconfig.base.json",
|
"extends": "../config/bsconfig.base.jsonc",
|
||||||
"rootDir": "src/",
|
"rootDir": "src/",
|
||||||
"stagingDir": "../build/playlet-lib",
|
"stagingDir": "../build/playlet-lib",
|
||||||
"outFile": "../dist/playlet-lib.zip"
|
"outFile": "../dist/playlet-lib.zip"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"extends": "../config/bsconfig.tests.base.json",
|
"extends": "../config/bsconfig.tests.base.jsonc",
|
||||||
"rootDir": "src/",
|
"rootDir": "src/",
|
||||||
"stagingDir": "../build/playlet-lib-tests",
|
"stagingDir": "../build/playlet-lib-tests",
|
||||||
"outFile": "../build/playlet-lib-tests.zip"
|
"outFile": "../build/playlet-lib-tests.zip"
|
||||||
|
|||||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "playlet-lib",
|
"name": "playlet-lib",
|
||||||
"version": "0.17.0",
|
"version": "0.18.0",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "playlet-lib",
|
"name": "playlet-lib",
|
||||||
"version": "0.17.0"
|
"version": "0.18.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "playlet-lib",
|
"name": "playlet-lib",
|
||||||
"version": "0.17.0",
|
"version": "0.18.0",
|
||||||
"description": "Unofficial Youtube client for Roku",
|
"description": "Unofficial Youtube client for Roku",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"prebuild": "rm -rf build/playlet-lib",
|
"prebuild": "rm -rf build/playlet-lib",
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ function PushScreen(node as object)
|
|||||||
FocusTopScreen(invalid)
|
FocusTopScreen(invalid)
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function PopScreen(unused as dynamic)
|
function PopScreen(_unused as dynamic)
|
||||||
childCount = m.stack.getChildCount()
|
childCount = m.stack.getChildCount()
|
||||||
if childCount > 1
|
if childCount > 1
|
||||||
m.stack.removeChildIndex(childCount - 1)
|
m.stack.removeChildIndex(childCount - 1)
|
||||||
@@ -29,7 +29,7 @@ function PopScreen(unused as dynamic)
|
|||||||
end if
|
end if
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function FocusTopScreen(unused as dynamic)
|
function FocusTopScreen(_unused as dynamic)
|
||||||
childCount = m.stack.getChildCount()
|
childCount = m.stack.getChildCount()
|
||||||
topScreen = m.stack.getChild(childCount - 1)
|
topScreen = m.stack.getChild(childCount - 1)
|
||||||
NodeSetFocus(topScreen, true)
|
NodeSetFocus(topScreen, true)
|
||||||
@@ -60,7 +60,7 @@ function ShowRootScreen(screenName as string) as void
|
|||||||
' insert child at 0 to make sure it is behind the navbar
|
' insert child at 0 to make sure it is behind the navbar
|
||||||
m.root.insertChild(screen, 0)
|
m.root.insertChild(screen, 0)
|
||||||
if screen.hasField("binding_done")
|
if screen.hasField("binding_done")
|
||||||
screen@.BindNode(invalid)
|
screen@.BindNode()
|
||||||
end if
|
end if
|
||||||
end if
|
end if
|
||||||
screen = m.screens[screenName]
|
screen = m.screens[screenName]
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ namespace ChannelUtils
|
|||||||
appController = m.appController
|
appController = m.appController
|
||||||
end if
|
end if
|
||||||
appController@.PushScreen(channelView)
|
appController@.PushScreen(channelView)
|
||||||
channelView@.BindNode(invalid)
|
channelView@.BindNode()
|
||||||
channelView.content = contentNode
|
channelView.content = contentNode
|
||||||
end function
|
end function
|
||||||
end namespace
|
end namespace
|
||||||
@@ -21,7 +21,7 @@ function Init()
|
|||||||
m.rowList.focusable = true
|
m.rowList.focusable = true
|
||||||
m.rowList.screen = m.top
|
m.rowList.screen = m.top
|
||||||
|
|
||||||
DisposableObserveField(m.banner, "loadStatus", FuncName(OnBannerLoadStatus))
|
DisposableObserveFieldScoped(m.banner, "loadStatus", FuncName(OnBannerLoadStatus))
|
||||||
m.author = ""
|
m.author = ""
|
||||||
m.authorId = ""
|
m.authorId = ""
|
||||||
|
|
||||||
@@ -29,13 +29,13 @@ function Init()
|
|||||||
end function
|
end function
|
||||||
|
|
||||||
function OnNodeready()
|
function OnNodeready()
|
||||||
m.rowList@.BindNode(invalid)
|
m.rowList@.BindNode()
|
||||||
|
|
||||||
SetNavigation(m.rowList, "up", m.subscribeButton)
|
SetNavigation(m.rowList, "up", m.subscribeButton)
|
||||||
SetNavigation(m.subscribeButton, "down", m.rowList)
|
SetNavigation(m.subscribeButton, "down", m.rowList)
|
||||||
|
|
||||||
m.subscribeButton.text = "Subscribe"
|
m.subscribeButton.text = "Subscribe"
|
||||||
DisposableObserveField(m.subscribeButton, "buttonSelected", FuncName(OnSubscribeButtonSelected))
|
DisposableObserveFieldScoped(m.subscribeButton, "buttonSelected", FuncName(OnSubscribeButtonSelected))
|
||||||
|
|
||||||
SetSubscribeButtonVisibility()
|
SetSubscribeButtonVisibility()
|
||||||
DisposableObserveFieldScoped(m.invidious, "authToken", FuncName(SetSubscribeButtonVisibility))
|
DisposableObserveFieldScoped(m.invidious, "authToken", FuncName(SetSubscribeButtonVisibility))
|
||||||
@@ -115,13 +115,17 @@ function OnkeyEvent(key as string, press as boolean) as boolean
|
|||||||
end function
|
end function
|
||||||
|
|
||||||
function Close()
|
function Close()
|
||||||
m.appController@.PopScreen(invalid)
|
m.appController@.PopScreen()
|
||||||
m.top.dispose = true
|
m.top.dispose = true
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function OnDispose()
|
function OnDispose()
|
||||||
m.rowList.dispose = true
|
m.rowList.dispose = true
|
||||||
DisposeObservers()
|
DisposeObservers()
|
||||||
|
if m.subscribeTask <> invalid
|
||||||
|
m.subscribeTask.cancel = true
|
||||||
|
m.subscribeTask = invalid
|
||||||
|
end if
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function OnSubscribeButtonSelected()
|
function OnSubscribeButtonSelected()
|
||||||
@@ -131,8 +135,8 @@ function OnSubscribeButtonSelected()
|
|||||||
|
|
||||||
isSubbed = IsSubscribed()
|
isSubbed = IsSubscribed()
|
||||||
m.subscribeTask = StartAsyncTask(SubscribeTask, {
|
m.subscribeTask = StartAsyncTask(SubscribeTask, {
|
||||||
invidious: m.invidious,
|
invidious: m.invidious
|
||||||
ucid: m.authorId,
|
ucid: m.authorId
|
||||||
subscribe: not isSubbed
|
subscribe: not isSubbed
|
||||||
})
|
})
|
||||||
end function
|
end function
|
||||||
@@ -168,19 +172,19 @@ function InitializeTabs()
|
|||||||
m.tabs = {
|
m.tabs = {
|
||||||
videos: function(authorId as string, author as string) as object
|
videos: function(authorId as string, author as string) as object
|
||||||
return CreateChannelFeed("Latest videos", "channel_videos", authorId, author)
|
return CreateChannelFeed("Latest videos", "channel_videos", authorId, author)
|
||||||
end function,
|
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)
|
return CreateChannelFeed("Shorts", "channel_shorts", authorId, author)
|
||||||
end function,
|
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)
|
return CreateChannelFeed("Live", "channel_streams", authorId, author)
|
||||||
end function,
|
end function
|
||||||
podcasts: function(authorId as string, author as string) as object
|
podcasts: function(authorId as string, author as string) as object
|
||||||
return CreateChannelFeed("Podcasts", "channel_podcasts", authorId, author)
|
return CreateChannelFeed("Podcasts", "channel_podcasts", authorId, author)
|
||||||
end function,
|
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)
|
return CreateChannelFeed("Playlists", "channel_playlists", authorId, author)
|
||||||
end function,
|
end function
|
||||||
channels: function(authorId as string, author as string) as object
|
channels: function(authorId as string, author as string) as object
|
||||||
return CreateChannelFeed("Channels", "channel_channels", authorId, author)
|
return CreateChannelFeed("Channels", "channel_channels", authorId, author)
|
||||||
end function
|
end function
|
||||||
@@ -189,12 +193,12 @@ end function
|
|||||||
|
|
||||||
function CreateChannelFeed(title as string, endpoint as string, ucid as string, author as string) as object
|
function CreateChannelFeed(title as string, endpoint as string, ucid as string, author as string) as object
|
||||||
return {
|
return {
|
||||||
title: title,
|
title: title
|
||||||
feedSources: [{
|
feedSources: [{
|
||||||
"id": `inv_${endpoint}_${ucid}`,
|
"id": `inv_${endpoint}_${ucid}`
|
||||||
"title": `${author} - ${title}`,
|
"title": `${author} - ${title}`
|
||||||
"apiType": "Invidious",
|
"apiType": "Invidious"
|
||||||
"endpoint": endpoint,
|
"endpoint": endpoint
|
||||||
"pathParams": {
|
"pathParams": {
|
||||||
"ucid": ucid
|
"ucid": ucid
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ function SubscribeTask(input as object) as object
|
|||||||
error = response.ErrorMessage()
|
error = response.ErrorMessage()
|
||||||
LogError("Failed to subscribe/unsubscribe to channel:", error)
|
LogError("Failed to subscribe/unsubscribe to channel:", error)
|
||||||
return {
|
return {
|
||||||
success: false,
|
success: false
|
||||||
error: error
|
error: error
|
||||||
}
|
}
|
||||||
end if
|
end if
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ function LoadChannel(invidiousNode as object) as void
|
|||||||
|
|
||||||
m.top.loadState = FeedLoadState.Loading
|
m.top.loadState = FeedLoadState.Loading
|
||||||
m.contentTask = StartAsyncTask(ChannelContentTask, {
|
m.contentTask = StartAsyncTask(ChannelContentTask, {
|
||||||
content: m.top,
|
content: m.top
|
||||||
invidious: invidiousNode
|
invidious: invidiousNode
|
||||||
}, OnChannelContentTaskResult)
|
}, OnChannelContentTaskResult)
|
||||||
end function
|
end function
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ function ChannelContentTask(input as object) as object
|
|||||||
if not response.IsSuccess() or metadata = invalid
|
if not response.IsSuccess() or metadata = invalid
|
||||||
contentNode.loadState = FeedLoadState.Error
|
contentNode.loadState = FeedLoadState.Error
|
||||||
return {
|
return {
|
||||||
success: false,
|
success: false
|
||||||
error: response.ErrorMessage()
|
error: response.ErrorMessage()
|
||||||
}
|
}
|
||||||
end if
|
end if
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ import "pkg:/source/utils/Logging.bs"
|
|||||||
import "pkg:/source/utils/StringUtils.bs"
|
import "pkg:/source/utils/StringUtils.bs"
|
||||||
import "pkg:/source/utils/Types.bs"
|
import "pkg:/source/utils/Types.bs"
|
||||||
|
|
||||||
' TODO:P0 Web app support
|
' TODO:P1 Web app support
|
||||||
' TODO:P0 Web apis and open api spec updates
|
' TODO:P1 Web apis and open api spec updates
|
||||||
'
|
'
|
||||||
' From the main screen:
|
' From the main screen:
|
||||||
' When a video is selected:
|
' When a video is selected:
|
||||||
@@ -167,5 +167,5 @@ function OnkeyEvent(key as string, press as boolean) as boolean
|
|||||||
end function
|
end function
|
||||||
|
|
||||||
function Close()
|
function Close()
|
||||||
m.top.appController@.PopScreen(invalid)
|
m.top.appController@.PopScreen()
|
||||||
end function
|
end function
|
||||||
@@ -11,19 +11,19 @@ function OnItemHasFocus()
|
|||||||
hasFocus = m.top.itemHasFocus
|
hasFocus = m.top.itemHasFocus
|
||||||
if hasFocus
|
if hasFocus
|
||||||
m.top.font = "font:SmallestBoldSystemFont"
|
m.top.font = "font:SmallestBoldSystemFont"
|
||||||
m.top.color = "0x262626ff"
|
m.top.color = "#262626ff"
|
||||||
else
|
else
|
||||||
m.top.font = "font:SmallestSystemFont"
|
m.top.font = "font:SmallestSystemFont"
|
||||||
m.top.color = "0xddddddff"
|
m.top.color = "#DBDBDBFF"
|
||||||
end if
|
end if
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function OnFocusPercent()
|
function OnFocusPercent()
|
||||||
if m.top.focusPercent > 0.5
|
if m.top.focusPercent > 0.5
|
||||||
m.top.font = "font:SmallestBoldSystemFont"
|
m.top.font = "font:SmallestBoldSystemFont"
|
||||||
m.top.color = "0x262626ff"
|
m.top.color = "#262626FF"
|
||||||
else
|
else
|
||||||
m.top.font = "font:SmallestSystemFont"
|
m.top.font = "font:SmallestSystemFont"
|
||||||
m.top.color = "0xddddddff"
|
m.top.color = "#DBDBDBFF"
|
||||||
end if
|
end if
|
||||||
end function
|
end function
|
||||||
@@ -19,7 +19,7 @@ namespace ContextMenuUtils
|
|||||||
ContextMenuUtils.SetItem(contextMenu, item)
|
ContextMenuUtils.SetItem(contextMenu, item)
|
||||||
contextMenu.options = options
|
contextMenu.options = options
|
||||||
|
|
||||||
contextMenu@.Show(invalid)
|
contextMenu@.Show()
|
||||||
return contextMenu
|
return contextMenu
|
||||||
end function
|
end function
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
function SetPalette(dialog as object)
|
||||||
|
palette = createObject("roSGNode", "RSGPalette")
|
||||||
|
palette.colors = {
|
||||||
|
DialogBackgroundColor: "#242424FF"
|
||||||
|
DialogFocusColor: "#CECECEFF"
|
||||||
|
DialogFocusItemColor: "#202020FF"
|
||||||
|
DialogSecondaryTextColor: "#DBDBDBFF"
|
||||||
|
DialogSecondaryItemColor: "#FF1C30FF"
|
||||||
|
DialogTextColor: "#DBDBDBFF"
|
||||||
|
}
|
||||||
|
dialog.palette = palette
|
||||||
|
end function
|
||||||
@@ -1,9 +1,11 @@
|
|||||||
|
import "DialogPalette.bs"
|
||||||
import "pkg:/components/Screens/WebAppScreen/GenerateQrCodeTask.bs"
|
import "pkg:/components/Screens/WebAppScreen/GenerateQrCodeTask.bs"
|
||||||
import "pkg:/source/asyncTask/asyncTask.bs"
|
import "pkg:/source/asyncTask/asyncTask.bs"
|
||||||
import "pkg:/source/utils/StringUtils.bs"
|
import "pkg:/source/utils/StringUtils.bs"
|
||||||
import "pkg:/source/utils/Types.bs"
|
import "pkg:/source/utils/Types.bs"
|
||||||
|
|
||||||
function Init()
|
function Init()
|
||||||
|
SetPalette(m.top)
|
||||||
m.urlLabel = m.top.findNode("urlLabel")
|
m.urlLabel = m.top.findNode("urlLabel")
|
||||||
m.qrCode = m.top.findNode("QrCodePoster")
|
m.qrCode = m.top.findNode("QrCodePoster")
|
||||||
|
|
||||||
@@ -12,9 +14,9 @@ function Init()
|
|||||||
end function
|
end function
|
||||||
|
|
||||||
function OnNodeReady()
|
function OnNodeReady()
|
||||||
address = m.webserver@.GetServerAddress(invalid)
|
address = m.webserver@.GetServerAddress()
|
||||||
isValidIp = not StringUtils.IsNullOrEmpty(address)
|
isValidAddress = not StringUtils.IsNullOrEmpty(address)
|
||||||
if isValidIp
|
if isValidAddress
|
||||||
m.top.url = `${address}/invidious/login`
|
m.top.url = `${address}/invidious/login`
|
||||||
else
|
else
|
||||||
m.urlLabel.text = "No IP address found"
|
m.urlLabel.text = "No IP address found"
|
||||||
@@ -32,9 +34,9 @@ function OnUrlSet()
|
|||||||
|
|
||||||
m.urlLabel.text = url
|
m.urlLabel.text = url
|
||||||
StartAsyncTask(GenerateQrCodeTask, {
|
StartAsyncTask(GenerateQrCodeTask, {
|
||||||
poster: m.qrCode,
|
poster: m.qrCode
|
||||||
text: url,
|
text: url
|
||||||
size: m.qrCode.loadWidth,
|
size: m.qrCode.loadWidth
|
||||||
padding: 10
|
padding: 10
|
||||||
})
|
})
|
||||||
end function
|
end function
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
horizAlign="right"
|
horizAlign="right"
|
||||||
width="400"
|
width="400"
|
||||||
extendToDialogEdge="false"
|
extendToDialogEdge="false"
|
||||||
showDivider="true">
|
showDivider="false">
|
||||||
<Label
|
<Label
|
||||||
text="Scan the QR Code"
|
text="Scan the QR Code"
|
||||||
horizAlign="center"
|
horizAlign="center"
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
|
import "DialogPalette.bs"
|
||||||
import "pkg:/source/utils/Types.bs"
|
import "pkg:/source/utils/Types.bs"
|
||||||
|
|
||||||
function Init()
|
function Init()
|
||||||
|
SetPalette(m.top)
|
||||||
m.top.observeField("buttonSelected", FuncName(CloseDialog))
|
m.top.observeField("buttonSelected", FuncName(CloseDialog))
|
||||||
end function
|
end function
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import "pkg:/components/EcpArgs.bs"
|
import "pkg:/components/EcpArgs.bs"
|
||||||
import "pkg:/components/parts/AutoBind/AutoBind.part.bs"
|
import "pkg:/components/parts/AutoBind/AutoBind.part.bs"
|
||||||
|
import "pkg:/components/parts/AutoBind/OnNodeReadyNoOp.bs"
|
||||||
import "pkg:/source/utils/LoadingScreen.bs"
|
import "pkg:/source/utils/LoadingScreen.bs"
|
||||||
|
|
||||||
function Init()
|
function Init()
|
||||||
@@ -16,9 +17,10 @@ function MainSceneContainerChanged()
|
|||||||
HideLoadingScreen()
|
HideLoadingScreen()
|
||||||
InitEcpArgs()
|
InitEcpArgs()
|
||||||
m.scene.signalBeacon("AppLaunchComplete")
|
m.scene.signalBeacon("AppLaunchComplete")
|
||||||
|
CopyLoadingMessagesToCache()
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function StartWebServer()
|
function StartWebServer()
|
||||||
m.webServer = m.top.findNode("WebServer")
|
m.webServer = m.top.findNode("WebServer")
|
||||||
m.webServer@.StartServer(invalid)
|
m.webServer@.StartServer()
|
||||||
end function
|
end function
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
'import "pkg:/components/EcpArgs.bs"
|
'import "pkg:/components/EcpArgs.bs"
|
||||||
'import "pkg:/components/parts/AutoBind/AutoBind.part.bs"
|
'import "pkg:/components/parts/AutoBind/AutoBind.part.bs"
|
||||||
|
'import "pkg:/components/parts/AutoBind/OnNodeReadyNoOp.bs"
|
||||||
'import "pkg:/source/utils/LoadingScreen.bs"
|
'import "pkg:/source/utils/LoadingScreen.bs"
|
||||||
|
|
||||||
function Init()
|
function Init()
|
||||||
@@ -17,6 +18,7 @@ function MainSceneContainerChanged()
|
|||||||
HideLoadingScreen()
|
HideLoadingScreen()
|
||||||
InitEcpArgs()
|
InitEcpArgs()
|
||||||
m.scene.signalBeacon("AppLaunchComplete")
|
m.scene.signalBeacon("AppLaunchComplete")
|
||||||
|
CopyLoadingMessagesToCache()
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function StartWebServer()
|
function StartWebServer()
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
<script type="text/brightscript" uri="pkg:/components/MainScene_bindings.brs" />
|
<script type="text/brightscript" uri="pkg:/components/MainScene_bindings.brs" />
|
||||||
<script type="text/brightscript" uri="pkg:/components/MainScene.brs" />
|
<script type="text/brightscript" uri="pkg:/components/MainScene.brs" />
|
||||||
<script type="text/brightscript" uri="pkg:/source/utils/LoadingScreen.brs" />
|
<script type="text/brightscript" uri="pkg:/source/utils/LoadingScreen.brs" />
|
||||||
|
<script type="text/brightscript" uri="pkg:/components/parts/AutoBind/OnNodeReadyNoOp.brs" />
|
||||||
<script type="text/brightscript" uri="pkg:/components/EcpArgs.brs" />
|
<script type="text/brightscript" uri="pkg:/components/EcpArgs.brs" />
|
||||||
<script type="text/brightscript" uri="pkg:/source/utils/Types.brs" />
|
<script type="text/brightscript" uri="pkg:/source/utils/Types.brs" />
|
||||||
<script type="text/brightscript" uri="pkg:/source/utils/StringUtils.brs" />
|
<script type="text/brightscript" uri="pkg:/source/utils/StringUtils.brs" />
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import "pkg:/source/utils/ColorUtils.bs"
|
|
||||||
import "pkg:/source/utils/FocusManagement.bs"
|
import "pkg:/source/utils/FocusManagement.bs"
|
||||||
import "pkg:/source/utils/Types.bs"
|
import "pkg:/source/utils/Types.bs"
|
||||||
|
|
||||||
@@ -31,8 +30,8 @@ function PopulateButtons() as void
|
|||||||
buttons = []
|
buttons = []
|
||||||
for each item in navBarItems
|
for each item in navBarItems
|
||||||
button = CreateObject("roSGNode", "IconButton")
|
button = CreateObject("roSGNode", "IconButton")
|
||||||
button.background = ColorUtils.HexToInt("242424")
|
button.background = "#242424FF"
|
||||||
button.focusBackground = ColorUtils.HexToInt("ff1c30")
|
button.focusBackground = "#FF1C30FF"
|
||||||
button.padding = 20
|
button.padding = 20
|
||||||
button.height = 50
|
button.height = 50
|
||||||
button.width = 90
|
button.width = 90
|
||||||
@@ -47,6 +46,18 @@ function PopulateButtons() as void
|
|||||||
m.top.focusable = buttons.Count() > 0
|
m.top.focusable = buttons.Count() > 0
|
||||||
|
|
||||||
m.top.focusIndex = m.top.focusIndex
|
m.top.focusIndex = m.top.focusIndex
|
||||||
|
|
||||||
|
CenterButtons()
|
||||||
|
end function
|
||||||
|
|
||||||
|
function CenterButtons()
|
||||||
|
parent = m.buttonGroup.getParent()
|
||||||
|
parentWidth = parent.width
|
||||||
|
parentHeight = parent.height
|
||||||
|
|
||||||
|
rect = m.buttonGroup.boundingRect()
|
||||||
|
|
||||||
|
m.buttonGroup.translation = [parentWidth / 2 - rect.width / 2, parentHeight / 2 - rect.height / 2]
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function onKeyEvent(key as string, press as boolean) as boolean
|
function onKeyEvent(key as string, press as boolean) as boolean
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ const OPTIONS_LONG_PRESS_KEY = "OPTIONS_LONG_PRESS"
|
|||||||
|
|
||||||
function InitializeLongPress(keys as object, duration = 1.0 as float)
|
function InitializeLongPress(keys as object, duration = 1.0 as float)
|
||||||
longPressKeyMap = {
|
longPressKeyMap = {
|
||||||
"OK": OK_LONG_PRESS_KEY,
|
"OK": OK_LONG_PRESS_KEY
|
||||||
"options": OPTIONS_LONG_PRESS_KEY
|
"options": OPTIONS_LONG_PRESS_KEY
|
||||||
}
|
}
|
||||||
m._longPressKeyMap = {}
|
m._longPressKeyMap = {}
|
||||||
@@ -17,7 +17,7 @@ function InitializeLongPress(keys as object, duration = 1.0 as float)
|
|||||||
' - press K to simulate an "OK" long press on the remote.
|
' - press K to simulate an "OK" long press on the remote.
|
||||||
' - press O to simulate an "options" long press on the remote.
|
' - press O to simulate an "options" long press on the remote.
|
||||||
simulatedLongPressKeyMap = {
|
simulatedLongPressKeyMap = {
|
||||||
"OK": "Lit_k",
|
"OK": "Lit_k"
|
||||||
"options": "Lit_o"
|
"options": "Lit_o"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ function SetNavigation(fromNode as object, direction as string, toNode as object
|
|||||||
end if
|
end if
|
||||||
|
|
||||||
m._navigation[direction].push({
|
m._navigation[direction].push({
|
||||||
fromNode: fromNode,
|
fromNode: fromNode
|
||||||
toNode: toNode,
|
toNode: toNode
|
||||||
callback: callback
|
callback: callback
|
||||||
})
|
})
|
||||||
end function
|
end function
|
||||||
@@ -19,7 +19,7 @@ end function
|
|||||||
function NavigationKeyHandler(key as string, press as boolean) as object
|
function NavigationKeyHandler(key as string, press as boolean) as object
|
||||||
if not press
|
if not press
|
||||||
return {
|
return {
|
||||||
handled: false,
|
handled: false
|
||||||
node: invalid
|
node: invalid
|
||||||
}
|
}
|
||||||
end if
|
end if
|
||||||
@@ -27,7 +27,7 @@ function NavigationKeyHandler(key as string, press as boolean) as object
|
|||||||
navigations = m._navigation[key]
|
navigations = m._navigation[key]
|
||||||
if navigations = invalid
|
if navigations = invalid
|
||||||
return {
|
return {
|
||||||
handled: false,
|
handled: false
|
||||||
node: invalid
|
node: invalid
|
||||||
}
|
}
|
||||||
end if
|
end if
|
||||||
@@ -41,13 +41,13 @@ function NavigationKeyHandler(key as string, press as boolean) as object
|
|||||||
item.callback()
|
item.callback()
|
||||||
end if
|
end if
|
||||||
return {
|
return {
|
||||||
handled: true,
|
handled: true
|
||||||
node: item.toNode
|
node: item.toNode
|
||||||
}
|
}
|
||||||
end if
|
end if
|
||||||
end for
|
end for
|
||||||
return {
|
return {
|
||||||
handled: false,
|
handled: false
|
||||||
node: invalid
|
node: invalid
|
||||||
}
|
}
|
||||||
end function
|
end function
|
||||||
@@ -8,6 +8,7 @@ import "pkg:/source/asyncTask/asyncTask.bs"
|
|||||||
import "pkg:/source/utils/ArrayUtils.bs"
|
import "pkg:/source/utils/ArrayUtils.bs"
|
||||||
import "pkg:/source/utils/ErrorUtils.bs"
|
import "pkg:/source/utils/ErrorUtils.bs"
|
||||||
import "pkg:/source/utils/Logging.bs"
|
import "pkg:/source/utils/Logging.bs"
|
||||||
|
import "pkg:/source/utils/RingBuffer.bs"
|
||||||
import "pkg:/source/utils/Types.bs"
|
import "pkg:/source/utils/Types.bs"
|
||||||
|
|
||||||
' TODO:P1 prevent adding duplicates of the same video/playlist
|
' TODO:P1 prevent adding duplicates of the same video/playlist
|
||||||
@@ -17,6 +18,8 @@ function Init()
|
|||||||
m.top.content = m.content
|
m.top.content = m.content
|
||||||
m.content.addField("index", "integer", false)
|
m.content.addField("index", "integer", false)
|
||||||
m.content.index = m.top.index
|
m.content.index = m.top.index
|
||||||
|
' TODO:P2 use actual queue nodes instead of internal buffer
|
||||||
|
m.watchedVideos = new RingBuffer(100)
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function Play(node as object, playlistIndex as integer)
|
function Play(node as object, playlistIndex as integer)
|
||||||
@@ -53,7 +56,7 @@ function WrapWithIndexField(node as object) as object
|
|||||||
end function
|
end function
|
||||||
|
|
||||||
' TODO:P0 better model of the queue (Now playing, etc)
|
' TODO:P0 better model of the queue (Now playing, etc)
|
||||||
function GetQueue(unused as dynamic) as object
|
function GetQueue(_unused as dynamic) as object
|
||||||
queueNodes = m.content.getChildren(-1, 0)
|
queueNodes = m.content.getChildren(-1, 0)
|
||||||
items = []
|
items = []
|
||||||
for each node in queueNodes
|
for each node in queueNodes
|
||||||
@@ -65,37 +68,37 @@ function GetQueue(unused as dynamic) as object
|
|||||||
nodeType = node.type
|
nodeType = node.type
|
||||||
if nodeType = "video"
|
if nodeType = "video"
|
||||||
items.push({
|
items.push({
|
||||||
type: nodeType,
|
type: nodeType
|
||||||
videoId: node.videoId,
|
videoId: node.videoId
|
||||||
title: node.title,
|
title: node.title
|
||||||
author: node.author,
|
author: node.author
|
||||||
thumbnail: node.thumbnail
|
thumbnail: node.thumbnail
|
||||||
})
|
})
|
||||||
else if node.type = "playlist"
|
else if node.type = "playlist"
|
||||||
items.push({
|
items.push({
|
||||||
type: nodeType,
|
type: nodeType
|
||||||
playlistId: node.playlistId,
|
playlistId: node.playlistId
|
||||||
title: node.title,
|
title: node.title
|
||||||
thumbnail: node.thumbnail,
|
thumbnail: node.thumbnail
|
||||||
videoCountText: node.videoCountText
|
videoCountText: node.videoCountText
|
||||||
})
|
})
|
||||||
end if
|
end if
|
||||||
end for
|
end for
|
||||||
|
|
||||||
return {
|
return {
|
||||||
index: m.top.index,
|
index: m.top.index
|
||||||
playlistIndex: m.top.playlistIndex,
|
playlistIndex: m.top.playlistIndex
|
||||||
items: items
|
items: items
|
||||||
}
|
}
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function Clear(unused as dynamic)
|
function Clear(_unused as dynamic)
|
||||||
m.content.removeChildrenIndex(m.content.getChildCount(), 0)
|
m.content.removeChildrenIndex(m.content.getChildCount(), 0)
|
||||||
m.top.index = -1
|
m.top.index = -1
|
||||||
m.top.playlistIndex = -1
|
m.top.playlistIndex = -1
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function PlayNextItem(unused as dynamic) as boolean
|
function PlayNextItem(_unused as dynamic) as boolean
|
||||||
childCount = m.content.getChildCount()
|
childCount = m.content.getChildCount()
|
||||||
if childCount = 0
|
if childCount = 0
|
||||||
return false
|
return false
|
||||||
@@ -138,7 +141,7 @@ function PlayItemAtCurrentIndex() as boolean
|
|||||||
return false
|
return false
|
||||||
end if
|
end if
|
||||||
if node.type = "video"
|
if node.type = "video"
|
||||||
VideoUtils.PlayVideo(node)
|
PlayVideo(node)
|
||||||
return true
|
return true
|
||||||
else if node.type = "playlist"
|
else if node.type = "playlist"
|
||||||
if m.top.playlistIndex = -1
|
if m.top.playlistIndex = -1
|
||||||
@@ -162,7 +165,7 @@ function PlayPlaylistAtCurrentIndex(playlist as object) as boolean
|
|||||||
|
|
||||||
if playlistIndex < playlist.getChildCount()
|
if playlistIndex < playlist.getChildCount()
|
||||||
child = playlist.getChild(playlistIndex)
|
child = playlist.getChild(playlistIndex)
|
||||||
VideoUtils.PlayVideo(child)
|
PlayVideo(child)
|
||||||
return true
|
return true
|
||||||
end if
|
end if
|
||||||
|
|
||||||
@@ -170,6 +173,14 @@ function PlayPlaylistAtCurrentIndex(playlist as object) as boolean
|
|||||||
return true
|
return true
|
||||||
end function
|
end function
|
||||||
|
|
||||||
|
function PlayVideo(node as object)
|
||||||
|
videoId = node.videoId
|
||||||
|
if not m.watchedVideos.Contains(videoId)
|
||||||
|
m.watchedVideos.Push(videoId)
|
||||||
|
end if
|
||||||
|
VideoUtils.PlayVideo(node)
|
||||||
|
end function
|
||||||
|
|
||||||
function LoadPlaylist(playlist as object) as void
|
function LoadPlaylist(playlist as object) as void
|
||||||
if playlist.loadState = FeedLoadState.Loading
|
if playlist.loadState = FeedLoadState.Loading
|
||||||
return
|
return
|
||||||
@@ -178,7 +189,7 @@ function LoadPlaylist(playlist as object) as void
|
|||||||
playlist.loadState = FeedLoadState.Loading
|
playlist.loadState = FeedLoadState.Loading
|
||||||
|
|
||||||
task = StartAsyncTask(PlaylistContentTask, {
|
task = StartAsyncTask(PlaylistContentTask, {
|
||||||
content: playlist,
|
content: playlist
|
||||||
invidious: m.top.invidious
|
invidious: m.top.invidious
|
||||||
}, OnPlaylistContentTaskResult)
|
}, OnPlaylistContentTaskResult)
|
||||||
m.pendingLoadTasks[task.id] = task
|
m.pendingLoadTasks[task.id] = task
|
||||||
@@ -219,3 +230,11 @@ function OnIndexChange()
|
|||||||
child.index = index
|
child.index = index
|
||||||
end for
|
end for
|
||||||
end function
|
end function
|
||||||
|
|
||||||
|
function watchedVideosContain(videoId as string) as boolean
|
||||||
|
return m.watchedVideos.Contains(videoId)
|
||||||
|
end function
|
||||||
|
|
||||||
|
function watchedVideosClear(_unused as dynamic)
|
||||||
|
m.watchedVideos = new RingBuffer(100)
|
||||||
|
end function
|
||||||
@@ -12,6 +12,8 @@
|
|||||||
<function name="Clear" />
|
<function name="Clear" />
|
||||||
<function name="PlayNextItem" />
|
<function name="PlayNextItem" />
|
||||||
<function name="PlayItemAtIndex" />
|
<function name="PlayItemAtIndex" />
|
||||||
|
<function name="watchedVideosContain" />
|
||||||
|
<function name="watchedVideosClear" />
|
||||||
</interface>
|
</interface>
|
||||||
<children>
|
<children>
|
||||||
<ContentNode id="Content" />
|
<ContentNode id="Content" />
|
||||||
|
|||||||
@@ -61,11 +61,11 @@ function OnkeyEvent(key as string, press as boolean) as boolean
|
|||||||
end function
|
end function
|
||||||
|
|
||||||
function Close()
|
function Close()
|
||||||
m.top.appController@.PopScreen(invalid)
|
m.top.appController@.PopScreen()
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function OnClearButtonSelected()
|
function OnClearButtonSelected()
|
||||||
m.top.playQueue@.Clear(invalid)
|
m.top.playQueue@.Clear()
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function OnItemSelected() as void
|
function OnItemSelected() as void
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ function SetHighlight() as void
|
|||||||
index = m.top.index
|
index = m.top.index
|
||||||
|
|
||||||
if playQueueIndex = index
|
if playQueueIndex = index
|
||||||
|
' bs:disable-next-line LINT3023
|
||||||
m.top.thumbnailBlendColor = "#FFFFFFFF"
|
m.top.thumbnailBlendColor = "#FFFFFFFF"
|
||||||
m.top.highlightUri = "pkg:/images/focus_grid.9.png"
|
m.top.highlightUri = "pkg:/images/focus_grid.9.png"
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
</Poster>
|
</Poster>
|
||||||
<Poster
|
<Poster
|
||||||
id="highlightPoster"
|
id="highlightPoster"
|
||||||
blendColor="0xFF0000"
|
blendColor="0xFF1C30"
|
||||||
width="164"
|
width="164"
|
||||||
height="94" />
|
height="94" />
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ namespace PlayQueueViewUtils
|
|||||||
playQueueView.jumpToItem = index
|
playQueueView.jumpToItem = index
|
||||||
end if
|
end if
|
||||||
|
|
||||||
playQueueView@.Show(invalid)
|
playQueueView@.Show()
|
||||||
return playQueueView
|
return playQueueView
|
||||||
end function
|
end function
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ function PlaylistContentTask(input as object) as object
|
|||||||
if not response.IsSuccess() or metadata = invalid
|
if not response.IsSuccess() or metadata = invalid
|
||||||
contentNode.loadState = FeedLoadState.Error
|
contentNode.loadState = FeedLoadState.Error
|
||||||
return {
|
return {
|
||||||
success: false,
|
success: false
|
||||||
error: response.ErrorMessage()
|
error: response.ErrorMessage()
|
||||||
}
|
}
|
||||||
end if
|
end if
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ namespace PlaylistUtils
|
|||||||
appController = m.appController
|
appController = m.appController
|
||||||
end if
|
end if
|
||||||
appController@.PushScreen(playlistView)
|
appController@.PushScreen(playlistView)
|
||||||
playlistView@.BindNode(invalid)
|
playlistView@.BindNode()
|
||||||
playlistView.content = contentNode
|
playlistView.content = contentNode
|
||||||
end function
|
end function
|
||||||
end namespace
|
end namespace
|
||||||
@@ -91,9 +91,10 @@ end function
|
|||||||
function Close()
|
function Close()
|
||||||
if m.playlistLoadTask <> invalid
|
if m.playlistLoadTask <> invalid
|
||||||
m.playlistLoadTask.cancel = true
|
m.playlistLoadTask.cancel = true
|
||||||
|
m.playlistLoadTask = invalid
|
||||||
end if
|
end if
|
||||||
|
|
||||||
m.appController@.PopScreen(invalid)
|
m.appController@.PopScreen()
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function OnItemFocused()
|
function OnItemFocused()
|
||||||
@@ -222,7 +223,7 @@ function LoadPlaylist() as void
|
|||||||
|
|
||||||
m.top.content.loadState = FeedLoadState.Loading
|
m.top.content.loadState = FeedLoadState.Loading
|
||||||
m.playlistLoadTask = StartAsyncTask(PlaylistContentTask, {
|
m.playlistLoadTask = StartAsyncTask(PlaylistContentTask, {
|
||||||
content: m.top.content,
|
content: m.top.content
|
||||||
invidious: m.top.invidious
|
invidious: m.top.invidious
|
||||||
}, OnPlaylistContentTaskResult)
|
}, OnPlaylistContentTaskResult)
|
||||||
end function
|
end function
|
||||||
|
|||||||
@@ -1,22 +1,38 @@
|
|||||||
import "pkg:/source/asyncTask/asyncTask.bs"
|
import "pkg:/source/asyncTask/asyncTask.bs"
|
||||||
|
|
||||||
function Init()
|
function Init()
|
||||||
m.displayNames = {
|
' TODO:P2 Add tooltip to each field with description of what it means
|
||||||
"version": "Playlet Version",
|
m.displayNames = [{
|
||||||
"lib_version": "Playlet Library Version",
|
key: "app_version"
|
||||||
"lib_version_latest": "Playlet Library Latest Version",
|
displayText: "Playlet App Version"
|
||||||
"lib_url": "Playlet Library URL",
|
}, {
|
||||||
"lib_url_type": "Playlet Library URL Type",
|
key: "lib_version"
|
||||||
"git_commit_hash": "Playlet Git Commit Hash",
|
displayText: "Playlet Library Version"
|
||||||
"lib_git_commit_hash": "Playlet Library Git Commit Hash",
|
}, {
|
||||||
"id": "App ID"
|
key: "lib_version_latest"
|
||||||
}
|
displayText: "Playlet Library Latest Version"
|
||||||
|
}, {
|
||||||
|
key: "lib_url"
|
||||||
|
displayText: "Playlet Library URL"
|
||||||
|
}, {
|
||||||
|
key: "lib_url_type"
|
||||||
|
displayText: "Playlet Library URL Type"
|
||||||
|
}, {
|
||||||
|
key: "app_git_commit_hash"
|
||||||
|
displayText: "Playlet App Git Commit Hash"
|
||||||
|
}, {
|
||||||
|
key: "lib_git_commit_hash"
|
||||||
|
displayText: "Playlet Library Git Commit Hash"
|
||||||
|
}, {
|
||||||
|
key: "id"
|
||||||
|
displayText: "App ID"
|
||||||
|
}]
|
||||||
|
|
||||||
m.keyValueList = m.top.findNode("KeyValueListContent")
|
m.keyValueList = m.top.findNode("KeyValueListContent")
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function OnNodeReady()
|
function OnNodeReady()
|
||||||
m.appInfo = m.applicationInfo@.GetAppInfo(invalid)
|
m.appInfo = m.applicationInfo@.GetAppInfo()
|
||||||
|
|
||||||
UpdateKeyValueList()
|
UpdateKeyValueList()
|
||||||
|
|
||||||
@@ -35,8 +51,8 @@ function UpdateKeyValueList()
|
|||||||
m.keyValueList.removeChildIndex(0)
|
m.keyValueList.removeChildIndex(0)
|
||||||
end while
|
end while
|
||||||
|
|
||||||
for each item in m.appInfo
|
for each item in m.displayNames
|
||||||
value = `${m.displayNames[item]}: ${m.appInfo[item]}`
|
value = `${item.displayText}: ${m.appInfo[item.key]}`
|
||||||
contentNode = m.keyValueList.createChild("ContentNode")
|
contentNode = m.keyValueList.createChild("ContentNode")
|
||||||
contentNode.title = value
|
contentNode.title = value
|
||||||
end for
|
end for
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ function OnNodeReady()
|
|||||||
SetNavigation(invalid, "back", m.navBar)
|
SetNavigation(invalid, "back", m.navBar)
|
||||||
SetNavigation(invalid, "left", m.navBar)
|
SetNavigation(invalid, "left", m.navBar)
|
||||||
|
|
||||||
m.rowList@.BindNode(invalid)
|
m.rowList@.BindNode()
|
||||||
|
|
||||||
OnBookmarksChange()
|
OnBookmarksChange()
|
||||||
m.bookmarks.ObserveField("contentChange", FuncName(OnBookmarksChange))
|
m.bookmarks.ObserveField("contentChange", FuncName(OnBookmarksChange))
|
||||||
@@ -41,7 +41,7 @@ function OnVisibleChange()
|
|||||||
end if
|
end if
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function Refresh(unused as dynamic)
|
function Refresh(_unused as dynamic)
|
||||||
m.isDirty = true
|
m.isDirty = true
|
||||||
OnBookmarksChange()
|
OnBookmarksChange()
|
||||||
end function
|
end function
|
||||||
@@ -79,7 +79,7 @@ function SetRowListContent(bookmarksContent as object)
|
|||||||
end for
|
end for
|
||||||
|
|
||||||
feeds.push({
|
feeds.push({
|
||||||
"title": bookmarkGroupNode.title,
|
"title": bookmarkGroupNode.title
|
||||||
"feedSources": feedSources
|
"feedSources": feedSources
|
||||||
})
|
})
|
||||||
end for
|
end for
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ function OnNodeReady()
|
|||||||
SetNavigation(invalid, "back", m.navBar)
|
SetNavigation(invalid, "back", m.navBar)
|
||||||
SetNavigation(invalid, "left", m.navBar)
|
SetNavigation(invalid, "left", m.navBar)
|
||||||
|
|
||||||
m.rowList@.BindNode(invalid)
|
m.rowList@.BindNode()
|
||||||
m.rowList.feeds = ParseJson(ReadAsciiFile(m.top.feedFile))
|
m.rowList.feeds = ParseJson(ReadAsciiFile(m.top.feedFile))
|
||||||
end function
|
end function
|
||||||
|
|
||||||
|
|||||||
@@ -5,110 +5,110 @@ import "pkg:/source/utils/Types.bs"
|
|||||||
function Init()
|
function Init()
|
||||||
options = {
|
options = {
|
||||||
date: [{
|
date: [{
|
||||||
title: "Any date",
|
title: "Any date"
|
||||||
value: ""
|
value: ""
|
||||||
}, {
|
}, {
|
||||||
title: "Last hour",
|
title: "Last hour"
|
||||||
value: "hour"
|
value: "hour"
|
||||||
}, {
|
}, {
|
||||||
title: "Today",
|
title: "Today"
|
||||||
value: "today"
|
value: "today"
|
||||||
}, {
|
}, {
|
||||||
title: "This week",
|
title: "This week"
|
||||||
value: "week"
|
value: "week"
|
||||||
}, {
|
}, {
|
||||||
title: "This month",
|
title: "This month"
|
||||||
value: "month"
|
value: "month"
|
||||||
}, {
|
}, {
|
||||||
title: "This year",
|
title: "This year"
|
||||||
value: "year"
|
value: "year"
|
||||||
}],
|
}]
|
||||||
type: [{
|
type: [{
|
||||||
title: "Any type",
|
title: "Any type"
|
||||||
value: ""
|
value: ""
|
||||||
}, {
|
}, {
|
||||||
title: "Video",
|
title: "Video"
|
||||||
value: "video"
|
value: "video"
|
||||||
}, {
|
}, {
|
||||||
title: "Playlist",
|
title: "Playlist"
|
||||||
value: "playlist"
|
value: "playlist"
|
||||||
}, {
|
}, {
|
||||||
title: "Channel",
|
title: "Channel"
|
||||||
value: "channel"
|
value: "channel"
|
||||||
}, {
|
}, {
|
||||||
title: "Movie",
|
title: "Movie"
|
||||||
value: "movie"
|
value: "movie"
|
||||||
}, {
|
}, {
|
||||||
title: "Show",
|
title: "Show"
|
||||||
value: "show"
|
value: "show"
|
||||||
}],
|
}]
|
||||||
duration: [{
|
duration: [{
|
||||||
title: "Any duration",
|
title: "Any duration"
|
||||||
value: ""
|
value: ""
|
||||||
}, {
|
}, {
|
||||||
title: "Under 4 minutes",
|
title: "Under 4 minutes"
|
||||||
value: "short"
|
value: "short"
|
||||||
}, {
|
}, {
|
||||||
title: "4 - 20 minutes",
|
title: "4 - 20 minutes"
|
||||||
value: "medium"
|
value: "medium"
|
||||||
}, {
|
}, {
|
||||||
title: "Over 20 minutes",
|
title: "Over 20 minutes"
|
||||||
value: "long"
|
value: "long"
|
||||||
}],
|
}]
|
||||||
features: [{
|
features: [{
|
||||||
title: "Live",
|
title: "Live"
|
||||||
value: "live"
|
value: "live"
|
||||||
}, {
|
}, {
|
||||||
title: "4K",
|
title: "4K"
|
||||||
value: "4k"
|
value: "4k"
|
||||||
}, {
|
}, {
|
||||||
title: "HD",
|
title: "HD"
|
||||||
value: "hd"
|
value: "hd"
|
||||||
}, {
|
}, {
|
||||||
title: "Subtitles/CC",
|
title: "Subtitles/CC"
|
||||||
value: "subtitles"
|
value: "subtitles"
|
||||||
}, {
|
}, {
|
||||||
title: "Creative Commons",
|
title: "Creative Commons"
|
||||||
value: "creative_commons"
|
value: "creative_commons"
|
||||||
}, {
|
}, {
|
||||||
title: "360°",
|
title: "360°"
|
||||||
value: "360"
|
value: "360"
|
||||||
}, {
|
}, {
|
||||||
title: "VR180",
|
title: "VR180"
|
||||||
value: "vr180"
|
value: "vr180"
|
||||||
}, {
|
}, {
|
||||||
title: "3D",
|
title: "3D"
|
||||||
value: "3d"
|
value: "3d"
|
||||||
}, {
|
}, {
|
||||||
title: "HDR",
|
title: "HDR"
|
||||||
value: "hdr"
|
value: "hdr"
|
||||||
}, {
|
}, {
|
||||||
title: "Purchased",
|
title: "Purchased"
|
||||||
value: "purchased"
|
value: "purchased"
|
||||||
}, {
|
}, {
|
||||||
title: "Location",
|
title: "Location"
|
||||||
value: "location"
|
value: "location"
|
||||||
}],
|
}]
|
||||||
sort_by: [{
|
sort_by: [{
|
||||||
title: "Relevance",
|
title: "Relevance"
|
||||||
value: ""
|
value: ""
|
||||||
}, {
|
}, {
|
||||||
title: "Upload date",
|
title: "Upload date"
|
||||||
value: "upload_date"
|
value: "upload_date"
|
||||||
}, {
|
}, {
|
||||||
title: "View count",
|
title: "View count"
|
||||||
value: "view_count"
|
value: "view_count"
|
||||||
}, {
|
}, {
|
||||||
title: "Rating",
|
title: "Rating"
|
||||||
value: "rating"
|
value: "rating"
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
|
|
||||||
m.controls = {
|
m.controls = {
|
||||||
date: m.top.findNode("UploadDateList"),
|
date: m.top.findNode("UploadDateList")
|
||||||
type: m.top.findNode("TypeList"),
|
type: m.top.findNode("TypeList")
|
||||||
duration: m.top.findNode("DurationList"),
|
duration: m.top.findNode("DurationList")
|
||||||
features: m.top.findNode("FeaturesList"),
|
features: m.top.findNode("FeaturesList")
|
||||||
sort_by: m.top.findNode("SortByList")
|
sort_by: m.top.findNode("SortByList")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,10 +118,10 @@ function Init()
|
|||||||
end for
|
end for
|
||||||
|
|
||||||
m.contentNodes = {
|
m.contentNodes = {
|
||||||
date: m.controls.date.content,
|
date: m.controls.date.content
|
||||||
type: m.controls.type.content,
|
type: m.controls.type.content
|
||||||
duration: m.controls.duration.content,
|
duration: m.controls.duration.content
|
||||||
features: m.controls.features.content,
|
features: m.controls.features.content
|
||||||
sort_by: m.controls.sort_by.content
|
sort_by: m.controls.sort_by.content
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -266,5 +266,5 @@ function OnkeyEvent(key as string, press as boolean) as boolean
|
|||||||
end function
|
end function
|
||||||
|
|
||||||
function Close()
|
function Close()
|
||||||
m.appController@.PopScreen(invalid)
|
m.appController@.PopScreen()
|
||||||
end function
|
end function
|
||||||
@@ -6,6 +6,7 @@ import "pkg:/source/utils/ErrorUtils.bs"
|
|||||||
import "pkg:/source/utils/FocusManagement.bs"
|
import "pkg:/source/utils/FocusManagement.bs"
|
||||||
import "pkg:/source/utils/LoadingScreen.bs"
|
import "pkg:/source/utils/LoadingScreen.bs"
|
||||||
import "pkg:/source/utils/Logging.bs"
|
import "pkg:/source/utils/Logging.bs"
|
||||||
|
import "pkg:/source/utils/UrlUtils.bs"
|
||||||
|
|
||||||
function Init()
|
function Init()
|
||||||
m.top.focusable = true
|
m.top.focusable = true
|
||||||
@@ -24,10 +25,10 @@ function Init()
|
|||||||
textEditBox.voiceEnabled = true
|
textEditBox.voiceEnabled = true
|
||||||
|
|
||||||
m.top.filters = {
|
m.top.filters = {
|
||||||
date: "",
|
date: ""
|
||||||
type: "",
|
type: ""
|
||||||
duration: "",
|
duration: ""
|
||||||
features: [],
|
features: []
|
||||||
sort_by: ""
|
sort_by: ""
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -35,7 +36,7 @@ function Init()
|
|||||||
end function
|
end function
|
||||||
|
|
||||||
function OnNodeReady()
|
function OnNodeReady()
|
||||||
m.rowlist@.BindNode(invalid)
|
m.rowlist@.BindNode()
|
||||||
m.keyboard.ObserveField("text", FuncName(OnTextChange))
|
m.keyboard.ObserveField("text", FuncName(OnTextChange))
|
||||||
m.suggestions.ObserveField("buttonFocused", FuncName(OnSearchButtonFocused))
|
m.suggestions.ObserveField("buttonFocused", FuncName(OnSearchButtonFocused))
|
||||||
m.suggestions.ObserveField("buttonSelected", FuncName(OnSearchButtonSelected))
|
m.suggestions.ObserveField("buttonSelected", FuncName(OnSearchButtonSelected))
|
||||||
@@ -98,8 +99,8 @@ function OnTextChange() as void
|
|||||||
end if
|
end if
|
||||||
|
|
||||||
m.searchSuggestionsTask = StartAsyncTask(SearchSuggestionsTask, {
|
m.searchSuggestionsTask = StartAsyncTask(SearchSuggestionsTask, {
|
||||||
q: m.keyboard.text,
|
q: m.keyboard.text
|
||||||
invidious: m.invidious,
|
invidious: m.invidious
|
||||||
preferences: m.preferences
|
preferences: m.preferences
|
||||||
}, OnSearchSuggestionsTaskResults)
|
}, OnSearchSuggestionsTaskResults)
|
||||||
end function
|
end function
|
||||||
@@ -150,7 +151,7 @@ function OnFiltersButtonSelected()
|
|||||||
searchFilters = CreateObject("roSGNode", "SearchFilters")
|
searchFilters = CreateObject("roSGNode", "SearchFilters")
|
||||||
m.appController@.PushScreen(searchFilters)
|
m.appController@.PushScreen(searchFilters)
|
||||||
searchFilters.searchScreen = m.top
|
searchFilters.searchScreen = m.top
|
||||||
searchFilters@.BindNode(invalid)
|
searchFilters@.BindNode()
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function OnSearchButtonSelected()
|
function OnSearchButtonSelected()
|
||||||
@@ -205,10 +206,10 @@ function Search(text as string)
|
|||||||
ShowLoadingScreen()
|
ShowLoadingScreen()
|
||||||
|
|
||||||
feedSource = {
|
feedSource = {
|
||||||
"id": `inv_search_${CryptoUtils.GetMd5(text)}`,
|
"id": `inv_search_${CryptoUtils.GetMd5(text)}`
|
||||||
"title": `Search - ${text}`,
|
"title": `Search - ${text}`
|
||||||
"apiType": "Invidious",
|
"apiType": "Invidious"
|
||||||
"endpoint": "search",
|
"endpoint": "search"
|
||||||
"queryParams": {
|
"queryParams": {
|
||||||
"q": text
|
"q": text
|
||||||
}
|
}
|
||||||
@@ -220,17 +221,15 @@ function Search(text as string)
|
|||||||
if IsString(value) and value.len() > 0
|
if IsString(value) and value.len() > 0
|
||||||
feedSource.queryParams[filter] = value
|
feedSource.queryParams[filter] = value
|
||||||
else if IsArray(value) and value.Count() > 0
|
else if IsArray(value) and value.Count() > 0
|
||||||
' TODO:P1 this is http client implementation details leaking
|
|
||||||
' We need a declarative way to set array types
|
|
||||||
feedSource.queryParams[filter] = {
|
feedSource.queryParams[filter] = {
|
||||||
value: value,
|
value: value
|
||||||
__arrayType: HttpClient.QueryParamArrayType.CommaSeparated
|
arrayType: UrlUtils.QueryParamArrayType.CommaSeparated
|
||||||
}
|
}
|
||||||
end if
|
end if
|
||||||
end for
|
end for
|
||||||
|
|
||||||
m.rowList.feeds = [{
|
m.rowList.feeds = [{
|
||||||
"title": `Search - ${text}`,
|
"title": `Search - ${text}`
|
||||||
"feedSources": [feedSource]
|
"feedSources": [feedSource]
|
||||||
}]
|
}]
|
||||||
end function
|
end function
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ function SearchSuggestionsTask(input as object) as object
|
|||||||
end if
|
end if
|
||||||
|
|
||||||
return {
|
return {
|
||||||
q: q,
|
q: q
|
||||||
response: history
|
response: history
|
||||||
}
|
}
|
||||||
end function
|
end function
|
||||||
|
|||||||
+2
-1
@@ -1,3 +1,4 @@
|
|||||||
|
import "pkg:/components/parts/AutoBind/OnNodeReadyNoOp.bs"
|
||||||
import "pkg:/source/utils/FocusManagement.bs"
|
import "pkg:/source/utils/FocusManagement.bs"
|
||||||
import "pkg:/source/utils/Types.bs"
|
import "pkg:/source/utils/Types.bs"
|
||||||
|
|
||||||
@@ -54,7 +55,7 @@ end function
|
|||||||
function OpenInvidiousInstanceSettings()
|
function OpenInvidiousInstanceSettings()
|
||||||
settings = CreateObject("roSGNode", "InvidiousInstanceSettings")
|
settings = CreateObject("roSGNode", "InvidiousInstanceSettings")
|
||||||
m.appController@.PushScreen(settings)
|
m.appController@.PushScreen(settings)
|
||||||
settings@.BindNode(invalid)
|
settings@.BindNode()
|
||||||
settings.text = m.top.value
|
settings.text = m.top.value
|
||||||
settings.observeField("save", FuncName(OnSaveInvidiousInstance))
|
settings.observeField("save", FuncName(OnSaveInvidiousInstance))
|
||||||
end function
|
end function
|
||||||
|
|||||||
+5
-2
@@ -1,4 +1,6 @@
|
|||||||
|
import "pkg:/components/Dialog/DialogPalette.bs"
|
||||||
import "pkg:/components/Navigation/Navigation.bs"
|
import "pkg:/components/Navigation/Navigation.bs"
|
||||||
|
import "pkg:/components/parts/AutoBind/OnNodeReadyNoOp.bs"
|
||||||
import "pkg:/components/Services/Invidious/InvidiousService.bs"
|
import "pkg:/components/Services/Invidious/InvidiousService.bs"
|
||||||
import "pkg:/source/utils/Types.bs"
|
import "pkg:/source/utils/Types.bs"
|
||||||
|
|
||||||
@@ -70,13 +72,14 @@ end function
|
|||||||
function OnTestButtonSelected()
|
function OnTestButtonSelected()
|
||||||
testing = CreateObject("roSGNode", "InvidiousInstanceTesting")
|
testing = CreateObject("roSGNode", "InvidiousInstanceTesting")
|
||||||
m.appController@.PushScreen(testing)
|
m.appController@.PushScreen(testing)
|
||||||
testing@.BindNode(invalid)
|
testing@.BindNode()
|
||||||
testing.instance = m.top.text
|
testing.instance = m.top.text
|
||||||
testing.run = true
|
testing.run = true
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function OnEditButtonSelected()
|
function OnEditButtonSelected()
|
||||||
keyboardDialog = createObject("roSGNode", "StandardKeyboardDialog")
|
keyboardDialog = createObject("roSGNode", "StandardKeyboardDialog")
|
||||||
|
SetPalette(keyboardDialog)
|
||||||
keyboardDialog.title = "Edit Instance"
|
keyboardDialog.title = "Edit Instance"
|
||||||
keyboardDialog.message = [`Enter the instance url (e.g. ${Invidious.DEFAULT_INSTANCE})`]
|
keyboardDialog.message = [`Enter the instance url (e.g. ${Invidious.DEFAULT_INSTANCE})`]
|
||||||
keyboardDialog.text = m.top.text
|
keyboardDialog.text = m.top.text
|
||||||
@@ -103,5 +106,5 @@ function OnSaveButtonSelected()
|
|||||||
end function
|
end function
|
||||||
|
|
||||||
function Close()
|
function Close()
|
||||||
m.appController@.PopScreen(invalid)
|
m.appController@.PopScreen()
|
||||||
end function
|
end function
|
||||||
+3
-2
@@ -1,5 +1,6 @@
|
|||||||
import "pkg:/components/Dialog/DialogUtils.bs"
|
import "pkg:/components/Dialog/DialogUtils.bs"
|
||||||
import "pkg:/components/Navigation/Navigation.bs"
|
import "pkg:/components/Navigation/Navigation.bs"
|
||||||
|
import "pkg:/components/parts/AutoBind/OnNodeReadyNoOp.bs"
|
||||||
import "pkg:/components/Screens/SettingsScreen/InvidiousInstance/InvidiousInstanceTesting/InvidiousInstanceTestingTask.bs"
|
import "pkg:/components/Screens/SettingsScreen/InvidiousInstance/InvidiousInstanceTesting/InvidiousInstanceTestingTask.bs"
|
||||||
import "pkg:/source/asyncTask/asyncTask.bs"
|
import "pkg:/source/asyncTask/asyncTask.bs"
|
||||||
import "pkg:/source/utils/FocusManagement.bs"
|
import "pkg:/source/utils/FocusManagement.bs"
|
||||||
@@ -47,7 +48,7 @@ function Close()
|
|||||||
m.testingTask.cancel = true
|
m.testingTask.cancel = true
|
||||||
end if
|
end if
|
||||||
|
|
||||||
m.appController@.PopScreen(invalid)
|
m.appController@.PopScreen()
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function RunTestsTask()
|
function RunTestsTask()
|
||||||
@@ -58,7 +59,7 @@ function RunTestsTask()
|
|||||||
end if
|
end if
|
||||||
|
|
||||||
m.testingTask = StartAsyncTask(InvidiousInstanceTestingTask, {
|
m.testingTask = StartAsyncTask(InvidiousInstanceTestingTask, {
|
||||||
instance: m.top.instance,
|
instance: m.top.instance
|
||||||
listNode: m.testList
|
listNode: m.testList
|
||||||
})
|
})
|
||||||
end function
|
end function
|
||||||
|
|||||||
+63
-3
@@ -1,4 +1,5 @@
|
|||||||
import "pkg:/components/Services/Invidious/InvidiousService.bs"
|
import "pkg:/components/Services/Invidious/InvidiousService.bs"
|
||||||
|
import "pkg:/components/Services/Invidious/InvidiousToContentNode.bs"
|
||||||
import "pkg:/source/services/HttpClient.bs"
|
import "pkg:/source/services/HttpClient.bs"
|
||||||
import "pkg:/source/utils/ErrorUtils.bs"
|
import "pkg:/source/utils/ErrorUtils.bs"
|
||||||
import "pkg:/source/utils/StringUtils.bs"
|
import "pkg:/source/utils/StringUtils.bs"
|
||||||
@@ -29,6 +30,7 @@ function PrepareTests() as object
|
|||||||
content.AppendChild(CreateTestNode("Fetch video details", CanFetchVideoDetails))
|
content.AppendChild(CreateTestNode("Fetch video details", CanFetchVideoDetails))
|
||||||
content.AppendChild(CreateTestNode("Fetch video comments", CanFetchVideoComments))
|
content.AppendChild(CreateTestNode("Fetch video comments", CanFetchVideoComments))
|
||||||
content.AppendChild(CreateTestNode("Fetch video captions", CanFetchVideoCaptions))
|
content.AppendChild(CreateTestNode("Fetch video captions", CanFetchVideoCaptions))
|
||||||
|
content.AppendChild(CreateTestNode("Fetch video thumbnails", CanFetchVideoThumbails))
|
||||||
return content
|
return content
|
||||||
end function
|
end function
|
||||||
|
|
||||||
@@ -36,9 +38,9 @@ function CreateTestNode(title as string, func as function) as object
|
|||||||
testNode = CreateObject("roSGNode", "ContentNode")
|
testNode = CreateObject("roSGNode", "ContentNode")
|
||||||
testNode.title = title
|
testNode.title = title
|
||||||
testNode.AddFields({
|
testNode.AddFields({
|
||||||
func: FuncName(func),
|
func: FuncName(func)
|
||||||
state: "loading",
|
state: "loading"
|
||||||
details: "",
|
details: ""
|
||||||
duration: 0
|
duration: 0
|
||||||
})
|
})
|
||||||
m[testNode.func] = func
|
m[testNode.func] = func
|
||||||
@@ -251,3 +253,61 @@ function CanFetchVideoCaptions(instance as string, testNode as object) as void
|
|||||||
testNode.details = ErrorUtils.Format(e)
|
testNode.details = ErrorUtils.Format(e)
|
||||||
end try
|
end try
|
||||||
end function
|
end function
|
||||||
|
|
||||||
|
function CanFetchVideoThumbails(instance as string, testNode as object) as void
|
||||||
|
try
|
||||||
|
videoId = "jNQXAC9IVRw"
|
||||||
|
url = `${instance}${Invidious.VIDEOS_ENDPOINT}/${videoId}`
|
||||||
|
response = HttpClient.Get(url).NoCache().Await()
|
||||||
|
|
||||||
|
if not response.IsSuccess()
|
||||||
|
testNode.state = "failed"
|
||||||
|
testNode.details = response.ErrorMessage()
|
||||||
|
return
|
||||||
|
end if
|
||||||
|
|
||||||
|
json = response.Json()
|
||||||
|
if json = invalid
|
||||||
|
testNode.state = "failed"
|
||||||
|
testNode.details = `Invalid json from ${url}`
|
||||||
|
return
|
||||||
|
end if
|
||||||
|
|
||||||
|
videoThumbnails = json.videoThumbnails
|
||||||
|
if not IsArray(videoThumbnails) or videoThumbnails.Count() = 0
|
||||||
|
testNode.state = "failed"
|
||||||
|
testNode.details = `No thumbnails found in json from ${url}`
|
||||||
|
return
|
||||||
|
end if
|
||||||
|
|
||||||
|
contentNode = InvidiousContent.ToVideoContentNode(invalid, json, instance)
|
||||||
|
thumbnail = contentNode.thumbnail
|
||||||
|
if StringUtils.IsNullOrEmpty(thumbnail)
|
||||||
|
testNode.state = "failed"
|
||||||
|
testNode.details = `No thumbnail found in json from ${url}`
|
||||||
|
return
|
||||||
|
end if
|
||||||
|
|
||||||
|
' Note: we could do a HEAD request, but Invidious returns 200 even for invalid thumbnails
|
||||||
|
' To make sure we don't get a 200 for an invalid thumbnail, we do a GET request instead
|
||||||
|
response = HttpClient.Get(thumbnail).NoCache().Await()
|
||||||
|
if not response.IsSuccess()
|
||||||
|
testNode.state = "failed"
|
||||||
|
testNode.details = `${thumbnail} is not reachable\n${response.ErrorMessage(false)}`
|
||||||
|
return
|
||||||
|
end if
|
||||||
|
|
||||||
|
contentType = response.Headers()["Content-Type"]
|
||||||
|
if StringUtils.IsNullOrEmpty(contentType) or not contentType.StartsWith("image/")
|
||||||
|
testNode.state = "failed"
|
||||||
|
testNode.details = `Invalid thumbnail data ${thumbnail} (Content-Type is not image/*)`
|
||||||
|
return
|
||||||
|
end if
|
||||||
|
|
||||||
|
testNode.state = "passed"
|
||||||
|
testNode.details = `The instance can fetch video thumbnail for id "${videoId}" (${thumbnail})`
|
||||||
|
catch e
|
||||||
|
testNode.state = "failed"
|
||||||
|
testNode.details = ErrorUtils.Format(e)
|
||||||
|
end try
|
||||||
|
end function
|
||||||
+1
-1
@@ -12,7 +12,7 @@
|
|||||||
translation="[190,60]" />
|
translation="[190,60]" />
|
||||||
<Button
|
<Button
|
||||||
id="refreshButton"
|
id="refreshButton"
|
||||||
minWidth="0"
|
minWidth="180"
|
||||||
text="Refresh"
|
text="Refresh"
|
||||||
translation="[340,130]" />
|
translation="[340,130]" />
|
||||||
|
|
||||||
|
|||||||
+53
-15
@@ -1,5 +1,6 @@
|
|||||||
import "pkg:/components/Services/Invidious/InvidiousService.bs"
|
import "pkg:/components/Services/Invidious/InvidiousService.bs"
|
||||||
import "pkg:/source/services/HttpClient.bs"
|
import "pkg:/source/services/HttpClient.bs"
|
||||||
|
import "pkg:/source/utils/Logging.bs"
|
||||||
|
|
||||||
@asynctask
|
@asynctask
|
||||||
function InvidiousPublicInstancesTask(input as object) as object
|
function InvidiousPublicInstancesTask(input as object) as object
|
||||||
@@ -14,7 +15,7 @@ function InvidiousPublicInstancesTask(input as object) as object
|
|||||||
|
|
||||||
if not response.IsSuccess() or instances = invalid
|
if not response.IsSuccess() or instances = invalid
|
||||||
return {
|
return {
|
||||||
success: false,
|
success: false
|
||||||
error: response.ErrorMessage()
|
error: response.ErrorMessage()
|
||||||
}
|
}
|
||||||
end if
|
end if
|
||||||
@@ -28,18 +29,10 @@ function InvidiousPublicInstancesTask(input as object) as object
|
|||||||
content = CreateObject("roSGNode", "ContentNode")
|
content = CreateObject("roSGNode", "ContentNode")
|
||||||
|
|
||||||
for each instance in instances
|
for each instance in instances
|
||||||
item = CreateObject("roSGNode", "InvidiousPublicInstancesListItemContent")
|
item = CreateListItemContent(instance)
|
||||||
item.setFields({
|
if item = invalid
|
||||||
name: instance[0],
|
continue for
|
||||||
version: instance[1].stats.software.version,
|
end if
|
||||||
users: instance[1].stats.usage.users.total,
|
|
||||||
signup: instance[1].stats.openRegistrations ? "Yes" : "No",
|
|
||||||
' Leave 5 spaces for the flag, just to simplify the layout
|
|
||||||
location: ` ${instance[1].region}`,
|
|
||||||
flag: GetFlagUrl(instance[1].flag),
|
|
||||||
health: instance[1].monitor["30dRatio"].ratio,
|
|
||||||
uri: instance[1].uri
|
|
||||||
})
|
|
||||||
content.AppendChild(item)
|
content.AppendChild(item)
|
||||||
end for
|
end for
|
||||||
|
|
||||||
@@ -54,6 +47,11 @@ function FilterInstances(instances as object) as object
|
|||||||
filtered = []
|
filtered = []
|
||||||
|
|
||||||
for each instance in instances
|
for each instance in instances
|
||||||
|
if not IsArray(instance) or instance.Count() < 2
|
||||||
|
LogWarn("Invalid instance:", instance)
|
||||||
|
continue for
|
||||||
|
end if
|
||||||
|
|
||||||
flags = instance[1]
|
flags = instance[1]
|
||||||
if flags.type = "https" and flags.api = true and flags.cors = true
|
if flags.type = "https" and flags.api = true and flags.cors = true
|
||||||
filtered.Push(instance)
|
filtered.Push(instance)
|
||||||
@@ -63,12 +61,52 @@ function FilterInstances(instances as object) as object
|
|||||||
return filtered
|
return filtered
|
||||||
end function
|
end function
|
||||||
|
|
||||||
|
function CreateListItemContent(instance as object) as object
|
||||||
|
if not IsArray(instance) or instance.Count() < 2
|
||||||
|
LogWarn("Invalid instance:", instance)
|
||||||
|
return invalid
|
||||||
|
end if
|
||||||
|
|
||||||
|
item = CreateObject("roSGNode", "InvidiousPublicInstancesListItemContent")
|
||||||
|
item.setFields({
|
||||||
|
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"
|
||||||
|
' 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
|
||||||
|
})
|
||||||
|
|
||||||
|
return item
|
||||||
|
end function
|
||||||
|
|
||||||
|
function DrillIntoObject(obj as object, path as object, defaultValue as dynamic) as dynamic
|
||||||
|
if obj = invalid
|
||||||
|
return defaultValue
|
||||||
|
end if
|
||||||
|
|
||||||
|
for each key in path
|
||||||
|
if obj[key] = invalid
|
||||||
|
return defaultValue
|
||||||
|
end if
|
||||||
|
obj = obj[key]
|
||||||
|
end for
|
||||||
|
|
||||||
|
return obj
|
||||||
|
end function
|
||||||
|
|
||||||
function GetFlagUrl(flag as string) as string
|
function GetFlagUrl(flag as string) as string
|
||||||
codePoint = emojiToCodePoint(flag)
|
if flag = ""
|
||||||
|
return ""
|
||||||
|
end if
|
||||||
|
codePoint = EmojiToCodePoint(flag)
|
||||||
return `https://github.githubassets.com/images/icons/emoji/unicode/${codePoint}.png?v8`
|
return `https://github.githubassets.com/images/icons/emoji/unicode/${codePoint}.png?v8`
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function emojiToCodePoint(emoji as string) as string
|
function EmojiToCodePoint(emoji as string) as string
|
||||||
codes = []
|
codes = []
|
||||||
chars = emoji.Split("")
|
chars = emoji.Split("")
|
||||||
for i = 0 to chars.count() - 1
|
for i = 0 to chars.count() - 1
|
||||||
|
|||||||
@@ -8,9 +8,9 @@ function Init()
|
|||||||
m.scrollAnimation = m.top.findNode("scrollAnimation")
|
m.scrollAnimation = m.top.findNode("scrollAnimation")
|
||||||
m.scrollAnimationInterpolator = m.scrollAnimation.findNode("scrollAnimationInterpolator")
|
m.scrollAnimationInterpolator = m.scrollAnimation.findNode("scrollAnimationInterpolator")
|
||||||
m.viewport = {
|
m.viewport = {
|
||||||
x: 150,
|
x: 150
|
||||||
y: 96,
|
y: 96
|
||||||
width: 1920,
|
width: 1920
|
||||||
height: 550
|
height: 550
|
||||||
}
|
}
|
||||||
end function
|
end function
|
||||||
@@ -75,7 +75,7 @@ function CreateCategoryNode(item as object, container as object, startX as integ
|
|||||||
node.displayText = item.displayText
|
node.displayText = item.displayText
|
||||||
node.description = item.description
|
node.description = item.description
|
||||||
return {
|
return {
|
||||||
node: node,
|
node: node
|
||||||
rect: node.boundingRect()
|
rect: node.boundingRect()
|
||||||
}
|
}
|
||||||
end function
|
end function
|
||||||
@@ -107,11 +107,11 @@ function CreateControls(item as object, container as object, startX as integer,
|
|||||||
end for
|
end for
|
||||||
|
|
||||||
return {
|
return {
|
||||||
nodes: nodes,
|
nodes: nodes
|
||||||
rect: {
|
rect: {
|
||||||
x: x,
|
x: x
|
||||||
y: y,
|
y: y
|
||||||
width: width,
|
width: width
|
||||||
height: height
|
height: height
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -137,12 +137,12 @@ function CreateControl(item as object, container as object, startX as integer, s
|
|||||||
control.id = `preference.${item.key}`
|
control.id = `preference.${item.key}`
|
||||||
control.translation = [startX, startY]
|
control.translation = [startX, startY]
|
||||||
if control.hasField("binding_done")
|
if control.hasField("binding_done")
|
||||||
control@.BindNode(invalid)
|
control@.BindNode()
|
||||||
end if
|
end if
|
||||||
control@.BindPreference(m.preferences, item.key)
|
control@.BindPreference(m.preferences, item.key)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
node: control,
|
node: control
|
||||||
rect: control.boundingRect()
|
rect: control.boundingRect()
|
||||||
}
|
}
|
||||||
end function
|
end function
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import "pkg:/components/Dialog/DialogPalette.bs"
|
||||||
import "pkg:/source/utils/FocusManagement.bs"
|
import "pkg:/source/utils/FocusManagement.bs"
|
||||||
import "pkg:/source/utils/Types.bs"
|
import "pkg:/source/utils/Types.bs"
|
||||||
|
|
||||||
@@ -65,6 +66,7 @@ end function
|
|||||||
|
|
||||||
function ShowEditKeyboard()
|
function ShowEditKeyboard()
|
||||||
keyboardDialog = createObject("roSGNode", "StandardKeyboardDialog")
|
keyboardDialog = createObject("roSGNode", "StandardKeyboardDialog")
|
||||||
|
SetPalette(keyboardDialog)
|
||||||
keyboardDialog.title = m.top.displayText
|
keyboardDialog.title = m.top.displayText
|
||||||
keyboardDialog.message = [m.top.description]
|
keyboardDialog.message = [m.top.description]
|
||||||
keyboardDialog.text = m.top.value
|
keyboardDialog.text = m.top.value
|
||||||
|
|||||||
@@ -6,13 +6,13 @@ function Init()
|
|||||||
end function
|
end function
|
||||||
|
|
||||||
function OnNodeReady()
|
function OnNodeReady()
|
||||||
address = m.webserver@.GetServerAddress(invalid)
|
address = m.webserver@.GetServerAddress()
|
||||||
isValidIp = not StringUtils.IsNullOrEmpty(address)
|
isValidAddress = not StringUtils.IsNullOrEmpty(address)
|
||||||
if isValidIp
|
if isValidAddress
|
||||||
m.top.url = address
|
m.top.url = address
|
||||||
end if
|
end if
|
||||||
m.top.findNode("noInternet").visible = not isValidIp
|
m.top.findNode("noInternet").visible = not isValidAddress
|
||||||
m.top.findNode("yesInternet").visible = isValidIp
|
m.top.findNode("yesInternet").visible = isValidAddress
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function OnUrlSet()
|
function OnUrlSet()
|
||||||
@@ -23,9 +23,9 @@ function OnUrlSet()
|
|||||||
|
|
||||||
qrCodePoster = m.top.findNode("QrCodePoster")
|
qrCodePoster = m.top.findNode("QrCodePoster")
|
||||||
StartAsyncTask(GenerateQrCodeTask, {
|
StartAsyncTask(GenerateQrCodeTask, {
|
||||||
poster: qrCodePoster,
|
poster: qrCodePoster
|
||||||
text: url,
|
text: url
|
||||||
size: qrCodePoster.loadWidth,
|
size: qrCodePoster.loadWidth
|
||||||
padding: 20
|
padding: 20
|
||||||
})
|
})
|
||||||
end function
|
end function
|
||||||
@@ -7,23 +7,23 @@ function Init()
|
|||||||
m.service = new ApplicationInfo(m.top)
|
m.service = new ApplicationInfo(m.top)
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function GetAppInfo(unused as dynamic) as object
|
function GetAppInfo(_unused as dynamic) as object
|
||||||
return m.service.GetAppInfo()
|
return m.service.GetAppInfo()
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function GetDeviceInfo(unused as dynamic) as object
|
function GetDeviceInfo(_unused as dynamic) as object
|
||||||
return m.service.GetDeviceInfo()
|
return m.service.GetDeviceInfo()
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function GetUserCountryCode(unused as dynamic) as string
|
function GetUserCountryCode(_unused as dynamic) as string
|
||||||
return m.service.GetUserCountryCode()
|
return m.service.GetUserCountryCode()
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function GetLocalIpAddress(unused as dynamic) as dynamic
|
function GetLocalIpAddress(_unused as dynamic) as dynamic
|
||||||
return m.service.GetLocalIpAddress()
|
return m.service.GetLocalIpAddress()
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function GetLatestPlayletLibVersion(unused as dynamic) as dynamic
|
function GetLatestPlayletLibVersion(_unused as dynamic) as dynamic
|
||||||
if not StringUtils.IsNullOrEmpty(m.top.lib_version_latest)
|
if not StringUtils.IsNullOrEmpty(m.top.lib_version_latest)
|
||||||
return m.top.lib_version_latest
|
return m.top.lib_version_latest
|
||||||
end if
|
end if
|
||||||
|
|||||||
@@ -53,18 +53,18 @@ function Save() as void
|
|||||||
bookmarkNodes = bookmarkGroupNode.getChildren(-1, 0)
|
bookmarkNodes = bookmarkGroupNode.getChildren(-1, 0)
|
||||||
for each bookmarkNode in bookmarkNodes
|
for each bookmarkNode in bookmarkNodes
|
||||||
bookmarks.push({
|
bookmarks.push({
|
||||||
"id": bookmarkNode.id,
|
"id": bookmarkNode.id
|
||||||
"feedSource": bookmarkNode.feedSource
|
"feedSource": bookmarkNode.feedSource
|
||||||
})
|
})
|
||||||
end for
|
end for
|
||||||
groups.push({
|
groups.push({
|
||||||
"title": bookmarkGroupNode.title,
|
"title": bookmarkGroupNode.title
|
||||||
"bookmarks": bookmarks
|
"bookmarks": bookmarks
|
||||||
})
|
})
|
||||||
end for
|
end for
|
||||||
|
|
||||||
bookmarksString = FormatJson({
|
bookmarksString = FormatJson({
|
||||||
"__version": m.top.__version,
|
"__version": m.top.__version
|
||||||
"groups": groups
|
"groups": groups
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -110,8 +110,8 @@ function AddVideoBookmark(id as string, groupName as string)
|
|||||||
bookmarkGroupNode = GetOrCreateBookmarkGroup(groupName)
|
bookmarkGroupNode = GetOrCreateBookmarkGroup(groupName)
|
||||||
|
|
||||||
feedSource = {
|
feedSource = {
|
||||||
"apiType": "Invidious",
|
"apiType": "Invidious"
|
||||||
"endpoint": "video_info",
|
"endpoint": "video_info"
|
||||||
"pathParams": {
|
"pathParams": {
|
||||||
"id": id
|
"id": id
|
||||||
}
|
}
|
||||||
@@ -123,8 +123,8 @@ function AddPlaylistBookmark(id as string, groupName as string)
|
|||||||
bookmarkGroupNode = GetOrCreateBookmarkGroup(groupName)
|
bookmarkGroupNode = GetOrCreateBookmarkGroup(groupName)
|
||||||
|
|
||||||
feedSource = {
|
feedSource = {
|
||||||
"apiType": "Invidious",
|
"apiType": "Invidious"
|
||||||
"endpoint": "playlist_info",
|
"endpoint": "playlist_info"
|
||||||
"pathParams": {
|
"pathParams": {
|
||||||
"plid": id
|
"plid": id
|
||||||
}
|
}
|
||||||
@@ -136,10 +136,10 @@ function AddPlaylistBookmarkWithSpread(id as string, groupName as string)
|
|||||||
bookmarkGroupNode = GetOrCreateBookmarkGroup(groupName)
|
bookmarkGroupNode = GetOrCreateBookmarkGroup(groupName)
|
||||||
|
|
||||||
feedSource = {
|
feedSource = {
|
||||||
"id": `inv_playlist_${id}`,
|
"id": `inv_playlist_${id}`
|
||||||
"title": `${groupName} videos`,
|
"title": `${groupName} videos`
|
||||||
"apiType": "Invidious",
|
"apiType": "Invidious"
|
||||||
"endpoint": "playlist",
|
"endpoint": "playlist"
|
||||||
"pathParams": {
|
"pathParams": {
|
||||||
"plid": id
|
"plid": id
|
||||||
}
|
}
|
||||||
@@ -147,8 +147,8 @@ function AddPlaylistBookmarkWithSpread(id as string, groupName as string)
|
|||||||
AddFeedSourceBookmark(feedSource, `inv_playlist_${id}`, bookmarkGroupNode)
|
AddFeedSourceBookmark(feedSource, `inv_playlist_${id}`, bookmarkGroupNode)
|
||||||
|
|
||||||
feedSource = {
|
feedSource = {
|
||||||
"apiType": "Invidious",
|
"apiType": "Invidious"
|
||||||
"endpoint": "playlist_info",
|
"endpoint": "playlist_info"
|
||||||
"pathParams": {
|
"pathParams": {
|
||||||
"plid": id
|
"plid": id
|
||||||
}
|
}
|
||||||
@@ -160,8 +160,8 @@ function AddChannelBookmark(id as string, groupName as string)
|
|||||||
bookmarkGroupNode = GetOrCreateBookmarkGroup(groupName)
|
bookmarkGroupNode = GetOrCreateBookmarkGroup(groupName)
|
||||||
|
|
||||||
feedSource = {
|
feedSource = {
|
||||||
"apiType": "Invidious",
|
"apiType": "Invidious"
|
||||||
"endpoint": "channel_info",
|
"endpoint": "channel_info"
|
||||||
"pathParams": {
|
"pathParams": {
|
||||||
"ucid": id
|
"ucid": id
|
||||||
}
|
}
|
||||||
@@ -173,10 +173,10 @@ function AddChannelBookmarkWithSpread(id as string, groupName as string)
|
|||||||
bookmarkGroupNode = GetOrCreateBookmarkGroup(groupName)
|
bookmarkGroupNode = GetOrCreateBookmarkGroup(groupName)
|
||||||
|
|
||||||
feedSource = {
|
feedSource = {
|
||||||
"id": `inv_channel_videos_${id}`,
|
"id": `inv_channel_videos_${id}`
|
||||||
"title": `${groupName} videos`,
|
"title": `${groupName} videos`
|
||||||
"apiType": "Invidious",
|
"apiType": "Invidious"
|
||||||
"endpoint": "channel_videos",
|
"endpoint": "channel_videos"
|
||||||
"pathParams": {
|
"pathParams": {
|
||||||
"ucid": id
|
"ucid": id
|
||||||
}
|
}
|
||||||
@@ -184,8 +184,8 @@ function AddChannelBookmarkWithSpread(id as string, groupName as string)
|
|||||||
AddFeedSourceBookmark(feedSource, `inv_channel_videos_${id}`, bookmarkGroupNode)
|
AddFeedSourceBookmark(feedSource, `inv_channel_videos_${id}`, bookmarkGroupNode)
|
||||||
|
|
||||||
feedSource = {
|
feedSource = {
|
||||||
"apiType": "Invidious",
|
"apiType": "Invidious"
|
||||||
"endpoint": "channel_info",
|
"endpoint": "channel_info"
|
||||||
"pathParams": {
|
"pathParams": {
|
||||||
"ucid": id
|
"ucid": id
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import "pkg:/components/Web/WebServer/Http/HttpUtils.bs"
|
import "pkg:/components/Web/WebServer/Http/HttpUtils.bs"
|
||||||
import "pkg:/source/services/XmlObject.bs"
|
import "pkg:/source/services/XmlObject.bs"
|
||||||
import "pkg:/source/utils/StringUtils.bs"
|
import "pkg:/source/utils/StringUtils.bs"
|
||||||
|
import "pkg:/source/utils/UrlUtils.bs"
|
||||||
|
|
||||||
class DashManifest
|
class DashManifest
|
||||||
|
|
||||||
@@ -33,10 +34,10 @@ class DashManifest
|
|||||||
xml = new XmlObject()
|
xml = new XmlObject()
|
||||||
|
|
||||||
if xml.Node("MPD", {
|
if xml.Node("MPD", {
|
||||||
"xmlns": "urn:mpeg:dash:schema:mpd:2011",
|
"xmlns": "urn:mpeg:dash:schema:mpd:2011"
|
||||||
"profiles": "urn:mpeg:dash:profile:full:2011",
|
"profiles": "urn:mpeg:dash:profile:full:2011"
|
||||||
"minBufferTime": "PT1.5S",
|
"minBufferTime": "PT1.5S"
|
||||||
"type": "static",
|
"type": "static"
|
||||||
"mediaPresentationDuration": `PT${metadata.lengthSeconds ?? 0}S`
|
"mediaPresentationDuration": `PT${metadata.lengthSeconds ?? 0}S`
|
||||||
})
|
})
|
||||||
if xml.Node("Period")
|
if xml.Node("Period")
|
||||||
@@ -44,9 +45,9 @@ class DashManifest
|
|||||||
id = 0
|
id = 0
|
||||||
for each audioSet in audioSets
|
for each audioSet in audioSets
|
||||||
adaptationSetAttributes = {
|
adaptationSetAttributes = {
|
||||||
"id": `${id}`,
|
"id": `${id}`
|
||||||
"mimeType": audioSet.mimeType,
|
"mimeType": audioSet.mimeType
|
||||||
"startWithSAP": "1",
|
"startWithSAP": "1"
|
||||||
"subsegmentAlignment": "true"
|
"subsegmentAlignment": "true"
|
||||||
}
|
}
|
||||||
if not StringUtils.IsNullOrEmpty(audioSet.lang)
|
if not StringUtils.IsNullOrEmpty(audioSet.lang)
|
||||||
@@ -55,7 +56,7 @@ class DashManifest
|
|||||||
|
|
||||||
if xml.Node("AdaptationSet", adaptationSetAttributes)
|
if xml.Node("AdaptationSet", adaptationSetAttributes)
|
||||||
xml.Node("Role", {
|
xml.Node("Role", {
|
||||||
"schemeIdUri": "urn:mpeg:dash:role:2011",
|
"schemeIdUri": "urn:mpeg:dash:role:2011"
|
||||||
"value": audioSet.acont = "original" ? "main" : "alternate"
|
"value": audioSet.acont = "original" ? "main" : "alternate"
|
||||||
})
|
})
|
||||||
xml.End()
|
xml.End()
|
||||||
@@ -76,13 +77,13 @@ class DashManifest
|
|||||||
end if
|
end if
|
||||||
|
|
||||||
if xml.Node("Representation", {
|
if xml.Node("Representation", {
|
||||||
"id": stream.itag,
|
"id": stream.itag
|
||||||
"codecs": codecs,
|
"codecs": codecs
|
||||||
"bandwidth": stream.bitrate
|
"bandwidth": stream.bitrate
|
||||||
})
|
})
|
||||||
|
|
||||||
xml.Node("AudioChannelConfiguration", {
|
xml.Node("AudioChannelConfiguration", {
|
||||||
"schemeIdUri": "urn:mpeg:dash:23003:3:audio_channel_configuration:2011",
|
"schemeIdUri": "urn:mpeg:dash:23003:3:audio_channel_configuration:2011"
|
||||||
"value": `${stream.audioChannels}`
|
"value": `${stream.audioChannels}`
|
||||||
})
|
})
|
||||||
xml.End()
|
xml.End()
|
||||||
@@ -114,9 +115,9 @@ class DashManifest
|
|||||||
|
|
||||||
for each mimeType in videoMimeTypes
|
for each mimeType in videoMimeTypes
|
||||||
if xml.Node("AdaptationSet", {
|
if xml.Node("AdaptationSet", {
|
||||||
"id": `${id}`,
|
"id": `${id}`
|
||||||
"mimeType": mimeType,
|
"mimeType": mimeType
|
||||||
"startWithSAP": "1",
|
"startWithSAP": "1"
|
||||||
"subsegmentAlignment": "true"
|
"subsegmentAlignment": "true"
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -136,10 +137,10 @@ class DashManifest
|
|||||||
end if
|
end if
|
||||||
|
|
||||||
representationAttributes = {
|
representationAttributes = {
|
||||||
"id": stream.itag,
|
"id": stream.itag
|
||||||
"codecs": codecs,
|
"codecs": codecs
|
||||||
"startWithSAP": "1",
|
"startWithSAP": "1"
|
||||||
"maxPlayoutRate": "1",
|
"maxPlayoutRate": "1"
|
||||||
"bandwidth": stream.bitrate
|
"bandwidth": stream.bitrate
|
||||||
}
|
}
|
||||||
if stream.width <> invalid
|
if stream.width <> invalid
|
||||||
@@ -225,26 +226,26 @@ class DashManifest
|
|||||||
bandwidth = ((storyboardWidthInPixels * storyboardHeightInPixels * 0.5) / duration)
|
bandwidth = ((storyboardWidthInPixels * storyboardHeightInPixels * 0.5) / duration)
|
||||||
|
|
||||||
if xml.Node("AdaptationSet", {
|
if xml.Node("AdaptationSet", {
|
||||||
"id": `${id}`,
|
"id": `${id}`
|
||||||
"mimeType": "image/jpeg",
|
"mimeType": "image/jpeg"
|
||||||
"contentType": "image"
|
"contentType": "image"
|
||||||
})
|
})
|
||||||
xml.Node("SegmentTemplate", {
|
xml.Node("SegmentTemplate", {
|
||||||
"media": url,
|
"media": url
|
||||||
"duration": duration,
|
"duration": duration
|
||||||
"startNumber": 0
|
"startNumber": 0
|
||||||
})
|
})
|
||||||
xml.End()
|
xml.End()
|
||||||
|
|
||||||
if xml.Node("Representation", {
|
if xml.Node("Representation", {
|
||||||
"id": `thumbnails_${id}`,
|
"id": `thumbnails_${id}`
|
||||||
"bandwidth": bandwidth,
|
"bandwidth": bandwidth
|
||||||
"width": storyboardWidthInPixels,
|
"width": storyboardWidthInPixels
|
||||||
"height": storyboardHeightInPixels
|
"height": storyboardHeightInPixels
|
||||||
})
|
})
|
||||||
|
|
||||||
xml.Node("EssentialProperty", {
|
xml.Node("EssentialProperty", {
|
||||||
"schemeIdUri": "http://dashif.org/guidelines/thumbnail_tile",
|
"schemeIdUri": "http://dashif.org/guidelines/thumbnail_tile"
|
||||||
"value": `${storyboardWidth}x${storyboardHeight}`
|
"value": `${storyboardWidth}x${storyboardHeight}`
|
||||||
})
|
})
|
||||||
xml.End()
|
xml.End()
|
||||||
@@ -333,8 +334,8 @@ class DashManifest
|
|||||||
stream = streams[i]
|
stream = streams[i]
|
||||||
mimeType = stream.type.Tokenize(";")[0]
|
mimeType = stream.type.Tokenize(";")[0]
|
||||||
types[`${mimeType}-${stream.languageInfo.lang}-${stream.languageInfo.acont}`] = {
|
types[`${mimeType}-${stream.languageInfo.lang}-${stream.languageInfo.acont}`] = {
|
||||||
"mimeType": mimeType,
|
"mimeType": mimeType
|
||||||
"lang": stream.languageInfo.lang,
|
"lang": stream.languageInfo.lang
|
||||||
"acont": stream.languageInfo.acont
|
"acont": stream.languageInfo.acont
|
||||||
}
|
}
|
||||||
end for
|
end for
|
||||||
@@ -349,7 +350,7 @@ class DashManifest
|
|||||||
|
|
||||||
function ParseAudioLanguage(url as string) as object
|
function ParseAudioLanguage(url as string) as object
|
||||||
result = { lang: "", acont: "" }
|
result = { lang: "", acont: "" }
|
||||||
queryParams = m.utils.ParseUrlQueryComponents(url)
|
queryParams = UrlUtils.ParseQueryComponents(url)
|
||||||
if StringUtils.IsNullOrEmpty(queryParams["xtags"])
|
if StringUtils.IsNullOrEmpty(queryParams["xtags"])
|
||||||
return result
|
return result
|
||||||
end if
|
end if
|
||||||
|
|||||||
@@ -8,11 +8,11 @@ function Init()
|
|||||||
m.top.authToken = m.service.GetAuthToken()
|
m.top.authToken = m.service.GetAuthToken()
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function GetCurrentInstance(unused as dynamic) as string
|
function GetCurrentInstance(_unused as dynamic) as string
|
||||||
return m.service.GetInstance()
|
return m.service.GetInstance()
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function GetAuthorizeTokenLink(unused as dynamic) as dynamic
|
function GetAuthorizeTokenLink(_unused as dynamic) as dynamic
|
||||||
return m.service.GetAuthorizeTokenLink()
|
return m.service.GetAuthorizeTokenLink()
|
||||||
end function
|
end function
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
|
import "pkg:/components/Dialog/DialogUtils.bs"
|
||||||
|
import "pkg:/components/Services/Invidious/InvidiousUnregisterTokenTask.bs"
|
||||||
import "pkg:/components/VideoFeed/PaginationType.bs"
|
import "pkg:/components/VideoFeed/PaginationType.bs"
|
||||||
|
import "pkg:/source/asyncTask/asyncTask.bs"
|
||||||
import "pkg:/source/services/HttpClient.bs"
|
import "pkg:/source/services/HttpClient.bs"
|
||||||
import "pkg:/source/utils/CryptoUtils.bs"
|
import "pkg:/source/utils/CryptoUtils.bs"
|
||||||
import "pkg:/source/utils/Logging.bs"
|
import "pkg:/source/utils/Logging.bs"
|
||||||
@@ -22,7 +25,7 @@ namespace Invidious
|
|||||||
|
|
||||||
const SEARCH_SUGGEST_ENDPOINT = "/api/v1/search/suggestions"
|
const SEARCH_SUGGEST_ENDPOINT = "/api/v1/search/suggestions"
|
||||||
|
|
||||||
const AUTH_SCOPES = "GET:feed,GET:playlists*,POST:tokens/*,POST:history*,:subscriptions*"
|
const AUTH_SCOPES = "GET:feed,GET:playlists*,POST:tokens/*,:history*,:subscriptions*"
|
||||||
|
|
||||||
const AUTH_PLAYLISTS = "/api/v1/auth/playlists"
|
const AUTH_PLAYLISTS = "/api/v1/auth/playlists"
|
||||||
const AUTH_SUBSCRIPTIONS = "/api/v1/auth/subscriptions"
|
const AUTH_SUBSCRIPTIONS = "/api/v1/auth/subscriptions"
|
||||||
@@ -42,21 +45,22 @@ namespace Invidious
|
|||||||
m.endpoints = node.apiDefinitions
|
m.endpoints = node.apiDefinitions
|
||||||
|
|
||||||
m.responseHanlders = {
|
m.responseHanlders = {
|
||||||
DefaultHandler: m.DefaultHandler,
|
DefaultHandler: m.DefaultHandler
|
||||||
AuthFeedHandler: m.AuthFeedHandler,
|
AuthFeedHandler: m.AuthFeedHandler
|
||||||
PlaylistHandler: m.PlaylistHandler,
|
PlaylistHandler: m.PlaylistHandler
|
||||||
VideoInfoHandler: m.VideoInfoHandler,
|
VideoInfoHandler: m.VideoInfoHandler
|
||||||
PlaylistInfoHandler: m.PlaylistInfoHandler,
|
PlaylistInfoHandler: m.PlaylistInfoHandler
|
||||||
ChannelInfoHandler: m.ChannelInfoHandler,
|
ChannelInfoHandler: m.ChannelInfoHandler
|
||||||
ChannelVideosHandler: m.ChannelVideosHandler,
|
ChannelVideosHandler: m.ChannelVideosHandler
|
||||||
ChannelPlaylistsHandler: m.ChannelPlaylistsHandler,
|
ChannelPlaylistsHandler: m.ChannelPlaylistsHandler
|
||||||
ChannelRelatedChannelsHandler: m.ChannelRelatedChannelsHandler
|
ChannelRelatedChannelsHandler: m.ChannelRelatedChannelsHandler
|
||||||
|
WatchHistoryHandler: m.WatchHistoryHandler
|
||||||
}
|
}
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function DefaultQueryParams() as object
|
function DefaultQueryParams() as object
|
||||||
return {
|
return {
|
||||||
region: m.node.applicationInfo@.GetUserCountryCode(invalid)
|
region: m.node.applicationInfo@.GetUserCountryCode()
|
||||||
}
|
}
|
||||||
end function
|
end function
|
||||||
|
|
||||||
@@ -98,11 +102,7 @@ namespace Invidious
|
|||||||
request = HttpClient.Get(url)
|
request = HttpClient.Get(url)
|
||||||
request.QueryParams(m.DefaultQueryParams())
|
request.QueryParams(m.DefaultQueryParams())
|
||||||
request.QueryParam("q", q)
|
request.QueryParam("q", q)
|
||||||
' 5 hours cache. Videos should expire in 6 hours, but since we don't
|
request.CacheSeconds(60 * 60 * 24)
|
||||||
' have the exact expiration time, we'll use 5 hours. Invidious currently
|
|
||||||
' Does a fresh fetch if the cache is older than 10 minutes.
|
|
||||||
' https://github.com/iv-org/invidious/blob/069e91d2a609b1df94bdfbb693335969b2a281d8/src/invidious/videos.cr#L349
|
|
||||||
request.CacheSeconds(60 * 60 * 5)
|
|
||||||
|
|
||||||
request.Cancellation(cancellation)
|
request.Cancellation(cancellation)
|
||||||
|
|
||||||
@@ -116,7 +116,11 @@ namespace Invidious
|
|||||||
|
|
||||||
request = HttpClient.Get(url)
|
request = HttpClient.Get(url)
|
||||||
request.QueryParams(m.DefaultQueryParams())
|
request.QueryParams(m.DefaultQueryParams())
|
||||||
request.CacheSeconds(60 * 60 * 6)' 6 hours
|
' 5 hours cache. Videos should expire in 6 hours, but since we don't
|
||||||
|
' have the exact expiration time, we'll use 5 hours. Invidious currently
|
||||||
|
' Does a fresh fetch if the cache is older than 10 minutes.
|
||||||
|
' https://github.com/iv-org/invidious/blob/069e91d2a609b1df94bdfbb693335969b2a281d8/src/invidious/videos.cr#L349
|
||||||
|
request.CacheSeconds(60 * 60 * 5)
|
||||||
request.Cancellation(cancellation)
|
request.Cancellation(cancellation)
|
||||||
|
|
||||||
return request.Await()
|
return request.Await()
|
||||||
@@ -154,9 +158,13 @@ namespace Invidious
|
|||||||
return request.Await()
|
return request.Await()
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function GetVideoStreamUrl(videoId as string) as string
|
function GetVideoStreamUrl(videoId as string, itag = invalid as dynamic) as string
|
||||||
instance = m.GetInstance()
|
instance = m.GetInstance()
|
||||||
return `${instance}/latest_version?id=${videoId}`
|
url = `${instance}/latest_version?id=${videoId}`
|
||||||
|
if itag <> invalid
|
||||||
|
url = `${url}&itag=${itag}`
|
||||||
|
end if
|
||||||
|
return url
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function MarkFeedPagination(feedContentNode as object) as object
|
function MarkFeedPagination(feedContentNode as object) as object
|
||||||
@@ -201,7 +209,7 @@ namespace Invidious
|
|||||||
endpoint = m.endpoints[feedSource.endpoint]
|
endpoint = m.endpoints[feedSource.endpoint]
|
||||||
if endpoint = invalid
|
if endpoint = invalid
|
||||||
return {
|
return {
|
||||||
success: false,
|
success: false
|
||||||
error: `Endpoint ${feedSource.endpoint} not found`
|
error: `Endpoint ${feedSource.endpoint} not found`
|
||||||
}
|
}
|
||||||
end if
|
end if
|
||||||
@@ -214,7 +222,7 @@ namespace Invidious
|
|||||||
authToken = m.node.authToken
|
authToken = m.node.authToken
|
||||||
if authToken = invalid
|
if authToken = invalid
|
||||||
return {
|
return {
|
||||||
success: false,
|
success: false
|
||||||
error: ERROR_NOT_AUTHENTICATED
|
error: ERROR_NOT_AUTHENTICATED
|
||||||
}
|
}
|
||||||
end if
|
end if
|
||||||
@@ -228,16 +236,12 @@ namespace Invidious
|
|||||||
if queryParam.default <> invalid
|
if queryParam.default <> invalid
|
||||||
if IsString(queryParam.type) and queryParam.type = "#ISO3166"
|
if IsString(queryParam.type) and queryParam.type = "#ISO3166"
|
||||||
if queryParam.default = "GetUserCountryCode"
|
if queryParam.default = "GetUserCountryCode"
|
||||||
request.QueryParam(queryParamKey, m.node.applicationInfo@.GetUserCountryCode(invalid))
|
request.QueryParam(queryParamKey, m.node.applicationInfo@.GetUserCountryCode())
|
||||||
else
|
else
|
||||||
request.QueryParam(queryParamKey, queryParam.default)
|
request.QueryParam(queryParamKey, queryParam.default)
|
||||||
end if
|
end if
|
||||||
else if IsArray(queryParam.default)
|
else if IsArray(queryParam.default) and queryParam.arrayType <> invalid
|
||||||
if queryParam.arrayType = "repeat"
|
request.QueryParamArray(queryParamKey, queryParam.default, queryParam.arrayType)
|
||||||
request.QueryParamArray(queryParamKey, queryParam.default, HttpClient.QueryParamArrayType.Repeated)
|
|
||||||
else if queryParam.arrayType = "comma-separated"
|
|
||||||
request.QueryParamArray(queryParamKey, queryParam.default, HttpClient.QueryParamArrayType.CommaSeparated)
|
|
||||||
end if
|
|
||||||
else
|
else
|
||||||
request.QueryParam(queryParamKey, queryParam.default)
|
request.QueryParam(queryParamKey, queryParam.default)
|
||||||
end if
|
end if
|
||||||
@@ -279,12 +283,12 @@ namespace Invidious
|
|||||||
|
|
||||||
if response.IsSuccess() and result <> invalid
|
if response.IsSuccess() and result <> invalid
|
||||||
return {
|
return {
|
||||||
success: true,
|
success: true
|
||||||
result: result
|
result: result
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return {
|
return {
|
||||||
success: false,
|
success: false
|
||||||
error: response.ErrorMessage()
|
error: response.ErrorMessage()
|
||||||
}
|
}
|
||||||
end if
|
end if
|
||||||
@@ -314,7 +318,7 @@ namespace Invidious
|
|||||||
if response.StatusCode() = 200
|
if response.StatusCode() = 200
|
||||||
json = response.Json()
|
json = response.Json()
|
||||||
return {
|
return {
|
||||||
items: json.videos,
|
items: json.videos
|
||||||
continuation: json.continuation
|
continuation: json.continuation
|
||||||
}
|
}
|
||||||
end if
|
end if
|
||||||
@@ -325,7 +329,7 @@ namespace Invidious
|
|||||||
if response.StatusCode() = 200
|
if response.StatusCode() = 200
|
||||||
json = response.Json()
|
json = response.Json()
|
||||||
return {
|
return {
|
||||||
items: json.playlists,
|
items: json.playlists
|
||||||
continuation: json.continuation
|
continuation: json.continuation
|
||||||
}
|
}
|
||||||
end if
|
end if
|
||||||
@@ -336,7 +340,7 @@ namespace Invidious
|
|||||||
if response.StatusCode() = 200
|
if response.StatusCode() = 200
|
||||||
json = response.Json()
|
json = response.Json()
|
||||||
return {
|
return {
|
||||||
items: json.relatedChannels,
|
items: json.relatedChannels
|
||||||
continuation: json.continuation
|
continuation: json.continuation
|
||||||
}
|
}
|
||||||
end if
|
end if
|
||||||
@@ -403,6 +407,31 @@ namespace Invidious
|
|||||||
}
|
}
|
||||||
end function
|
end function
|
||||||
|
|
||||||
|
function WatchHistoryHandler(m as object, feedSource as object, response as object) as object
|
||||||
|
m.DeleteExpiredToken(response)
|
||||||
|
|
||||||
|
if response.StatusCode() <> 200
|
||||||
|
return invalid
|
||||||
|
end if
|
||||||
|
|
||||||
|
json = response.Json()
|
||||||
|
if json = invalid
|
||||||
|
return invalid
|
||||||
|
end if
|
||||||
|
|
||||||
|
videos = []
|
||||||
|
for each item in json
|
||||||
|
videos.push({
|
||||||
|
"type": "video"
|
||||||
|
"videoId": item
|
||||||
|
})
|
||||||
|
end for
|
||||||
|
|
||||||
|
return {
|
||||||
|
items: videos
|
||||||
|
}
|
||||||
|
end function
|
||||||
|
|
||||||
function DeleteExpiredToken(response as object)
|
function DeleteExpiredToken(response as object)
|
||||||
if response.StatusCode() = 403
|
if response.StatusCode() = 403
|
||||||
LogWarn(`Invidious instance responded with 403: ${response.Text()}`)
|
LogWarn(`Invidious instance responded with 403: ${response.Text()}`)
|
||||||
@@ -422,12 +451,18 @@ namespace Invidious
|
|||||||
return invalid
|
return invalid
|
||||||
end if
|
end if
|
||||||
if not m.VerifyTokenScope(authToken.token)
|
if not m.VerifyTokenScope(authToken.token)
|
||||||
' TODO:P1 automatically logging out the user is not a good experience
|
' Right now we're probably in a UI thread, and we can't unregister the token
|
||||||
' We can at least show a message to the user on why they are logged out
|
' Without a Task
|
||||||
' TODO:P2 right now we're probably in a UI thread, and we can't unregister the token
|
StartAsyncTask(InvidiousUnregisterTokenTask, {
|
||||||
' So we're just going to ignore it for now
|
invidious: m.node
|
||||||
' m.UnregisterToken(authToken)
|
authToken: authToken
|
||||||
|
})
|
||||||
RegistryUtils.Delete(RegistryUtils.INVIDIOUS_TOKEN)
|
RegistryUtils.Delete(RegistryUtils.INVIDIOUS_TOKEN)
|
||||||
|
message = `It looks like you are logged in to Invidious, but your access token does not have the required permissions.
|
||||||
|
For that reason, we have logged you out. Please log in again.
|
||||||
|
This can happen when Playlet is updated with new features.
|
||||||
|
We apologize for the inconvenience.`
|
||||||
|
DialogUtils.ShowDialog(message, "User logged out")
|
||||||
return invalid
|
return invalid
|
||||||
end if
|
end if
|
||||||
return authToken
|
return authToken
|
||||||
@@ -435,8 +470,8 @@ namespace Invidious
|
|||||||
|
|
||||||
function SetAuthToken(token as string, instance as string, username as dynamic)
|
function SetAuthToken(token as string, instance as string, username as dynamic)
|
||||||
obj = {
|
obj = {
|
||||||
token: token,
|
token: token
|
||||||
instance: instance,
|
instance: instance
|
||||||
username: username
|
username: username
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ function InvidiousSubscriptionsTask(input as object) as object
|
|||||||
LogError("Error getting subscriptions:", error)
|
LogError("Error getting subscriptions:", error)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
success: false,
|
success: false
|
||||||
error: response.ErrorMessage()
|
error: response.ErrorMessage()
|
||||||
}
|
}
|
||||||
end if
|
end if
|
||||||
|
|||||||
@@ -128,7 +128,11 @@ namespace InvidiousContent
|
|||||||
function VideoSetThumbnail(node as object, videoItem as object, instance as dynamic, quality = "medium" as string) as boolean
|
function VideoSetThumbnail(node as object, videoItem as object, instance as dynamic, quality = "medium" as string) as boolean
|
||||||
videoThumbnails = videoItem.videoThumbnails
|
videoThumbnails = videoItem.videoThumbnails
|
||||||
if videoThumbnails = invalid or videoThumbnails.Count() = 0
|
if videoThumbnails = invalid or videoThumbnails.Count() = 0
|
||||||
|
if StringUtils.IsNullOrEmpty(instance)
|
||||||
node.thumbnail = "pkg:/images/thumbnail-missing.jpg"
|
node.thumbnail = "pkg:/images/thumbnail-missing.jpg"
|
||||||
|
else
|
||||||
|
node.thumbnail = `${instance}/vi/${videoItem.videoId}/mqdefault.jpg`
|
||||||
|
end if
|
||||||
return false
|
return false
|
||||||
end if
|
end if
|
||||||
url = invalid
|
url = invalid
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
import "InvidiousService.bs"
|
||||||
|
|
||||||
|
@asynctask
|
||||||
|
function InvidiousUnregisterTokenTask(input as object) as object
|
||||||
|
invidiousNode = input.invidious
|
||||||
|
authToken = input.authToken
|
||||||
|
|
||||||
|
service = new Invidious.InvidiousService(invidiousNode)
|
||||||
|
service.UnregisterToken(authToken)
|
||||||
|
|
||||||
|
return invalid
|
||||||
|
end function
|
||||||
@@ -141,7 +141,7 @@ function ApplyToUserPreferences(userPrefs as object, model as object) as boolean
|
|||||||
return isDirty
|
return isDirty
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function GetUserPreferences(unused as dynamic) as object
|
function GetUserPreferences(_unused as dynamic) as object
|
||||||
userPrefs = {}
|
userPrefs = {}
|
||||||
prefsFields = m.top.preferenceFields
|
prefsFields = m.top.preferenceFields
|
||||||
for each key in prefsFields
|
for each key in prefsFields
|
||||||
@@ -162,7 +162,7 @@ function ApplyUserPreferences(preferences as object) as void
|
|||||||
SaveUserPreferencesToRegistry()
|
SaveUserPreferencesToRegistry()
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function ClearUserPreferences(unused as dynamic) as void
|
function ClearUserPreferences(_unused as dynamic) as void
|
||||||
userPrefs = {}
|
userPrefs = {}
|
||||||
ApplyDefaultsToUserPreferences(userPrefs)
|
ApplyDefaultsToUserPreferences(userPrefs)
|
||||||
ApplyUserPreferences(userPrefs)
|
ApplyUserPreferences(userPrefs)
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
<component name="SponsorBlockNotification" extends="Group">
|
<component name="SponsorBlockNotification" extends="Group">
|
||||||
<interface>
|
<interface>
|
||||||
<field id="segment" type="assocarray" onChange="OnSegmentSet" />
|
<field id="segment" type="assocarray" />
|
||||||
<field id="action" type="string" onChange="OnActionSet" alwaysNotify="true" />
|
<field id="action" type="string" onChange="OnActionSet" alwaysNotify="true" />
|
||||||
</interface>
|
</interface>
|
||||||
<children>
|
<children>
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ namespace SponsorBlock
|
|||||||
const SKIP_SEGMENT_ENDPOINT = "/api/skipSegments"
|
const SKIP_SEGMENT_ENDPOINT = "/api/skipSegments"
|
||||||
const VIEWED_SEGMENT_ENDPOINT = "/api/viewedVideoSponsorTime"
|
const VIEWED_SEGMENT_ENDPOINT = "/api/viewedVideoSponsorTime"
|
||||||
|
|
||||||
|
|
||||||
class SponsorBlockService
|
class SponsorBlockService
|
||||||
function new()
|
function new()
|
||||||
|
' TODO:P2 this is being read and parsed on every skipped segment. It should be cached.
|
||||||
m.sponsorBlockConfig = ParseJson(ReadAsciiFile("libpkg:/config/sponsorblock_config.json5"))
|
m.sponsorBlockConfig = ParseJson(ReadAsciiFile("libpkg:/config/sponsorblock_config.json5"))
|
||||||
end function
|
end function
|
||||||
|
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ function SponsorBlockTask(input as object) as object
|
|||||||
end if
|
end if
|
||||||
|
|
||||||
return {
|
return {
|
||||||
videoId: videoId,
|
videoId: videoId
|
||||||
skipSegments: skipSegments,
|
skipSegments: skipSegments
|
||||||
barPath: barPath
|
barPath: barPath
|
||||||
}
|
}
|
||||||
end function
|
end function
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import "pkg:/source/utils/Types.bs"
|
import "pkg:/source/utils/Types.bs"
|
||||||
|
|
||||||
function Init()
|
function Init()
|
||||||
m.animation = m.top.findNode("loadingAnimation")
|
' TODO:P2 make component disposable, and stop animation when component is disposed
|
||||||
m.top.observeField("visible", FuncName(OnVisibleChanged))
|
m.top.observeField("visible", FuncName(OnVisibleChanged))
|
||||||
OnVisibleChanged()
|
OnVisibleChanged()
|
||||||
end function
|
end function
|
||||||
@@ -11,10 +11,10 @@ function OnVisibleChanged()
|
|||||||
end function
|
end function
|
||||||
|
|
||||||
function OnIndexSet()
|
function OnIndexSet()
|
||||||
m.animation.delay = (m.top.index mod 5) * 0.2
|
m.top.animationDelay = (m.top.index mod 5) * 0.2
|
||||||
Animate()
|
Animate()
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function Animate()
|
function Animate()
|
||||||
m.animation.control = m.top.visible ? "start" : "stop"
|
m.top.animationControl = m.top.visible ? "start" : "stop"
|
||||||
end function
|
end function
|
||||||
@@ -1,8 +1,10 @@
|
|||||||
<component name="LoadingRowCell" extends="Group">
|
<component name="LoadingRowCell" extends="Group">
|
||||||
<interface>
|
<interface>
|
||||||
<field id="itemContent" type="node" onChange="OnContentSet" />
|
<field id="itemContent" type="node" />
|
||||||
<field id="index" type="integer" onChange="OnIndexSet" />
|
<field id="index" type="integer" onChange="OnIndexSet" />
|
||||||
<field id="type" type="string" value="loading" />
|
<field id="type" type="string" value="loading" />
|
||||||
|
<field id="animationDelay" type="time" alias="loadingAnimation.delay" />
|
||||||
|
<field id="animationControl" type="string" alias="loadingAnimation.control" />
|
||||||
</interface>
|
</interface>
|
||||||
<children>
|
<children>
|
||||||
<Rectangle
|
<Rectangle
|
||||||
|
|||||||
@@ -4,18 +4,18 @@ function OnContentSet() as void
|
|||||||
content = m.top.itemContent
|
content = m.top.itemContent
|
||||||
|
|
||||||
visibleProperties = {
|
visibleProperties = {
|
||||||
"video": "videoRowCellVisible",
|
"video": "videoRowCellVisible"
|
||||||
"playlist": "playlistRowCellVisible",
|
"playlist": "playlistRowCellVisible"
|
||||||
"channel": "channelRowCellVisible",
|
"channel": "channelRowCellVisible"
|
||||||
"loading": "loadingRowCellVisible",
|
"loading": "loadingRowCellVisible"
|
||||||
"action": "actionRowCellVisible"
|
"action": "actionRowCellVisible"
|
||||||
}
|
}
|
||||||
|
|
||||||
contentProperties = {
|
contentProperties = {
|
||||||
"video": "videoRowCellItemContent",
|
"video": "videoRowCellItemContent"
|
||||||
"playlist": "playlistRowCellItemContent",
|
"playlist": "playlistRowCellItemContent"
|
||||||
"channel": "channelRowCellItemContent",
|
"channel": "channelRowCellItemContent"
|
||||||
"loading": "loadingRowCellItemContent",
|
"loading": "loadingRowCellItemContent"
|
||||||
"action": "actionRowCellItemContent"
|
"action": "actionRowCellItemContent"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ function Init()
|
|||||||
end function
|
end function
|
||||||
|
|
||||||
function FindChildren()
|
function FindChildren()
|
||||||
|
' TODO:P2 use component properties with alias instead of FindNode
|
||||||
m.titleLabel = m.top.FindNode("titleLabel")
|
m.titleLabel = m.top.FindNode("titleLabel")
|
||||||
m.authorLabel = m.top.FindNode("authorLabel")
|
m.authorLabel = m.top.FindNode("authorLabel")
|
||||||
m.viewCountDateLabel = m.top.FindNode("viewCountDateLabel")
|
m.viewCountDateLabel = m.top.FindNode("viewCountDateLabel")
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ import "pkg:/source/utils/Types.bs"
|
|||||||
|
|
||||||
' TODO:P1 add the option to remove a row if it does not have any content
|
' TODO:P1 add the option to remove a row if it does not have any content
|
||||||
' E.g. NBC News does not return any related chnanels
|
' E.g. NBC News does not return any related chnanels
|
||||||
|
' The "Continue Watching" feed source might return nothing. In this case,
|
||||||
|
' it should be removed.
|
||||||
function Init()
|
function Init()
|
||||||
m.pendingLoadTasks = {}
|
m.pendingLoadTasks = {}
|
||||||
end function
|
end function
|
||||||
@@ -109,7 +111,7 @@ function OnRowItemSelected(index as object) as void
|
|||||||
else if rowItem.type = "action"
|
else if rowItem.type = "action"
|
||||||
if rowItem.action = "LoginDialog"
|
if rowItem.action = "LoginDialog"
|
||||||
dialog = CreateObject("roSGNode", "LoginDialog")
|
dialog = CreateObject("roSGNode", "LoginDialog")
|
||||||
dialog@.BindNode(invalid)
|
dialog@.BindNode()
|
||||||
m.top.getScene().dialog = dialog
|
m.top.getScene().dialog = dialog
|
||||||
end if
|
end if
|
||||||
end if
|
end if
|
||||||
@@ -207,7 +209,7 @@ function InitContent() as void
|
|||||||
end if
|
end if
|
||||||
|
|
||||||
task = StartAsyncTask(VideoRowListContentTask, {
|
task = StartAsyncTask(VideoRowListContentTask, {
|
||||||
node: m.top,
|
node: m.top
|
||||||
feeds: m.top.feeds
|
feeds: m.top.feeds
|
||||||
}, OnVideoRowListContentTaskResult)
|
}, OnVideoRowListContentTaskResult)
|
||||||
m.pendingLoadTasks[task.id] = task
|
m.pendingLoadTasks[task.id] = task
|
||||||
@@ -280,8 +282,8 @@ function LoadRowContent(contentNode as object)
|
|||||||
|
|
||||||
contentNode.loadState = FeedLoadState.Loading
|
contentNode.loadState = FeedLoadState.Loading
|
||||||
task = StartAsyncTask(VideoRowListRowContentTask, {
|
task = StartAsyncTask(VideoRowListRowContentTask, {
|
||||||
rowList: m.top,
|
rowList: m.top
|
||||||
feedContentNode: contentNode,
|
feedContentNode: contentNode
|
||||||
invidious: m.invidious
|
invidious: m.invidious
|
||||||
}, OnVideoRowListRowContentTaskResult)
|
}, OnVideoRowListRowContentTaskResult)
|
||||||
m.pendingLoadTasks[task.id] = task
|
m.pendingLoadTasks[task.id] = task
|
||||||
@@ -316,4 +318,7 @@ end function
|
|||||||
function OnDispose()
|
function OnDispose()
|
||||||
CancelCurrentTasks()
|
CancelCurrentTasks()
|
||||||
DisposeObservers()
|
DisposeObservers()
|
||||||
|
m.top.screen = invalid
|
||||||
|
m.top.content = invalid
|
||||||
|
m.top.itemComponentName = invalid
|
||||||
end function
|
end function
|
||||||
@@ -143,7 +143,7 @@ function VideoRowListRowContentTask(input as object) as object
|
|||||||
catch error
|
catch error
|
||||||
HandleFeedLoadErrorDialog(error, rowList)
|
HandleFeedLoadErrorDialog(error, rowList)
|
||||||
return {
|
return {
|
||||||
success: false,
|
success: false
|
||||||
error: error
|
error: error
|
||||||
}
|
}
|
||||||
end try
|
end try
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ namespace SponsorBlock
|
|||||||
barPath = output.result.barPath
|
barPath = output.result.barPath
|
||||||
if barPath <> invalid
|
if barPath <> invalid
|
||||||
m.top.trickPlayBar.trackImageUri = barPath
|
m.top.trickPlayBar.trackImageUri = barPath
|
||||||
m.top.trickPlayBar.filledBarBlendColor = "0xFF000080"
|
m.top.trickPlayBar.filledBarBlendColor = "#FF000080"
|
||||||
end if
|
end if
|
||||||
|
|
||||||
m.top.UnobserveFieldScoped("position")
|
m.top.UnobserveFieldScoped("position")
|
||||||
@@ -135,12 +135,25 @@ namespace SponsorBlock
|
|||||||
end if
|
end if
|
||||||
|
|
||||||
if action = "AutoSkip"
|
if action = "AutoSkip"
|
||||||
m.top.seek = segmentEnd
|
duration = m.top.duration
|
||||||
|
' Sometimes segmentEnd is greater than duration
|
||||||
|
if duration > 0 and segmentEnd > duration
|
||||||
|
segmentEnd = duration
|
||||||
|
end if
|
||||||
|
' If the segment is at the end of the video, skip the video instead of seeking
|
||||||
|
if duration > 0 and Abs(segmentEnd - duration) < 2
|
||||||
|
LogInfo("Skipping section:", segment["category"], "at end of video")
|
||||||
|
SendSkippedSectionEvent(segment.UUID)
|
||||||
|
OnVideoFinished()
|
||||||
|
return
|
||||||
|
else
|
||||||
LogInfo("Skipping section:", segment["category"])
|
LogInfo("Skipping section:", segment["category"])
|
||||||
SendSkippedSectionEvent(segment.UUID)
|
SendSkippedSectionEvent(segment.UUID)
|
||||||
|
m.top.seek = segmentEnd
|
||||||
return
|
return
|
||||||
end if
|
end if
|
||||||
end if
|
end if
|
||||||
|
end if
|
||||||
end for
|
end for
|
||||||
end function
|
end function
|
||||||
|
|
||||||
|
|||||||
@@ -1,24 +0,0 @@
|
|||||||
import "pkg:/source/utils/RingBuffer.bs"
|
|
||||||
|
|
||||||
function Init()
|
|
||||||
' We keep in memory the last videos we watched, to avoid a loop
|
|
||||||
' Sometimes recommended videos point to each other, and we're stuck watching
|
|
||||||
' The same 2 videos over and over again
|
|
||||||
|
|
||||||
' TODO:P1 get rid of `watchedVideos` and use the PlayQueue instead
|
|
||||||
m.watchedVideos = new RingBuffer(100)
|
|
||||||
end function
|
|
||||||
|
|
||||||
function watchedVideosContain(videoId as string) as boolean
|
|
||||||
return m.watchedVideos.Contains(videoId)
|
|
||||||
end function
|
|
||||||
|
|
||||||
function watchedVideosAdd(videoId as string)
|
|
||||||
if not watchedVideosContain(videoId)
|
|
||||||
m.watchedVideos.Push(videoId)
|
|
||||||
end if
|
|
||||||
end function
|
|
||||||
|
|
||||||
function watchedVideosClear(unused as dynamic)
|
|
||||||
m.watchedVideos = new RingBuffer(100)
|
|
||||||
end function
|
|
||||||
@@ -1,8 +1,5 @@
|
|||||||
<component name="VideoContainer" extends="Group">
|
<component name="VideoContainer" extends="Group">
|
||||||
<interface>
|
<interface>
|
||||||
<field id="fullscreen" type="boolean" value="true" />
|
<field id="fullscreen" type="boolean" value="true" />
|
||||||
<function name="watchedVideosContain" />
|
|
||||||
<function name="watchedVideosAdd" />
|
|
||||||
<function name="watchedVideosClear" />
|
|
||||||
</interface>
|
</interface>
|
||||||
</component>
|
</component>
|
||||||
@@ -5,7 +5,7 @@ function VideoContentTask(input as object) as object
|
|||||||
contentNode = input.content
|
contentNode = input.content
|
||||||
invidiousNode = input.invidious
|
invidiousNode = input.invidious
|
||||||
preferencesNode = input.preferences
|
preferencesNode = input.preferences
|
||||||
playletServerUrl = input.playletServerUrl
|
playletServerPort = input.playletServerPort
|
||||||
|
|
||||||
if m.top.cancel
|
if m.top.cancel
|
||||||
return invalid
|
return invalid
|
||||||
@@ -27,7 +27,7 @@ function VideoContentTask(input as object) as object
|
|||||||
|
|
||||||
if not response.IsSuccess() or metadata = invalid
|
if not response.IsSuccess() or metadata = invalid
|
||||||
return {
|
return {
|
||||||
success: false,
|
success: false
|
||||||
error: response.ErrorMessage()
|
error: response.ErrorMessage()
|
||||||
}
|
}
|
||||||
end if
|
end if
|
||||||
@@ -35,15 +35,15 @@ function VideoContentTask(input as object) as object
|
|||||||
contentNode.title = metadata.title
|
contentNode.title = metadata.title
|
||||||
contentNode.secondaryTitle = metadata.author
|
contentNode.secondaryTitle = metadata.author
|
||||||
|
|
||||||
streamUrls = CreateStreamUrls(metadata, service, preferencesNode, playletServerUrl)
|
streamUrls = CreateStreamUrls(metadata, service, preferencesNode, playletServerPort)
|
||||||
contentNode.url = streamUrls[0]
|
contentNode.url = streamUrls[0]
|
||||||
|
|
||||||
SetCaptions(metadata, service, contentNode)
|
SetCaptions(metadata, service, contentNode)
|
||||||
|
|
||||||
contentNode.addFields({
|
contentNode.addFields({
|
||||||
metadata: metadata,
|
metadata: metadata
|
||||||
' StreamUrls is taken
|
' StreamUrls is taken
|
||||||
playletStreamUrls: streamUrls,
|
playletStreamUrls: streamUrls
|
||||||
playletStreamUrlIndex: 0
|
playletStreamUrlIndex: 0
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -52,7 +52,7 @@ function VideoContentTask(input as object) as object
|
|||||||
}
|
}
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function CreateStreamUrls(metadata as object, service as Invidious.InvidiousService, preferences as object, playletServerUrl as string) as object
|
function CreateStreamUrls(metadata as object, service as Invidious.InvidiousService, preferences as object, playletServerPort as integer) as object
|
||||||
instance = service.GetInstance()
|
instance = service.GetInstance()
|
||||||
proxyVideos = preferences["invidious.proxy_videos"]
|
proxyVideos = preferences["invidious.proxy_videos"]
|
||||||
|
|
||||||
@@ -63,12 +63,12 @@ function CreateStreamUrls(metadata as object, service as Invidious.InvidiousServ
|
|||||||
else
|
else
|
||||||
preferredQuality = preferences["playback.preferred_quality"]
|
preferredQuality = preferences["playback.preferred_quality"]
|
||||||
|
|
||||||
if preferredQuality = "720p"
|
if preferredQuality = "auto"
|
||||||
AddStreamUrls(streamUrls, metadata, service, proxyVideos)
|
AddDashUrls(streamUrls, metadata, proxyVideos, playletServerPort)
|
||||||
AddDashUrls(streamUrls, metadata, proxyVideos, playletServerUrl)
|
AddStreamUrls(streamUrls, metadata, service, proxyVideos, preferredQuality)
|
||||||
else
|
else
|
||||||
AddDashUrls(streamUrls, metadata, proxyVideos, playletServerUrl)
|
AddStreamUrls(streamUrls, metadata, service, proxyVideos, preferredQuality)
|
||||||
AddStreamUrls(streamUrls, metadata, service, proxyVideos)
|
AddDashUrls(streamUrls, metadata, proxyVideos, playletServerPort)
|
||||||
end if
|
end if
|
||||||
end if
|
end if
|
||||||
|
|
||||||
@@ -84,29 +84,42 @@ function AddHlsUrls(streamUrls as object, metadata as object, proxyVideos as str
|
|||||||
AddUrls(streamUrls, hlsUrl, hlsUrlLocal, proxyVideos)
|
AddUrls(streamUrls, hlsUrl, hlsUrlLocal, proxyVideos)
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function AddDashUrls(streamUrls as object, metadata as object, proxyVideos as string, playletServerUrl as string) as void
|
function AddDashUrls(streamUrls as object, metadata as object, proxyVideos as string, playletServerPort as integer) as void
|
||||||
#if LOCAL_DASH
|
|
||||||
' Redirect to Playet's local web server, where will will be
|
' Redirect to Playet's local web server, where will will be
|
||||||
' dynamically generating the DASH manifest.
|
' dynamically generating the DASH manifest, instead of metadata.dashUrl
|
||||||
dashUrl = `${playletServerUrl}/api/dash?v=${metadata.videoId}`
|
dashUrl = `http://127.0.0.1:${playletServerPort}/api/dash?v=${metadata.videoId}`
|
||||||
#else
|
|
||||||
if metadata.dashUrl = invalid
|
|
||||||
return
|
|
||||||
end if
|
|
||||||
|
|
||||||
dashUrl = metadata.dashUrl
|
|
||||||
#end if
|
|
||||||
|
|
||||||
dashUrlLocal = AddLocalFlag(dashUrl)
|
dashUrlLocal = AddLocalFlag(dashUrl)
|
||||||
AddUrls(streamUrls, dashUrl, dashUrlLocal, proxyVideos)
|
AddUrls(streamUrls, dashUrl, dashUrlLocal, proxyVideos)
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function AddStreamUrls(streamUrls as object, metadata as object, service as Invidious.InvidiousService, proxyVideos as string) as void
|
function AddStreamUrls(streamUrls as object, metadata as object, service as Invidious.InvidiousService, proxyVideos as string, preferredQuality as string) as void
|
||||||
if metadata.formatStreams = invalid or metadata.formatStreams.Count() = 0
|
if metadata.formatStreams = invalid or metadata.formatStreams.Count() = 0
|
||||||
return
|
return
|
||||||
end if
|
end if
|
||||||
|
|
||||||
url = service.GetVideoStreamUrl(metadata.videoId)
|
itag = invalid
|
||||||
|
' If we prefer medium quality, we check if we have a 360p or 480p streams
|
||||||
|
if preferredQuality = "medium"
|
||||||
|
' These are roughly the itags for 360p and 480p
|
||||||
|
' Most videos will hit 18, which is 360p
|
||||||
|
mediumItags = {
|
||||||
|
"18": true
|
||||||
|
"43": true
|
||||||
|
"44": true
|
||||||
|
"82": true
|
||||||
|
"83": true
|
||||||
|
"101": true
|
||||||
|
}
|
||||||
|
for each formatStream in metadata.formatStreams
|
||||||
|
if mediumItags[ValidString(formatStream.itag)] = true
|
||||||
|
itag = formatStream.itag
|
||||||
|
exit for
|
||||||
|
end if
|
||||||
|
end for
|
||||||
|
end if
|
||||||
|
|
||||||
|
url = service.GetVideoStreamUrl(metadata.videoId, itag)
|
||||||
localUrl = AddLocalFlag(url)
|
localUrl = AddLocalFlag(url)
|
||||||
|
|
||||||
AddUrls(streamUrls, url, localUrl, proxyVideos)
|
AddUrls(streamUrls, url, localUrl, proxyVideos)
|
||||||
@@ -159,8 +172,8 @@ function SetCaptions(metadata as object, service as object, contentNode as objec
|
|||||||
|
|
||||||
for each caption in metadata.captions
|
for each caption in metadata.captions
|
||||||
subtitleTracks.Push({
|
subtitleTracks.Push({
|
||||||
Description: caption.label,
|
Description: caption.label
|
||||||
Language: isoLanguageList[caption.language_code] ?? caption.language_code,
|
Language: isoLanguageList[caption.language_code] ?? caption.language_code
|
||||||
TrackName: instance + caption.url
|
TrackName: instance + caption.url
|
||||||
})
|
})
|
||||||
end for
|
end for
|
||||||
@@ -168,4 +181,3 @@ function SetCaptions(metadata as object, service as object, contentNode as objec
|
|||||||
contentNode.ClosedCaptions = True
|
contentNode.ClosedCaptions = True
|
||||||
contentNode.SubtitleTracks = subtitleTracks
|
contentNode.SubtitleTracks = subtitleTracks
|
||||||
end function
|
end function
|
||||||
|
|
||||||
@@ -69,10 +69,10 @@ function StartVideoContentTask(videoContentNode as object)
|
|||||||
m.top.content = videoContentNode
|
m.top.content = videoContentNode
|
||||||
|
|
||||||
m.videoContentTask = StartAsyncTask(VideoContentTask, {
|
m.videoContentTask = StartAsyncTask(VideoContentTask, {
|
||||||
content: videoContentNode,
|
content: videoContentNode
|
||||||
invidious: m.top.invidious,
|
invidious: m.top.invidious
|
||||||
preferences: m.top.preferences,
|
preferences: m.top.preferences
|
||||||
playletServerUrl: m.top.webServer@.GetServerAddress(invalid)
|
playletServerPort: m.top.webServer.port
|
||||||
}, OnVideoContentTaskResults)
|
}, OnVideoContentTaskResults)
|
||||||
end function
|
end function
|
||||||
|
|
||||||
@@ -110,13 +110,13 @@ end function
|
|||||||
function MarkVideoWatched(videoId as string)
|
function MarkVideoWatched(videoId as string)
|
||||||
if m.top.invidious.authToken <> invalid
|
if m.top.invidious.authToken <> invalid
|
||||||
StartAsyncTask(MarkVideoWatchedTask, {
|
StartAsyncTask(MarkVideoWatchedTask, {
|
||||||
videoId: videoId,
|
videoId: videoId
|
||||||
invidious: m.top.invidious
|
invidious: m.top.invidious
|
||||||
})
|
})
|
||||||
end if
|
end if
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function Close(unused as dynamic)
|
function Close(_unused as dynamic)
|
||||||
m.top.control = "stop"
|
m.top.control = "stop"
|
||||||
m.top.content = invalid
|
m.top.content = invalid
|
||||||
parent = m.top.getParent()
|
parent = m.top.getParent()
|
||||||
@@ -185,21 +185,8 @@ function OnVideoPlayerStateChange() as void
|
|||||||
end if
|
end if
|
||||||
|
|
||||||
if state = "finished"
|
if state = "finished"
|
||||||
if content = invalid
|
OnVideoFinished()
|
||||||
m.container@.watchedVideosClear(invalid)
|
return
|
||||||
VideoUtils.CloseVideo()
|
|
||||||
end if
|
|
||||||
|
|
||||||
metadata = content.metadata
|
|
||||||
if metadata = invalid
|
|
||||||
m.container@.watchedVideosClear(invalid)
|
|
||||||
VideoUtils.CloseVideo()
|
|
||||||
end if
|
|
||||||
|
|
||||||
if not PlayNext(metadata.recommendedVideos)
|
|
||||||
m.container@.watchedVideosClear(invalid)
|
|
||||||
VideoUtils.CloseVideo()
|
|
||||||
end if
|
|
||||||
end if
|
end if
|
||||||
|
|
||||||
if state = "error"
|
if state = "error"
|
||||||
@@ -223,8 +210,29 @@ function OnVideoPlayerStateChange() as void
|
|||||||
end if
|
end if
|
||||||
end function
|
end function
|
||||||
|
|
||||||
|
function OnVideoFinished() as void
|
||||||
|
content = m.top.content
|
||||||
|
if content = invalid
|
||||||
|
m.playQueue@.watchedVideosClear()
|
||||||
|
VideoUtils.CloseVideo()
|
||||||
|
return
|
||||||
|
end if
|
||||||
|
|
||||||
|
metadata = content.metadata
|
||||||
|
if metadata = invalid
|
||||||
|
m.playQueue@.watchedVideosClear()
|
||||||
|
VideoUtils.CloseVideo()
|
||||||
|
return
|
||||||
|
end if
|
||||||
|
|
||||||
|
if not PlayNext(metadata.recommendedVideos)
|
||||||
|
m.playQueue@.watchedVideosClear()
|
||||||
|
VideoUtils.CloseVideo()
|
||||||
|
end if
|
||||||
|
end function
|
||||||
|
|
||||||
function PlayNext(recommendedVideos as object) as boolean
|
function PlayNext(recommendedVideos as object) as boolean
|
||||||
if m.playQueue@.PlayNextItem(invalid)
|
if m.playQueue@.PlayNextItem()
|
||||||
return true
|
return true
|
||||||
end if
|
end if
|
||||||
|
|
||||||
@@ -249,9 +257,9 @@ function PlayNextRecommendedVideo(recommendedVideos as object) as boolean
|
|||||||
if videoId = invalid
|
if videoId = invalid
|
||||||
continue for
|
continue for
|
||||||
end if
|
end if
|
||||||
if not m.container@.watchedVideosContain(videoId)
|
if not m.playQueue@.watchedVideosContain(videoId)
|
||||||
LogInfo(`Playing next recommended video (${videoId})`)
|
LogInfo(`Playing next recommended video (${videoId})`)
|
||||||
instance = m.invidious@.GetCurrentInstance(invalid)
|
instance = m.invidious@.GetCurrentInstance()
|
||||||
node = InvidiousContent.ToVideoContentNode(invalid, metadata, instance)
|
node = InvidiousContent.ToVideoContentNode(invalid, metadata, instance)
|
||||||
m.playQueue@.Play(node, -1)
|
m.playQueue@.Play(node, -1)
|
||||||
return true
|
return true
|
||||||
@@ -275,7 +283,7 @@ function OnkeyEvent(key as string, press as boolean) as boolean
|
|||||||
end if
|
end if
|
||||||
|
|
||||||
if key = "back"
|
if key = "back"
|
||||||
m.container@.watchedVideosClear(invalid)
|
m.playQueue@.watchedVideosClear()
|
||||||
VideoUtils.CloseVideo()
|
VideoUtils.CloseVideo()
|
||||||
return true
|
return true
|
||||||
end if
|
end if
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
function SetPlayerStyle()
|
function SetPlayerStyle()
|
||||||
m.top.trickPlayBar.filledBarBlendColor = "0xFF0000FF"
|
m.top.trickPlayBar.filledBarBlendColor = "#FF1C30FF"
|
||||||
m.top.bufferingBar.filledBarBlendColor = "0xFF0000FF"
|
m.top.bufferingBar.filledBarBlendColor = "#FF1C30FF"
|
||||||
m.top.retrievingBar.filledBarBlendColor = "0xFF0000FF"
|
m.top.retrievingBar.filledBarBlendColor = "#FF1C30FF"
|
||||||
|
|
||||||
' Find the BusySpinner built into the Video node
|
' Find the BusySpinner built into the Video node
|
||||||
busySpinner = FindChildNodeOfType(m.top, "BusySpinner")
|
busySpinner = FindChildNodeOfType(m.top, "BusySpinner")
|
||||||
if busySpinner <> invalid
|
if busySpinner <> invalid
|
||||||
busySpinner.poster.blendColor = "0xFF0000FF"
|
busySpinner.poster.blendColor = "#FF1C30FF"
|
||||||
end if
|
end if
|
||||||
end function
|
end function
|
||||||
|
|
||||||
|
|||||||
@@ -13,14 +13,14 @@ namespace VideoUtils
|
|||||||
LogError("VideoContainer not found! Attempting to restore focus to top screen...")
|
LogError("VideoContainer not found! Attempting to restore focus to top screen...")
|
||||||
appController = m.top.getScene().findNode("AppController")
|
appController = m.top.getScene().findNode("AppController")
|
||||||
if appController <> invalid
|
if appController <> invalid
|
||||||
appController@.FocusTopScreen(invalid)
|
appController@.FocusTopScreen()
|
||||||
end if
|
end if
|
||||||
DialogUtils.ShowDialog(`VideoContainer not found!\nPlease try again. If the problem persist, contact Playlet authors.`, "Error playing video")
|
DialogUtils.ShowDialog(`VideoContainer not found!\nPlease try again. If the problem persist, contact Playlet authors.`, "Error playing video")
|
||||||
return
|
return
|
||||||
end if
|
end if
|
||||||
videoPlayer = container.createChild("videoPlayer")
|
videoPlayer = container.createChild("videoPlayer")
|
||||||
videoPlayer.id = "VideoPlayer"
|
videoPlayer.id = "VideoPlayer"
|
||||||
videoPlayer@.BindNode(invalid)
|
videoPlayer@.BindNode()
|
||||||
|
|
||||||
videoPlayer@.PlayWithContent(contentNode)
|
videoPlayer@.PlayWithContent(contentNode)
|
||||||
|
|
||||||
@@ -39,10 +39,10 @@ namespace VideoUtils
|
|||||||
if videoPlayer = invalid
|
if videoPlayer = invalid
|
||||||
return
|
return
|
||||||
end if
|
end if
|
||||||
videoPlayer@.Close(invalid)
|
videoPlayer@.Close()
|
||||||
|
|
||||||
if setFocus
|
if setFocus
|
||||||
videoPlayer.appController@.FocusTopScreen(invalid)
|
videoPlayer.appController@.FocusTopScreen()
|
||||||
end if
|
end if
|
||||||
end function
|
end function
|
||||||
|
|
||||||
@@ -76,7 +76,7 @@ namespace VideoUtils
|
|||||||
if videoContainer.fullscreen
|
if videoContainer.fullscreen
|
||||||
NodeSetFocus(videoPlayer, true)
|
NodeSetFocus(videoPlayer, true)
|
||||||
else
|
else
|
||||||
videoPlayer.appController@.FocusTopScreen(invalid)
|
videoPlayer.appController@.FocusTopScreen()
|
||||||
end if
|
end if
|
||||||
return true
|
return true
|
||||||
end function
|
end function
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ namespace Http
|
|||||||
end for
|
end for
|
||||||
|
|
||||||
feeds.push({
|
feeds.push({
|
||||||
"title": bookmarkGroupNode.title,
|
"title": bookmarkGroupNode.title
|
||||||
"feedSources": feedSources
|
"feedSources": feedSources
|
||||||
})
|
})
|
||||||
end for
|
end for
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ namespace Http
|
|||||||
response = context.response
|
response = context.response
|
||||||
invidiousNode = context.server.task.invidious
|
invidiousNode = context.server.task.invidious
|
||||||
|
|
||||||
authLink = invidiousNode@.GetAuthorizeTokenLink(invalid)
|
authLink = invidiousNode@.GetAuthorizeTokenLink()
|
||||||
response.Redirect(authLink)
|
response.Redirect(authLink)
|
||||||
return true
|
return true
|
||||||
end function)
|
end function)
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ namespace Http
|
|||||||
task = context.server.task
|
task = context.server.task
|
||||||
playQueue = task.playQueue
|
playQueue = task.playQueue
|
||||||
|
|
||||||
queue = playQueue@.GetQueue(invalid)
|
queue = playQueue@.GetQueue()
|
||||||
response.Json(queue)
|
response.Json(queue)
|
||||||
return true
|
return true
|
||||||
end function)
|
end function)
|
||||||
@@ -25,6 +25,7 @@ namespace Http
|
|||||||
response = context.response
|
response = context.response
|
||||||
task = context.server.task
|
task = context.server.task
|
||||||
playQueue = task.playQueue
|
playQueue = task.playQueue
|
||||||
|
invidiousNode = task.invidious
|
||||||
|
|
||||||
payload = request.Json()
|
payload = request.Json()
|
||||||
if payload = invalid
|
if payload = invalid
|
||||||
@@ -39,10 +40,13 @@ namespace Http
|
|||||||
return true
|
return true
|
||||||
end if
|
end if
|
||||||
|
|
||||||
contentNode = InvidiousContent.ToRowCellContentNode(payload, invalid)
|
service = new Invidious.InvidiousService(invidiousNode)
|
||||||
|
instance = service.GetInstance()
|
||||||
|
|
||||||
|
contentNode = InvidiousContent.ToRowCellContentNode(payload, instance)
|
||||||
playQueue@.AddToQueue(contentNode)
|
playQueue@.AddToQueue(contentNode)
|
||||||
|
|
||||||
queue = playQueue@.GetQueue(invalid)
|
queue = playQueue@.GetQueue()
|
||||||
response.Json(queue)
|
response.Json(queue)
|
||||||
return true
|
return true
|
||||||
end function)
|
end function)
|
||||||
@@ -53,6 +57,7 @@ namespace Http
|
|||||||
response = context.response
|
response = context.response
|
||||||
task = context.server.task
|
task = context.server.task
|
||||||
playQueue = task.playQueue
|
playQueue = task.playQueue
|
||||||
|
invidiousNode = task.invidious
|
||||||
|
|
||||||
payload = request.Json()
|
payload = request.Json()
|
||||||
if payload = invalid
|
if payload = invalid
|
||||||
@@ -71,7 +76,10 @@ namespace Http
|
|||||||
payload.timestamp = payload.timestamp.toInt()
|
payload.timestamp = payload.timestamp.toInt()
|
||||||
end if
|
end if
|
||||||
|
|
||||||
contentNode = InvidiousContent.ToRowCellContentNode(payload, invalid)
|
service = new Invidious.InvidiousService(invidiousNode)
|
||||||
|
instance = service.GetInstance()
|
||||||
|
|
||||||
|
contentNode = InvidiousContent.ToRowCellContentNode(payload, instance)
|
||||||
playlistIndex = IsInt(payload.playlistIndex) ? payload.playlistIndex : -1
|
playlistIndex = IsInt(payload.playlistIndex) ? payload.playlistIndex : -1
|
||||||
if contentNode.type = "playlist" and playlistIndex = -1
|
if contentNode.type = "playlist" and playlistIndex = -1
|
||||||
playlistIndex = 0
|
playlistIndex = 0
|
||||||
@@ -95,7 +103,7 @@ namespace Http
|
|||||||
return true
|
return true
|
||||||
end if
|
end if
|
||||||
|
|
||||||
playQueue@.Clear(invalid)
|
playQueue@.Clear()
|
||||||
response.Default(204, "OK")
|
response.Default(204, "OK")
|
||||||
return true
|
return true
|
||||||
end function)
|
end function)
|
||||||
|
|||||||
Loaded 100 of 214 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user