Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9df1b70e49 | ||
|
|
bb471a5cde | ||
|
|
b68aad7d4a | ||
|
|
73b6314ec7 | ||
|
|
29969db3e4 | ||
|
|
5335a0273b | ||
|
|
641c9ef5bf | ||
|
|
b0257d97e0 | ||
|
|
5c9c1c204f | ||
|
|
11afc34ecc | ||
|
|
3edfce1366 | ||
|
|
5ff02af7ac | ||
|
|
0cc8cdf2be | ||
|
|
3ecac831bf | ||
|
|
86d5710969 | ||
|
|
575935f5ac | ||
|
|
7eb20dfe2c | ||
|
|
0b01830ad9 | ||
|
|
33fdf796a2 | ||
|
|
fd7bdde733 | ||
|
|
e7324495fe | ||
|
|
2e7b3d0aa5 | ||
|
|
20f345593e | ||
|
|
754da7e836 | ||
|
|
85c3eb8321 | ||
|
|
e59e45e310 | ||
|
|
2548fb9097 | ||
|
|
1cb80f71b5 | ||
|
|
0a7a6c65e2 | ||
|
|
529b915d7f | ||
|
|
a76a2cb77f | ||
|
|
707739b901 | ||
|
|
8c72258879 | ||
|
|
d245c072e9 | ||
|
|
0f000590a0 | ||
|
|
93c1e48d39 | ||
|
|
d6c7d81347 | ||
|
|
331f2ff3cb | ||
|
|
6c42fbe056 | ||
|
|
7e8c828007 |
No files matched your search
@@ -5,6 +5,38 @@ All notable changes to this project will be documented in this file.
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [0.19.0] - 2024-01-10
|
||||
|
||||
### Added
|
||||
|
||||
- A home screen editor allowing to enable/disable feeds, and change their order.
|
||||
- The editor can be accessed from the Settings screen.
|
||||
|
||||
### Fixed
|
||||
|
||||
- `HTTP/0.9 when not allowed` errors by adding a retry to web requests
|
||||
- Issue where a bookmarked video is no longer valid (such as a video made private, or a live stream that ended)
|
||||
- [Perf] App loads slightly faster (~500ms)
|
||||
|
||||
## [0.18.1] - 2024-01-02
|
||||
|
||||
### Fixed
|
||||
|
||||
- A rare bug that causes the app to crash when displaying video cells
|
||||
- A rare bug where a long press can cause a crash
|
||||
- [Attempt] to fix a crash caused by execution timeout when stopping a video takes too long
|
||||
- Unsupported subtitles (subtitles that can't be rendered will not be used)
|
||||
|
||||
### Removed
|
||||
|
||||
- `Funny` and `News` from the Home screen.
|
||||
- These are not standard feeds (like `Trending`), and are just search results for `Funny` and `News`. They were added in earlier Playlet versions to have more content in the Home screen.
|
||||
- If you like to add these two feeds to your bookmarks:
|
||||
- Search for `Funny` (or `News`)
|
||||
- Set the `Sort by` filter to `Upload date`
|
||||
- Press and hold the `Ok` button while a video from the search result is selected
|
||||
- Choose the `Add to "Search - Funny"` option
|
||||
|
||||
## [0.18.0] - 2023-12-28
|
||||
|
||||
### Added
|
||||
|
||||
@@ -70,11 +70,13 @@
|
||||
"../tools/bs-plugins/json-yaml-plugin.ts",
|
||||
"../tools/bs-plugins/validation-plugin.ts",
|
||||
"../tools/bs-plugins/logger-plugin.ts",
|
||||
"../tools/bs-plugins/image-gen-plugin.ts"
|
||||
"../tools/bs-plugins/image-gen-plugin.ts",
|
||||
"../tools/bs-plugins/type-gen-plugin.ts"
|
||||
],
|
||||
"retainStagingDir": true,
|
||||
"require": [
|
||||
"ts-node/register"
|
||||
],
|
||||
"sourceMap": true
|
||||
"sourceMap": true,
|
||||
"pruneEmptyCodeFiles": true
|
||||
}
|
||||
@@ -26,7 +26,8 @@
|
||||
"../tools/bs-plugins/json-yaml-plugin.ts",
|
||||
"../tools/bs-plugins/validation-plugin.ts",
|
||||
"../tools/bs-plugins/logger-plugin.ts",
|
||||
"../tools/bs-plugins/image-gen-plugin.ts"
|
||||
"../tools/bs-plugins/image-gen-plugin.ts",
|
||||
"../tools/bs-plugins/type-gen-plugin.ts"
|
||||
],
|
||||
"rooibos": {
|
||||
"logLevel": 2,
|
||||
|
||||
@@ -163,7 +163,7 @@ Playlet lib comes equipped with a web server that runs on port 8888 when the app
|
||||
- Allows remotely casting videos, change preferences, etc.
|
||||
- Authentication using Invidious
|
||||
|
||||
The web server runs on a continiously running [Task](https://developer.roku.com/en-ca/docs/references/scenegraph/control-nodes/task.md) and uses a middeware system to manage routes, serve static files, [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS), and more.
|
||||
The web server runs on a continuously running [Task](https://developer.roku.com/en-ca/docs/references/scenegraph/control-nodes/task.md) and uses a middeware system to manage routes, serve static files, [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS), and more.
|
||||
|
||||
The server's API enpoints are described through the Open API spec file [playlet-web-api.yml](./playlet-web-api.yml)
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ openapi: 3.0.0
|
||||
|
||||
info:
|
||||
title: Playlet Web API
|
||||
version: 0.18.0
|
||||
version: 0.19.0
|
||||
description:
|
||||
Playlet Web API is a RESTful API for controlling the Playlet app on
|
||||
Roku devices. The API is intended to be used by the Playlet web app, but can
|
||||
@@ -153,7 +153,7 @@ paths:
|
||||
properties:
|
||||
index:
|
||||
type: integer
|
||||
playlistIndex
|
||||
playlistIndex:
|
||||
type: integer
|
||||
items:
|
||||
type: array
|
||||
@@ -178,7 +178,7 @@ paths:
|
||||
properties:
|
||||
index:
|
||||
type: integer
|
||||
playlistIndex
|
||||
playlistIndex:
|
||||
type: integer
|
||||
items:
|
||||
type: array
|
||||
@@ -227,6 +227,41 @@ paths:
|
||||
description: No Content
|
||||
"400":
|
||||
description: Bad Request
|
||||
/api/home-layout:
|
||||
get:
|
||||
summary: Get home layout
|
||||
description: Get the current home layout. This is the layout of the home screen, based on user preferences.
|
||||
operationId: getHomeLayout
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
title:
|
||||
type: string
|
||||
feedSources:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
properties:
|
||||
apiType:
|
||||
type: string
|
||||
endpoint:
|
||||
type: string
|
||||
id:
|
||||
type: string
|
||||
queryParams:
|
||||
type: object
|
||||
additionalProperties: true
|
||||
title:
|
||||
type: string
|
||||
/api/playlet-lib-urls:
|
||||
get:
|
||||
summary: Get Playlet lib URLs
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
- [Async Task Generator](#async-task-generator)
|
||||
- [Tracking transpilied files](#tracking-transpilied-files)
|
||||
- [Logger](#logger)
|
||||
- [Type Gen](#type-gen)
|
||||
|
||||
Playlet implements a few [Brighterscript Plugins](https://github.com/rokucommunity/brighterscript/blob/master/docs/plugins.md). The plugins inject themselves in the compilation process, allowing the modification of bs scripts, xml components, and even assets or the app manifest. Let's start with a simple one:
|
||||
|
||||
@@ -469,7 +470,10 @@ end function
|
||||
And use the function like so
|
||||
|
||||
```brighterscript
|
||||
StartAsyncTask(MyBackgroundTask, {myVar: "some input"}, function(output as object) as void
|
||||
import "pkg:/source/AsyncTask/Tasks.bs"
|
||||
import "pkg:/source/AsyncTask/AsyncTask.bs"
|
||||
|
||||
AsyncTask.Start(Tasks.MyBackgroundTask, {myVar: "some input"}, function(output as object) as void
|
||||
if output.success
|
||||
print(output.result.value)
|
||||
end if
|
||||
@@ -478,7 +482,7 @@ end function)
|
||||
|
||||
The rest will be taken care of by the plugin, which will generate an `xml` file containing the task component, and a script that handles calling the function.
|
||||
|
||||
Although very useful, this pattern might not be the best for long running tasks (like the Web Server) or other tasks that require task reuse. This is because `StartAsyncTask` create a new instance of the task every time.
|
||||
Although very useful, this pattern might not be the best for long running tasks (like the Web Server) or other tasks that require task reuse. This is because `AsyncTask.Start` create a new instance of the task every time.
|
||||
|
||||
## Tracking transpilied files
|
||||
|
||||
@@ -517,7 +521,7 @@ The logger plugin searches for calls to the predefined functions `LogError`, `Lo
|
||||
- For example, it replaces `LogError("Cannot complete operation:", error)` with `LogError2("Cannot complete operation:", error)`
|
||||
- Based on usage, it generates `LogErrorX` functions used. Example:
|
||||
|
||||
```
|
||||
```brs
|
||||
function LogError2(arg0, arg1) as void
|
||||
logger = m.global.logger
|
||||
if logger.logLevel < 0
|
||||
@@ -537,3 +541,33 @@ This is implemented to make it easy to identify where logs came from, and to gen
|
||||
To understand more about what's being generated, download `playlet-lib.zip` from [releases](https://github.com/iBicha/playlet/releases), extract, and inspect the file `source/utils/Logging.brs`. You will see it contains log functions in the form `LogVerbX`, that are generated based on usage.
|
||||
|
||||
To give credit where credit is due, some of the ideas here (like adding the source location to the log) came from [roku-log](https://github.com/georgejecook/roku-log)
|
||||
|
||||
## Type Gen
|
||||
|
||||
**[Source](/tools/bs-plugins/type-gen-plugin.ts)**
|
||||
|
||||
### Why
|
||||
|
||||
I found myself implementing type checking functions like `IsBool`, `IsInt`, and `IsString`, and functions for getting a valid type, like `ValidBool`, `ValidInt`, and `ValidString`. The implementation is the same, why not generate them?
|
||||
|
||||
### How
|
||||
|
||||
Simply we declare them in an object describing the type, the interface, and the default value, and generate all corresponding functions.
|
||||
|
||||
Sample output:
|
||||
|
||||
```brs
|
||||
' Returns true if the given object is of type Bool, false otherwise
|
||||
function IsBool(obj as dynamic) as boolean
|
||||
return obj <> invalid and GetInterface(obj, "ifBoolean") <> invalid
|
||||
end function
|
||||
|
||||
' Returns the given object if it is of type Bool, otherwise returns the default value `false`
|
||||
function ValidBool(obj as dynamic) as boolean
|
||||
if obj <> invalid and GetInterface(obj, "ifBoolean") <> invalid
|
||||
return obj
|
||||
else
|
||||
return false
|
||||
end if
|
||||
end function
|
||||
```
|
||||
@@ -1,30 +1,37 @@
|
||||
# Screenshots
|
||||
|
||||
## Home
|
||||
## Playlet
|
||||
|
||||

|
||||
| Home | Search |
|
||||
| ------------------- | ----------------------- |
|
||||
|  |  |
|
||||
|
||||
## Search
|
||||
| Bookmarks | Queue + Picture-in-picture |
|
||||
| ----------------------------- | ----------------------------------------------------- |
|
||||
|  |  |
|
||||
|
||||

|
||||
| Channel | Playlist |
|
||||
| ------------------------- | --------------------------- |
|
||||
|  |  |
|
||||
|
||||
## Settings
|
||||
| Settings | Invidious instances | Invidious testing |
|
||||
| --------------------------- | ------------------------------------------------ | --------------------------------------------- |
|
||||
|  |  |  |
|
||||
|
||||

|
||||
| Link to web app | App info |
|
||||
| ----------------------------------- | --------------------------- |
|
||||
|  |  |
|
||||
|
||||
## Playlist
|
||||
## Playlet web app
|
||||
|
||||

|
||||
|
||||
## Link to web app
|
||||
|
||||

|
||||
|
||||
## App info
|
||||
|
||||

|
||||
|
||||
## Web app
|
||||
|
||||
|  |  |  |
|
||||
| Home | Search | Settings |
|
||||
| ---------------------------------- | -------------------------------------- | ------------------------------------------ |
|
||||
|  |  |  |
|
||||
|
||||
| Bookmarks | Remote | Cast video |
|
||||
| ------------------------------------ | ------------------------------ | -------------------------------- |
|
||||
|  |  |  |
|
||||
|
||||
| App info | | |
|
||||
| ------------------------------ | --- | --- |
|
||||
|  | | |
|
||||
|
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 37 KiB |
|
After Width: | Height: | Size: 78 KiB |
|
After Width: | Height: | Size: 123 KiB |
|
Before Width: | Height: | Size: 83 KiB After Width: | Height: | Size: 124 KiB |
|
After Width: | Height: | Size: 62 KiB |
|
After Width: | Height: | Size: 41 KiB |
|
After Width: | Height: | Size: 106 KiB |
|
Before Width: | Height: | Size: 80 KiB After Width: | Height: | Size: 83 KiB |
|
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 39 KiB |
|
After Width: | Height: | Size: 639 KiB |
|
After Width: | Height: | Size: 982 KiB |
|
Before Width: | Height: | Size: 358 KiB After Width: | Height: | Size: 1.2 MiB |
|
After Width: | Height: | Size: 244 KiB |
|
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 52 KiB |
|
After Width: | Height: | Size: 154 KiB |
|
Before Width: | Height: | Size: 362 KiB After Width: | Height: | Size: 751 KiB |
|
Before Width: | Height: | Size: 99 KiB After Width: | Height: | Size: 256 KiB |
@@ -1,22 +1,22 @@
|
||||
{
|
||||
"name": "playlet",
|
||||
"version": "0.18.0",
|
||||
"version": "0.19.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "playlet",
|
||||
"version": "0.18.0",
|
||||
"version": "0.19.0",
|
||||
"hasInstallScript": true,
|
||||
"devDependencies": {
|
||||
"@rokucommunity/bslint": "^0.8.13",
|
||||
"@rokucommunity/bslint": "^0.8.14",
|
||||
"@types/crypto-js": "^4.2.1",
|
||||
"@types/fs-extra": "^11.0.4",
|
||||
"@types/node": "^20.10.5",
|
||||
"@types/node": "^20.10.7",
|
||||
"@types/xml2js": "^0.4.14",
|
||||
"argparse": "^2.0.1",
|
||||
"brighterscript": "0.65.14",
|
||||
"brighterscript-formatter": "^1.6.36",
|
||||
"brighterscript": "0.65.16",
|
||||
"brighterscript-formatter": "^1.6.37",
|
||||
"convert-svg-to-png": "^0.6.4",
|
||||
"cross-fetch": "^4.0.0",
|
||||
"crypto-js": "^4.2.0",
|
||||
@@ -27,9 +27,9 @@
|
||||
"imap": "^0.8.19",
|
||||
"ip": "^1.1.8",
|
||||
"json5": "^2.2.3",
|
||||
"mailparser": "^3.6.5",
|
||||
"mailparser": "^3.6.6",
|
||||
"roku-deploy": "^3.11.2",
|
||||
"rooibos-roku": "^5.8.0",
|
||||
"rooibos-roku": "^5.10.0",
|
||||
"semver": "^7.5.4",
|
||||
"shelljs": "^0.8.5",
|
||||
"ts-node": "^10.9.2",
|
||||
@@ -276,9 +276,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@rokucommunity/bslint": {
|
||||
"version": "0.8.13",
|
||||
"resolved": "https://registry.npmjs.org/@rokucommunity/bslint/-/bslint-0.8.13.tgz",
|
||||
"integrity": "sha512-EC5tQdtRFTJxOo+9lnZz6yLcsyctuchCzUNJX391ZgCN0EKJTjGigyqTsdsFprINmr0pBojUiys/ZpS/Bv3ROQ==",
|
||||
"version": "0.8.14",
|
||||
"resolved": "https://registry.npmjs.org/@rokucommunity/bslint/-/bslint-0.8.14.tgz",
|
||||
"integrity": "sha512-vKD2weW5I8jOXe+2xHN9FZ9GUCkbE/FOTbWcziLXrObraXJZcNRqk+fWDvi7go79ourQ/9DmYfmFH0bocjOMqg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"fs-extra": "^10.0.0",
|
||||
@@ -370,9 +370,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "20.10.5",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.5.tgz",
|
||||
"integrity": "sha512-nNPsNE65wjMxEKI93yOP+NPGGBJz/PoN3kZsVLee0XMiJolxSekEVD8wRwBUBqkwc7UWop0edW50yrCQW4CyRw==",
|
||||
"version": "20.10.7",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.7.tgz",
|
||||
"integrity": "sha512-fRbIKb8C/Y2lXxB5eVMj4IU7xpdox0Lh8bUPEdtLysaylsml1hOOx1+STloRs/B9nf7C6kPRmmg/V7aQW7usNg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"undici-types": "~5.26.4"
|
||||
@@ -728,9 +728,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/brighterscript": {
|
||||
"version": "0.65.14",
|
||||
"resolved": "https://registry.npmjs.org/brighterscript/-/brighterscript-0.65.14.tgz",
|
||||
"integrity": "sha512-DVbFFp/ESu3Ow1LNsELTrmf4S/8bmXUTP9Z3R3VW21WRed392pur9ZU+tiz8w0Z0BaKjPOi+JD13P+PWkEq8zw==",
|
||||
"version": "0.65.16",
|
||||
"resolved": "https://registry.npmjs.org/brighterscript/-/brighterscript-0.65.16.tgz",
|
||||
"integrity": "sha512-2RJMF8itkrPXtZ92JkJf3emvzcCl5ETXGVyPsdO/hMKbUGinEGMRFG07FR0bzjRotbALzsozGE/Hjzw412Sjww==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@rokucommunity/bslib": "^0.1.1",
|
||||
@@ -771,12 +771,12 @@
|
||||
}
|
||||
},
|
||||
"node_modules/brighterscript-formatter": {
|
||||
"version": "1.6.36",
|
||||
"resolved": "https://registry.npmjs.org/brighterscript-formatter/-/brighterscript-formatter-1.6.36.tgz",
|
||||
"integrity": "sha512-f9Y3Re6egB1MCUftph8AT8RxWTtXmeMjwigRv1biNGmEuGeSOipoBnCbwY4U1CFz46L7W39/TL4n1JMV9URD6w==",
|
||||
"version": "1.6.37",
|
||||
"resolved": "https://registry.npmjs.org/brighterscript-formatter/-/brighterscript-formatter-1.6.37.tgz",
|
||||
"integrity": "sha512-jIlqRjPVIp2WwB9Pe0YwK4KU4G3WqhRsqRluuOFY1sTDVW0R/AKXMvCfTsu99L2W7CbpeWA4UjOPzl9JOqN5hw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"brighterscript": "^0.65.12",
|
||||
"brighterscript": "^0.65.16",
|
||||
"glob-all": "^3.3.0",
|
||||
"jsonc-parser": "^3.0.0",
|
||||
"source-map": "^0.7.3",
|
||||
@@ -2902,12 +2902,12 @@
|
||||
}
|
||||
},
|
||||
"node_modules/linkify-it": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-4.0.1.tgz",
|
||||
"integrity": "sha512-C7bfi1UZmoj8+PQx22XyeXCuBlokoyWQL5pWSP+EI6nzRylyThouddufc2c1NDIcP9k5agmN9fLpA7VNJfIiqw==",
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-5.0.0.tgz",
|
||||
"integrity": "sha512-5aHCbzQRADcdP+ATqnDuhhJ/MRIqDkZX5pyjFHRRysS8vZ5AbqGEoFIb6pYHPZ+L/OC2Lc+xT8uHVVR5CAK/wQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"uc.micro": "^1.0.1"
|
||||
"uc.micro": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/locate-path": {
|
||||
@@ -2980,9 +2980,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/mailparser": {
|
||||
"version": "3.6.5",
|
||||
"resolved": "https://registry.npmjs.org/mailparser/-/mailparser-3.6.5.tgz",
|
||||
"integrity": "sha512-nteTpF0Khm5JLOnt4sigmzNdUH/6mO7PZ4KEnvxf4mckyXYFFhrtAWZzbq/V5aQMH+049gA7ZjfLdh+QiX2Uqg==",
|
||||
"version": "3.6.6",
|
||||
"resolved": "https://registry.npmjs.org/mailparser/-/mailparser-3.6.6.tgz",
|
||||
"integrity": "sha512-noCjBl3FToxmqTP2fp7z17hQsiCroWNntfTd8O+UejOAF59xeN5WGZK27ilexXV2e2X/cbUhG3L8sfEKaz0/sw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"encoding-japanese": "2.0.0",
|
||||
@@ -2990,10 +2990,10 @@
|
||||
"html-to-text": "9.0.5",
|
||||
"iconv-lite": "0.6.3",
|
||||
"libmime": "5.2.1",
|
||||
"linkify-it": "4.0.1",
|
||||
"linkify-it": "5.0.0",
|
||||
"mailsplit": "5.4.0",
|
||||
"nodemailer": "6.9.3",
|
||||
"tlds": "1.240.0"
|
||||
"nodemailer": "6.9.8",
|
||||
"tlds": "1.248.0"
|
||||
}
|
||||
},
|
||||
"node_modules/mailparser/node_modules/iconv-lite": {
|
||||
@@ -3200,9 +3200,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/nodemailer": {
|
||||
"version": "6.9.3",
|
||||
"resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.9.3.tgz",
|
||||
"integrity": "sha512-fy9v3NgTzBngrMFkDsKEj0r02U7jm6XfC3b52eoNV+GCrGj+s8pt5OqhiJdWKuw51zCTdiNR/IUD1z33LIIGpg==",
|
||||
"version": "6.9.8",
|
||||
"resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.9.8.tgz",
|
||||
"integrity": "sha512-cfrYUk16e67Ks051i4CntM9kshRYei1/o/Gi8K1d+R34OIs21xdFnW7Pt7EucmVKA0LKtqUGNcjMZ7ehjl49mQ==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=6.0.0"
|
||||
@@ -3994,9 +3994,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/rooibos-roku": {
|
||||
"version": "5.8.0",
|
||||
"resolved": "https://registry.npmjs.org/rooibos-roku/-/rooibos-roku-5.8.0.tgz",
|
||||
"integrity": "sha512-mPAszwOH1VdxMgSaoXQ/CgpAZ3RQ0A+d3BoxyY8axMsYS5kPO/8dL8fa7iFTGEZYA7803Ur52zlyN8GXqV5nLg==",
|
||||
"version": "5.10.0",
|
||||
"resolved": "https://registry.npmjs.org/rooibos-roku/-/rooibos-roku-5.10.0.tgz",
|
||||
"integrity": "sha512-Idiv3nWQOEr5V8z8oHcIovjcoBffgqRtTQ5B6K+x/cGAouKxyVJp0fsZ80xQvUul9IwHQ0XIPUYbNWCR3RQ3sA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"source-map": "^0.7.3",
|
||||
@@ -4477,9 +4477,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/tlds": {
|
||||
"version": "1.240.0",
|
||||
"resolved": "https://registry.npmjs.org/tlds/-/tlds-1.240.0.tgz",
|
||||
"integrity": "sha512-1OYJQenswGZSOdRw7Bql5Qu7uf75b+F3HFBXbqnG/ifHa0fev1XcG+3pJf3pA/KC6RtHQzfKgIf1vkMlMG7mtQ==",
|
||||
"version": "1.248.0",
|
||||
"resolved": "https://registry.npmjs.org/tlds/-/tlds-1.248.0.tgz",
|
||||
"integrity": "sha512-noj0KdpWTBhwsKxMOXk0rN9otg4kTgLm4WohERRHbJ9IY+kSDKr3RmjitaQ3JFzny+DyvBOQKlFZhp0G0qNSfg==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"tlds": "bin.js"
|
||||
@@ -4612,9 +4612,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/uc.micro": {
|
||||
"version": "1.0.6",
|
||||
"resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.6.tgz",
|
||||
"integrity": "sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA==",
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-2.0.0.tgz",
|
||||
"integrity": "sha512-DffL94LsNOccVn4hyfRe5rdKa273swqeA5DJpMOeFmEn1wCDc7nAbbB0gXlgBCL7TNzeTv6G7XVWzan7iJtfig==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/unbzip2-stream": {
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
{
|
||||
"name": "playlet",
|
||||
"version": "0.18.0",
|
||||
"version": "0.19.0",
|
||||
"description": "Unofficial Youtube client for Roku",
|
||||
"devDependencies": {
|
||||
"@rokucommunity/bslint": "^0.8.13",
|
||||
"@rokucommunity/bslint": "^0.8.14",
|
||||
"@types/crypto-js": "^4.2.1",
|
||||
"@types/fs-extra": "^11.0.4",
|
||||
"@types/node": "^20.10.5",
|
||||
"@types/node": "^20.10.7",
|
||||
"@types/xml2js": "^0.4.14",
|
||||
"argparse": "^2.0.1",
|
||||
"brighterscript": "0.65.14",
|
||||
"brighterscript-formatter": "^1.6.36",
|
||||
"brighterscript": "0.65.16",
|
||||
"brighterscript-formatter": "^1.6.37",
|
||||
"convert-svg-to-png": "^0.6.4",
|
||||
"cross-fetch": "^4.0.0",
|
||||
"crypto-js": "^4.2.0",
|
||||
@@ -21,9 +21,9 @@
|
||||
"imap": "^0.8.19",
|
||||
"ip": "^1.1.8",
|
||||
"json5": "^2.2.3",
|
||||
"mailparser": "^3.6.5",
|
||||
"mailparser": "^3.6.6",
|
||||
"roku-deploy": "^3.11.2",
|
||||
"rooibos-roku": "^5.8.0",
|
||||
"rooibos-roku": "^5.10.0",
|
||||
"semver": "^7.5.4",
|
||||
"shelljs": "^0.8.5",
|
||||
"ts-node": "^10.9.2",
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "playlet-app",
|
||||
"version": "0.18.0",
|
||||
"version": "0.19.0",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "playlet-app",
|
||||
"version": "0.18.0"
|
||||
"version": "0.19.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "playlet-app",
|
||||
"version": "0.18.0",
|
||||
"version": "0.19.0",
|
||||
"description": "Unofficial Youtube client for Roku",
|
||||
"scripts": {
|
||||
"prebuild": "rm -rf build/playlet-app",
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import "LoadingMessages.bs"
|
||||
import "pkg:/source/Logger.bs"
|
||||
|
||||
function Init() as void
|
||||
m.scene = m.top.getScene()
|
||||
@@ -21,17 +22,17 @@ end function
|
||||
|
||||
function GetPlayletLibUrls() as object
|
||||
#if DEBUG
|
||||
debug = { type: "debug", link: ReadManifestValue("playlet_lib_debug_url") }
|
||||
debug = { type: "debug", link: Manifest.ReadValue("playlet_lib_debug_url") }
|
||||
return [debug]
|
||||
#else
|
||||
savedUrls = GetPlayletLibUrlsFromRegistry()
|
||||
savedUrls = Registry.GetPlayletLibUrlsFromRegistry()
|
||||
if savedUrls <> invalid
|
||||
m.shouldClearRegistryOnLoadFail = true
|
||||
return savedUrls
|
||||
end if
|
||||
|
||||
github = { type: "github", link: ReadManifestValue("playlet_lib_remote_url") }
|
||||
embedded = { type: "embedded", link: ReadManifestValue("playlet_lib_embedded_url") }
|
||||
github = { type: "github", link: Manifest.ReadValue("playlet_lib_remote_url") }
|
||||
embedded = { type: "embedded", link: Manifest.ReadValue("playlet_lib_embedded_url") }
|
||||
return [github, embedded]
|
||||
#end if
|
||||
end function
|
||||
@@ -40,7 +41,7 @@ function LoadPlayletLib() as void
|
||||
if m.playletLibUrlIndex >= m.playletLibUrls.Count()
|
||||
m.loadingIndicator.visible = false
|
||||
if m.shouldClearRegistryOnLoadFail = true
|
||||
DeleteRegistryKey("playlet_lib_urls", "Playlet")
|
||||
Registry.DeleteKey("playlet_lib_urls", "Playlet")
|
||||
end if
|
||||
ShowPlayletLibLoadErrorDialog()
|
||||
return
|
||||
@@ -55,8 +56,8 @@ function OnLoadStatusChanged() as void
|
||||
libUrl = m.playletLibUrls[m.playletLibUrlIndex]
|
||||
if m.lib.loadStatus = "ready"
|
||||
RemoveComponentLibrary()
|
||||
' bs:disable-next-line LINT3012
|
||||
?"Playlet lib loaded from " libUrl.link
|
||||
Logger.Log(`Playlet lib loaded from ${libUrl.link} in ${m.timer.TotalMilliseconds()} ms`)
|
||||
m.timer = invalid
|
||||
m.scene.playletLibLoadedUrl = libUrl
|
||||
container = m.scene.findNode("MainSceneContainer")
|
||||
container.createChild("PlayletLib:MainScene")
|
||||
@@ -64,8 +65,7 @@ function OnLoadStatusChanged() as void
|
||||
end if
|
||||
|
||||
if m.lib.loadStatus = "failed"
|
||||
' bs:disable-next-line LINT3012
|
||||
?"Playlet lib failed to load from " libUrl.link
|
||||
Logger.Log(`Playlet lib failed to load from ${libUrl.link}`)
|
||||
' Try next url
|
||||
m.playletLibUrlIndex += 1
|
||||
LoadPlayletLib()
|
||||
@@ -83,11 +83,14 @@ function RemoveComponentLibrary() as void
|
||||
end function
|
||||
|
||||
function LoadComponentLibrary(uri as string)
|
||||
m.timer = CreateObject("roTimespan")
|
||||
m.timer.mark()
|
||||
|
||||
m.lib = m.scene.createChild("ComponentLibrary")
|
||||
' bs:disable-next-line NO_OBSERVE_STRING_CALLBACK
|
||||
m.lib.observeField("loadStatus", "OnLoadStatusChanged")
|
||||
' bs:disable-next-line LINT3012
|
||||
?"Loading Playlet lib from " uri
|
||||
|
||||
Logger.Log(`Loading Playlet lib from ${uri}`)
|
||||
m.lib.uri = uri
|
||||
end function
|
||||
|
||||
@@ -106,5 +109,5 @@ function ShowPlayletLibLoadErrorDialog()
|
||||
"If the problem persist, contact Playlet authors."
|
||||
]
|
||||
|
||||
ShowErrorDialog(message, bulletText, bottomText)
|
||||
Dialog.ShowError(message, bulletText, bottomText)
|
||||
end function
|
||||
@@ -2,7 +2,7 @@ title=Playlet
|
||||
|
||||
# Do not update version manually, it is auto updated from package.json
|
||||
major_version=0
|
||||
minor_version=18
|
||||
minor_version=19
|
||||
build_version=00000
|
||||
|
||||
ui_resolutions=hd
|
||||
|
||||
@@ -1,40 +1,45 @@
|
||||
function ShowErrorDialog(message as object, bulletText as object, bottomMessage as object)
|
||||
' Note: dialog can be null since StandardMessageDialog is only available on 10.0 and later
|
||||
dialog = CreateObject("roSGNode", "StandardMessageDialog")
|
||||
SetPalette(dialog)
|
||||
dialog.message = message
|
||||
dialog.bulletText = bulletText
|
||||
dialog.bottomMessage = bottomMessage
|
||||
dialog.title = "Error loading Playlet"
|
||||
dialog.buttons = ["Exit"]
|
||||
namespace Dialog
|
||||
|
||||
' bs:disable-next-line NO_OBSERVE_STRING_CALLBACK
|
||||
dialog.observeField("buttonSelected", "OnButtonSelected")
|
||||
' bs:disable-next-line NO_OBSERVE_STRING_CALLBACK
|
||||
dialog.observeField("wasClosed", "OnDialogClosed")
|
||||
function ShowError(message as object, bulletText as object, bottomMessage as object)
|
||||
' Note: dialog can be null since StandardMessageDialog is only available on 10.0 and later
|
||||
msgDialog = CreateObject("roSGNode", "StandardMessageDialog")
|
||||
SetPalette(msgDialog)
|
||||
msgDialog.message = message
|
||||
msgDialog.bulletText = bulletText
|
||||
msgDialog.bottomMessage = bottomMessage
|
||||
msgDialog.title = "Error loading Playlet"
|
||||
msgDialog.buttons = ["Exit"]
|
||||
|
||||
m.top.getScene().dialog = dialog
|
||||
end function
|
||||
' bs:disable-next-line NO_OBSERVE_STRING_CALLBACK
|
||||
msgDialog.observeField("buttonSelected", "OnButtonSelected")
|
||||
' bs:disable-next-line NO_OBSERVE_STRING_CALLBACK
|
||||
msgDialog.observeField("wasClosed", "OnDialogClosed")
|
||||
|
||||
function 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
|
||||
m.top.getScene().dialog = msgDialog
|
||||
end function
|
||||
|
||||
function OnButtonSelected()
|
||||
m.top.getScene().dialog.close = true
|
||||
end function
|
||||
function SetPalette(msgDialog as object)
|
||||
palette = createObject("roSGNode", "RSGPalette")
|
||||
palette.colors = {
|
||||
DialogBackgroundColor: "#242424FF"
|
||||
DialogFocusColor: "#CECECEFF"
|
||||
DialogFocusItemColor: "#202020FF"
|
||||
DialogSecondaryTextColor: "#DBDBDBFF"
|
||||
DialogSecondaryItemColor: "#FF1C30FF"
|
||||
DialogTextColor: "#DBDBDBFF"
|
||||
}
|
||||
msgDialog.palette = palette
|
||||
end function
|
||||
|
||||
function OnButtonSelected()
|
||||
m.top.getScene().dialog.close = true
|
||||
end function
|
||||
|
||||
function OnDialogClosed()
|
||||
' TODO:P1 throw an exception to cause a crash report to be generated
|
||||
' Should include which playlet lib failed to load
|
||||
m.top.getScene().exitChannel = true
|
||||
end function
|
||||
|
||||
end namespace
|
||||
|
||||
function OnDialogClosed()
|
||||
' TODO:P1 throw an exception to cause a crash report to be generated
|
||||
' Should include which playlet lib failed to load
|
||||
m.top.getScene().exitChannel = true
|
||||
end function
|
||||
@@ -0,0 +1,20 @@
|
||||
namespace Logger
|
||||
|
||||
' Put the file at the root directry to avoid needing to create a folder
|
||||
const LOGS_FILE_PATH = "cachefs:/playlet_startup_logs.txt"
|
||||
|
||||
function Init()
|
||||
DeleteFile(LOGS_FILE_PATH)
|
||||
end function
|
||||
|
||||
function Log(msg as string)
|
||||
msg = "[APP] " + msg
|
||||
' bs:disable-next-line LINT3012
|
||||
print(msg)
|
||||
|
||||
buffer = CreateObject("roByteArray")
|
||||
buffer.FromAsciiString(msg + `\n`)
|
||||
buffer.AppendFile(LOGS_FILE_PATH)
|
||||
end function
|
||||
|
||||
end namespace
|
||||
@@ -1,5 +1,5 @@
|
||||
' Playlet (App to play videos from an Invidious server on Roku TVs)
|
||||
' Copyright (C) 2023 Brahim Hadriche
|
||||
' Copyright (C) 2024 Brahim Hadriche
|
||||
|
||||
' This program is free software: you can redistribute it and/or modify
|
||||
' it under the terms of the GNU Affero General Public License as published by
|
||||
@@ -19,8 +19,9 @@ function Main(args as object) as void
|
||||
port = CreateObject("roMessagePort")
|
||||
screen.setMessagePort(port)
|
||||
m.global = screen.getGlobalNode()
|
||||
Logger.Init()
|
||||
|
||||
ClearPlayletLibUrlsIfNeeded(args)
|
||||
Registry.ClearPlayletLibUrlsIfNeeded(args)
|
||||
|
||||
scene = screen.CreateScene("BootstrapScene")
|
||||
screen.show()
|
||||
@@ -77,7 +78,7 @@ function Main(args as object) as void
|
||||
field = msg.getField()
|
||||
data = msg.getData()
|
||||
if field = "exitChannel" and data = true
|
||||
END
|
||||
return
|
||||
end if
|
||||
else if msgType = "roInputEvent"
|
||||
scene.inputArgs = msg.getInfo()
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
function ReadManifestValue(key as string) as string
|
||||
appInfo = CreateObject("roAppInfo")
|
||||
return appInfo.GetValue(key)
|
||||
end function
|
||||
namespace Manifest
|
||||
|
||||
function ReadValue(key as string) as string
|
||||
appInfo = CreateObject("roAppInfo")
|
||||
return appInfo.GetValue(key)
|
||||
end function
|
||||
|
||||
end namespace
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace Tests
|
||||
@params("playlet_lib_remote_url", "https://github.com/iBicha/playlet/releases/latest/download/playlet-lib.zip")
|
||||
@params("playlet_lib_embedded_url", "pkg:/lib/playlet-lib.zip")
|
||||
function _(key as string, expectedValue as string)
|
||||
m.assertEqual(ReadManifestValue(key), expectedValue)
|
||||
m.assertEqual(Manifest.ReadValue(key), expectedValue)
|
||||
end function
|
||||
|
||||
end class
|
||||
|
||||
@@ -1,29 +1,34 @@
|
||||
function ReadRegistryKey(key as string, section as string) as dynamic
|
||||
sec = CreateObject("roRegistrySection", section)
|
||||
if not sec.Exists(key)
|
||||
return invalid
|
||||
end if
|
||||
return sec.Read(key)
|
||||
end function
|
||||
namespace Registry
|
||||
|
||||
function DeleteRegistryKey(key as string, section as string)
|
||||
sec = CreateObject("roRegistrySection", section)
|
||||
sec.Delete(key)
|
||||
sec.Flush()
|
||||
end function
|
||||
function ReadKey(key as string, section as string) as dynamic
|
||||
sec = CreateObject("roRegistrySection", section)
|
||||
if not sec.Exists(key)
|
||||
return invalid
|
||||
end if
|
||||
return sec.Read(key)
|
||||
end function
|
||||
|
||||
function GetPlayletLibUrlsFromRegistry() as object
|
||||
urlsJson = ReadRegistryKey("playlet_lib_urls", "Playlet")
|
||||
if urlsJson = invalid
|
||||
return invalid
|
||||
end if
|
||||
urls = ParseJson(urlsJson)
|
||||
return urls
|
||||
end function
|
||||
function DeleteKey(key as string, section as string)
|
||||
sec = CreateObject("roRegistrySection", section)
|
||||
sec.Delete(key)
|
||||
sec.Flush()
|
||||
end function
|
||||
|
||||
function ClearPlayletLibUrlsIfNeeded(launchArgs as object) as void
|
||||
if launchArgs = invalid or launchArgs.clearPlayletLibUrls = invalid
|
||||
return
|
||||
end if
|
||||
DeleteRegistryKey("playlet_lib_urls", "Playlet")
|
||||
end function
|
||||
function GetPlayletLibUrlsFromRegistry() as object
|
||||
urlsJson = ReadKey("playlet_lib_urls", "Playlet")
|
||||
if urlsJson = invalid
|
||||
return invalid
|
||||
end if
|
||||
urls = ParseJson(urlsJson)
|
||||
return urls
|
||||
end function
|
||||
|
||||
function ClearPlayletLibUrlsIfNeeded(launchArgs as object) as void
|
||||
if launchArgs = invalid or launchArgs.clearPlayletLibUrls = invalid
|
||||
return
|
||||
end if
|
||||
DeleteKey("playlet_lib_urls", "Playlet")
|
||||
Logger.Log("Cleared key playlet_lib_urls from registry")
|
||||
end function
|
||||
|
||||
end namespace
|
||||
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "playlet-lib",
|
||||
"version": "0.18.0",
|
||||
"version": "0.19.0",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "playlet-lib",
|
||||
"version": "0.18.0"
|
||||
"version": "0.19.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "playlet-lib",
|
||||
"version": "0.18.0",
|
||||
"version": "0.19.0",
|
||||
"description": "Unofficial Youtube client for Roku",
|
||||
"scripts": {
|
||||
"prebuild": "rm -rf build/playlet-lib",
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import "pkg:/components/Navigation/Navigation.bs"
|
||||
import "pkg:/source/asyncTask/asyncTask.bs"
|
||||
import "pkg:/source/AsyncTask/AsyncTask.bs"
|
||||
import "pkg:/source/AsyncTask/Tasks.bs"
|
||||
import "pkg:/source/utils/DisposableObserve.bs"
|
||||
import "pkg:/source/utils/FocusManagement.bs"
|
||||
import "pkg:/source/utils/Logging.bs"
|
||||
import "pkg:/source/utils/StringUtils.bs"
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
import "SubscribeTask.bs"
|
||||
|
||||
function Init()
|
||||
m.container = m.top.findNode("container")
|
||||
@@ -134,7 +134,7 @@ function OnSubscribeButtonSelected()
|
||||
end if
|
||||
|
||||
isSubbed = IsSubscribed()
|
||||
m.subscribeTask = StartAsyncTask(SubscribeTask, {
|
||||
m.subscribeTask = AsyncTask.Start(Tasks.SubscribeTask, {
|
||||
invidious: m.invidious
|
||||
ucid: m.authorId
|
||||
subscribe: not isSubbed
|
||||
@@ -185,9 +185,6 @@ function InitializeTabs()
|
||||
playlists: function(authorId as string, author as string) as object
|
||||
return CreateChannelFeed("Playlists", "channel_playlists", authorId, author)
|
||||
end function
|
||||
channels: function(authorId as string, author as string) as object
|
||||
return CreateChannelFeed("Channels", "channel_channels", authorId, author)
|
||||
end function
|
||||
}
|
||||
end function
|
||||
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import "pkg:/components/ContentNode/ChannelContentTask.bs"
|
||||
import "pkg:/components/Dialog/DialogUtils.bs"
|
||||
import "pkg:/source/asyncTask/asyncTask.bs"
|
||||
import "pkg:/components/VideoFeed/FeedLoadState.bs"
|
||||
import "pkg:/source/AsyncTask/AsyncTask.bs"
|
||||
import "pkg:/source/AsyncTask/Tasks.bs"
|
||||
import "pkg:/source/utils/ErrorUtils.bs"
|
||||
import "pkg:/source/utils/Logging.bs"
|
||||
|
||||
function Init()
|
||||
end function
|
||||
@@ -17,7 +19,7 @@ function LoadChannel(invidiousNode as object) as void
|
||||
end if
|
||||
|
||||
m.top.loadState = FeedLoadState.Loading
|
||||
m.contentTask = StartAsyncTask(ChannelContentTask, {
|
||||
m.contentTask = AsyncTask.Start(Tasks.ChannelContentTask, {
|
||||
content: m.top
|
||||
invidious: invidiousNode
|
||||
}, OnChannelContentTaskResult)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import "DialogPalette.bs"
|
||||
import "pkg:/components/Screens/WebAppScreen/GenerateQrCodeTask.bs"
|
||||
import "pkg:/source/asyncTask/asyncTask.bs"
|
||||
import "pkg:/source/AsyncTask/AsyncTask.bs"
|
||||
import "pkg:/source/AsyncTask/Tasks.bs"
|
||||
import "pkg:/source/utils/StringUtils.bs"
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
|
||||
@@ -33,7 +33,7 @@ function OnUrlSet()
|
||||
url = m.top.url
|
||||
|
||||
m.urlLabel.text = url
|
||||
StartAsyncTask(GenerateQrCodeTask, {
|
||||
AsyncTask.Start(Tasks.GenerateQrCodeTask, {
|
||||
poster: m.qrCode
|
||||
text: url
|
||||
size: m.qrCode.loadWidth
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import "pkg:/source/utils/Logging.bs"
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
import "pkg:/source/utils/StringUtils.bs"
|
||||
|
||||
function Init()
|
||||
m.top.functionName = "LoggerLoop"
|
||||
@@ -32,13 +32,23 @@ function LoggerLoop()
|
||||
port = m.port
|
||||
|
||||
buffer = CreateObject("roByteArray")
|
||||
previousLogsFile = m.top.folder + "/" + m.top.filenamePrevious
|
||||
logsFile = m.top.folder + "/" + m.top.filename
|
||||
previousLogsFile = m.top.folder + "/" + m.top.filenamePrevious
|
||||
filenameStartup = m.top.filenameStartup
|
||||
|
||||
CreateDirectory(m.top.folder)
|
||||
DeleteFile(previousLogsFile)
|
||||
MoveFile(logsFile, previousLogsFile)
|
||||
|
||||
startUpLogs = ReadAsciiFile(filenameStartup)
|
||||
if not StringUtils.IsNullOrEmpty(startUpLogs)
|
||||
line = `************* Startup Logs *************\n${startUpLogs}*********** End Startup Logs ***********\n`
|
||||
' bs:disable-next-line LINT3012
|
||||
print line
|
||||
buffer.FromAsciiString(line)
|
||||
buffer.AppendFile(logsFile)
|
||||
end if
|
||||
|
||||
while true
|
||||
msg = wait(0, port)
|
||||
msgType = type(msg)
|
||||
|
||||
@@ -5,5 +5,6 @@
|
||||
<field id="folder" type="string" value="cachefs:/logs" />
|
||||
<field id="filename" type="string" value="app_logs.txt" />
|
||||
<field id="filenamePrevious" type="string" value="app_logs_previous.txt" />
|
||||
<field id="filenameStartup" type="string" value="cachefs:/playlet_startup_logs.txt" />
|
||||
</interface>
|
||||
</component>
|
||||
@@ -1,10 +1,10 @@
|
||||
import "pkg:/components/Dialog/DialogUtils.bs"
|
||||
import "pkg:/components/NodeByRef/NodeByRef.bs"
|
||||
import "pkg:/components/PlaylistView/PlaylistContentTask.bs"
|
||||
import "pkg:/components/PlayQueue/Notifications/PlayQueueNotificationUtils.bs"
|
||||
import "pkg:/components/VideoFeed/FeedLoadState.bs"
|
||||
import "pkg:/components/VideoPlayer/VideoUtils.bs"
|
||||
import "pkg:/source/asyncTask/asyncTask.bs"
|
||||
import "pkg:/source/AsyncTask/AsyncTask.bs"
|
||||
import "pkg:/source/AsyncTask/Tasks.bs"
|
||||
import "pkg:/source/utils/ArrayUtils.bs"
|
||||
import "pkg:/source/utils/ErrorUtils.bs"
|
||||
import "pkg:/source/utils/Logging.bs"
|
||||
@@ -188,7 +188,7 @@ function LoadPlaylist(playlist as object) as void
|
||||
|
||||
playlist.loadState = FeedLoadState.Loading
|
||||
|
||||
task = StartAsyncTask(PlaylistContentTask, {
|
||||
task = AsyncTask.Start(Tasks.PlaylistContentTask, {
|
||||
content: playlist
|
||||
invidious: m.top.invidious
|
||||
}, OnPlaylistContentTaskResult)
|
||||
|
||||
@@ -2,10 +2,11 @@ import "pkg:/components/ChannelView/ChannelUtils.bs"
|
||||
import "pkg:/components/ContextMenu/ContextMenuUtils.bs"
|
||||
import "pkg:/components/Dialog/DialogUtils.bs"
|
||||
import "pkg:/components/Navigation/LongPress.bs"
|
||||
import "pkg:/components/PlaylistView/PlaylistContentTask.bs"
|
||||
import "pkg:/components/Services/Invidious/InvidiousToContentNode.bs"
|
||||
import "pkg:/components/VideoFeed/FeedLoadState.bs"
|
||||
import "pkg:/components/VideoPlayer/VideoUtils.bs"
|
||||
import "pkg:/source/asyncTask/asyncTask.bs"
|
||||
import "pkg:/source/AsyncTask/AsyncTask.bs"
|
||||
import "pkg:/source/AsyncTask/Tasks.bs"
|
||||
import "pkg:/source/utils/ErrorUtils.bs"
|
||||
import "pkg:/source/utils/FocusManagement.bs"
|
||||
import "pkg:/source/utils/Logging.bs"
|
||||
@@ -222,7 +223,7 @@ function LoadPlaylist() as void
|
||||
end if
|
||||
|
||||
m.top.content.loadState = FeedLoadState.Loading
|
||||
m.playlistLoadTask = StartAsyncTask(PlaylistContentTask, {
|
||||
m.playlistLoadTask = AsyncTask.Start(Tasks.PlaylistContentTask, {
|
||||
content: m.top.content
|
||||
invidious: m.top.invidious
|
||||
}, OnPlaylistContentTaskResult)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import "pkg:/source/asyncTask/asyncTask.bs"
|
||||
import "pkg:/source/AsyncTask/AsyncTask.bs"
|
||||
|
||||
function Init()
|
||||
' TODO:P2 Add tooltip to each field with description of what it means
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import "HomeScreenUtils.bs"
|
||||
import "pkg:/components/ContextMenu/ContextMenuUtils.bs"
|
||||
import "pkg:/components/Navigation/Navigation.bs"
|
||||
import "pkg:/source/utils/FocusManagement.bs"
|
||||
@@ -14,7 +15,15 @@ function OnNodeReady()
|
||||
SetNavigation(invalid, "left", m.navBar)
|
||||
|
||||
m.rowList@.BindNode()
|
||||
m.rowList.feeds = ParseJson(ReadAsciiFile(m.top.feedFile))
|
||||
|
||||
' TODO:P1 home screen should only be refreshed when the user navigates to it
|
||||
' (similar to bookmarks screen)
|
||||
m.preferences.observeFieldScoped("misc.home_screen_layout", FuncName(OnHomeLayoutChange))
|
||||
OnHomeLayoutChange()
|
||||
end function
|
||||
|
||||
function OnHomeLayoutChange() as void
|
||||
m.rowList.feeds = HomeScreenUtils.GetFeed(m.top.feedFile, m.preferences)
|
||||
end function
|
||||
|
||||
function OnFocusChange() as void
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
<interface>
|
||||
<field id="navBar" type="node" bind="/NavBar" />
|
||||
<field id="invidious" type="node" bind="/Invidious" />
|
||||
<field id="preferences" type="node" bind="/Preferences" />
|
||||
<field id="feedFile" type="string" value="libpkg:/config/default_home_layout.yaml" />
|
||||
</interface>
|
||||
<children>
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
|
||||
namespace HomeScreenUtils
|
||||
|
||||
function GetFeed(feedFileName as string, preferences as object) as object
|
||||
feed = ParseJson(ReadAsciiFile(feedFileName))
|
||||
|
||||
homeLayout = preferences["misc.home_screen_layout"]
|
||||
if not IsArray(homeLayout) or homeLayout.Count() = 0
|
||||
return feed
|
||||
end if
|
||||
|
||||
feedItems = {}
|
||||
for each item in feed
|
||||
feedItems[item["id"]] = item
|
||||
end for
|
||||
|
||||
filteredFeed = []
|
||||
for each item in homeLayout
|
||||
if item.enabled = true
|
||||
filteredFeed.push(feedItems[item.id])
|
||||
end if
|
||||
end for
|
||||
|
||||
return filteredFeed
|
||||
end function
|
||||
|
||||
end namespace
|
||||
@@ -1,7 +1,8 @@
|
||||
import "pkg:/components/Navigation/Navigation.bs"
|
||||
import "pkg:/components/Screens/SearchScreen/SearchSuggestionsTask.bs"
|
||||
import "pkg:/components/Services/SearchHistory/SearchHistoryUtils.bs"
|
||||
import "pkg:/source/asyncTask/asyncTask.bs"
|
||||
import "pkg:/source/AsyncTask/AsyncTask.bs"
|
||||
import "pkg:/source/AsyncTask/Tasks.bs"
|
||||
import "pkg:/source/utils/CryptoUtils.bs"
|
||||
import "pkg:/source/utils/ErrorUtils.bs"
|
||||
import "pkg:/source/utils/FocusManagement.bs"
|
||||
import "pkg:/source/utils/LoadingScreen.bs"
|
||||
@@ -98,7 +99,7 @@ function OnTextChange() as void
|
||||
m.searchSuggestionsTask.cancel = true
|
||||
end if
|
||||
|
||||
m.searchSuggestionsTask = StartAsyncTask(SearchSuggestionsTask, {
|
||||
m.searchSuggestionsTask = AsyncTask.Start(Tasks.SearchSuggestionsTask, {
|
||||
q: m.keyboard.text
|
||||
invidious: m.invidious
|
||||
preferences: m.preferences
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
import "pkg:/components/parts/AutoBind/OnNodeReadyNoOp.bs"
|
||||
import "pkg:/source/utils/FocusManagement.bs"
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
|
||||
function Init()
|
||||
m.top.focusable = true
|
||||
m.top.itemSpacings = [8]
|
||||
|
||||
m.button = m.top.findNode("button")
|
||||
m.button.observeField("buttonSelected", FuncName(OpenHomeScreenEditor))
|
||||
end function
|
||||
|
||||
function OnFocusChange() as void
|
||||
if not m.top.focus
|
||||
return
|
||||
end if
|
||||
|
||||
NodeSetFocus(m.button, true)
|
||||
end function
|
||||
|
||||
function BindPreference(preferences as object, key as string)
|
||||
if m.preferences <> invalid and m.key <> invalid
|
||||
m.preferences.unobserveFieldScoped(m.key)
|
||||
end if
|
||||
|
||||
m.preferences = preferences
|
||||
m.key = key
|
||||
|
||||
if preferences <> invalid and key <> invalid
|
||||
preferences.observeFieldScoped(key, FuncName(OnPreferenceChange))
|
||||
OnPreferenceChange()
|
||||
end if
|
||||
end function
|
||||
|
||||
function OpenHomeScreenEditor()
|
||||
editor = CreateObject("roSGNode", "HomeScreenEditor")
|
||||
m.appController@.PushScreen(editor)
|
||||
editor@.BindNode()
|
||||
editor.value = m.top.value
|
||||
editor.observeField("save", FuncName(OnSaveHomeScreenEditor))
|
||||
end function
|
||||
|
||||
function OnSaveHomeScreenEditor(event as object)
|
||||
editor = event.GetRoSGNode()
|
||||
m.top.value = editor.value
|
||||
end function
|
||||
|
||||
function OnPreferenceChange()
|
||||
m.top.value = m.preferences[m.key]
|
||||
end function
|
||||
|
||||
function OnValueChange() as void
|
||||
if m.preferences = invalid or m.key = invalid
|
||||
return
|
||||
end if
|
||||
|
||||
m.preferences[m.key] = m.top.value
|
||||
end function
|
||||
@@ -0,0 +1,21 @@
|
||||
<component name="EditHomeScreenControl" extends="LayoutGroup" includes="AutoBind,Focus">
|
||||
<interface>
|
||||
<field id="displayText" type="string" alias="Button.text" />
|
||||
<field id="description" type="string" alias="DescriptionLabel.text" />
|
||||
<field id="value" type="array" onChange="OnValueChange" />
|
||||
<field id="appController" type="node" bind="/AppController" />
|
||||
<function name="BindPreference" />
|
||||
</interface>
|
||||
<children>
|
||||
<Button
|
||||
id="button"
|
||||
minWidth="300"
|
||||
showFocusFootprint="true" />
|
||||
<Label id="DescriptionLabel"
|
||||
width="450"
|
||||
color="0xb4b4b4ff"
|
||||
wrap="true">
|
||||
<Font role="font" uri="font:SystemFontFile" size="18" />
|
||||
</Label>
|
||||
</children>
|
||||
</component>
|
||||
@@ -0,0 +1,156 @@
|
||||
import "pkg:/components/Navigation/Navigation.bs"
|
||||
import "pkg:/components/parts/AutoBind/OnNodeReadyNoOp.bs"
|
||||
import "pkg:/source/utils/MathUtils.bs"
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
|
||||
function Init()
|
||||
m.homeLayout = {}
|
||||
homeLayout = ParseJson(ReadAsciiFile("libpkg:/config/default_home_layout.yaml"))
|
||||
for each item in homeLayout
|
||||
m.homeLayout[item.id] = item
|
||||
end for
|
||||
|
||||
m.checkList = m.top.findNode("checkList")
|
||||
m.moveUpButton = m.top.findNode("moveUpButton")
|
||||
m.moveDownButton = m.top.findNode("moveDownButton")
|
||||
m.closeButton = m.top.findNode("closeButton")
|
||||
m.saveButton = m.top.findNode("saveButton")
|
||||
|
||||
SetNavigation(m.checkList, "down", m.saveButton)
|
||||
SetNavigation(m.saveButton, "up", m.checkList)
|
||||
SetNavigation(m.closeButton, "up", m.checkList)
|
||||
SetNavigation(m.saveButton, "right", m.closeButton)
|
||||
SetNavigation(m.closeButton, "left", m.saveButton)
|
||||
SetNavigation(m.moveUpButton, "left", m.checkList)
|
||||
SetNavigation(m.moveDownButton, "left", m.checkList)
|
||||
SetNavigation(m.checkList, "right", m.moveUpButton)
|
||||
SetNavigation(m.moveUpButton, "down", m.moveDownButton)
|
||||
SetNavigation(m.moveDownButton, "up", m.moveUpButton)
|
||||
SetNavigation(m.moveDownButton, "down", m.closeButton)
|
||||
|
||||
m.moveUpButton.observeField("buttonSelected", FuncName(OnMoveUpButtonSelected))
|
||||
m.moveDownButton.observeField("buttonSelected", FuncName(OnMoveDownButtonSelected))
|
||||
m.saveButton.observeField("buttonSelected", FuncName(OnSaveButtonSelected))
|
||||
m.closeButton.observeField("buttonSelected", FuncName(Close))
|
||||
|
||||
m.checkList.observeField("checkedState", FuncName(OnCheckedStateChange))
|
||||
end function
|
||||
|
||||
function OnFocusChange() as void
|
||||
if not m.top.focus
|
||||
return
|
||||
end if
|
||||
|
||||
NodeSetFocus(m.checkList, true)
|
||||
end function
|
||||
|
||||
function OnkeyEvent(key as string, press as boolean) as boolean
|
||||
if NavigationKeyHandler(key, press).handled
|
||||
return true
|
||||
end if
|
||||
|
||||
if key = "options" and press
|
||||
' A pass-through to the app controller, so it can toggle picture-in-picture
|
||||
return false
|
||||
end if
|
||||
|
||||
if key = "back" and press
|
||||
Close()
|
||||
return true
|
||||
end if
|
||||
|
||||
return true
|
||||
end function
|
||||
|
||||
function OnValueChange()
|
||||
content = m.checkList.content
|
||||
value = m.top.value
|
||||
|
||||
nodes = []
|
||||
checkedState = []
|
||||
for each item in value
|
||||
node = CreateObject("roSGNode", "ContentNode")
|
||||
node.id = item.id
|
||||
node.title = m.homeLayout[item.id].title
|
||||
nodes.push(node)
|
||||
checkedState.push(item.enabled)
|
||||
end for
|
||||
|
||||
labelCount = content.getChildCount()
|
||||
if labelCount > 0
|
||||
content.removeChildrenIndex(labelCount, 0)
|
||||
end if
|
||||
|
||||
content.appendChildren(nodes)
|
||||
m.checkList.checkedState = checkedState
|
||||
end function
|
||||
|
||||
function OnCheckedStateChange() as void
|
||||
content = m.checkList.content
|
||||
if content = invalid or content.getChildCount() = 0
|
||||
return
|
||||
end if
|
||||
checkedState = m.checkList.checkedState
|
||||
if checkedState = invalid or checkedState.Count() = 0
|
||||
return
|
||||
end if
|
||||
|
||||
value = []
|
||||
checkboxes = content.getChildren(-1, 0)
|
||||
|
||||
for i = 0 to checkboxes.Count() - 1
|
||||
checkbox = checkboxes[i]
|
||||
value.push({
|
||||
id: checkbox.id
|
||||
enabled: checkedState[i]
|
||||
})
|
||||
end for
|
||||
|
||||
m.top.value = value
|
||||
end function
|
||||
|
||||
function OnMoveUpButtonSelected() as void
|
||||
MoveItem(-1)
|
||||
end function
|
||||
|
||||
function OnMoveDownButtonSelected() as void
|
||||
MoveItem(1)
|
||||
end function
|
||||
|
||||
function MoveItem(offset as integer) as void
|
||||
content = m.checkList.content
|
||||
if content = invalid or content.getChildCount() = 0
|
||||
return
|
||||
end if
|
||||
|
||||
itemCount = content.getChildCount()
|
||||
index = m.checkList.itemFocused
|
||||
newIndex = MathUtils.Max(0, MathUtils.Min(index + offset, itemCount - 1))
|
||||
|
||||
if index = newIndex
|
||||
return
|
||||
end if
|
||||
|
||||
checkedState = m.checkList.checkedState
|
||||
node = content.getChild(index)
|
||||
content.insertChild(node, newIndex)
|
||||
|
||||
tmp = checkedState[index]
|
||||
checkedState[index] = checkedState[newIndex]
|
||||
checkedState[newIndex] = tmp
|
||||
|
||||
m.checkList.itemFocused = newIndex
|
||||
m.checkList.jumpToItem = newIndex
|
||||
m.checkList.checkedState = checkedState
|
||||
end function
|
||||
|
||||
function OnSaveButtonSelected()
|
||||
' Save the new layout to m.top.value
|
||||
OnCheckedStateChange()
|
||||
m.top.save = true
|
||||
Close()
|
||||
end function
|
||||
|
||||
function Close()
|
||||
m.appController@.PopScreen()
|
||||
end function
|
||||
@@ -0,0 +1,53 @@
|
||||
<component name="HomeScreenEditor" extends="Group" includes="AutoBind,Focus">
|
||||
<interface>
|
||||
<field id="value" type="array" onChange="OnValueChange" />
|
||||
<field id="save" type="boolean" alwaysNotify="true" />
|
||||
<field id="appController" type="node" bind="/AppController" />
|
||||
</interface>
|
||||
<children>
|
||||
<Rectangle
|
||||
width="1280"
|
||||
height="720"
|
||||
color="#000000"
|
||||
opacity="0.5">
|
||||
</Rectangle>
|
||||
<Rectangle
|
||||
width="960"
|
||||
height="600"
|
||||
translation="[160,60]"
|
||||
color="#242424">
|
||||
<CheckList
|
||||
id="checkList"
|
||||
vertFocusAnimationStyle="floatingFocus"
|
||||
translation="[164,70]">
|
||||
|
||||
<ContentNode role="content" />
|
||||
</CheckList>
|
||||
|
||||
<Button
|
||||
id="moveUpButton"
|
||||
text="Move up"
|
||||
showFocusFootprint="true"
|
||||
minWidth="220"
|
||||
translation="[640,183]" />
|
||||
<Button
|
||||
id="moveDownButton"
|
||||
text="Move down"
|
||||
showFocusFootprint="true"
|
||||
minWidth="220"
|
||||
translation="[640,273]" />
|
||||
<Button
|
||||
id="closeButton"
|
||||
text="Close"
|
||||
showFocusFootprint="true"
|
||||
minWidth="150"
|
||||
translation="[500,500]" />
|
||||
<Button
|
||||
id="saveButton"
|
||||
text="Save"
|
||||
showFocusFootprint="true"
|
||||
minWidth="150"
|
||||
translation="[320,500]" />
|
||||
</Rectangle>
|
||||
</children>
|
||||
</component>
|
||||
@@ -1,9 +1,10 @@
|
||||
import "pkg:/components/Dialog/DialogUtils.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:/source/asyncTask/asyncTask.bs"
|
||||
import "pkg:/source/AsyncTask/AsyncTask.bs"
|
||||
import "pkg:/source/AsyncTask/Tasks.bs"
|
||||
import "pkg:/source/utils/FocusManagement.bs"
|
||||
import "pkg:/source/utils/StringUtils.bs"
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
|
||||
function Init()
|
||||
@@ -58,7 +59,7 @@ function RunTestsTask()
|
||||
m.testingTask.cancel = true
|
||||
end if
|
||||
|
||||
m.testingTask = StartAsyncTask(InvidiousInstanceTestingTask, {
|
||||
m.testingTask = AsyncTask.Start(Tasks.InvidiousInstanceTestingTask, {
|
||||
instance: m.top.instance
|
||||
listNode: m.testList
|
||||
})
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import "pkg:/components/Dialog/DialogUtils.bs"
|
||||
import "pkg:/components/Screens/SettingsScreen/InvidiousInstance/InvidiousPublicInstances/InvidiousPublicInstancesTask.bs"
|
||||
import "pkg:/source/asyncTask/asyncTask.bs"
|
||||
import "pkg:/source/AsyncTask/AsyncTask.bs"
|
||||
import "pkg:/source/AsyncTask/Tasks.bs"
|
||||
import "pkg:/source/utils/ErrorUtils.bs"
|
||||
import "pkg:/source/utils/FocusManagement.bs"
|
||||
import "pkg:/source/utils/Logging.bs"
|
||||
@@ -43,7 +43,7 @@ function Refresh()
|
||||
m.invidiousPublicInstancesTask.cancel = true
|
||||
end if
|
||||
|
||||
m.invidiousPublicInstancesTask = StartAsyncTask(InvidiousPublicInstancesTask, {
|
||||
m.invidiousPublicInstancesTask = AsyncTask.Start(Tasks.InvidiousPublicInstancesTask, {
|
||||
listNode: m.instances
|
||||
}, OnInvidiousPublicInstancesTaskResults)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import "pkg:/components/Screens/WebAppScreen/GenerateQrCodeTask.bs"
|
||||
import "pkg:/source/asyncTask/asyncTask.bs"
|
||||
import "pkg:/source/AsyncTask/AsyncTask.bs"
|
||||
import "pkg:/source/AsyncTask/Tasks.bs"
|
||||
import "pkg:/source/utils/StringUtils.bs"
|
||||
|
||||
function Init()
|
||||
@@ -22,7 +22,7 @@ function OnUrlSet()
|
||||
urlLabel.text = url
|
||||
|
||||
qrCodePoster = m.top.findNode("QrCodePoster")
|
||||
StartAsyncTask(GenerateQrCodeTask, {
|
||||
AsyncTask.Start(Tasks.GenerateQrCodeTask, {
|
||||
poster: qrCodePoster
|
||||
text: url
|
||||
size: qrCodePoster.loadWidth
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import "LatestLibVersionTask.bs"
|
||||
import "pkg:/source/asyncTask/asyncTask.bs"
|
||||
|
||||
import "pkg:/source/AsyncTask/AsyncTask.bs"
|
||||
import "pkg:/source/AsyncTask/Tasks.bs"
|
||||
import "pkg:/source/services/ApplicationInfo.bs"
|
||||
|
||||
function Init()
|
||||
@@ -32,7 +31,7 @@ function GetLatestPlayletLibVersion(_unused as dynamic) as dynamic
|
||||
return invalid
|
||||
end if
|
||||
|
||||
m.latestLibVersionTask = StartAsyncTask(LatestLibVersionTask, {}, function(output as object) as void
|
||||
m.latestLibVersionTask = AsyncTask.Start(Tasks.LatestLibVersionTask, {}, function(output as object) as void
|
||||
m.latestLibVersionTask = invalid
|
||||
if output.success and output.result.latest <> invalid
|
||||
m.top.lib_version_latest = output.result.latest
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import "InvidiousService.bs"
|
||||
import "InvidiousSubscriptionsTask.bs"
|
||||
import "pkg:/source/asyncTask/asyncTask.bs"
|
||||
import "pkg:/source/AsyncTask/AsyncTask.bs"
|
||||
import "pkg:/source/AsyncTask/Tasks.bs"
|
||||
|
||||
function Init()
|
||||
m.top.apiDefinitions = ParseJson(ReadAsciiFile("libpkg:/config/invidious_video_api.yaml"))
|
||||
@@ -32,5 +32,5 @@ function GetSubscriptions() as void
|
||||
m.top.subscriptions = invalid
|
||||
return
|
||||
end if
|
||||
m.subscriptionsTask = StartAsyncTask(InvidiousSubscriptionsTask, { invidious: m.top })
|
||||
m.subscriptionsTask = AsyncTask.Start(Tasks.InvidiousSubscriptionsTask, { invidious: m.top })
|
||||
end function
|
||||
@@ -1,7 +1,7 @@
|
||||
import "pkg:/components/Dialog/DialogUtils.bs"
|
||||
import "pkg:/components/Services/Invidious/InvidiousUnregisterTokenTask.bs"
|
||||
import "pkg:/components/VideoFeed/PaginationType.bs"
|
||||
import "pkg:/source/asyncTask/asyncTask.bs"
|
||||
import "pkg:/source/AsyncTask/AsyncTask.bs"
|
||||
import "pkg:/source/AsyncTask/Tasks.bs"
|
||||
import "pkg:/source/services/HttpClient.bs"
|
||||
import "pkg:/source/utils/CryptoUtils.bs"
|
||||
import "pkg:/source/utils/Logging.bs"
|
||||
@@ -44,7 +44,7 @@ namespace Invidious
|
||||
|
||||
m.endpoints = node.apiDefinitions
|
||||
|
||||
m.responseHanlders = {
|
||||
m.responseHandlers = {
|
||||
DefaultHandler: m.DefaultHandler
|
||||
AuthFeedHandler: m.AuthFeedHandler
|
||||
PlaylistHandler: m.PlaylistHandler
|
||||
@@ -53,7 +53,6 @@ namespace Invidious
|
||||
ChannelInfoHandler: m.ChannelInfoHandler
|
||||
ChannelVideosHandler: m.ChannelVideosHandler
|
||||
ChannelPlaylistsHandler: m.ChannelPlaylistsHandler
|
||||
ChannelRelatedChannelsHandler: m.ChannelRelatedChannelsHandler
|
||||
WatchHistoryHandler: m.WatchHistoryHandler
|
||||
}
|
||||
end function
|
||||
@@ -123,6 +122,21 @@ namespace Invidious
|
||||
request.CacheSeconds(60 * 60 * 5)
|
||||
request.Cancellation(cancellation)
|
||||
|
||||
request.TryCount(2)
|
||||
request.RetryCallback(function(context as object) as boolean
|
||||
response = context.response
|
||||
' In some cases, video info requests return "HTTP/0.9 when not allowed" errors.
|
||||
' Retrying should usually fix the issue.
|
||||
if response.StatusCode() = HttpClient.CurlErrors.CURLE_UNSUPPORTED_PROTOCOL
|
||||
errorMessage = response.ErrorMessage()
|
||||
if errorMessage.Contains("HTTP/0.9")
|
||||
return true
|
||||
end if
|
||||
end if
|
||||
|
||||
return false
|
||||
end function)
|
||||
|
||||
return request.Await()
|
||||
end function
|
||||
|
||||
@@ -277,7 +291,7 @@ namespace Invidious
|
||||
|
||||
response = request.Await()
|
||||
|
||||
responseHandler = endpoint.responseHandler <> invalid ? m.responseHanlders[endpoint.responseHandler] : m.responseHanlders["DefaultHandler"]
|
||||
responseHandler = endpoint.responseHandler <> invalid ? m.responseHandlers[endpoint.responseHandler] : m.responseHandlers["DefaultHandler"]
|
||||
|
||||
result = responseHandler(m, feedSource, response)
|
||||
|
||||
@@ -336,25 +350,32 @@ namespace Invidious
|
||||
return invalid
|
||||
end function
|
||||
|
||||
function ChannelRelatedChannelsHandler(m as object, feedSource as object, response as object) as object
|
||||
if response.StatusCode() = 200
|
||||
json = response.Json()
|
||||
function VideoInfoHandler(m as object, feedSource as object, response as object) as object
|
||||
statusCode = response.StatusCode()
|
||||
if statusCode >= 500
|
||||
' In some cases, such as a video became private, or a live stream ended,
|
||||
' Invidious returns a 500 error. We can in this case return a valid response
|
||||
' with just a video id, which will allow us to show a valid thumbnail if possible.
|
||||
' This is to makes it possible to load a bookmarked video and delete it even if
|
||||
' it is no longer valid.
|
||||
' TODO:P2 access to private property
|
||||
response._statusCode = 200
|
||||
return {
|
||||
items: json.relatedChannels
|
||||
continuation: json.continuation
|
||||
items: [{
|
||||
"videoId": feedSource.pathParams.id
|
||||
"type": "video"
|
||||
}]
|
||||
}
|
||||
end if
|
||||
return invalid
|
||||
end function
|
||||
|
||||
function VideoInfoHandler(m as object, feedSource as object, response as object) as object
|
||||
if response.StatusCode() = 200
|
||||
if statusCode = 200
|
||||
json = response.Json()
|
||||
json.type = "video"
|
||||
return {
|
||||
items: [json]
|
||||
}
|
||||
end if
|
||||
|
||||
return invalid
|
||||
end function
|
||||
|
||||
@@ -453,7 +474,7 @@ namespace Invidious
|
||||
if not m.VerifyTokenScope(authToken.token)
|
||||
' Right now we're probably in a UI thread, and we can't unregister the token
|
||||
' Without a Task
|
||||
StartAsyncTask(InvidiousUnregisterTokenTask, {
|
||||
AsyncTask.Start(Tasks.InvidiousUnregisterTokenTask, {
|
||||
invidious: m.node
|
||||
authToken: authToken
|
||||
})
|
||||
|
||||
@@ -2,6 +2,13 @@ import "pkg:/source/utils/RegistryUtils.bs"
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
|
||||
function Init()
|
||||
m.typeMapping = {
|
||||
"boolean": "boolean"
|
||||
"string": "string"
|
||||
"radio": "string"
|
||||
"array": "array"
|
||||
}
|
||||
|
||||
m.disableSavingToRegistry = false
|
||||
LoadPreferencesFile()
|
||||
AddNodeFields()
|
||||
@@ -25,14 +32,7 @@ end function
|
||||
|
||||
function AddNodeFieldsFromPreference(pref as object, fields as object)
|
||||
if pref.key <> invalid and pref.type <> invalid
|
||||
fieldType = ""
|
||||
if pref.type = "boolean"
|
||||
fieldType = "boolean"
|
||||
else if pref.type = "string"
|
||||
fieldType = "string"
|
||||
else if pref.type = "radio"
|
||||
fieldType = "string"
|
||||
end if
|
||||
fieldType = m.typeMapping[pref.type]
|
||||
m.top.addField(pref.key, fieldType, false)
|
||||
fields[pref.key] = true
|
||||
end if
|
||||
|
||||
@@ -1,13 +1,8 @@
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
|
||||
function Init()
|
||||
m.titleLabel = m.top.FindNode("titleLabel")
|
||||
m.authorLabel = m.top.FindNode("authorLabel")
|
||||
m.updatedLabel = m.top.FindNode("updatedLabel")
|
||||
m.videoCountRect = m.top.FindNode("videoCountRect")
|
||||
m.videoCountLabel = m.top.FindNode("videoCountLabel")
|
||||
m.thumbnail = m.top.FindNode("thumbnail")
|
||||
m.thumbnail.failedBitmapUri = "pkg:/images/thumbnail-missing.jpg"
|
||||
end function
|
||||
|
||||
function OnContentSet() as void
|
||||
@@ -17,23 +12,28 @@ function OnContentSet() as void
|
||||
return
|
||||
end if
|
||||
|
||||
m.titleLabel.text = content.title
|
||||
m.top.title = content.title
|
||||
' NOTE: "_author" not "author". See PlaylistContentNode.xml for explanation.
|
||||
m.authorLabel.text = content._author
|
||||
m.updatedLabel.text = content.updatedText
|
||||
m.top.author = content._author
|
||||
m.top.updated = content.updatedText
|
||||
|
||||
m.thumbnail.uri = content.thumbnail
|
||||
m.top.thumbnailUri = content.thumbnail
|
||||
|
||||
SetVideoCount(content.videoCountText)
|
||||
end function
|
||||
|
||||
function SetVideoCount(videoCountText as string)
|
||||
function SetVideoCount(videoCountText as string) as void
|
||||
m.top.videoCount = videoCountText
|
||||
|
||||
label = m.videoCountLabel
|
||||
rect = m.videoCountRect
|
||||
|
||||
if label = invalid or rect = invalid
|
||||
return
|
||||
end if
|
||||
|
||||
rectParent = rect.getParent()
|
||||
|
||||
label.text = videoCountText
|
||||
size = label.localBoundingRect()
|
||||
|
||||
rect.width = size.width + 16
|
||||
|
||||
@@ -2,6 +2,11 @@
|
||||
<interface>
|
||||
<field id="itemContent" type="node" onChange="OnContentSet" />
|
||||
<field id="type" type="string" value="playlist" />
|
||||
<field id="title" type="string" alias="titleLabel.text" />
|
||||
<field id="author" type="string" alias="authorLabel.text" />
|
||||
<field id="updated" type="string" alias="updatedLabel.text" />
|
||||
<field id="thumbnailUri" type="uri" alias="thumbnail.uri" />
|
||||
<field id="videoCount" type="string" alias="videoCountLabel.text" />
|
||||
</interface>
|
||||
<children>
|
||||
<LayoutGroup
|
||||
@@ -10,7 +15,8 @@
|
||||
id="thumbnail"
|
||||
loadDisplayMode="scaleToZoom"
|
||||
width="350"
|
||||
height="196">
|
||||
height="196"
|
||||
failedBitmapUri="pkg:/images/thumbnail-missing.jpg">
|
||||
<Rectangle
|
||||
id="videoCountRect"
|
||||
width="60"
|
||||
|
||||
@@ -3,19 +3,8 @@ import "pkg:/source/utils/TimeUtils.bs"
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
|
||||
function Init()
|
||||
FindChildren()
|
||||
end function
|
||||
|
||||
function FindChildren()
|
||||
' TODO:P2 use component properties with alias instead of FindNode
|
||||
m.titleLabel = m.top.FindNode("titleLabel")
|
||||
m.authorLabel = m.top.FindNode("authorLabel")
|
||||
m.viewCountDateLabel = m.top.FindNode("viewCountDateLabel")
|
||||
m.liveRect = m.top.FindNode("liveRect")
|
||||
m.upcomingRect = m.top.FindNode("upcomingRect")
|
||||
m.durationRect = m.top.FindNode("durationRect")
|
||||
m.durationLabel = m.top.FindNode("durationLabel")
|
||||
m.thumbnail = m.top.FindNode("thumbnail")
|
||||
end function
|
||||
|
||||
function OnContentSet() as void
|
||||
@@ -25,50 +14,51 @@ function OnContentSet() as void
|
||||
return
|
||||
end if
|
||||
|
||||
if m.titleLabel = invalid
|
||||
FindChildren()
|
||||
end if
|
||||
|
||||
m.titleLabel.text = content.title
|
||||
m.authorLabel.text = content.author
|
||||
m.top.title = content.title
|
||||
m.top.author = content.author
|
||||
|
||||
if content.isUpcoming = true
|
||||
m.viewCountDateLabel.text = content.premiereTimestampText
|
||||
m.top.viewCountDate = content.premiereTimestampText
|
||||
else if not StringUtils.IsNullOrEmpty(content.publishedText)
|
||||
label = content.publishedText
|
||||
if not StringUtils.IsNullOrEmpty(content.viewCountText)
|
||||
label = `${label} • ${content.viewCountText}`
|
||||
end if
|
||||
m.viewCountDateLabel.text = label
|
||||
m.top.viewCountDate = label
|
||||
else
|
||||
m.viewCountDateLabel.text = ""
|
||||
m.top.viewCountDate = ""
|
||||
end if
|
||||
|
||||
m.thumbnail.uri = content.thumbnail
|
||||
m.top.thumbnailUri = content.thumbnail
|
||||
|
||||
m.durationRect.visible = false
|
||||
m.upcomingRect.visible = false
|
||||
m.liveRect.visible = false
|
||||
m.top.durationRectVisible = false
|
||||
m.top.upcomingRectVisible = false
|
||||
m.top.liveRectVisible = false
|
||||
|
||||
if ValidInt(content.lengthSeconds) <> 0
|
||||
SetDurationText(content.lengthText)
|
||||
m.durationRect.visible = true
|
||||
m.top.durationRectVisible = true
|
||||
else
|
||||
if content.isUpcoming = true
|
||||
m.upcomingRect.visible = true
|
||||
m.top.upcomingRectVisible = true
|
||||
else if content.liveNow
|
||||
m.liveRect.visible = true
|
||||
m.top.liveRectVisible = true
|
||||
end if
|
||||
end if
|
||||
end function
|
||||
|
||||
function SetDurationText(text as string)
|
||||
function SetDurationText(text as string) as void
|
||||
m.top.duration = text
|
||||
|
||||
label = m.durationLabel
|
||||
rect = m.durationRect
|
||||
|
||||
if label = invalid or rect = invalid
|
||||
return
|
||||
end if
|
||||
|
||||
rectParent = rect.getParent()
|
||||
|
||||
label.text = text
|
||||
size = label.localBoundingRect()
|
||||
|
||||
rect.width = size.width + 16
|
||||
|
||||
@@ -2,6 +2,14 @@
|
||||
<interface>
|
||||
<field id="itemContent" type="node" onChange="OnContentSet" />
|
||||
<field id="type" type="string" value="video" />
|
||||
<field id="title" type="string" alias="titleLabel.text" />
|
||||
<field id="author" type="string" alias="authorLabel.text" />
|
||||
<field id="viewCountDate" type="string" alias="viewCountDateLabel.text" />
|
||||
<field id="liveRectVisible" type="boolean" alias="liveRect.visible" />
|
||||
<field id="upcomingRectVisible" type="boolean" alias="upcomingRect.visible" />
|
||||
<field id="durationRectVisible" type="boolean" alias="durationRect.visible" />
|
||||
<field id="duration" type="string" alias="durationLabel.text" />
|
||||
<field id="thumbnailUri" type="string" alias="thumbnail.uri" />
|
||||
</interface>
|
||||
<children>
|
||||
<LayoutGroup
|
||||
|
||||
@@ -2,10 +2,11 @@ import "pkg:/components/ChannelView/ChannelUtils.bs"
|
||||
import "pkg:/components/ContextMenu/ContextMenuUtils.bs"
|
||||
import "pkg:/components/Navigation/LongPress.bs"
|
||||
import "pkg:/components/PlaylistView/PlaylistUtils.bs"
|
||||
import "pkg:/components/VideoFeed/VideoRowListContentTask.bs"
|
||||
import "pkg:/components/VideoFeed/VideoRowListRowContentTask.bs"
|
||||
import "pkg:/components/Services/Invidious/InvidiousToContentNode.bs"
|
||||
import "pkg:/components/VideoFeed/FeedLoadState.bs"
|
||||
import "pkg:/components/VideoPlayer/VideoUtils.bs"
|
||||
import "pkg:/source/asyncTask/asyncTask.bs"
|
||||
import "pkg:/source/AsyncTask/AsyncTask.bs"
|
||||
import "pkg:/source/AsyncTask/Tasks.bs"
|
||||
import "pkg:/source/utils/DisposableObserve.bs"
|
||||
import "pkg:/source/utils/ErrorUtils.bs"
|
||||
import "pkg:/source/utils/Logging.bs"
|
||||
@@ -123,16 +124,21 @@ function OnRowItemLongPressed(index as object) as void
|
||||
return
|
||||
end if
|
||||
|
||||
if not IsArray(index) or index.count() <> 2
|
||||
LogWarn("Invalid index:", index)
|
||||
return
|
||||
end if
|
||||
|
||||
rowIndex = index[0]
|
||||
rowItemIndex = index[1]
|
||||
|
||||
if rowIndex < 0 or rowIndex >= content.GetChildCount()
|
||||
if not IsInt(rowIndex) or rowIndex < 0 or rowIndex >= content.GetChildCount()
|
||||
LogWarn("Invalid row index:", rowIndex)
|
||||
return
|
||||
end if
|
||||
row = content.GetChild(rowIndex)
|
||||
|
||||
if rowItemIndex < 0 or rowItemIndex >= row.GetChildCount()
|
||||
if not IsInt(rowItemIndex) or rowItemIndex < 0 or rowItemIndex >= row.GetChildCount()
|
||||
LogWarn("Invalid row item index:", rowItemIndex)
|
||||
return
|
||||
end if
|
||||
@@ -208,7 +214,7 @@ function InitContent() as void
|
||||
return
|
||||
end if
|
||||
|
||||
task = StartAsyncTask(VideoRowListContentTask, {
|
||||
task = AsyncTask.Start(Tasks.VideoRowListContentTask, {
|
||||
node: m.top
|
||||
feeds: m.top.feeds
|
||||
}, OnVideoRowListContentTaskResult)
|
||||
@@ -281,7 +287,7 @@ function LoadRowContent(contentNode as object)
|
||||
LogInfo("Loading row content:", contentNode.title)
|
||||
|
||||
contentNode.loadState = FeedLoadState.Loading
|
||||
task = StartAsyncTask(VideoRowListRowContentTask, {
|
||||
task = AsyncTask.Start(Tasks.VideoRowListRowContentTask, {
|
||||
rowList: m.top
|
||||
feedContentNode: contentNode
|
||||
invidious: m.invidious
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import "FeedLoadState.bs"
|
||||
import "pkg:/components/VideoFeed/FeedLoadState.bs"
|
||||
import "pkg:/source/utils/StringUtils.bs"
|
||||
|
||||
@asynctask
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import "pkg:/components/Services/SponsorBlock/Notifications/SponsorBlockNotificationUtils.bs"
|
||||
import "pkg:/components/Services/SponsorBlock/SponsorBlockSegmentViewedTask.bs"
|
||||
import "pkg:/components/Services/SponsorBlock/SponsorBlockTask.bs"
|
||||
import "pkg:/source/asyncTask/asyncTask.bs"
|
||||
import "pkg:/components/Services/SponsorBlock/SponsorBlockService.bs"
|
||||
import "pkg:/source/AsyncTask/AsyncTask.bs"
|
||||
import "pkg:/source/AsyncTask/Tasks.bs"
|
||||
|
||||
namespace SponsorBlock
|
||||
|
||||
@@ -84,7 +84,7 @@ namespace SponsorBlock
|
||||
m.sponsorBlockTask.cancel = true
|
||||
end if
|
||||
|
||||
m.sponsorBlockTask = StartAsyncTask(SponsorBlockTask, { metadata: metadata }, OnSponsorBlockTaskResults)
|
||||
m.sponsorBlockTask = AsyncTask.Start(Tasks.SponsorBlockTask, { metadata: metadata }, OnSponsorBlockTaskResults)
|
||||
end function
|
||||
|
||||
function OnSponsorBlockTaskResults(output as object) as void
|
||||
@@ -172,7 +172,7 @@ namespace SponsorBlock
|
||||
end function
|
||||
|
||||
function SendSkippedSectionEvent(segmentId as string)
|
||||
StartAsyncTask(SponsorBlockSegmentViewedTask, { segmentId: segmentId })
|
||||
AsyncTask.Start(Tasks.SponsorBlockSegmentViewedTask, { segmentId: segmentId })
|
||||
end function
|
||||
|
||||
end namespace
|
||||
@@ -164,6 +164,7 @@ function SetCaptions(metadata as object, service as object, contentNode as objec
|
||||
if metadata.captions.Count() = 0
|
||||
return
|
||||
end if
|
||||
|
||||
' TODO:P2 we don't need to read and parse this every time
|
||||
isoLanguageList = ParseJson(ReadAsciiFile("libpkg:/config/ISO-639-1-to-ISO-639-2T.json5"))
|
||||
instance = service.GetInstance()
|
||||
@@ -171,9 +172,25 @@ function SetCaptions(metadata as object, service as object, contentNode as objec
|
||||
subtitleTracks = []
|
||||
|
||||
for each caption in metadata.captions
|
||||
code = caption.language_code
|
||||
if StringUtils.IsNullOrEmpty(code)
|
||||
continue for
|
||||
end if
|
||||
|
||||
if code.InStr("-") <> -1
|
||||
code = code.Split("-")[0]
|
||||
end if
|
||||
|
||||
if code.len() = 2
|
||||
if not isoLanguageList.DoesExist(code)
|
||||
continue for
|
||||
end if
|
||||
code = isoLanguageList[code]
|
||||
end if
|
||||
|
||||
subtitleTracks.Push({
|
||||
Description: caption.label
|
||||
Language: isoLanguageList[caption.language_code] ?? caption.language_code
|
||||
Language: code
|
||||
TrackName: instance + caption.url
|
||||
})
|
||||
end for
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import "pkg:/components/Dialog/DialogUtils.bs"
|
||||
import "pkg:/components/Services/Invidious/InvidiousToContentNode.bs"
|
||||
import "pkg:/components/VideoPlayer/MarkVideoWatchedTask.bs"
|
||||
import "pkg:/components/VideoPlayer/SponsorBlock.bs"
|
||||
import "pkg:/components/VideoPlayer/VideoContentTask.bs"
|
||||
import "pkg:/components/VideoPlayer/VideoPlayerStyle.bs"
|
||||
import "pkg:/components/VideoPlayer/VideoUtils.bs"
|
||||
import "pkg:/source/asyncTask/asyncTask.bs"
|
||||
import "pkg:/source/AsyncTask/AsyncTask.bs"
|
||||
import "pkg:/source/AsyncTask/Tasks.bs"
|
||||
import "pkg:/source/utils/ErrorUtils.bs"
|
||||
import "pkg:/source/utils/Logging.bs"
|
||||
|
||||
@@ -15,12 +14,22 @@ function Init()
|
||||
|
||||
' videoPlayingSuccess indicates if we started playing a video successfully
|
||||
' We use it to detect if we should try another link for a video, or if another error
|
||||
' occurred (such as a next work error)
|
||||
' occurred (such as a network error)
|
||||
m.videoPlayingSuccess = false
|
||||
' ignoreNextFinishedState indicates if we should ignore the next finished state
|
||||
' This is used to prevent the video from playing the next video when we are
|
||||
' still trying to find a working stream url
|
||||
m.ignoreNextFinishedState = false
|
||||
|
||||
' asyncStopSemantics available since Roku OS 12.5
|
||||
' It is set to true because stopping synchronously causes timeout and crash
|
||||
' Usually we would need to wait for the video state to move to "stopping" then to "stopped"
|
||||
' before considering the video node closed, and creating a new one.
|
||||
' However, since we have a task to load video details, there should be enough time for the
|
||||
' video node to close before we create a new one.
|
||||
if m.top.hasField("asyncStopSemantics")
|
||||
m.top.asyncStopSemantics = true
|
||||
end if
|
||||
end function
|
||||
|
||||
function OnNodeReady()
|
||||
@@ -35,7 +44,6 @@ function OnNodeReady()
|
||||
|
||||
m.container.observeFieldScoped("fullscreen", FuncName(OnFullScreenChange))
|
||||
m.top.ObserveField("state", FuncName(OnVideoPlayerStateChange))
|
||||
m.top.observeField("control", FuncName(OnControlChange))
|
||||
|
||||
SponsorBlock.SetupSponsorBlock()
|
||||
end function
|
||||
@@ -68,7 +76,7 @@ function StartVideoContentTask(videoContentNode as object)
|
||||
|
||||
m.top.content = videoContentNode
|
||||
|
||||
m.videoContentTask = StartAsyncTask(VideoContentTask, {
|
||||
m.videoContentTask = AsyncTask.Start(Tasks.VideoContentTask, {
|
||||
content: videoContentNode
|
||||
invidious: m.top.invidious
|
||||
preferences: m.top.preferences
|
||||
@@ -109,7 +117,7 @@ end function
|
||||
|
||||
function MarkVideoWatched(videoId as string)
|
||||
if m.top.invidious.authToken <> invalid
|
||||
StartAsyncTask(MarkVideoWatchedTask, {
|
||||
AsyncTask.Start(Tasks.MarkVideoWatchedTask, {
|
||||
videoId: videoId
|
||||
invidious: m.top.invidious
|
||||
})
|
||||
@@ -117,6 +125,15 @@ function MarkVideoWatched(videoId as string)
|
||||
end function
|
||||
|
||||
function Close(_unused as dynamic)
|
||||
if m.videoContentTask <> invalid
|
||||
m.videoContentTask.cancel = true
|
||||
m.videoContentTask = invalid
|
||||
end if
|
||||
if m.sponsorBlockTask <> invalid
|
||||
m.sponsorBlockTask.cancel = true
|
||||
m.sponsorBlockTask = invalid
|
||||
end if
|
||||
|
||||
m.top.control = "stop"
|
||||
m.top.content = invalid
|
||||
parent = m.top.getParent()
|
||||
@@ -126,19 +143,6 @@ function Close(_unused as dynamic)
|
||||
SponsorBlock.RemoveNotifcation(m.notifications)
|
||||
end function
|
||||
|
||||
function OnControlChange()
|
||||
if m.top.control = "stop"
|
||||
if m.videoContentTask <> invalid
|
||||
m.videoContentTask.cancel = true
|
||||
m.videoContentTask = invalid
|
||||
end if
|
||||
if m.sponsorBlockTask <> invalid
|
||||
m.sponsorBlockTask.cancel = true
|
||||
m.sponsorBlockTask = invalid
|
||||
end if
|
||||
end if
|
||||
end function
|
||||
|
||||
function OnVideoPlayerStateChange() as void
|
||||
state = m.top.state
|
||||
content = m.top.content
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
import "pkg:/components/Screens/HomeScreen/HomeScreenUtils.bs"
|
||||
|
||||
namespace Http
|
||||
|
||||
class HomeLayoutRouter extends HttpRouter
|
||||
|
||||
function new()
|
||||
super()
|
||||
|
||||
m.Get("/api/home-layout", function(context as object) as boolean
|
||||
response = context.response
|
||||
task = context.server.task
|
||||
preferences = task.preferences
|
||||
|
||||
feed = HomeScreenUtils.GetFeed("libpkg:/config/default_home_layout.yaml", preferences)
|
||||
response.Json(feed)
|
||||
|
||||
return true
|
||||
end function)
|
||||
|
||||
end function
|
||||
|
||||
end class
|
||||
|
||||
end namespace
|
||||
@@ -1,6 +1,7 @@
|
||||
import "pkg:/components/parts/AutoBind/OnNodeReadyNoOp.bs"
|
||||
import "pkg:/components/Web/PlayletWebServer/Middleware/BookmarksRouter.bs"
|
||||
import "pkg:/components/Web/PlayletWebServer/Middleware/DashRouter.bs"
|
||||
import "pkg:/components/Web/PlayletWebServer/Middleware/HomeLayoutRouter.bs"
|
||||
import "pkg:/components/Web/PlayletWebServer/Middleware/InvidiousRouter.bs"
|
||||
import "pkg:/components/Web/PlayletWebServer/Middleware/PlayletLibUrlsRouter.bs"
|
||||
import "pkg:/components/Web/PlayletWebServer/Middleware/PlayQueueRouter.bs"
|
||||
@@ -46,6 +47,7 @@ function SetupRoutes(server as object)
|
||||
server.UseRouter(new Http.InvidiousRouter())
|
||||
server.UseRouter(new Http.PlayQueueRouter())
|
||||
server.UseRouter(new Http.BookmarksRouter())
|
||||
server.UseRouter(new Http.HomeLayoutRouter())
|
||||
server.UseRouter(new Http.ViewRouter())
|
||||
server.UseRouter(new Http.SearchHistoryRouter())
|
||||
server.UseRouter(new Http.PlayletLibUrlsRouter())
|
||||
|
||||
@@ -1,186 +1,64 @@
|
||||
// Language codes from ISO 639-1 to ISO 639-2T.
|
||||
// Only includes a subset of the supported languages, as indicated
|
||||
// in https://www.ccfonts.com/cinecav-styles/
|
||||
// Languages covered
|
||||
// Albanian, Avar, Basque, Basque, Belarusian, Bosnian, Breton, Bulgarian, Buryat,
|
||||
// Catalan, Chamorro, Chichewa, Croatian, Cyrillic, Czech, Danish, Dutch, English,
|
||||
// Estonian, Faroese, Finnish, French, Frisian, Galician, German, Greek, Hungarian,
|
||||
// Icelandic, Irish, Italian, Kalmyk, Kurdish, Kyrgyz, Latvian, Lithuanian, Macedonian,
|
||||
// Malagasy, Maltese, Montenegrin, Norwegian, Ossetian, Polish, Portuguese, Romani,
|
||||
// Romanian, Russian, Serbian, Slovak, Slovenian, Spanish, Tajik, Tatar, Turkish,
|
||||
// Ukrainian & Welsh.
|
||||
// Some of the languages don't seem to have a 2 letter code, so they are not on the list.
|
||||
{
|
||||
aa: "aar",
|
||||
ab: "abk",
|
||||
af: "afr",
|
||||
ak: "aka",
|
||||
sq: "alb",
|
||||
am: "amh",
|
||||
ar: "ara",
|
||||
an: "arg",
|
||||
hy: "hye",
|
||||
as: "asm",
|
||||
av: "ava",
|
||||
ae: "ave",
|
||||
ay: "aym",
|
||||
az: "aze",
|
||||
ba: "bak",
|
||||
bm: "bam",
|
||||
eu: "eus",
|
||||
be: "bel",
|
||||
bn: "ben",
|
||||
bh: "bih",
|
||||
bi: "bis",
|
||||
bo: "tib",
|
||||
bs: "bos",
|
||||
br: "bre",
|
||||
bg: "bul",
|
||||
my: "mya",
|
||||
ca: "cat",
|
||||
cs: "cze",
|
||||
ch: "cha",
|
||||
ce: "che",
|
||||
zh: "zho",
|
||||
cu: "chu",
|
||||
cv: "chv",
|
||||
kw: "cor",
|
||||
co: "cos",
|
||||
cr: "cre",
|
||||
cy: "wel",
|
||||
da: "dan",
|
||||
de: "ger",
|
||||
dv: "div",
|
||||
nl: "dut",
|
||||
dz: "dzo",
|
||||
el: "gre",
|
||||
en: "eng",
|
||||
eo: "epo",
|
||||
et: "est",
|
||||
ee: "ewe",
|
||||
fo: "fao",
|
||||
fa: "per",
|
||||
fj: "fij",
|
||||
fi: "fin",
|
||||
fr: "fra",
|
||||
fy: "fry",
|
||||
ff: "ful",
|
||||
ka: "geo",
|
||||
gd: "gla",
|
||||
ga: "gle",
|
||||
gl: "glg",
|
||||
gv: "glv",
|
||||
gn: "grn",
|
||||
gu: "guj",
|
||||
ht: "hat",
|
||||
ha: "hau",
|
||||
he: "heb",
|
||||
hz: "her",
|
||||
hi: "hin",
|
||||
ho: "hmo",
|
||||
hr: "hrv",
|
||||
hu: "hun",
|
||||
ig: "ibo",
|
||||
is: "ice",
|
||||
io: "ido",
|
||||
ii: "iii",
|
||||
iu: "iku",
|
||||
ie: "ile",
|
||||
ia: "ina",
|
||||
id: "ind",
|
||||
ik: "ipk",
|
||||
it: "ita",
|
||||
jv: "jav",
|
||||
ja: "jpn",
|
||||
kl: "kal",
|
||||
kn: "kan",
|
||||
ks: "kas",
|
||||
kr: "kau",
|
||||
kk: "kaz",
|
||||
km: "khm",
|
||||
ki: "kik",
|
||||
rw: "kin",
|
||||
ky: "kir",
|
||||
kv: "kom",
|
||||
kg: "kon",
|
||||
ko: "kor",
|
||||
kj: "kua",
|
||||
ku: "kur",
|
||||
lo: "lao",
|
||||
la: "lat",
|
||||
lv: "lav",
|
||||
li: "lim",
|
||||
ln: "lin",
|
||||
lt: "lit",
|
||||
lb: "ltz",
|
||||
lu: "lub",
|
||||
lg: "lug",
|
||||
mk: "mkd",
|
||||
mh: "mah",
|
||||
ml: "mal",
|
||||
mi: "mri",
|
||||
mr: "mar",
|
||||
ms: "may",
|
||||
mg: "mlg",
|
||||
mt: "mlt",
|
||||
mn: "mon",
|
||||
na: "nau",
|
||||
nv: "nav",
|
||||
nr: "nbl",
|
||||
nd: "nde",
|
||||
ng: "ndo",
|
||||
ne: "nep",
|
||||
nn: "nno",
|
||||
nb: "nob",
|
||||
no: "nor",
|
||||
ny: "nya",
|
||||
oc: "oci",
|
||||
oj: "oji",
|
||||
or: "ori",
|
||||
om: "orm",
|
||||
os: "oss",
|
||||
pa: "pan",
|
||||
pi: "pli",
|
||||
pl: "pol",
|
||||
pt: "por",
|
||||
ps: "pus",
|
||||
qu: "que",
|
||||
rm: "roh",
|
||||
ro: "ron",
|
||||
rn: "run",
|
||||
ru: "rus",
|
||||
sg: "sag",
|
||||
sa: "san",
|
||||
si: "sin",
|
||||
sk: "slk",
|
||||
sl: "slv",
|
||||
se: "sme",
|
||||
sm: "smo",
|
||||
sn: "sna",
|
||||
sd: "snd",
|
||||
so: "som",
|
||||
st: "sot",
|
||||
es: "spa",
|
||||
sc: "srd",
|
||||
sr: "srp",
|
||||
ss: "ssw",
|
||||
su: "sun",
|
||||
sw: "swa",
|
||||
sv: "swe",
|
||||
ty: "tah",
|
||||
ta: "tam",
|
||||
tt: "tat",
|
||||
te: "tel",
|
||||
tg: "tgk",
|
||||
tl: "tgl",
|
||||
th: "tha",
|
||||
ti: "tir",
|
||||
to: "ton",
|
||||
tn: "tsn",
|
||||
ts: "tso",
|
||||
tk: "tuk",
|
||||
tr: "tur",
|
||||
tw: "twi",
|
||||
ug: "uig",
|
||||
uk: "ukr",
|
||||
ur: "urd",
|
||||
uz: "uzb",
|
||||
ve: "ven",
|
||||
vi: "vie",
|
||||
vo: "vol",
|
||||
wa: "wln",
|
||||
wo: "wol",
|
||||
xh: "xho",
|
||||
yi: "yid",
|
||||
yo: "yor",
|
||||
za: "zha",
|
||||
zu: "zul",
|
||||
sq: "sqi", // Albanian
|
||||
av: "ava", // Avar
|
||||
eu: "eus", // Basque
|
||||
be: "bel", // Belarusian
|
||||
bs: "bos", // Bosnian
|
||||
br: "bre", // Breton
|
||||
bg: "bul", // Bulgarian
|
||||
ca: "cat", // Catalan
|
||||
ch: "cha", // Chamorro
|
||||
ny: "nya", // Chichewa
|
||||
hr: "hrv", // Croatian
|
||||
cu: "chu", // Cyrillic
|
||||
cs: "ces", // Czech
|
||||
da: "dan", // Danish
|
||||
nl: "nld", // Dutch
|
||||
en: "eng", // English
|
||||
et: "est", // Estonian
|
||||
fo: "fao", // Faroese
|
||||
fi: "fin", // Finnish
|
||||
fr: "fra", // French
|
||||
fy: "fry", // Frisian
|
||||
gl: "glg", // Galician
|
||||
de: "deu", // German
|
||||
el: "ell", // Greek
|
||||
hu: "hun", // Hungarian
|
||||
is: "isl", // Icelandic
|
||||
ga: "gle", // Irish
|
||||
it: "ita", // Italian
|
||||
ku: "kur", // Kurdish
|
||||
ky: "kir", // Kyrgyz
|
||||
lv: "lav", // Latvian
|
||||
lt: "lit", // Lithuanian
|
||||
mk: "mkd", // Macedonian
|
||||
mg: "mlg", // Malagasy
|
||||
mt: "mlt", // Maltese
|
||||
no: "nor", // Norwegian
|
||||
os: "oss", // Ossetian
|
||||
pl: "pol", // Polish
|
||||
pt: "por", // Portuguese
|
||||
ro: "ron", // Romanian
|
||||
ru: "rus", // Russian
|
||||
sr: "srp", // Serbian
|
||||
sk: "slk", // Slovak
|
||||
sl: "slv", // Slovenian
|
||||
es: "spa", // Spanish
|
||||
tg: "tgk", // Tajik
|
||||
tt: "tat", // Tatar
|
||||
tr: "tur", // Turkish
|
||||
uk: "ukr", // Ukrainian
|
||||
cy: "cym", // Welsh
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
- title: Subscriptions
|
||||
id: subscriptions
|
||||
feedSources:
|
||||
- id: inv_auth_feed
|
||||
title: Subscriptions
|
||||
@@ -6,6 +7,7 @@
|
||||
endpoint: auth_feed
|
||||
|
||||
- title: Trending
|
||||
id: trending
|
||||
feedSources:
|
||||
- id: inv_trending
|
||||
title: Trending
|
||||
@@ -13,6 +15,7 @@
|
||||
endpoint: trending
|
||||
|
||||
- title: Trending - Music
|
||||
id: trending_music
|
||||
feedSources:
|
||||
- id: inv_trending_music
|
||||
title: Trending - Music
|
||||
@@ -22,6 +25,7 @@
|
||||
type: Music
|
||||
|
||||
- title: Trending - Gaming
|
||||
id: trending_gaming
|
||||
feedSources:
|
||||
- id: inv_trending_gaming
|
||||
title: Trending - Gaming
|
||||
@@ -31,6 +35,7 @@
|
||||
type: Gaming
|
||||
|
||||
- title: Trending - Movies
|
||||
id: trending_movies
|
||||
feedSources:
|
||||
- id: inv_trending_movies
|
||||
title: Trending - Movies
|
||||
@@ -40,33 +45,15 @@
|
||||
type: Movies
|
||||
|
||||
- title: Popular
|
||||
id: popular
|
||||
feedSources:
|
||||
- id: inv_popular
|
||||
title: Popular
|
||||
apiType: Invidious
|
||||
endpoint: popular
|
||||
|
||||
- title: Funny
|
||||
feedSources:
|
||||
- id: inv_search_funny
|
||||
title: Search - Funny
|
||||
apiType: Invidious
|
||||
endpoint: search
|
||||
queryParams:
|
||||
q: Funny
|
||||
sort_by: upload_date
|
||||
|
||||
- title: News
|
||||
feedSources:
|
||||
- id: inv_search_news
|
||||
title: Search - News
|
||||
apiType: Invidious
|
||||
endpoint: search
|
||||
queryParams:
|
||||
q: News
|
||||
sort_by: upload_date
|
||||
|
||||
- title: Playlists
|
||||
id: playlists
|
||||
feedSources:
|
||||
- id: inv_auth_playlists
|
||||
title: Playlists
|
||||
@@ -74,6 +61,7 @@
|
||||
endpoint: auth_playlists
|
||||
|
||||
- title: Watch history
|
||||
id: watch_history
|
||||
feedSources:
|
||||
- id: inv_auth_history
|
||||
title: Watch history
|
||||
|
||||
@@ -194,15 +194,6 @@ channel_podcasts:
|
||||
paginationType: Continuation
|
||||
tryCount: 3
|
||||
|
||||
# TODO:P1 related channels are no longer working
|
||||
# https://github.com/iv-org/invidious/issues/4275
|
||||
channel_channels:
|
||||
title: Related channels
|
||||
url: /api/v1/channels/{ucid}/channels
|
||||
responseHandler: ChannelRelatedChannelsHandler
|
||||
paginationType: Continuation
|
||||
tryCount: 3
|
||||
|
||||
watch_history:
|
||||
title: Watch history
|
||||
url: /api/v1/auth/history
|
||||
|
||||
@@ -130,6 +130,55 @@
|
||||
key: "misc",
|
||||
description: "Misc. preferences",
|
||||
children: [
|
||||
{
|
||||
displayText: "Edit home screen",
|
||||
key: "misc.home_screen_layout",
|
||||
description: "Enable/disable and reorder sections on the home screen",
|
||||
type: "array",
|
||||
defaultValue: [
|
||||
{
|
||||
id: "subscriptions",
|
||||
enabled: true,
|
||||
},
|
||||
{
|
||||
id: "trending",
|
||||
enabled: true,
|
||||
},
|
||||
{
|
||||
id: "trending_music",
|
||||
enabled: true,
|
||||
},
|
||||
{
|
||||
id: "trending_gaming",
|
||||
enabled: true,
|
||||
},
|
||||
{
|
||||
id: "trending_movies",
|
||||
enabled: true,
|
||||
},
|
||||
{
|
||||
id: "popular",
|
||||
enabled: true,
|
||||
},
|
||||
{
|
||||
id: "playlists",
|
||||
enabled: true,
|
||||
},
|
||||
{
|
||||
id: "watch_history",
|
||||
enabled: true,
|
||||
},
|
||||
],
|
||||
visibility: "tv",
|
||||
rokuComponent: "EditHomeScreenControl",
|
||||
},
|
||||
{
|
||||
displayText: "Edit home screen",
|
||||
key: "misc.home_screen_layout",
|
||||
description: "Enable/disable and reorder sections on the home screen",
|
||||
visibility: "web",
|
||||
svelteComponent: "EditHomeScreenControl",
|
||||
},
|
||||
{
|
||||
displayText: "Queue notifications",
|
||||
key: "misc.queue_notifications",
|
||||
|
||||
@@ -79,7 +79,8 @@
|
||||
},
|
||||
preview: {
|
||||
title: 'Preview/Recap/Hook',
|
||||
short_title: 'Preview/Recap/Hook',
|
||||
// Note: short title renamed from "Preview/Recap/Hook" to "Preview/Recap" to fit in the UI
|
||||
short_title: 'Preview/Recap',
|
||||
categorySupport: [
|
||||
'skip',
|
||||
'mute',
|
||||
|
||||
@@ -2,7 +2,7 @@ title=PlayletLib
|
||||
|
||||
# Do not update version manually, it is auto updated from package.json
|
||||
major_version=0
|
||||
minor_version=18
|
||||
minor_version=19
|
||||
build_version=00000
|
||||
|
||||
ui_resolutions=hd
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
|
||||
namespace AsyncTask
|
||||
|
||||
function Start(taskName as string, input as object, callback = invalid as object) as object
|
||||
task = Create(taskName, input, callback)
|
||||
task.control = "RUN"
|
||||
return task
|
||||
end function
|
||||
|
||||
function Create(taskName as string, input as object, callback = invalid as object) as object
|
||||
id = StrI(rnd(2147483647), 36)
|
||||
task = createObject("roSGNode", taskName)
|
||||
task.id = id
|
||||
task.input = input
|
||||
|
||||
m[`asynctask_${id}`] = task
|
||||
m[`asynctask_${id}_callback`] = callback
|
||||
task.ObserveFieldScoped("state", FuncName(internal_OnTaskState))
|
||||
|
||||
return task
|
||||
end function
|
||||
|
||||
function internal_OnTaskState(e as object) as void
|
||||
task = e.getRoSGNode()
|
||||
if task.state = "init" or task.state = "run"
|
||||
return
|
||||
end if
|
||||
|
||||
task.UnobserveFieldScoped("state")
|
||||
|
||||
id = task.id
|
||||
output = task.output
|
||||
' if output is invalid, it means the task was interrupted before the result is ready
|
||||
if output <> invalid
|
||||
callback = m[`asynctask_${id}_callback`]
|
||||
if callback <> invalid
|
||||
callback(output)
|
||||
end if
|
||||
end if
|
||||
|
||||
task.input = invalid
|
||||
task.output = invalid
|
||||
m.delete(`asynctask_${id}`)
|
||||
m.delete(`asynctask_${id}_callback`)
|
||||
end function
|
||||
|
||||
end namespace
|
||||
@@ -1,56 +0,0 @@
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
|
||||
function StartAsyncTask(taskFunc as object, input as object, callback = invalid as object) as object
|
||||
task = CreateAsyncTask(taskFunc, input, callback)
|
||||
task.control = "RUN"
|
||||
return task
|
||||
end function
|
||||
|
||||
function CreateAsyncTask(taskFunc as object, input as object, callback = invalid as object) as object
|
||||
id = StrI(rnd(2147483647), 36)
|
||||
task = createObject("roSGNode", GetComponentName(taskFunc))
|
||||
task.id = id
|
||||
task.input = input
|
||||
|
||||
m[`asynctask_${id}`] = task
|
||||
m[`asynctask_${id}_callback`] = callback
|
||||
task.ObserveFieldScoped("state", FuncName(OnTaskState))
|
||||
|
||||
return task
|
||||
end function
|
||||
|
||||
function GetComponentName(taskFunc as object) as string
|
||||
if IsString(taskFunc)
|
||||
return `${taskFunc}_asynctask`
|
||||
end if
|
||||
' NOTE: do NOT use FuncName in here.
|
||||
' we use:
|
||||
' return `${FuncName(taskFunc)}_asynctask`
|
||||
' The app hangs on exit, and the TV crashes and restarts. I'm not kidding.
|
||||
return (LCase(`${taskFunc}_asynctask`)).replace("function:", "").trim()
|
||||
end function
|
||||
|
||||
function OnTaskState(e as object) as void
|
||||
task = e.getRoSGNode()
|
||||
if task.state = "init" or task.state = "run"
|
||||
return
|
||||
end if
|
||||
|
||||
task.UnobserveFieldScoped("state")
|
||||
|
||||
id = task.id
|
||||
output = task.output
|
||||
' if output is invalid, it means the task was interrupted before the result is ready
|
||||
if output <> invalid
|
||||
callback = m[`asynctask_${id}_callback`]
|
||||
if callback <> invalid
|
||||
callback(output)
|
||||
end if
|
||||
end if
|
||||
|
||||
|
||||
task.input = invalid
|
||||
task.output = invalid
|
||||
m.delete(`asynctask_${id}`)
|
||||
m.delete(`asynctask_${id}_callback`)
|
||||
end function
|
||||
@@ -1,6 +1,7 @@
|
||||
#const DISABLE_CACHE = false
|
||||
|
||||
import "pkg:/source/utils/CryptoUtils.bs"
|
||||
import "pkg:/source/utils/ErrorUtils.bs"
|
||||
import "pkg:/source/utils/Logging.bs"
|
||||
import "pkg:/source/utils/StringUtils.bs"
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
@@ -8,6 +9,82 @@ import "pkg:/source/utils/UrlUtils.bs"
|
||||
|
||||
namespace HttpClient
|
||||
|
||||
const COMPRESSION_ENABLED = true
|
||||
|
||||
' https://developer.roku.com/en-ca/docs/references/brightscript/events/rourlevent.md#getresponsecode-as-integer
|
||||
' Seem to mirror the curl error codes https://curl.se/libcurl/c/libcurl-errors.html
|
||||
enum CurlErrors
|
||||
CURLE_UNSUPPORTED_PROTOCOL = -1
|
||||
CURLE_FAILED_INIT = -2
|
||||
CURLE_URL_MALFORMAT = -3
|
||||
CURLE_NOT_BUILT_IN = -4
|
||||
CURLE_COULDNT_RESOLVE_PROXY = -5
|
||||
CURLE_COULDNT_RESOLVE_HOST = -6
|
||||
CURLE_COULDNT_CONNECT = -7
|
||||
CURLE_FTP_WEIRD_SERVER_REPLY = -8
|
||||
CURLE_REMOTE_ACCESS_DENIED = -9
|
||||
CURLE_FTP_WEIRD_PASS_REPLY = -11
|
||||
CURLE_FTP_WEIRD_PASV_REPLY = -13
|
||||
CURLE_FTP_WEIRD_227_FORMAT = -14
|
||||
CURLE_FTP_CANT_GET_HOST = -15
|
||||
CURLE_HTTP2 = -16
|
||||
CURLE_FTP_COULDNT_SET_TYPE = -17
|
||||
CURLE_PARTIAL_FILE = -18
|
||||
CURLE_FTP_COULDNT_RETR_FILE = -19
|
||||
CURLE_QUOTE_ERROR = -21
|
||||
CURLE_HTTP_RETURNED_ERROR = -22
|
||||
CURLE_WRITE_ERROR = -23
|
||||
CURLE_UPLOAD_FAILED = -25
|
||||
CURLE_READ_ERROR = -26
|
||||
CURLE_OUT_OF_MEMORY = -27
|
||||
CURLE_OPERATION_TIMEDOUT = -28
|
||||
CURLE_FTP_PORT_FAILED = -30
|
||||
CURLE_FTP_COULDNT_USE_REST = -31
|
||||
CURLE_RANGE_ERROR = -33
|
||||
CURLE_HTTP_POST_ERROR = -34
|
||||
CURLE_SSL_CONNECT_ERROR = -35
|
||||
CURLE_BAD_DOWNLOAD_RESUME = -36
|
||||
CURLE_FILE_COULDNT_READ_FILE = -37
|
||||
CURLE_LDAP_CANNOT_BIND = -38
|
||||
CURLE_LDAP_SEARCH_FAILED = -39
|
||||
CURLE_FUNCTION_NOT_FOUND = -41
|
||||
CURLE_ABORTED_BY_CALLBACK = -42
|
||||
CURLE_BAD_FUNCTION_ARGUMENT = -43
|
||||
CURLE_INTERFACE_FAILED = -45
|
||||
CURLE_TOO_MANY_REDIRECTS = -47
|
||||
CURLE_UNKNOWN_TELNET_OPTION = -48
|
||||
CURLE_TELNET_OPTION_SYNTAX = -49
|
||||
CURLE_PEER_FAILED_VERIFICATION = -51
|
||||
CURLE_GOT_NOTHING = -52
|
||||
CURLE_SSL_ENGINE_NOTFOUND = -53
|
||||
CURLE_SSL_ENGINE_SETFAILED = -54
|
||||
CURLE_SEND_ERROR = -55
|
||||
CURLE_RECV_ERROR = -56
|
||||
CURLE_SSL_CERTPROBLEM = -58
|
||||
CURLE_SSL_CIPHER = -59
|
||||
CURLE_SSL_CACERT = -60
|
||||
CURLE_BAD_CONTENT_ENCODING = -61
|
||||
CURLE_LDAP_INVALID_URL = -62
|
||||
CURLE_FILESIZE_EXCEEDED = -63
|
||||
CURLE_USE_SSL_FAILED = -64
|
||||
CURLE_SEND_FAIL_REWIND = -65
|
||||
CURLE_SSL_ENGINE_INITFAILED = -66
|
||||
CURLE_LOGIN_DENIED = -67
|
||||
CURLE_TFTP_NOTFOUND = -68
|
||||
CURLE_TFTP_PERM = -69
|
||||
CURLE_REMOTE_DISK_FULL = -70
|
||||
CURLE_TFTP_ILLEGAL = -71
|
||||
CURLE_TFTP_UNKNOWNID = -72
|
||||
CURLE_REMOTE_FILE_EXISTS = -73
|
||||
CURLE_TFTP_NOSUCHUSER = -74
|
||||
CURLE_CONV_FAILED = -75
|
||||
CURLE_CONV_REQD = -76
|
||||
CURLE_SSL_CACERT_BADFILE = -77
|
||||
CURLE_REMOTE_FILE_NOT_FOUND = -78
|
||||
CURLE_SSH = -79
|
||||
CURLE_SSL_SHUTDOWN_FAILED = -80
|
||||
end enum
|
||||
|
||||
function Get(url as string) as HttpRequest
|
||||
return (new HttpRequest()).Method("GET").Url(url)
|
||||
end function
|
||||
@@ -161,6 +238,11 @@ namespace HttpClient
|
||||
return m
|
||||
end function
|
||||
|
||||
function RetryCallback(callback as function) as HttpRequest
|
||||
m._retryCallback = callback
|
||||
return m
|
||||
end function
|
||||
|
||||
function NoCache() as HttpRequest
|
||||
m._noCache = true
|
||||
return m
|
||||
@@ -188,7 +270,10 @@ namespace HttpClient
|
||||
end if
|
||||
|
||||
command += ` \\\n --max-time ${m._timeoutSeconds}`
|
||||
command += ` \\\n --compressed`
|
||||
|
||||
if COMPRESSION_ENABLED
|
||||
command += ` \\\n --compressed`
|
||||
end if
|
||||
|
||||
if m._headers <> invalid
|
||||
for each key in m._headers
|
||||
@@ -289,7 +374,7 @@ namespace HttpClient
|
||||
response = invalid
|
||||
|
||||
response = m.AwaitInternal()
|
||||
if response.IsSuccess() or response.TimedOut() or response.IsCancelled() or response.StatusCode() < 500
|
||||
if response.IsSuccess() or response.TimedOut() or response.IsCancelled()
|
||||
return response
|
||||
end if
|
||||
triesLeft -= 1
|
||||
@@ -297,7 +382,29 @@ namespace HttpClient
|
||||
while triesLeft > 0
|
||||
backoffMs = 1000 + Rnd(2000)
|
||||
tryNumber = m._tryCount - triesLeft + 1
|
||||
LogInfo("Request failed ID:", m.urlTransfer.GetIdentity(), "ErrorMessage:", response.ErrorMessage(), `\nRetrying: (`, tryNumber, "/", m._tryCount, ") in", backoffMs, "ms")
|
||||
LogWarn("Request failed ID:", m.urlTransfer.GetIdentity(), "ErrorMessage:", response.ErrorMessage(), `\nRetrying: (`, tryNumber, "/", m._tryCount, ") in", backoffMs, "ms")
|
||||
|
||||
if IsFunction(m._retryCallback)
|
||||
try
|
||||
shouldRetry = m._retryCallback({
|
||||
tryNumber: tryNumber
|
||||
tryCount: m._tryCount
|
||||
request: m
|
||||
response: response
|
||||
})
|
||||
|
||||
if IsBool(shouldRetry) and not shouldRetry
|
||||
LogInfo("Retry callback returned false. Not retrying.")
|
||||
return response
|
||||
end if
|
||||
catch error
|
||||
#if DEBUG
|
||||
throw error
|
||||
#else
|
||||
LogError("Retry callback failed:", ErrorUtils.Format(error))
|
||||
#end if
|
||||
end try
|
||||
end if
|
||||
|
||||
m.urlTransfer = invalid
|
||||
m._cache = invalid
|
||||
@@ -385,7 +492,12 @@ namespace HttpClient
|
||||
if urlTransfer = invalid
|
||||
return invalid
|
||||
end if
|
||||
urlTransfer.EnableEncodings(true)
|
||||
|
||||
if COMPRESSION_ENABLED
|
||||
' Enables gzip encoding of transfers
|
||||
urlTransfer.EnableEncodings(true)
|
||||
end if
|
||||
|
||||
urlTransfer.RetainBodyOnError(true)
|
||||
if LCase(left(m._url, 6)).StartsWith("https:")
|
||||
urlTransfer.SetCertificatesFile("common:/certs/ca-bundle.crt")
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
namespace MathUtils
|
||||
|
||||
function Max(a as dynamic, b as dynamic) as dynamic
|
||||
if a > b
|
||||
return a
|
||||
else
|
||||
return b
|
||||
end if
|
||||
end function
|
||||
|
||||
function Min(a as dynamic, b as dynamic) as dynamic
|
||||
if a < b
|
||||
return a
|
||||
else
|
||||
return b
|
||||
end if
|
||||
end function
|
||||
|
||||
end namespace
|
||||
@@ -8,9 +8,11 @@ namespace RegistryUtils
|
||||
const PLAYLET_LIB_URLS = "playlet_lib_urls"
|
||||
const BOOKMARKS = "bookmarks"
|
||||
|
||||
const INVIDIOUS_INSTANCES = "invidious_instances"
|
||||
const INVIDIOUS_TOKEN = "invidious_token"
|
||||
|
||||
' "invidious_instances" is deprecated, but we keep for migration purposes
|
||||
const INVIDIOUS_INSTANCES = "invidious_instances"
|
||||
|
||||
function Read(key as string, section = DEFAULT_SECTION as string) as dynamic
|
||||
sec = CreateObject("roRegistrySection", section)
|
||||
if sec.Exists(key)
|
||||
|
||||
@@ -1,54 +1,4 @@
|
||||
function IsString(obj as dynamic) as boolean
|
||||
return obj <> invalid and GetInterface(obj, "ifString") <> invalid
|
||||
end function
|
||||
|
||||
function IsArray(obj as dynamic) as boolean
|
||||
return obj <> invalid and GetInterface(obj, "ifArray") <> invalid
|
||||
end function
|
||||
|
||||
function IsAssociativeArray(obj as dynamic) as boolean
|
||||
return obj <> invalid and GetInterface(obj, "ifAssociativeArray") <> invalid
|
||||
end function
|
||||
|
||||
function IsByteArray(obj as dynamic) as boolean
|
||||
return obj <> invalid and GetInterface(obj, "ifByteArray") <> invalid
|
||||
end function
|
||||
|
||||
function IsInt(obj as dynamic) as boolean
|
||||
return obj <> invalid and GetInterface(obj, "ifInt") <> invalid
|
||||
end function
|
||||
|
||||
function IsDouble(obj as dynamic) as boolean
|
||||
return obj <> invalid and GetInterface(obj, "ifDouble") <> invalid
|
||||
end function
|
||||
|
||||
function IsFunction(obj as dynamic) as boolean
|
||||
return obj <> invalid and GetInterface(obj, "ifFunction") <> invalid
|
||||
end function
|
||||
|
||||
function ValidString(obj as object) as string
|
||||
if obj <> invalid and GetInterface(obj, "ifString") <> invalid
|
||||
return obj
|
||||
else
|
||||
return ""
|
||||
end if
|
||||
end function
|
||||
|
||||
function ValidInt(obj as dynamic) as integer
|
||||
if obj <> invalid and GetInterface(obj, "ifInt") <> invalid
|
||||
return obj
|
||||
else
|
||||
return 0
|
||||
end if
|
||||
end function
|
||||
|
||||
function ValidBool(obj as dynamic) as boolean
|
||||
if obj <> invalid and GetInterface(obj, "ifBoolean") <> invalid
|
||||
return obj
|
||||
else
|
||||
return false
|
||||
end if
|
||||
end function
|
||||
' This file will be populated with the functions using type-gen-plugin.ts
|
||||
|
||||
function FuncName(func as function) as string
|
||||
return (LCase(`${func}`)).replace("function:", "").trim()
|
||||
|
||||
@@ -1,31 +1,31 @@
|
||||
{
|
||||
"name": "playlet-web",
|
||||
"version": "0.18.0",
|
||||
"version": "0.19.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "playlet-web",
|
||||
"version": "0.18.0",
|
||||
"version": "0.19.0",
|
||||
"devDependencies": {
|
||||
"@sveltejs/vite-plugin-svelte": "^3.0.1",
|
||||
"@tailwindcss/typography": "^0.5.10",
|
||||
"@tsconfig/svelte": "^5.0.2",
|
||||
"@vitejs/plugin-legacy": "^5.2.0",
|
||||
"autoprefixer": "^10.4.16",
|
||||
"daisyui": "^4.4.23",
|
||||
"daisyui": "^4.5.0",
|
||||
"dotenv": "^16.3.1",
|
||||
"ip": "^1.1.8",
|
||||
"postcss": "^8.4.32",
|
||||
"postcss": "^8.4.33",
|
||||
"svelte": "^4.2.8",
|
||||
"svelte-check": "^3.6.2",
|
||||
"svelte-preprocess": "^5.1.3",
|
||||
"tailwindcss": "^3.4.0",
|
||||
"tailwindcss": "^3.4.1",
|
||||
"terser": "^5.26.0",
|
||||
"tslib": "^2.6.2",
|
||||
"typescript": "^5.3.3",
|
||||
"vite": "^5.0.10",
|
||||
"vite-tsconfig-paths": "^4.2.2"
|
||||
"vite": "^5.0.11",
|
||||
"vite-tsconfig-paths": "^4.2.3"
|
||||
}
|
||||
},
|
||||
"node_modules/@alloc/quick-lru": {
|
||||
@@ -2925,9 +2925,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/daisyui": {
|
||||
"version": "4.4.23",
|
||||
"resolved": "https://registry.npmjs.org/daisyui/-/daisyui-4.4.23.tgz",
|
||||
"integrity": "sha512-IFQRGoGoAke8chxPcDqQJFldVVd51JL7b4mRA3LqsLexW/6xicZzz9X3GXdGdnYsu8QPxZN4uzQZ5fwRNYXOSg==",
|
||||
"version": "4.5.0",
|
||||
"resolved": "https://registry.npmjs.org/daisyui/-/daisyui-4.5.0.tgz",
|
||||
"integrity": "sha512-RWQCPQ0vBUaxGy768O7Ku8SRQgwdoto1lDzuKeVOcMtYghuSbUY7NoPoMK+k8JH4s1J02OvpNAgtB9MeKpZIwg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"css-selector-tokenizer": "^0.8",
|
||||
@@ -3704,9 +3704,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/postcss": {
|
||||
"version": "8.4.32",
|
||||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.32.tgz",
|
||||
"integrity": "sha512-D/kj5JNu6oo2EIy+XL/26JEDTlIbB8hw85G8StOE6L74RQAVVP5rej6wxCNqyMbR4RkPfqvezVbPw81Ngd6Kcw==",
|
||||
"version": "8.4.33",
|
||||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.33.tgz",
|
||||
"integrity": "sha512-Kkpbhhdjw2qQs2O2DGX+8m5OVqEcbB9HRBvuYM9pgrjEFUg30A9LmXNlTAUj4S9kgtGyrMbTzVjH7E+s5Re2yg==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
@@ -4337,9 +4337,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/tailwindcss": {
|
||||
"version": "3.4.0",
|
||||
"resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.4.0.tgz",
|
||||
"integrity": "sha512-VigzymniH77knD1dryXbyxR+ePHihHociZbXnLZHUyzf2MMs2ZVqlUrZ3FvpXP8pno9JzmILt1sZPD19M3IxtA==",
|
||||
"version": "3.4.1",
|
||||
"resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.4.1.tgz",
|
||||
"integrity": "sha512-qAYmXRfk3ENzuPBakNK0SRrUDipP8NQnEY6772uDhflcQz5EhRdD7JNZxyrFHVQNCwULPBn6FNPp9brpO7ctcA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@alloc/quick-lru": "^5.2.0",
|
||||
@@ -4577,9 +4577,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/vite": {
|
||||
"version": "5.0.10",
|
||||
"resolved": "https://registry.npmjs.org/vite/-/vite-5.0.10.tgz",
|
||||
"integrity": "sha512-2P8J7WWgmc355HUMlFrwofacvr98DAjoE52BfdbwQtyLH06XKwaL/FMnmKM2crF0iX4MpmMKoDlNCB1ok7zHCw==",
|
||||
"version": "5.0.11",
|
||||
"resolved": "https://registry.npmjs.org/vite/-/vite-5.0.11.tgz",
|
||||
"integrity": "sha512-XBMnDjZcNAw/G1gEiskiM1v6yzM4GE5aMGvhWTlHAYYhxb7S3/V1s3m2LDHa8Vh6yIWYYB0iJwsEaS523c4oYA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"esbuild": "^0.19.3",
|
||||
@@ -4632,9 +4632,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/vite-tsconfig-paths": {
|
||||
"version": "4.2.2",
|
||||
"resolved": "https://registry.npmjs.org/vite-tsconfig-paths/-/vite-tsconfig-paths-4.2.2.tgz",
|
||||
"integrity": "sha512-dq0FjyxHHDnp0uS3P12WEOX2W7NeuLzX9AWP38D7Zw2CTbFErapwQVlCiT5DMJcVWKQ1MMdTe92PZl/rBQ7qcw==",
|
||||
"version": "4.2.3",
|
||||
"resolved": "https://registry.npmjs.org/vite-tsconfig-paths/-/vite-tsconfig-paths-4.2.3.tgz",
|
||||
"integrity": "sha512-xVsA2xe6QSlzBujtWF8q2NYexh7PAUYfzJ4C8Axpe/7d2pcERYxuxGgph9F4f0iQO36g5tyGq6eBUYIssdUrVw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"debug": "^4.1.1",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "playlet-web",
|
||||
"version": "0.18.0",
|
||||
"version": "0.19.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
@@ -14,18 +14,18 @@
|
||||
"@tsconfig/svelte": "^5.0.2",
|
||||
"@vitejs/plugin-legacy": "^5.2.0",
|
||||
"autoprefixer": "^10.4.16",
|
||||
"daisyui": "^4.4.23",
|
||||
"daisyui": "^4.5.0",
|
||||
"dotenv": "^16.3.1",
|
||||
"ip": "^1.1.8",
|
||||
"postcss": "^8.4.32",
|
||||
"postcss": "^8.4.33",
|
||||
"svelte": "^4.2.8",
|
||||
"svelte-check": "^3.6.2",
|
||||
"svelte-preprocess": "^5.1.3",
|
||||
"tailwindcss": "^3.4.0",
|
||||
"tailwindcss": "^3.4.1",
|
||||
"terser": "^5.26.0",
|
||||
"tslib": "^2.6.2",
|
||||
"typescript": "^5.3.3",
|
||||
"vite": "^5.0.10",
|
||||
"vite-tsconfig-paths": "^4.2.2"
|
||||
"vite": "^5.0.11",
|
||||
"vite-tsconfig-paths": "^4.2.3"
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@
|
||||
appStateStore,
|
||||
bookmarksStore,
|
||||
homeLayoutFileStore,
|
||||
homeLayoutStore,
|
||||
invidiousVideoApiStore,
|
||||
playletStateStore,
|
||||
preferencesModelStore,
|
||||
@@ -27,6 +28,10 @@
|
||||
playletStateStore.set(value);
|
||||
});
|
||||
|
||||
PlayletApi.getHomeLayout().then((value) => {
|
||||
homeLayoutStore.set(value);
|
||||
});
|
||||
|
||||
PlayletApi.getHomeLayoutFile().then((value) => {
|
||||
homeLayoutFileStore.set(value);
|
||||
});
|
||||
|
||||
@@ -18,7 +18,6 @@ export class InvidiousApi {
|
||||
"ChannelInfoHandler": (requestData, response) => this.ChannelInfoHandler(requestData, response),
|
||||
"ChannelVideosHandler": (requestData, response) => this.ChannelVideosHandler(requestData, response),
|
||||
"ChannelPlaylistsHandler": (requestData, response) => this.ChannelPlaylistsHandler(requestData, response),
|
||||
"ChannelRelatedChannelsHandler": (requestData, response) => this.ChannelRelatedChannelsHandler(requestData, response),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -211,13 +210,6 @@ export class InvidiousApi {
|
||||
};
|
||||
}
|
||||
|
||||
private async ChannelRelatedChannelsHandler(feedSource, responseJson) {
|
||||
return {
|
||||
items: responseJson.relatedChannels,
|
||||
continuation: responseJson.continuation
|
||||
};
|
||||
}
|
||||
|
||||
private makeUrl(url: string, params: any) {
|
||||
const encodedUrl = new URL(url);
|
||||
const existingParams = new URLSearchParams(encodedUrl.search);
|
||||
|
||||
@@ -13,6 +13,12 @@ export class PlayletApi {
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
// Home layout is the home layout file, but with the user's preferences applied.
|
||||
static async getHomeLayout() {
|
||||
const response = await fetch(`${PlayletApi.host()}/api/home-layout`);
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
static async getHomeLayoutFile() {
|
||||
const response = await fetch(`${PlayletApi.host()}/config/default_home_layout.yaml`);
|
||||
return await response.json();
|
||||
@@ -119,10 +125,6 @@ export class PlayletApi {
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
static async updateInstance(instance) {
|
||||
return await PlayletApi.putJson(`${PlayletApi.host()}/api/preferences`, { "invidious.instance": instance });
|
||||
}
|
||||
|
||||
static async setPlayletLibVersion(tag) {
|
||||
if (tag !== "") {
|
||||
const urls = [{
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
import RemoteIcon from "../assets/remote-control.svg.svelte";
|
||||
|
||||
import { appStateStore } from "lib/Stores";
|
||||
import type { AppState } from "lib/Types";
|
||||
import { ScreenNames, type AppState } from "lib/Types";
|
||||
import { onMount } from "svelte";
|
||||
|
||||
function setScreen(screen: AppState["screen"]) {
|
||||
appStateStore.update((state) => {
|
||||
@@ -20,6 +21,31 @@
|
||||
state.screen = screen;
|
||||
return state;
|
||||
});
|
||||
setScreenNameInUrl(screen);
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
const screen = getScreenNameInUrl();
|
||||
if (screen) {
|
||||
setScreen(screen);
|
||||
} else {
|
||||
setScreenNameInUrl("home");
|
||||
}
|
||||
});
|
||||
|
||||
function getScreenNameInUrl(): AppState["screen"] | undefined {
|
||||
const hash = window.location.hash;
|
||||
if (hash) {
|
||||
const screen = hash.substring(1) as AppState["screen"];
|
||||
if (!ScreenNames.includes(screen)) {
|
||||
return;
|
||||
}
|
||||
return screen;
|
||||
}
|
||||
}
|
||||
|
||||
function setScreenNameInUrl(screen: AppState["screen"]) {
|
||||
window.location.hash = screen;
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -31,6 +57,7 @@
|
||||
<div class="h-6">
|
||||
<SearchIcon />
|
||||
</div>
|
||||
<span class="text-xs">Search</span>
|
||||
</button>
|
||||
<button
|
||||
on:click={() => setScreen("home")}
|
||||
@@ -39,6 +66,7 @@
|
||||
<div class="h-6">
|
||||
<HomeIcon />
|
||||
</div>
|
||||
<span class="text-xs">Home</span>
|
||||
</button>
|
||||
<button
|
||||
on:click={() => setScreen("bookmarks")}
|
||||
@@ -47,6 +75,7 @@
|
||||
<div class="h-6">
|
||||
<BookmarksIcon />
|
||||
</div>
|
||||
<span class="text-xs">Bookmarks</span>
|
||||
</button>
|
||||
<button
|
||||
on:click={() => setScreen("settings")}
|
||||
@@ -55,6 +84,7 @@
|
||||
<div class="h-6">
|
||||
<SettingsIcon />
|
||||
</div>
|
||||
<span class="text-xs">Settings</span>
|
||||
</button>
|
||||
<button
|
||||
on:click={() => setScreen("remote")}
|
||||
@@ -63,6 +93,7 @@
|
||||
<div class="h-6">
|
||||
<RemoteIcon />
|
||||
</div>
|
||||
<span class="text-xs">Remote</span>
|
||||
</button>
|
||||
<button
|
||||
on:click={() => setScreen("info")}
|
||||
@@ -71,5 +102,6 @@
|
||||
<div class="h-6">
|
||||
<InfoIcon />
|
||||
</div>
|
||||
<span class="text-xs">Info</span>
|
||||
</button>
|
||||
</div>
|
||||
@@ -1,13 +1,13 @@
|
||||
<script lang="ts">
|
||||
import VideoListRow from "lib/VideoFeed/VideoListRow.svelte";
|
||||
import { homeLayoutFileStore } from "lib/Stores";
|
||||
import { homeLayoutStore } from "lib/Stores";
|
||||
|
||||
export let visibility: boolean;
|
||||
</script>
|
||||
|
||||
<div class={visibility ? "" : "hidden"}>
|
||||
<!-- TODO:P0 Handle authenticated feed when not logged in -->
|
||||
{#each $homeLayoutFileStore as feed}
|
||||
{#each $homeLayoutStore as feed}
|
||||
<VideoListRow {feed} />
|
||||
{/each}
|
||||
</div>
|
||||
@@ -1,4 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { getHost } from "lib/Api/Host";
|
||||
import { playletStateStore } from "lib/Stores";
|
||||
|
||||
export let visibility: boolean;
|
||||
@@ -38,6 +39,26 @@
|
||||
},
|
||||
];
|
||||
|
||||
const host = `http://${getHost()}`;
|
||||
const internalStateLinks = [
|
||||
{
|
||||
displayText: "App state",
|
||||
link: `${host}/api/state`,
|
||||
},
|
||||
{
|
||||
displayText: "Logs",
|
||||
link: `${host}/logs/app_logs.txt`,
|
||||
},
|
||||
{
|
||||
displayText: "Logs (previous run)",
|
||||
link: `${host}/logs/app_logs_previous.txt`,
|
||||
},
|
||||
{
|
||||
displayText: "Preferences",
|
||||
link: `${host}/api/preferences`,
|
||||
},
|
||||
];
|
||||
|
||||
function transformValue(key, value) {
|
||||
switch (key) {
|
||||
case "app_version":
|
||||
@@ -140,6 +161,26 @@ ${JSON.stringify(preferencesInfo, null, 2)}
|
||||
<td>{@html transformValue(item.key, appInfo[item.key])}</td>
|
||||
</tr>
|
||||
{/each}
|
||||
|
||||
<thead>
|
||||
<tr>
|
||||
<th>App internal state</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
{#each internalStateLinks as item}
|
||||
<tr>
|
||||
<td>{item.displayText}</td>
|
||||
<td
|
||||
><a
|
||||
class="link"
|
||||
href={item.link}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer">link</a
|
||||
></td
|
||||
>
|
||||
</tr>
|
||||
{/each}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,145 @@
|
||||
<script lang="ts">
|
||||
import {
|
||||
homeLayoutFileStore,
|
||||
homeLayoutStore,
|
||||
userPreferencesStore,
|
||||
} from "lib/Stores";
|
||||
import ArrowUpIcon from "assets/remote-control/arrow-up.svg.svelte";
|
||||
import ArrowDownIcon from "assets/remote-control/arrow-down.svg.svelte";
|
||||
import { PlayletApi } from "lib/Api/PlayletApi";
|
||||
|
||||
const textSizes = ["text-2xl", "text-lg", "text-base", "text-sm", "text-xs"];
|
||||
|
||||
export let displayText: string = "";
|
||||
// svelte-ignore unused-export-let
|
||||
export let key: string = "";
|
||||
export let description: string = "";
|
||||
export let level: number = 0;
|
||||
|
||||
let value;
|
||||
let originalValue;
|
||||
let homeLayout;
|
||||
userPreferencesStore.subscribe((userPreferences) => {
|
||||
originalValue = userPreferences[key];
|
||||
});
|
||||
|
||||
homeLayoutFileStore.subscribe((value) => {
|
||||
homeLayout = value.reduce((acc, cur) => {
|
||||
acc[cur.id] = cur;
|
||||
return acc;
|
||||
}, {});
|
||||
});
|
||||
|
||||
let modal;
|
||||
|
||||
async function openHomeScreenEditor() {
|
||||
value = JSON.parse(JSON.stringify(originalValue));
|
||||
modal.showModal();
|
||||
}
|
||||
|
||||
async function save() {
|
||||
if (key !== "" && value) {
|
||||
await PlayletApi.saveUserPreference(key, value);
|
||||
|
||||
const refreshUserPrefrences = PlayletApi.getUserPreferences();
|
||||
refreshUserPrefrences.then((value) => {
|
||||
userPreferencesStore.set(value);
|
||||
});
|
||||
|
||||
const refreshHomeLayout = PlayletApi.getHomeLayout();
|
||||
refreshHomeLayout.then((value) => {
|
||||
homeLayoutStore.set(value);
|
||||
});
|
||||
|
||||
await Promise.all([refreshUserPrefrences, refreshHomeLayout]);
|
||||
}
|
||||
}
|
||||
|
||||
function onClose() {
|
||||
// Reset value to original value to avoid weird animation on show
|
||||
value = JSON.parse(JSON.stringify(originalValue));
|
||||
}
|
||||
|
||||
function moveUp(index) {
|
||||
if (index > 0) {
|
||||
const updatedValue = [...value];
|
||||
[updatedValue[index - 1], updatedValue[index]] = [
|
||||
updatedValue[index],
|
||||
updatedValue[index - 1],
|
||||
];
|
||||
value = updatedValue;
|
||||
}
|
||||
}
|
||||
|
||||
function moveDown(index) {
|
||||
if (index < value.length - 1) {
|
||||
const updatedValue = [...value];
|
||||
[updatedValue[index], updatedValue[index + 1]] = [
|
||||
updatedValue[index + 1],
|
||||
updatedValue[index],
|
||||
];
|
||||
value = updatedValue;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="m-5">
|
||||
<div class={textSizes[level]}>{displayText}</div>
|
||||
<div class="text-xs text-gray-500">{@html description}</div>
|
||||
<button class="btn m-1" on:click={openHomeScreenEditor}
|
||||
>Edit home screen</button
|
||||
>
|
||||
</div>
|
||||
|
||||
<dialog bind:this={modal} on:close={onClose} class="modal">
|
||||
<div class="modal-box bg-base-100">
|
||||
{#if value && homeLayout}
|
||||
<table class="w-full">
|
||||
{#each value as item, i (i)}
|
||||
<tr>
|
||||
<td>
|
||||
<div class="tooltip" data-tip="Move up">
|
||||
<button
|
||||
class="btn btn-outline btn-sm"
|
||||
on:click={() => moveUp(i)}
|
||||
disabled={i === 0}
|
||||
>
|
||||
<ArrowUpIcon />
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<label class="label p-0 cursor-pointer">
|
||||
<div class="label-text">{homeLayout[item.id].title}</div>
|
||||
<input
|
||||
type="checkbox"
|
||||
name={item.id}
|
||||
bind:checked={item.enabled}
|
||||
class="toggle toggle-primary"
|
||||
/>
|
||||
</label>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<div class="tooltip" data-tip="Move down">
|
||||
<button
|
||||
class="btn btn-outline btn-sm m-2"
|
||||
on:click={() => moveDown(i)}
|
||||
disabled={i === value.length - 1}
|
||||
>
|
||||
<ArrowDownIcon />
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/each}
|
||||
</table>
|
||||
<form method="dialog" class="flex justify-center space-x-2">
|
||||
<button class="btn btn-primary" on:click={save}>Save</button>
|
||||
<button class="btn btn-primary">Close</button>
|
||||
</form>
|
||||
{/if}
|
||||
</div>
|
||||
<form method="dialog" class="modal-backdrop">
|
||||
<button>Close</button>
|
||||
</form>
|
||||
</dialog>
|
||||
@@ -1,6 +1,7 @@
|
||||
<script lang="ts">
|
||||
import BooleanControl from "lib/Screens/Settings/SettingControls/BooleanControl.svelte";
|
||||
import ClearSearchHistoryControl from "lib/Screens/Settings/SettingControls/ClearSearchHistoryControl.svelte";
|
||||
import EditHomeScreenControl from "lib/Screens/Settings/SettingControls/EditHomeScreenControl.svelte";
|
||||
import RadioControl from "lib/Screens/Settings/SettingControls/RadioControl.svelte";
|
||||
import StringControl from "lib/Screens/Settings/SettingControls/StringControl.svelte";
|
||||
|
||||
@@ -23,6 +24,7 @@
|
||||
|
||||
const customComponents = {
|
||||
ClearSearchHistoryControl,
|
||||
EditHomeScreenControl,
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
@@ -15,6 +15,8 @@ export const userPreferencesStore = writable({} as any);
|
||||
|
||||
export const invidiousVideoApiStore = writable({} as any);
|
||||
|
||||
export const homeLayoutStore = writable([] as any);
|
||||
|
||||
export const homeLayoutFileStore = writable([] as any);
|
||||
|
||||
export const bookmarksStore = writable([] as any);
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
export const ScreenNames = ["search", "home", "bookmarks", "settings", "info", "remote"] as const;
|
||||
|
||||
export type AppState = {
|
||||
screen: "search" | "home" | "bookmarks" | "settings" | "info" | "remote"
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
export let playlistThumbnail: string | undefined = undefined;
|
||||
export let videoCount: number | undefined = undefined;
|
||||
export let videos: any[] | undefined = undefined;
|
||||
export let updated: number | undefined = undefined;
|
||||
|
||||
// svelte-ignore unused-export-let
|
||||
export let type: string = undefined;
|
||||
@@ -19,6 +20,46 @@
|
||||
playletStateStore.subscribe((value) => {
|
||||
invidiousInstance = value?.invidious?.current_instance;
|
||||
});
|
||||
|
||||
function GetUpdatedText(updated) {
|
||||
if (typeof updated !== "number") {
|
||||
return "";
|
||||
}
|
||||
|
||||
const span = Math.floor(Date.now() / 1000) - updated;
|
||||
if (span < 1) {
|
||||
return "";
|
||||
}
|
||||
|
||||
let count = "";
|
||||
const totalDays = Math.floor(span / 86400);
|
||||
if (totalDays > 365) {
|
||||
const years = Math.floor(totalDays / 365);
|
||||
count = years > 1 ? `${years} years` : "1 year";
|
||||
} else if (totalDays > 30) {
|
||||
const months = Math.floor(totalDays / 30);
|
||||
count = months > 1 ? `${months} months` : "1 month";
|
||||
} else if (totalDays > 7) {
|
||||
const weeks = Math.floor(totalDays / 7);
|
||||
count = weeks > 1 ? `${weeks} weeks` : "1 week";
|
||||
} else if (totalDays > 1) {
|
||||
count = `${totalDays} days`;
|
||||
} else if (span > 3600) {
|
||||
const hours = Math.floor(span / 3600);
|
||||
count = hours > 1 ? `${hours} hours` : "1 hour";
|
||||
} else if (span > 60) {
|
||||
const minutes = Math.floor(span / 60);
|
||||
count = minutes > 1 ? `${minutes} minutes` : "1 minute";
|
||||
} else {
|
||||
count = span > 1 ? `${span} seconds` : "1 second";
|
||||
}
|
||||
|
||||
if (count === "") {
|
||||
return "";
|
||||
}
|
||||
|
||||
return `Updated ${count} ago`;
|
||||
}
|
||||
</script>
|
||||
|
||||
<button class="w-80 p-2" on:click={modal.show()}>
|
||||
@@ -33,6 +74,7 @@
|
||||
<div class="card-body">
|
||||
<h3 class="card-title text-base line-clamp-2 min-h-12">{title}</h3>
|
||||
<div class="font-semibold">{author}</div>
|
||||
<div>{GetUpdatedText(updated)}</div>
|
||||
</div>
|
||||
</div>
|
||||
</button>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
// TODO:P1 figure out why some uncached feeds (e.g. channels/ucid/videos) get hit twice
|
||||
export let feed: any = undefined;
|
||||
export let videos = [];
|
||||
let videos = [];
|
||||
|
||||
enum FeedLoadState {
|
||||
None,
|
||||
@@ -28,6 +28,8 @@
|
||||
let scrollStart = 0;
|
||||
let scrollEnd = 0;
|
||||
|
||||
let loadDataTask = undefined;
|
||||
|
||||
// w-80|w-60 p-2: 320px|240px + 16px padding on each side
|
||||
const videoItemWidth = 320 + 16 * 2;
|
||||
const channelItemWidth = 240 + 16 * 2;
|
||||
@@ -42,6 +44,18 @@
|
||||
{ threshold: [0] }
|
||||
);
|
||||
|
||||
$: {
|
||||
if (feed) {
|
||||
feedSourcesIndex = 0;
|
||||
feedLoadState = FeedLoadState.None;
|
||||
videos = [];
|
||||
itemWidths = [];
|
||||
scrollStart = 0;
|
||||
scrollEnd = 0;
|
||||
loadDataTask = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
$: {
|
||||
if (
|
||||
carouselElement &&
|
||||
@@ -112,8 +126,6 @@
|
||||
loadDataTask = undefined;
|
||||
}
|
||||
|
||||
let loadDataTask;
|
||||
|
||||
async function loadData() {
|
||||
feedLoadState = FeedLoadState.Loading;
|
||||
let totalFetchedItems = 0;
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
# Tools
|
||||
|
||||
Various scripts for various purposes. Most of them are not called directly, but from an npm shortcut `npm run COMMAND`
|
||||
@@ -3,89 +3,24 @@
|
||||
import {
|
||||
CompilerPlugin,
|
||||
BscFile,
|
||||
BeforeFileTranspileEvent,
|
||||
isBrsFile,
|
||||
WalkMode,
|
||||
createVisitor,
|
||||
DiagnosticSeverity,
|
||||
Program,
|
||||
FunctionStatement,
|
||||
BeforeFileValidateEvent,
|
||||
} from 'brighterscript';
|
||||
|
||||
declare type FunctionInFile = {
|
||||
functionStatement: FunctionStatement,
|
||||
file: BscFile
|
||||
}
|
||||
|
||||
export class AsyncTaskPlugin implements CompilerPlugin {
|
||||
public name = 'AsyncTaskPlugin';
|
||||
|
||||
private asyncTaskFunctions: FunctionInFile[] = []
|
||||
private duplicatesReporeted: FunctionInFile[] = []
|
||||
|
||||
beforeProgramValidate(program: Program) {
|
||||
this.asyncTaskFunctions = []
|
||||
this.duplicatesReporeted = []
|
||||
}
|
||||
|
||||
beforeFileValidate(event: BeforeFileValidateEvent) {
|
||||
if (!isBrsFile(event.file)) {
|
||||
return
|
||||
}
|
||||
event.file.ast.walk(createVisitor({
|
||||
FunctionExpression: (func) => {
|
||||
if (!this.isAsyncTask(func.functionStatement)) {
|
||||
return
|
||||
}
|
||||
|
||||
this.asyncTaskFunctions.push({
|
||||
file: event.file,
|
||||
functionStatement: func.functionStatement!
|
||||
})
|
||||
},
|
||||
}), {
|
||||
walkMode: WalkMode.visitExpressionsRecursive
|
||||
});
|
||||
}
|
||||
|
||||
afterFileValidate(file: BscFile) {
|
||||
afterFileParse(file: BscFile) {
|
||||
if (!isBrsFile(file)) {
|
||||
return
|
||||
}
|
||||
|
||||
const functionsWithDuplicates = this.getFunctionsWithDuplicatesForFile(file);
|
||||
const program = file.program
|
||||
|
||||
for (let index = 0; index < functionsWithDuplicates.length; index++) {
|
||||
const fn = functionsWithDuplicates[index];
|
||||
if (this.duplicatesReporeted.indexOf(fn) !== -1) {
|
||||
continue
|
||||
}
|
||||
file.addDiagnostics([{
|
||||
code: 6661,
|
||||
message: `Duplicate async task '${fn.functionStatement.name.text}', use a different function name`,
|
||||
range: fn.functionStatement.range,
|
||||
file: fn.file,
|
||||
source: "AsyncTaskPlugin",
|
||||
severity: DiagnosticSeverity.Error,
|
||||
}])
|
||||
this.duplicatesReporeted.push(fn)
|
||||
}
|
||||
}
|
||||
|
||||
beforeFileTranspile(event: BeforeFileTranspileEvent) {
|
||||
if (!isBrsFile(event.file)) {
|
||||
return
|
||||
}
|
||||
|
||||
const functions = this.asyncTaskFunctions
|
||||
.filter((fn) => fn.file === event.file)
|
||||
|
||||
if (functions.length === 0) {
|
||||
return
|
||||
}
|
||||
|
||||
event.file.ast.walk(createVisitor({
|
||||
file.ast.walk(createVisitor({
|
||||
FunctionExpression: (func) => {
|
||||
if (!this.isAsyncTask(func.functionStatement)) {
|
||||
return
|
||||
@@ -93,22 +28,51 @@ export class AsyncTaskPlugin implements CompilerPlugin {
|
||||
|
||||
const functionName = func.functionStatement!.name.text
|
||||
const hasParams = func.functionStatement!.func.parameters.length > 0
|
||||
const taskName = `${functionName}_asynctask`
|
||||
const taskName = `${functionName}_AsyncTask`
|
||||
|
||||
const bs = this.generateBsTask(functionName, hasParams, event.file)
|
||||
const bsFile = `components/asynctasks/generated/${taskName}.bs`
|
||||
const bs = this.generateBsTask(functionName, hasParams, file)
|
||||
const bsFile = `components/AsyncTask/generated/${taskName}.bs`
|
||||
|
||||
const xml = this.generateXmlTask(taskName, bsFile)
|
||||
const xmlFile = `components/asynctasks/generated/${taskName}.xml`
|
||||
const xmlFile = `components/AsyncTask/generated/${taskName}.xml`
|
||||
|
||||
event.program.setFile(xmlFile, xml)
|
||||
event.program.setFile(bsFile, bs)
|
||||
if (program.hasFile(xmlFile)) {
|
||||
const currentContent = program.getFile(xmlFile).fileContents
|
||||
if (currentContent !== xml) {
|
||||
file.addDiagnostics([{
|
||||
file: file,
|
||||
range: func.range,
|
||||
message: `AsyncTaskPlugin: file ${xmlFile} already exists`,
|
||||
severity: 1,
|
||||
code: 'ASYNC_TASK_FILE_EXISTS',
|
||||
}]);
|
||||
}
|
||||
}
|
||||
file.program.setFile(xmlFile, xml)
|
||||
|
||||
if (program.hasFile(bsFile)) {
|
||||
const currentContent = program.getFile(bsFile).fileContents
|
||||
if (currentContent !== bs) {
|
||||
file.addDiagnostics([{
|
||||
file: file,
|
||||
range: func.range,
|
||||
message: `AsyncTaskPlugin: file ${bsFile} already exists`,
|
||||
severity: 1,
|
||||
code: 'ASYNC_TASK_FILE_EXISTS',
|
||||
}]);
|
||||
}
|
||||
}
|
||||
file.program.setFile(bsFile, bs)
|
||||
},
|
||||
}), {
|
||||
walkMode: WalkMode.visitExpressionsRecursive
|
||||
});
|
||||
}
|
||||
|
||||
beforeProgramValidate(program: Program) {
|
||||
this.generateTaskListEnum(program);
|
||||
}
|
||||
|
||||
isAsyncTask(functionStatement: FunctionStatement | undefined) {
|
||||
const annotations = functionStatement?.annotations
|
||||
if (!annotations || annotations.length === 0) {
|
||||
@@ -123,39 +87,6 @@ export class AsyncTaskPlugin implements CompilerPlugin {
|
||||
return false
|
||||
}
|
||||
|
||||
getFunctionsWithDuplicatesForFile(filterFile: BscFile) {
|
||||
const fileFunctions = this.asyncTaskFunctions
|
||||
.filter((fn) => fn.file === filterFile)
|
||||
|
||||
if (fileFunctions.length === 0) {
|
||||
return []
|
||||
}
|
||||
|
||||
const uniqueNames: { [name: string]: FunctionInFile | undefined } = {}
|
||||
const duplicatesNames: { [name: string]: boolean } = {}
|
||||
const duplicates: FunctionInFile[] = []
|
||||
|
||||
for (var i = 0; i < this.asyncTaskFunctions.length; i++) {
|
||||
const fnName = this.asyncTaskFunctions[i].functionStatement.name.text.toLowerCase()
|
||||
if (duplicatesNames[fnName]) {
|
||||
duplicates.push(this.asyncTaskFunctions[i])
|
||||
continue
|
||||
}
|
||||
|
||||
if (uniqueNames[fnName]) {
|
||||
duplicates.push(uniqueNames[fnName]!)
|
||||
uniqueNames[fnName] = undefined
|
||||
duplicatesNames[fnName] = true
|
||||
duplicates.push(this.asyncTaskFunctions[i])
|
||||
continue
|
||||
}
|
||||
|
||||
uniqueNames[fnName] = this.asyncTaskFunctions[i]
|
||||
}
|
||||
|
||||
return duplicates
|
||||
}
|
||||
|
||||
generateBsTask(functionName: string, hasInput: boolean, file: BscFile): string {
|
||||
return `
|
||||
import "pkg:/${file.pkgPath}"
|
||||
@@ -164,8 +95,8 @@ import "pkg:/source/utils/ErrorUtils.bs"
|
||||
function Init()
|
||||
m.top.functionName = "TaskMain"
|
||||
m.top.cancellation = {
|
||||
node: m.top,
|
||||
field: "cancel",
|
||||
node: m.top
|
||||
field: "cancel"
|
||||
value: true
|
||||
}
|
||||
end function
|
||||
@@ -174,9 +105,9 @@ function TaskMain()
|
||||
try
|
||||
result = ${functionName}(${(hasInput ? "m.top.input" : "")})
|
||||
m.top.setField("output", {
|
||||
success: true,
|
||||
task: m.top,
|
||||
cancelled: m.top.cancel,
|
||||
success: true
|
||||
task: m.top
|
||||
cancelled: m.top.cancel
|
||||
result: result
|
||||
})
|
||||
catch e
|
||||
@@ -185,9 +116,9 @@ function TaskMain()
|
||||
print ErrorUtils.Format(e)
|
||||
#end if
|
||||
m.top.setField("output", {
|
||||
success: false,
|
||||
task: m.top,
|
||||
cancelled: m.top.cancel,
|
||||
success: false
|
||||
task: m.top
|
||||
cancelled: m.top.cancel
|
||||
error: e
|
||||
})
|
||||
end try
|
||||
@@ -206,9 +137,38 @@ end function
|
||||
<field id="cancel" type="boolean" alwaysNotify="true" />
|
||||
<field id="cancellation" type="assocarray" />
|
||||
</interface>
|
||||
<script type="text/brightscript" uri="pkg:/${bsFile}" />
|
||||
</component>`
|
||||
}
|
||||
|
||||
generateTaskListEnum(program: Program) {
|
||||
const asyncTasks = Object.values(program.files).reduce((acc, file) => {
|
||||
if (!isBrsFile(file)) {
|
||||
return acc
|
||||
}
|
||||
|
||||
file.ast.walk(createVisitor({
|
||||
FunctionExpression: (func) => {
|
||||
if (!this.isAsyncTask(func.functionStatement)) {
|
||||
return
|
||||
}
|
||||
|
||||
acc.add(func.functionStatement!.name.text)
|
||||
},
|
||||
}), {
|
||||
walkMode: WalkMode.visitExpressionsRecursive
|
||||
});
|
||||
|
||||
return acc
|
||||
}, new Set<string>());
|
||||
|
||||
const enumItems = Array.from(asyncTasks).map((task) => {
|
||||
return `${task} = "${task}_AsyncTask"`
|
||||
})
|
||||
|
||||
const content = 'enum Tasks\n ' + enumItems.join('\n ') + '\nend enum\n';
|
||||
|
||||
program.setFile('source/AsyncTask/Tasks.bs', content);
|
||||
}
|
||||
}
|
||||
|
||||
export default () => {
|
||||
|
||||