Generated task (#34)
* Async stash * tweak * Kinda works * Things work fine * Home grid task test * Convert some promises to regular tasks (#33) * Remove promise * Sponsorblock view task * Complete task cleanups * Prevent parallel search tasks * Comment * Changelog * Rename task, handle cleanups * Support task by name * Small changes
This commit is contained in:
1 parent
9a65bd4657
commit
fc20cfd7b4
27 files changed
+633
-236
No files matched your search
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Ability to clear search history from web app
|
||||
- WebSocket server for realtime events
|
||||
- SponsorBlock tracking
|
||||
- Auto-generated tasks and the @asynctask annotation
|
||||
|
||||
### Changed
|
||||
- The License has changed from MIT to AGPL
|
||||
@@ -22,6 +23,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Bug where DASH stream is not compatible. Play format stream as a fallback
|
||||
- Showing upcoming videos correctly
|
||||
|
||||
# Removed
|
||||
- Dependency on [roku-promise](https://github.com/rokucommunity/roku-promise)
|
||||
|
||||
## [0.5.0] - 2022-12-02
|
||||
### Added
|
||||
- Version check in settings page
|
||||
|
||||
@@ -20,9 +20,13 @@
|
||||
"lintConfig": "config/bslint.jsonc",
|
||||
"plugins": [
|
||||
"roku-log-bsc-plugin",
|
||||
"@rokucommunity/bslint"
|
||||
"@rokucommunity/bslint",
|
||||
"../scripts/asynctask-plugin.ts"
|
||||
],
|
||||
"retainStagingDir": true,
|
||||
"require": [
|
||||
"ts-node/register"
|
||||
],
|
||||
"rokuLog": {
|
||||
"insertPkgPath": true,
|
||||
"removeComments": false,
|
||||
|
||||
Generated
+332
-18
@@ -11,18 +11,57 @@
|
||||
"dependencies": {
|
||||
"bslib": "npm:@rokucommunity/bslib@^0.1.1",
|
||||
"log": "npm:roku-log@^0.8.0",
|
||||
"roku-promise": "^0.2.1",
|
||||
"roku-requests": "^0.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@rokucommunity/bslint": "^0.7.5",
|
||||
"@types/node": "^18.11.18",
|
||||
"brighterscript": "^0.60.6",
|
||||
"brighterscript-formatter": "^1.6.19",
|
||||
"convert-svg-to-png": "^0.6.4",
|
||||
"dotenv": "^16.0.3",
|
||||
"roku-log-bsc-plugin": "^0.6.1",
|
||||
"ropm": "^0.10.10",
|
||||
"semver": "^7.3.8"
|
||||
"semver": "^7.3.8",
|
||||
"ts-node": "^10.9.1",
|
||||
"typescript": "^4.9.4"
|
||||
}
|
||||
},
|
||||
"node_modules/@cspotcode/source-map-support": {
|
||||
"version": "0.8.1",
|
||||
"resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz",
|
||||
"integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@jridgewell/trace-mapping": "0.3.9"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@jridgewell/resolve-uri": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz",
|
||||
"integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@jridgewell/sourcemap-codec": {
|
||||
"version": "1.4.14",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz",
|
||||
"integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@jridgewell/trace-mapping": {
|
||||
"version": "0.3.9",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz",
|
||||
"integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@jridgewell/resolve-uri": "^3.0.3",
|
||||
"@jridgewell/sourcemap-codec": "^1.4.10"
|
||||
}
|
||||
},
|
||||
"node_modules/@nodelib/fs.scandir": {
|
||||
@@ -84,10 +123,34 @@
|
||||
"brighterscript": ">= 0.43 < 1"
|
||||
}
|
||||
},
|
||||
"node_modules/@tsconfig/node10": {
|
||||
"version": "1.0.9",
|
||||
"resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz",
|
||||
"integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@tsconfig/node12": {
|
||||
"version": "1.0.11",
|
||||
"resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz",
|
||||
"integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@tsconfig/node14": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz",
|
||||
"integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@tsconfig/node16": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.3.tgz",
|
||||
"integrity": "sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "14.18.33",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.33.tgz",
|
||||
"integrity": "sha512-qelS/Ra6sacc4loe/3MSjXNL1dNQ/GjxNHVzuChwMfmk7HuycRLVQN2qNY3XahK+fZc5E2szqQSKUyAF0E+2bg==",
|
||||
"version": "18.11.18",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.18.tgz",
|
||||
"integrity": "sha512-DHQpWGjyQKSHj3ebjFI/wRKcqQcdR+MoFBygntYOZytCqNfkd2ZC4ARDJ2DQqhjH5p85Nnd3jhUJIXrszFX/JA==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/yauzl": {
|
||||
@@ -138,6 +201,27 @@
|
||||
"regexp-to-ast": "0.5.0"
|
||||
}
|
||||
},
|
||||
"node_modules/acorn": {
|
||||
"version": "8.8.1",
|
||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.1.tgz",
|
||||
"integrity": "sha512-7zFpHzhnqYKrkYdUjF1HI1bzd0VygEGX8lFk4k5zVMqHEoES+P+7TKI+EvLO9WVMJ8eekdO0aDEK044xTXwPPA==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"acorn": "bin/acorn"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/acorn-walk": {
|
||||
"version": "8.2.0",
|
||||
"resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz",
|
||||
"integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=0.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/agent-base": {
|
||||
"version": "6.0.2",
|
||||
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz",
|
||||
@@ -213,6 +297,12 @@
|
||||
"node": ">= 8"
|
||||
}
|
||||
},
|
||||
"node_modules/arg": {
|
||||
"version": "4.1.3",
|
||||
"resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz",
|
||||
"integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/array-flat-polyfill": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/array-flat-polyfill/-/array-flat-polyfill-1.0.1.tgz",
|
||||
@@ -1061,6 +1151,12 @@
|
||||
"integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/create-require": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz",
|
||||
"integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/cross-fetch": {
|
||||
"version": "3.1.5",
|
||||
"resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.5.tgz",
|
||||
@@ -1200,6 +1296,15 @@
|
||||
"integrity": "sha512-0cuGS8+jhR67Fy7qG3i3Pc7Aw494sb9yG9QgpG97SFVWwolgYjlhJg7n+UaHxOQT30d1TYu/EYe9k01ivLErIg==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/diff": {
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz",
|
||||
"integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=0.3.1"
|
||||
}
|
||||
},
|
||||
"node_modules/dir-glob": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz",
|
||||
@@ -2043,6 +2148,12 @@
|
||||
"node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/make-error": {
|
||||
"version": "1.3.6",
|
||||
"resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz",
|
||||
"integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/merge2": {
|
||||
"version": "1.4.1",
|
||||
"resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz",
|
||||
@@ -2696,6 +2807,12 @@
|
||||
"vscode-languageserver-protocol": "~3.15.3"
|
||||
}
|
||||
},
|
||||
"node_modules/roku-log-bsc-plugin/node_modules/@types/node": {
|
||||
"version": "14.18.36",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.36.tgz",
|
||||
"integrity": "sha512-FXKWbsJ6a1hIrRxv+FoukuHnGTgEzKYGi7kilfMae96AL9UNkPFNWJEEYWzdRI9ooIkbr4AKldyuSTLql06vLQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/roku-log-bsc-plugin/node_modules/vscode-jsonrpc": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-5.0.1.tgz",
|
||||
@@ -2733,11 +2850,6 @@
|
||||
"integrity": "sha512-+a9MPUQrNGRrGU630OGbYVQ+11iOIovjCkqxajPa9w57Sd5ruK8WQNsslzpa0x/QJqC8kRc2DUxWjIFwoNm4ZQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/roku-promise": {
|
||||
"version": "0.2.1",
|
||||
"resolved": "https://registry.npmjs.org/roku-promise/-/roku-promise-0.2.1.tgz",
|
||||
"integrity": "sha512-4wKUtmQD1TOBzUZMMfblBu8Q5rw1XK2tB4pkm1GbJs8D+xgYlW1GgAlK5yDSzX6wCjn+dHgFCFEHtJiC4WMjRg=="
|
||||
},
|
||||
"node_modules/roku-requests": {
|
||||
"version": "0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/roku-requests/-/roku-requests-0.2.0.tgz",
|
||||
@@ -3308,6 +3420,49 @@
|
||||
"integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/ts-node": {
|
||||
"version": "10.9.1",
|
||||
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz",
|
||||
"integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@cspotcode/source-map-support": "^0.8.0",
|
||||
"@tsconfig/node10": "^1.0.7",
|
||||
"@tsconfig/node12": "^1.0.7",
|
||||
"@tsconfig/node14": "^1.0.0",
|
||||
"@tsconfig/node16": "^1.0.2",
|
||||
"acorn": "^8.4.1",
|
||||
"acorn-walk": "^8.1.1",
|
||||
"arg": "^4.1.0",
|
||||
"create-require": "^1.1.0",
|
||||
"diff": "^4.0.1",
|
||||
"make-error": "^1.1.1",
|
||||
"v8-compile-cache-lib": "^3.0.1",
|
||||
"yn": "3.1.1"
|
||||
},
|
||||
"bin": {
|
||||
"ts-node": "dist/bin.js",
|
||||
"ts-node-cwd": "dist/bin-cwd.js",
|
||||
"ts-node-esm": "dist/bin-esm.js",
|
||||
"ts-node-script": "dist/bin-script.js",
|
||||
"ts-node-transpile-only": "dist/bin-transpile.js",
|
||||
"ts-script": "dist/bin-script-deprecated.js"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@swc/core": ">=1.2.50",
|
||||
"@swc/wasm": ">=1.2.50",
|
||||
"@types/node": "*",
|
||||
"typescript": ">=2.7"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@swc/core": {
|
||||
"optional": true
|
||||
},
|
||||
"@swc/wasm": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/tunnel-agent": {
|
||||
"version": "0.6.0",
|
||||
"resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
|
||||
@@ -3338,6 +3493,19 @@
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/typescript": {
|
||||
"version": "4.9.4",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.4.tgz",
|
||||
"integrity": "sha512-Uz+dTXYzxXXbsFpM86Wh3dKCxrQqUcVMxwU54orwlJjOpO3ao8L7j5lH+dWfTwgCwIuM9GQ2kvVotzYJMXTBZg==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/unbzip2-stream": {
|
||||
"version": "1.4.3",
|
||||
"resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.4.3.tgz",
|
||||
@@ -3382,6 +3550,12 @@
|
||||
"uuid": "bin/uuid"
|
||||
}
|
||||
},
|
||||
"node_modules/v8-compile-cache-lib": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz",
|
||||
"integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/verror": {
|
||||
"version": "1.10.0",
|
||||
"resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz",
|
||||
@@ -3625,9 +3799,49 @@
|
||||
"buffer-crc32": "~0.2.3",
|
||||
"fd-slicer": "~1.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/yn": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz",
|
||||
"integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"@cspotcode/source-map-support": {
|
||||
"version": "0.8.1",
|
||||
"resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz",
|
||||
"integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@jridgewell/trace-mapping": "0.3.9"
|
||||
}
|
||||
},
|
||||
"@jridgewell/resolve-uri": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz",
|
||||
"integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==",
|
||||
"dev": true
|
||||
},
|
||||
"@jridgewell/sourcemap-codec": {
|
||||
"version": "1.4.14",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz",
|
||||
"integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==",
|
||||
"dev": true
|
||||
},
|
||||
"@jridgewell/trace-mapping": {
|
||||
"version": "0.3.9",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz",
|
||||
"integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@jridgewell/resolve-uri": "^3.0.3",
|
||||
"@jridgewell/sourcemap-codec": "^1.4.10"
|
||||
}
|
||||
},
|
||||
"@nodelib/fs.scandir": {
|
||||
"version": "2.1.5",
|
||||
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
|
||||
@@ -3672,10 +3886,34 @@
|
||||
"yargs": "^15.4.1"
|
||||
}
|
||||
},
|
||||
"@tsconfig/node10": {
|
||||
"version": "1.0.9",
|
||||
"resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz",
|
||||
"integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==",
|
||||
"dev": true
|
||||
},
|
||||
"@tsconfig/node12": {
|
||||
"version": "1.0.11",
|
||||
"resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz",
|
||||
"integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==",
|
||||
"dev": true
|
||||
},
|
||||
"@tsconfig/node14": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz",
|
||||
"integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==",
|
||||
"dev": true
|
||||
},
|
||||
"@tsconfig/node16": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.3.tgz",
|
||||
"integrity": "sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/node": {
|
||||
"version": "14.18.33",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.33.tgz",
|
||||
"integrity": "sha512-qelS/Ra6sacc4loe/3MSjXNL1dNQ/GjxNHVzuChwMfmk7HuycRLVQN2qNY3XahK+fZc5E2szqQSKUyAF0E+2bg==",
|
||||
"version": "18.11.18",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.18.tgz",
|
||||
"integrity": "sha512-DHQpWGjyQKSHj3ebjFI/wRKcqQcdR+MoFBygntYOZytCqNfkd2ZC4ARDJ2DQqhjH5p85Nnd3jhUJIXrszFX/JA==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/yauzl": {
|
||||
@@ -3728,6 +3966,18 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"acorn": {
|
||||
"version": "8.8.1",
|
||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.1.tgz",
|
||||
"integrity": "sha512-7zFpHzhnqYKrkYdUjF1HI1bzd0VygEGX8lFk4k5zVMqHEoES+P+7TKI+EvLO9WVMJ8eekdO0aDEK044xTXwPPA==",
|
||||
"dev": true
|
||||
},
|
||||
"acorn-walk": {
|
||||
"version": "8.2.0",
|
||||
"resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz",
|
||||
"integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==",
|
||||
"dev": true
|
||||
},
|
||||
"agent-base": {
|
||||
"version": "6.0.2",
|
||||
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz",
|
||||
@@ -3784,6 +4034,12 @@
|
||||
"picomatch": "^2.0.4"
|
||||
}
|
||||
},
|
||||
"arg": {
|
||||
"version": "4.1.3",
|
||||
"resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz",
|
||||
"integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==",
|
||||
"dev": true
|
||||
},
|
||||
"array-flat-polyfill": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/array-flat-polyfill/-/array-flat-polyfill-1.0.1.tgz",
|
||||
@@ -4423,6 +4679,12 @@
|
||||
"integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==",
|
||||
"dev": true
|
||||
},
|
||||
"create-require": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz",
|
||||
"integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==",
|
||||
"dev": true
|
||||
},
|
||||
"cross-fetch": {
|
||||
"version": "3.1.5",
|
||||
"resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.5.tgz",
|
||||
@@ -4527,6 +4789,12 @@
|
||||
"integrity": "sha512-0cuGS8+jhR67Fy7qG3i3Pc7Aw494sb9yG9QgpG97SFVWwolgYjlhJg7n+UaHxOQT30d1TYu/EYe9k01ivLErIg==",
|
||||
"dev": true
|
||||
},
|
||||
"diff": {
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz",
|
||||
"integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==",
|
||||
"dev": true
|
||||
},
|
||||
"dir-glob": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz",
|
||||
@@ -5173,6 +5441,12 @@
|
||||
"integrity": "sha512-TfTiyvZhwBYM/7QdAVDh+7dBTBA29v4ik0Ce9zda3Mnf8on1S5KJI8P2jKFZ8+5C0jhmr0KwJEO/Wdpm0VeWJQ==",
|
||||
"dev": true
|
||||
},
|
||||
"make-error": {
|
||||
"version": "1.3.6",
|
||||
"resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz",
|
||||
"integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==",
|
||||
"dev": true
|
||||
},
|
||||
"merge2": {
|
||||
"version": "1.4.1",
|
||||
"resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz",
|
||||
@@ -5673,6 +5947,12 @@
|
||||
"vscode-languageserver-protocol": "~3.15.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/node": {
|
||||
"version": "14.18.36",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.36.tgz",
|
||||
"integrity": "sha512-FXKWbsJ6a1hIrRxv+FoukuHnGTgEzKYGi7kilfMae96AL9UNkPFNWJEEYWzdRI9ooIkbr4AKldyuSTLql06vLQ==",
|
||||
"dev": true
|
||||
},
|
||||
"vscode-jsonrpc": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-5.0.1.tgz",
|
||||
@@ -5706,11 +5986,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"roku-promise": {
|
||||
"version": "0.2.1",
|
||||
"resolved": "https://registry.npmjs.org/roku-promise/-/roku-promise-0.2.1.tgz",
|
||||
"integrity": "sha512-4wKUtmQD1TOBzUZMMfblBu8Q5rw1XK2tB4pkm1GbJs8D+xgYlW1GgAlK5yDSzX6wCjn+dHgFCFEHtJiC4WMjRg=="
|
||||
},
|
||||
"roku-requests": {
|
||||
"version": "0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/roku-requests/-/roku-requests-0.2.0.tgz",
|
||||
@@ -6167,6 +6442,27 @@
|
||||
"integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==",
|
||||
"dev": true
|
||||
},
|
||||
"ts-node": {
|
||||
"version": "10.9.1",
|
||||
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz",
|
||||
"integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@cspotcode/source-map-support": "^0.8.0",
|
||||
"@tsconfig/node10": "^1.0.7",
|
||||
"@tsconfig/node12": "^1.0.7",
|
||||
"@tsconfig/node14": "^1.0.0",
|
||||
"@tsconfig/node16": "^1.0.2",
|
||||
"acorn": "^8.4.1",
|
||||
"acorn-walk": "^8.1.1",
|
||||
"arg": "^4.1.0",
|
||||
"create-require": "^1.1.0",
|
||||
"diff": "^4.0.1",
|
||||
"make-error": "^1.1.1",
|
||||
"v8-compile-cache-lib": "^3.0.1",
|
||||
"yn": "3.1.1"
|
||||
}
|
||||
},
|
||||
"tunnel-agent": {
|
||||
"version": "0.6.0",
|
||||
"resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
|
||||
@@ -6188,6 +6484,12 @@
|
||||
"integrity": "sha512-34R7HTnG0XIJcBSn5XhDd7nNFPRcXYRZrBB2O2jdKqYODldSzBAqzsWoZYYvduky73toYS/ESqxPvkDf/F0XMg==",
|
||||
"dev": true
|
||||
},
|
||||
"typescript": {
|
||||
"version": "4.9.4",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.4.tgz",
|
||||
"integrity": "sha512-Uz+dTXYzxXXbsFpM86Wh3dKCxrQqUcVMxwU54orwlJjOpO3ao8L7j5lH+dWfTwgCwIuM9GQ2kvVotzYJMXTBZg==",
|
||||
"dev": true
|
||||
},
|
||||
"unbzip2-stream": {
|
||||
"version": "1.4.3",
|
||||
"resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.4.3.tgz",
|
||||
@@ -6225,6 +6527,12 @@
|
||||
"integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==",
|
||||
"dev": true
|
||||
},
|
||||
"v8-compile-cache-lib": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz",
|
||||
"integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==",
|
||||
"dev": true
|
||||
},
|
||||
"verror": {
|
||||
"version": "1.10.0",
|
||||
"resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz",
|
||||
@@ -6425,6 +6733,12 @@
|
||||
"buffer-crc32": "~0.2.3",
|
||||
"fd-slicer": "~1.1.0"
|
||||
}
|
||||
},
|
||||
"yn": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz",
|
||||
"integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
}
|
||||
+5
-4
@@ -5,23 +5,24 @@
|
||||
"dependencies": {
|
||||
"bslib": "npm:@rokucommunity/bslib@^0.1.1",
|
||||
"log": "npm:roku-log@^0.8.0",
|
||||
"roku-promise": "^0.2.1",
|
||||
"roku-requests": "^0.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@rokucommunity/bslint": "^0.7.5",
|
||||
"@types/node": "^18.11.18",
|
||||
"brighterscript": "^0.60.6",
|
||||
"brighterscript-formatter": "^1.6.19",
|
||||
"convert-svg-to-png": "^0.6.4",
|
||||
"dotenv": "^16.0.3",
|
||||
"roku-log-bsc-plugin": "^0.6.1",
|
||||
"ropm": "^0.10.10",
|
||||
"semver": "^7.3.8"
|
||||
"semver": "^7.3.8",
|
||||
"ts-node": "^10.9.1",
|
||||
"typescript": "^4.9.4"
|
||||
},
|
||||
"ropm": {
|
||||
"rootDir": "src",
|
||||
"noprefix": [
|
||||
"roku-promise",
|
||||
"roku-requests"
|
||||
]
|
||||
},
|
||||
@@ -45,4 +46,4 @@
|
||||
"manifest-symbols": "node scripts/update-manifest-symbols.js",
|
||||
"postinstall": "npx ropm copy && cd playlet-web && npm install"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
import {
|
||||
CompilerPlugin,
|
||||
BscFile,
|
||||
BeforeFileTranspileEvent,
|
||||
isBrsFile,
|
||||
WalkMode,
|
||||
createVisitor,
|
||||
DiagnosticSeverity
|
||||
} from 'brighterscript';
|
||||
|
||||
export class AsyncTaskPlugin implements CompilerPlugin {
|
||||
public name = 'asyncTaskPlugin';
|
||||
|
||||
beforeFileTranspile(event: BeforeFileTranspileEvent) {
|
||||
if (!isBrsFile(event.file)) {
|
||||
return
|
||||
}
|
||||
event.file.ast.walk(createVisitor({
|
||||
FunctionExpression: (func) => {
|
||||
const annotations = func.functionStatement?.annotations
|
||||
if (!annotations || annotations.length === 0) {
|
||||
return
|
||||
}
|
||||
if (annotations[0].name !== "asynctask") {
|
||||
return
|
||||
}
|
||||
const functionName = func.functionStatement!.name.text
|
||||
const hasParams = func.functionStatement!.func.parameters.length > 0
|
||||
const taskName = `${functionName}_asynctask`
|
||||
|
||||
const bs = this.generateBsTask(functionName, hasParams, event.file)
|
||||
const bsFile = `components/asynctasks/generated/${taskName}.bs`
|
||||
|
||||
const xml = this.generateXmlTask(taskName, bsFile)
|
||||
const xmlFile = `components/asynctasks/generated/${taskName}.xml`
|
||||
|
||||
if (event.program.hasFile(xmlFile) || event.program.hasFile(bsFile)) {
|
||||
event.program.addDiagnostics([{
|
||||
message: `Duplicate async task ${functionName}, use a different name`,
|
||||
range: annotations[0].nameToken.range,
|
||||
file: event.file,
|
||||
severity: DiagnosticSeverity.Error,
|
||||
}])
|
||||
}
|
||||
|
||||
event.program.setFile(xmlFile, xml)
|
||||
event.program.setFile(bsFile, bs)
|
||||
},
|
||||
}), {
|
||||
walkMode: WalkMode.visitExpressionsRecursive
|
||||
});
|
||||
}
|
||||
|
||||
generateBsTask(functionName: string, hasInput: boolean, file: BscFile): string {
|
||||
return `
|
||||
import "pkg:/${file.pkgPath}"
|
||||
|
||||
function Init()
|
||||
m.top.functionName = "TaskMain"
|
||||
end function
|
||||
|
||||
function TaskMain()
|
||||
try
|
||||
result = ${functionName}(${(hasInput ? "m.top.input" : "")})
|
||||
m.top.setField("output", {
|
||||
success: true,
|
||||
result: result
|
||||
})
|
||||
catch e
|
||||
m.top.setField("output", {
|
||||
success: false,
|
||||
error: e
|
||||
})
|
||||
end try
|
||||
end function
|
||||
`
|
||||
}
|
||||
|
||||
generateXmlTask(taskName: string, bsFile: string): string {
|
||||
|
||||
return `<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<component name="${taskName}" extends="Task">
|
||||
<interface>
|
||||
<field id="input" type="assocarray" />
|
||||
<field id="output" type="assocarray" />
|
||||
</interface>
|
||||
<script type="text/brightscript" uri="pkg:/${bsFile}" />
|
||||
</component>`
|
||||
}
|
||||
}
|
||||
|
||||
export default () => {
|
||||
return new AsyncTaskPlugin();
|
||||
};
|
||||
@@ -1,5 +1,6 @@
|
||||
import "pkg:/source/roku_modules/rokupromise/Promise.brs"
|
||||
import "pkg:/source/asyncTask/asyncTask.bs"
|
||||
import "pkg:/components/VideoPlayer/Video.bs"
|
||||
import "pkg:/components/HomeGridScreen/HomeGridScreenTask.bs"
|
||||
|
||||
function Init()
|
||||
m.rowList = m.top.FindNode("rowList")
|
||||
@@ -23,6 +24,7 @@ function OnRefresh()
|
||||
end function
|
||||
|
||||
function InitContent()
|
||||
' TODO: stop any currently running tasks before starting a new batch of tasks
|
||||
m.sortedContent = []
|
||||
contentNode = CreateObject("roSGNode", "ContentNode")
|
||||
contentNode.Update({
|
||||
@@ -54,18 +56,16 @@ function StartFetchTask() as void
|
||||
return
|
||||
end if
|
||||
|
||||
createTaskPromise("HomeGridScreenTask", {
|
||||
input: {
|
||||
index: currentLoadingIndex,
|
||||
requestData: m.defaultLayout[currentLoadingIndex]
|
||||
}
|
||||
}).then(function(task as object)
|
||||
StartAsyncTask(GetHomeScreenContent, {
|
||||
index: currentLoadingIndex,
|
||||
requestData: m.defaultLayout[currentLoadingIndex]
|
||||
}, function(output as object)
|
||||
' TODO: this whole logic is not good.
|
||||
' The view should have placeholder, and child nodes get replaced as
|
||||
' They get ready.
|
||||
m.sortedContent.Push(task.output)
|
||||
m.sortedContent.Push(output.result)
|
||||
|
||||
if task.output.rootChildren.Count() > 0
|
||||
if output.result.rootChildren.Count() > 0
|
||||
m.sortedContent.SortBy("index")
|
||||
|
||||
newChildren = []
|
||||
|
||||
@@ -1,18 +1,14 @@
|
||||
import "pkg:/source/services/InvidiousService.bs"
|
||||
|
||||
function Init()
|
||||
m.top.functionName = "TaskMain"
|
||||
end function
|
||||
|
||||
function TaskMain()
|
||||
@asynctask
|
||||
function GetHomeScreenContent(input as object) as object
|
||||
rootChildren = []
|
||||
|
||||
invidious = new InvidiousService()
|
||||
service = new InvidiousService()
|
||||
|
||||
input = m.top.getField("input")
|
||||
requestData = input.requestData
|
||||
|
||||
response = invidious.MakeRequest(requestData)
|
||||
response = service.MakeRequest(requestData)
|
||||
if response <> invalid
|
||||
if type(response) = "roAssociativeArray"
|
||||
for each key in response
|
||||
@@ -29,10 +25,10 @@ function TaskMain()
|
||||
end if
|
||||
end if
|
||||
|
||||
m.top.setField("output", {
|
||||
return {
|
||||
index: input.index,
|
||||
rootChildren: rootChildren
|
||||
})
|
||||
}
|
||||
end function
|
||||
|
||||
function GetCategoryContent(category as string, json as object) as object
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<component name="HomeGridScreenTask" extends="Task">
|
||||
<interface>
|
||||
<field id="input" type="assocarray" />
|
||||
<field id="output" type="assocarray" />
|
||||
</interface>
|
||||
</component>
|
||||
@@ -1,6 +1,8 @@
|
||||
import "pkg:/source/roku_modules/rokupromise/Promise.brs"
|
||||
import "pkg:/source/asyncTask/asyncTask.bs"
|
||||
import "pkg:/components/VideoPlayer/Video.bs"
|
||||
import "pkg:/components/SearchScreen/SearchHistory.bs"
|
||||
import "pkg:/components/SearchScreen/SearchSuggestionsTask.bs"
|
||||
import "pkg:/components/SearchScreen/SearchTask.bs"
|
||||
|
||||
function Init()
|
||||
m.container = m.top.FindNode("container")
|
||||
@@ -22,64 +24,72 @@ function Init()
|
||||
end function
|
||||
|
||||
function OnFocusChange() as void
|
||||
if m.top.focus = true
|
||||
if m.rowlist.content <> invalid
|
||||
m.rowlist.SetFocus(true)
|
||||
ScrollDown()
|
||||
return
|
||||
end if
|
||||
if m.suggestions.buttons.Count() > 0
|
||||
if m.suggestions.buttonFocused >= m.suggestions.buttons.Count()
|
||||
m.suggestions.focusButton = 0
|
||||
end if
|
||||
m.suggestions.SetFocus(true)
|
||||
return
|
||||
end if
|
||||
m.keyboard.SetFocus(true)
|
||||
if m.top.focus <> true
|
||||
return
|
||||
end if
|
||||
|
||||
if m.rowlist.content <> invalid
|
||||
m.rowlist.SetFocus(true)
|
||||
ScrollDown()
|
||||
return
|
||||
end if
|
||||
if m.suggestions.buttons.Count() > 0
|
||||
if m.suggestions.buttonFocused >= m.suggestions.buttons.Count()
|
||||
m.suggestions.focusButton = 0
|
||||
end if
|
||||
m.suggestions.SetFocus(true)
|
||||
return
|
||||
end if
|
||||
m.keyboard.SetFocus(true)
|
||||
end function
|
||||
|
||||
function OnTextChange() as void
|
||||
if IsNodeFocused("suggestions")
|
||||
return
|
||||
end if
|
||||
text = m.keyboard.text
|
||||
|
||||
createTaskPromise("SearchSuggestionsTask", {
|
||||
input: {
|
||||
q: text
|
||||
}
|
||||
}).then(function(task as object) as void
|
||||
' In case this is an old request, discard suggestions
|
||||
if task.output.q <> m.keyboard.text
|
||||
return
|
||||
end if
|
||||
q = task.output.q
|
||||
suggestions = task.output.response
|
||||
if suggestions <> invalid
|
||||
if q.len() > 0 and ArrayIndexOf(suggestions, q) = -1
|
||||
suggestions.Unshift(q)
|
||||
end if
|
||||
if m.searchSuggestionsTask <> invalid
|
||||
m.searchSuggestionsTask.control = "stop"
|
||||
end if
|
||||
|
||||
' Capture current focused button and restore it after resetting the buttons
|
||||
buttonFocused = -1
|
||||
if IsNodeFocused("suggestions")
|
||||
buttonFocused = m.suggestions.buttonFocused
|
||||
end if
|
||||
if buttonFocused >= m.suggestions.buttons.Count()
|
||||
buttonFocused = m.suggestions.buttons.Count() - 1
|
||||
end if
|
||||
m.suggestions.buttons = suggestions
|
||||
if buttonFocused <> -1
|
||||
m.suggestions.focusButton = buttonFocused
|
||||
end if
|
||||
end if
|
||||
end function)
|
||||
m.searchSuggestionsTask = StartAsyncTask(SearchSuggestionsTask, {
|
||||
q: m.keyboard.text
|
||||
}, OnSearchSuggestionsTaskResults)
|
||||
end function
|
||||
|
||||
function OnSearchSuggestionsTaskResults(output as object) as void
|
||||
' In case this is an old request, discard suggestions
|
||||
q = output.result.q
|
||||
if q <> m.keyboard.text
|
||||
return
|
||||
end if
|
||||
suggestions = output.result.response
|
||||
if suggestions = invalid
|
||||
return
|
||||
end if
|
||||
|
||||
if q.len() > 0 and ArrayIndexOf(suggestions, q) = -1
|
||||
suggestions.Unshift(q)
|
||||
end if
|
||||
|
||||
' Capture current focused button and restore it after resetting the buttons
|
||||
buttonFocused = -1
|
||||
if IsNodeFocused("suggestions")
|
||||
buttonFocused = m.suggestions.buttonFocused
|
||||
end if
|
||||
if buttonFocused >= m.suggestions.buttons.Count()
|
||||
buttonFocused = m.suggestions.buttons.Count() - 1
|
||||
end if
|
||||
m.suggestions.buttons = suggestions
|
||||
if buttonFocused <> -1
|
||||
m.suggestions.focusButton = buttonFocused
|
||||
end if
|
||||
end function
|
||||
|
||||
function OnSearchButtonSelected()
|
||||
selected = m.suggestions.buttonSelected
|
||||
text = m.suggestions.buttons[selected]
|
||||
SaveSearchHistory(text)
|
||||
Search(text)
|
||||
end function
|
||||
|
||||
@@ -94,22 +104,25 @@ function OnSearchButtonFocused() as void
|
||||
end function
|
||||
|
||||
function Search(text as string)
|
||||
SaveSearchHistory(text)
|
||||
createTaskPromise("SearchTask", {
|
||||
input: {
|
||||
q: text
|
||||
}
|
||||
}).then(function(task as object) as void
|
||||
rootChildren = task.output.rootChildren
|
||||
contentNode = CreateObject("roSGNode", "ContentNode")
|
||||
contentNode.Update({
|
||||
children: rootChildren
|
||||
}, true)
|
||||
m.rowList.content = contentNode
|
||||
m.rowList.SetFocus(true)
|
||||
m.rowList.jumpToRowItem = [0, 0]
|
||||
ScrollDown()
|
||||
end function)
|
||||
if m.searchTask <> invalid
|
||||
m.searchTask.control = "stop"
|
||||
end if
|
||||
|
||||
m.searchTask = StartAsyncTask(SearchTask, {
|
||||
q: text
|
||||
}, OnSearchTaskResults)
|
||||
end function
|
||||
|
||||
function OnSearchTaskResults(output as object)
|
||||
rootChildren = output.result.rootChildren
|
||||
contentNode = CreateObject("roSGNode", "ContentNode")
|
||||
contentNode.Update({
|
||||
children: rootChildren
|
||||
}, true)
|
||||
m.rowList.content = contentNode
|
||||
m.rowList.SetFocus(true)
|
||||
m.rowList.jumpToRowItem = [0, 0]
|
||||
ScrollDown()
|
||||
end function
|
||||
|
||||
function OnVisibilityChange()
|
||||
|
||||
@@ -1,12 +1,8 @@
|
||||
import "pkg:/source/services/Invidious.bs"
|
||||
import "pkg:/components/SearchScreen/SearchHistory.bs"
|
||||
|
||||
function Init()
|
||||
m.top.functionName = "TaskMain"
|
||||
end function
|
||||
|
||||
function TaskMain()
|
||||
input = m.top.getField("input")
|
||||
@asynctask
|
||||
function SearchSuggestionsTask(input as object) as object
|
||||
q = input.q
|
||||
|
||||
searchSuggestsions = q <> "" ? Invidious.SearchSuggestions(q) : invalid
|
||||
@@ -17,10 +13,10 @@ function TaskMain()
|
||||
history = MergeSearchSuggestions(history, searchSuggestsions.suggestions)
|
||||
end if
|
||||
|
||||
m.top.setField("output", {
|
||||
return {
|
||||
q: q,
|
||||
response: history
|
||||
})
|
||||
}
|
||||
end function
|
||||
|
||||
function MergeSearchSuggestions(history as object, queryResults as object, maxItems = 10 as integer) as object
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<component name="SearchSuggestionsTask" extends="Task">
|
||||
<interface>
|
||||
<field id="input" type="assocarray" />
|
||||
<field id="output" type="assocarray" />
|
||||
</interface>
|
||||
</component>
|
||||
@@ -1,11 +1,7 @@
|
||||
import "pkg:/source/services/Invidious.bs"
|
||||
|
||||
function Init()
|
||||
m.top.functionName = "TaskMain"
|
||||
end function
|
||||
|
||||
function TaskMain()
|
||||
input = m.top.getField("input")
|
||||
@asynctask
|
||||
function SearchTask(input as object) as object
|
||||
q = input.q
|
||||
|
||||
rootChildren = []
|
||||
@@ -17,10 +13,10 @@ function TaskMain()
|
||||
rootChildren.Push(rowContent)
|
||||
end if
|
||||
|
||||
m.top.setField("output", {
|
||||
return {
|
||||
q: q,
|
||||
rootChildren: rootChildren
|
||||
})
|
||||
}
|
||||
end function
|
||||
|
||||
function GetCategoryContent(category as string, json as object) as object
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<component name="SearchTask" extends="Task">
|
||||
<interface>
|
||||
<field id="input" type="assocarray" />
|
||||
<field id="output" type="assocarray" />
|
||||
</interface>
|
||||
</component>
|
||||
@@ -1,11 +1,8 @@
|
||||
import "pkg:/source/utils/General.bs"
|
||||
import "pkg:/source/roku_modules/rokurequests/Requests.brs"
|
||||
|
||||
function Init()
|
||||
m.top.functionName = "TaskMain"
|
||||
end function
|
||||
|
||||
function TaskMain()
|
||||
@asynctask
|
||||
function AppVersionTask() as object
|
||||
latest = "N/A"
|
||||
response = Requests().request("HEAD", "https://github.com/iBicha/playlet/releases/latest", invalid)
|
||||
|
||||
@@ -19,7 +16,7 @@ function TaskMain()
|
||||
end if
|
||||
end if
|
||||
|
||||
m.top.setField("output", {
|
||||
return {
|
||||
latest: latest
|
||||
})
|
||||
}
|
||||
end function
|
||||
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<component name="AppVersionTask" extends="Task">
|
||||
<interface>
|
||||
<field id="input" type="assocarray" />
|
||||
<field id="output" type="assocarray" />
|
||||
</interface>
|
||||
</component>
|
||||
@@ -1,5 +1,6 @@
|
||||
import "pkg:/source/utils/General.bs"
|
||||
import "pkg:/source/roku_modules/rokupromise/Promise.brs"
|
||||
import "pkg:/source/asyncTask/asyncTask.bs"
|
||||
import "pkg:/components/SettingsScreen/AppVersionTask.bs"
|
||||
|
||||
function Init()
|
||||
m.versionLabel = m.top.findNode("VersionLabel")
|
||||
@@ -21,11 +22,9 @@ function OnUrlSet()
|
||||
end function
|
||||
|
||||
function GetLatestVersion()
|
||||
createTaskPromise("AppVersionTask", {
|
||||
input: {}
|
||||
}).then(function(task as object) as void
|
||||
if task.output.latest <> invalid
|
||||
SetVersionLabel(m.currentVersion, task.output.latest)
|
||||
StartAsyncTask(AppVersionTask, {}, function(output as object) as void
|
||||
if output.result.latest <> invalid
|
||||
SetVersionLabel(m.currentVersion, output.result.latest)
|
||||
end if
|
||||
end function)
|
||||
end function
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import "pkg:/source/services/SponsorBlock.bs"
|
||||
|
||||
function TaskMain()
|
||||
input = m.top.getField("input")
|
||||
@asynctask
|
||||
function SponsorBlockTask(input as object) as object
|
||||
videoId = input.videoId
|
||||
|
||||
sponsorBlockResponse = SponsorBlock.GetSkipSegmentsForVideo(videoId)
|
||||
@@ -25,9 +25,9 @@ function TaskMain()
|
||||
SponsorBlock.GenerateProgressBarBackground(skipSegments, barPath)
|
||||
end if
|
||||
|
||||
m.top.setField("output", {
|
||||
return {
|
||||
videoId: videoId,
|
||||
skipSegments: skipSegments,
|
||||
barPath: barPath
|
||||
})
|
||||
}
|
||||
end function
|
||||
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<component name="SponsorBlockTask" extends="Task">
|
||||
<interface>
|
||||
<field id="input" type="assocarray" />
|
||||
<field id="output" type="assocarray" />
|
||||
</interface>
|
||||
</component>
|
||||
@@ -1,10 +1,7 @@
|
||||
import "pkg:/source/services/SponsorBlock.bs"
|
||||
|
||||
function Init()
|
||||
m.top.functionName = "TaskMain"
|
||||
end function
|
||||
|
||||
function TaskMain()
|
||||
@asynctask
|
||||
function SponsorBlockTrackingTask(input as object)
|
||||
input = m.top.getField("input")
|
||||
segmentId = input.segmentId
|
||||
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<component name="SponsorBlockTrackingTask" extends="Task">
|
||||
<interface>
|
||||
<field id="input" type="assocarray" />
|
||||
<field id="output" type="assocarray" />
|
||||
</interface>
|
||||
</component>
|
||||
@@ -1,6 +1,5 @@
|
||||
import "pkg:/source/services/Invidious.bs"
|
||||
import "pkg:/components/Dialog/DialogUtils.bs"
|
||||
import "pkg:/source/roku_modules/rokupromise/Promise.brs"
|
||||
|
||||
function PlayVideo(videoId as string, sender as object)
|
||||
width = 1280
|
||||
|
||||
@@ -1,18 +1,13 @@
|
||||
import "pkg:/source/services/Invidious.bs"
|
||||
|
||||
function Init()
|
||||
m.top.functionName = "TaskMain"
|
||||
end function
|
||||
|
||||
function TaskMain()
|
||||
input = m.top.getField("input")
|
||||
@asynctask
|
||||
function VideoDetailsTask(input as object) as object
|
||||
videoId = input.videoId
|
||||
|
||||
metadata = Invidious.GetVideoMetadata(videoId)
|
||||
|
||||
m.top.setField("output", {
|
||||
return {
|
||||
videoId: videoId,
|
||||
metadata: metadata
|
||||
})
|
||||
}
|
||||
end function
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<component name="VideoDetailsTask" extends="Task">
|
||||
<interface>
|
||||
<field id="input" type="assocarray" />
|
||||
<field id="output" type="assocarray" />
|
||||
</interface>
|
||||
</component>
|
||||
@@ -1,6 +1,7 @@
|
||||
import "pkg:/source/utils/TimeUtils.bs"
|
||||
import "pkg:/source/services/SponsorBlock.bs"
|
||||
import "pkg:/components/VideoPlayer/Video.bs"
|
||||
import "pkg:/components/VideoPlayer/VideoDetailsTask.bs"
|
||||
|
||||
function Init()
|
||||
SetupSponsorBlock()
|
||||
@@ -15,8 +16,6 @@ function Init()
|
||||
m.top.enableUI = m.videoContainer.fullscreen
|
||||
m.videoContainer.observeFieldScoped("fullscreen", "OnFullScreenChange")
|
||||
|
||||
m.videoDetailsTask = m.top.findNode("VideoDetailsTask")
|
||||
|
||||
m.videoPlayingSuccess = false
|
||||
m.ignoreNextFinishedState = false
|
||||
|
||||
@@ -47,21 +46,26 @@ end function
|
||||
|
||||
function OnControlChange()
|
||||
if m.top.control = "stop"
|
||||
m.sponsorBlockTask.control = "stop"
|
||||
m.videoDetailsTask.control = "stop"
|
||||
if m.videoDetailsTask <> invalid
|
||||
m.videoDetailsTask.control = "stop"
|
||||
end if
|
||||
if m.sponsorBlockTask <> invalid
|
||||
m.sponsorBlockTask.control = "stop"
|
||||
end if
|
||||
end if
|
||||
end function
|
||||
|
||||
function StartVideoDetailsTask()
|
||||
m.videoDetailsTask.input = { videoId: m.top.videoId }
|
||||
m.videoDetailsTask.observeField("output", "OnVideoDetailsTaskResults")
|
||||
m.videoDetailsTask.control = "run"
|
||||
if m.videoDetailsTask <> invalid
|
||||
m.videoDetailsTask.control = "stop"
|
||||
end if
|
||||
|
||||
m.videoDetailsTask = StartAsyncTask(VideoDetailsTask, { videoId: m.top.videoId }, OnVideoDetailsTaskResults)
|
||||
end function
|
||||
|
||||
function OnVideoDetailsTaskResults() as void
|
||||
task = m.videoDetailsTask
|
||||
videoId = task.output.videoId
|
||||
metadata = task.output.metadata
|
||||
function OnVideoDetailsTaskResults(output as object) as void
|
||||
videoId = output.result.videoId
|
||||
metadata = output.result.metadata
|
||||
if videoId <> m.top.videoId
|
||||
return
|
||||
end if
|
||||
|
||||
@@ -8,13 +8,6 @@
|
||||
<field id="videoId" type="string" />
|
||||
</interface>
|
||||
<children>
|
||||
<SponsorBlockTask
|
||||
functionName="TaskMain"
|
||||
id="SponsorBlockTask" />
|
||||
<VideoDetailsTask
|
||||
functionName="TaskMain"
|
||||
id="VideoDetailsTask" />
|
||||
|
||||
<Label
|
||||
id="chapterLabel"
|
||||
width="350"
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
import "pkg:/source/asyncTask/asyncTask.bs"
|
||||
import "pkg:/components/VideoPlayer/SponsorBlockTask.bs"
|
||||
import "pkg:/components/VideoPlayer/SponsorBlockTrackingTask.bs"
|
||||
|
||||
function SetupSponsorBlock()
|
||||
PositionChapterLabel()
|
||||
m.timeLabel = FindTimeLabel()
|
||||
m.top.trickPlayBar.observeField("visible", "OnTrickPlayBarVisible")
|
||||
m.chapterLabelTimer = m.top.findNode("chapterLabelTimer")
|
||||
m.chapterLabelTimer.observeField("fire", "OnChapterLabelTimer")
|
||||
m.sponsorBlockTask = m.top.findNode("SponsorBlockTask")
|
||||
m.top.observeField("videoId", "StartSponsorBlockTask")
|
||||
end function
|
||||
|
||||
@@ -79,15 +82,16 @@ function UpdateSponsorBlockChapter(time as integer) as void
|
||||
end function
|
||||
|
||||
function StartSponsorBlockTask()
|
||||
m.sponsorBlockTask.input = { videoId: m.top.videoId }
|
||||
m.sponsorBlockTask.observeField("output", "OnSponsorBlockTaskResults")
|
||||
m.sponsorBlockTask.control = "run"
|
||||
if m.sponsorBlockTask <> invalid
|
||||
m.sponsorBlockTask.control = "stop"
|
||||
end if
|
||||
|
||||
m.sponsorBlockTask = StartAsyncTask(SponsorBlockTask, { videoId: m.top.videoId }, OnSponsorBlockTaskResults)
|
||||
end function
|
||||
|
||||
function OnSponsorBlockTaskResults()
|
||||
task = m.sponsorBlockTask
|
||||
skipSegments = task.output.skipSegments
|
||||
barPath = task.output.barPath
|
||||
function OnSponsorBlockTaskResults(output as object)
|
||||
skipSegments = output.result.skipSegments
|
||||
barPath = output.result.barPath
|
||||
if skipSegments <> invalid
|
||||
m.skipSegments = skipSegments
|
||||
m.top.seekMode = "accurate"
|
||||
@@ -144,7 +148,5 @@ function OnPositionChangeSkipSponsorBlockSections() as void
|
||||
end function
|
||||
|
||||
function SendSkippedSectionEvent(segmentId as string)
|
||||
task = createObject("roSGNode", "SponsorBlockTrackingTask")
|
||||
task.input = { segmentId: segmentId }
|
||||
task.control = "RUN"
|
||||
StartAsyncTask(SponsorBlockTrackingTask, { segmentId: segmentId })
|
||||
end function
|
||||
@@ -0,0 +1,48 @@
|
||||
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", GetFunctionName(taskFunc))
|
||||
task.id = id
|
||||
task.input = input
|
||||
|
||||
m[`asynctask_${id}`] = task
|
||||
m[`asynctask_${id}_callback`] = callback
|
||||
task.ObserveField("state", "OnTaskState")
|
||||
|
||||
return task
|
||||
end function
|
||||
|
||||
function GetFunctionName(taskFunc as object) as string
|
||||
if IsStr(taskFunc)
|
||||
return LCase(`${taskFunc}_asynctask`)
|
||||
end if
|
||||
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
|
||||
|
||||
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
|
||||
output = task.output
|
||||
callback(output)
|
||||
end if
|
||||
end if
|
||||
|
||||
m.delete(`asynctask_${id}`)
|
||||
m.delete(`asynctask_${id}_callback`)
|
||||
end function
|
||||
Reference in new issue
Block a user