Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
826228e939 | ||
|
|
b77519493d | ||
|
|
6a46d4cd09 | ||
|
|
382cbe33d3 | ||
|
|
e9b57c9c08 | ||
|
|
457242057d | ||
|
|
665f76701d | ||
|
|
258726fadb | ||
|
|
215a23c91d | ||
|
|
19ecc25852 | ||
|
|
0ae524f88c | ||
|
|
8bf16bfbd5 | ||
|
|
0acb7031d3 | ||
|
|
0ddc9a48aa | ||
|
|
3ac4d959d3 | ||
|
|
19de693298 | ||
|
|
46af79c2ae | ||
|
|
fd077a0d1a | ||
|
|
981e95b0d4 | ||
|
|
8883a59fcb | ||
|
|
662cb4b634 | ||
|
|
7269fdff7d | ||
|
|
710e892545 | ||
|
|
7dd5561faa | ||
|
|
d40a12d1f1 | ||
|
|
1170f422ec | ||
|
|
2639267e1f | ||
|
|
3b35adeae9 | ||
|
|
e8b6cd1588 | ||
|
|
0377f075be | ||
|
|
89034378fb | ||
|
|
9ae8601a32 | ||
|
|
61327401b0 | ||
|
|
94a017a878 | ||
|
|
eb3d1724e4 | ||
|
|
9d95834ebb | ||
|
|
9201b8dfe0 | ||
|
|
cf17fed02e | ||
|
|
f8d202be56 | ||
|
|
af091fe8f7 | ||
|
|
d89b1c519d | ||
|
|
dca3e42c79 | ||
|
|
2f72c6471a | ||
|
|
413e73c1c0 | ||
|
|
2a57cc99c7 | ||
|
|
d65f930247 | ||
|
|
ed632a7a62 | ||
|
|
89ea45ed54 | ||
|
|
d7e5732fde | ||
|
|
9f5a605e8f | ||
|
|
45da0880ba | ||
|
|
9e47d4d42e | ||
|
|
3312bbc56e | ||
|
|
e1cda5cc5c | ||
|
|
af0ddf68c5 | ||
|
|
3559a3fff6 | ||
|
|
e0709452be | ||
|
|
9bbf8dd038 | ||
|
|
64d655fca9 | ||
|
|
ecb738ab1f | ||
|
|
c14fa7a1d3 | ||
|
|
96f24a12a7 | ||
|
|
665fa44a49 | ||
|
|
3c43934081 | ||
|
|
e941bc2439 | ||
|
|
c35779b211 | ||
|
|
7adb90ccc2 | ||
|
|
59ed47108d | ||
|
|
2eb0cf88af | ||
|
|
38a1d9a950 | ||
|
|
c1bb059d66 | ||
|
|
da71382b4a | ||
|
|
4c32243e6e | ||
|
|
91be37fd8a | ||
|
|
54db808b83 | ||
|
|
8f722276f3 | ||
|
|
3b5d7a9520 | ||
|
|
94773d5c3a | ||
|
|
60fb566a01 | ||
|
|
ac9709fc4a | ||
|
|
1f1a4479da | ||
|
|
2dcfabdd60 | ||
|
|
8f59e3648e | ||
|
|
4233f30dec | ||
|
|
777db66bda | ||
|
|
771929d0d8 | ||
|
|
5179de5c74 | ||
|
|
e22051014f | ||
|
|
3eb45653f0 | ||
|
|
5287070233 | ||
|
|
d149c20e0d | ||
|
|
6cf735e089 | ||
|
|
af1fa0b401 | ||
|
|
f58137b326 | ||
|
|
200fb68ab9 | ||
|
|
bde4523c00 | ||
|
|
af020b509a | ||
|
|
97592f9839 | ||
|
|
53f8535535 | ||
|
|
982dd0cd2e | ||
|
|
4827537f57 | ||
|
|
586925c2da | ||
|
|
dd79d85cca | ||
|
|
584ee9a38a | ||
|
|
6051d45a80 | ||
|
|
549913ef7d | ||
|
|
8975861615 | ||
|
|
03e08c99c6 | ||
|
|
072b93728a | ||
|
|
57fa1c5c3f | ||
|
|
58ce2d6396 | ||
|
|
837386b6e0 | ||
|
|
9baa132ca3 | ||
|
|
ed2ec9bea5 | ||
|
|
2bc4d43f51 | ||
|
|
a61c0afe16 | ||
|
|
6fd34c13d1 | ||
|
|
e1b7500d7c | ||
|
|
7bfe657401 | ||
|
|
ceeb2bf37b | ||
|
|
3b69140398 | ||
|
|
25e573a1e1 | ||
|
|
d123393b2f | ||
|
|
6e0ee8adf4 | ||
|
|
74742c7e28 | ||
|
|
c740d5e0a0 | ||
|
|
620a8a6e2b | ||
|
|
84835e26e0 | ||
|
|
64f3683a22 | ||
|
|
e80fcabae5 | ||
|
|
a12b6cca11 | ||
|
|
b2f5ed2275 | ||
|
|
fc161ffe4c | ||
|
|
fc3629de09 | ||
|
|
4efbdda167 | ||
|
|
0aad02f5e6 | ||
|
|
ea5ca1c45d | ||
|
|
9fddd40ff3 | ||
|
|
b489735af9 | ||
|
|
508306c6f4 | ||
|
|
7818f778ea | ||
|
|
6abd18ab85 | ||
|
|
e8fd7ee35d | ||
|
|
deeed05383 | ||
|
|
518409cb3f | ||
|
|
a9d7de971b | ||
|
|
324543684d | ||
|
|
a6f8cb59ee | ||
|
|
e2822baac1 | ||
|
|
256fc22bd9 | ||
|
|
cb877f9415 | ||
|
|
acce520752 | ||
|
|
5d81f025ad | ||
|
|
c5680f7b06 | ||
|
|
dab6dc5bc4 | ||
|
|
e2df0b524a | ||
|
|
7401263f0d | ||
|
|
90fe768d2c | ||
|
|
5c1a62b7f3 | ||
|
|
44578bd6c5 | ||
|
|
75b8ad1c0c | ||
|
|
2b1d707f6d | ||
|
|
190dcdffe3 | ||
|
|
cf6d89f44f |
No files matched your search
@@ -17,6 +17,7 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.ref }}
|
||||
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
|
||||
- name: Configure repo
|
||||
run: |
|
||||
|
||||
@@ -3,6 +3,7 @@ name: Release
|
||||
on:
|
||||
push:
|
||||
branches: ["main"]
|
||||
workflow_dispatch: {}
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
name: Stats
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 11 * * *"
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
update_wiki_stats:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Checkout Wiki
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: ${{ github.repository }}.wiki
|
||||
path: ./playlet.wiki
|
||||
|
||||
- name: Configure repo
|
||||
run: |
|
||||
git config --local user.email "githubaction@githubaction.com"
|
||||
git config --local user.name "github-action wiki updater"
|
||||
working-directory: ./playlet.wiki
|
||||
|
||||
- name: Use Node.js 18.x
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 18.x
|
||||
cache: "npm"
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Download attachements
|
||||
run: node tools/download-stats.js
|
||||
env:
|
||||
EMAIL: ${{ secrets.EMAIL }}
|
||||
EMAIL_APP_PASSWORD: ${{ secrets.EMAIL_APP_PASSWORD }}
|
||||
|
||||
- name: Update wiki
|
||||
run: git add "." && git commit -m "Update stats" --no-verify && git push || true
|
||||
working-directory: ./playlet.wiki
|
||||
@@ -0,0 +1,36 @@
|
||||
name: Update Dependencies
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 0 * * 6"
|
||||
workflow_dispatch: {}
|
||||
|
||||
jobs:
|
||||
update_deps:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Use Node.js 18.x
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 18.x
|
||||
cache: "npm"
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Update dependencies
|
||||
run: npm run update-deps
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm i
|
||||
|
||||
- name: Create Pull Request
|
||||
uses: peter-evans/create-pull-request@v5
|
||||
with:
|
||||
commit-message: "update dependencies"
|
||||
branch: chore/update-deps
|
||||
title: "[chore] update dependencies"
|
||||
body: "Weekly pull request to update dependencies."
|
||||
Vendored
+6
-2
@@ -18,6 +18,7 @@
|
||||
"files": [
|
||||
"**"
|
||||
],
|
||||
"componentLibrariesPort": 8086,
|
||||
"componentLibraries": [
|
||||
{
|
||||
"rootDir": "${workspaceFolder}/build/playlet-lib",
|
||||
@@ -59,7 +60,7 @@
|
||||
"command": "npm run dev:web",
|
||||
"request": "launch",
|
||||
"type": "node-terminal"
|
||||
},
|
||||
},
|
||||
{
|
||||
"name": "Playlet Web (Chrome)",
|
||||
"type": "chrome",
|
||||
@@ -79,7 +80,10 @@
|
||||
"compounds": [
|
||||
{
|
||||
"name": "Playlet Web (Debug)",
|
||||
"configurations": ["Playlet Web (Dev)", "Playlet Web (Chrome)"],
|
||||
"configurations": [
|
||||
"Playlet Web (Dev)",
|
||||
"Playlet Web (Chrome)"
|
||||
],
|
||||
"stopAll": true
|
||||
}
|
||||
]
|
||||
|
||||
+150
@@ -5,6 +5,156 @@ 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.17.2] - 2023-12-10
|
||||
|
||||
### Added
|
||||
|
||||
- Loading message
|
||||
|
||||
## [0.17.1] - 2023-12-08
|
||||
|
||||
### Added
|
||||
|
||||
- An instance test to make sure thumbnails are reachable
|
||||
|
||||
### Fixed
|
||||
|
||||
- A rare error when video player is closed but does not have valid content
|
||||
- A rare error that can occur with loading indicators causing a crash
|
||||
|
||||
## [0.17.0] - 2023-11-17
|
||||
|
||||
### Added
|
||||
|
||||
- Playlet logo in web app is clickable, and launches app if not already on
|
||||
- Remote control in web app
|
||||
- Clickable buttons and keyboard support
|
||||
|
||||
## [0.16.0] - 2023-11-13
|
||||
|
||||
### Added
|
||||
|
||||
- User interface for the Queue: Press and hold `Options (*)` to show the queue
|
||||
|
||||
### Fixed
|
||||
|
||||
- Crash when video player has no content
|
||||
- Execution timeout on cirlce posters
|
||||
|
||||
## [0.15.1] - 2023-11-10
|
||||
|
||||
### Added
|
||||
|
||||
- An option to disable search history
|
||||
|
||||
### Fixed
|
||||
|
||||
- A rare bug that causes the app to crash when displaying video cells
|
||||
- A bug where we show error dialogs that happened on screens that are already closed
|
||||
- A bug where bookmarks show duplicate videos
|
||||
- A bug where watch history is not always sent to Invidious
|
||||
|
||||
## [0.15.0] - 2023-11-05
|
||||
|
||||
### Added
|
||||
|
||||
- Pagination support in web app search (load more button)
|
||||
- Video links pasted into the web app triggers the dialog to cast the video
|
||||
- Ability to subscribe/unsubscribe from a channel screen
|
||||
- This needs additional scope for the Invidious token. You will be logged out, and need to login again. Sorry for the inconvenience.
|
||||
- A notification when videos are added to the queue (can be disabled from the settings)
|
||||
|
||||
### Fixed
|
||||
|
||||
- A bug where casting from web included timestamp even if the "Start at" check box is unchecked
|
||||
- A leak where channel screens would reload data even when closed
|
||||
- A crash when fetching subscriptions
|
||||
- Fetching errors by adding a retry mechanism to web requests
|
||||
|
||||
## [0.14.0] - 2023-10-25
|
||||
|
||||
### Added
|
||||
|
||||
- Bookmarks: different items can now be bookmarked, and be found in the `Bookmarks` screen.
|
||||
Things that can be bookmarked:
|
||||
- A video
|
||||
- A channel
|
||||
- A playlist
|
||||
- Subscriptions
|
||||
- Trending
|
||||
- Popular
|
||||
- Playlists
|
||||
- Search results
|
||||
- Channel tabs (latest videos, live streams, playlists, shorts, podcasts, related channels)
|
||||
- Context menu: press and hold `OK` to show a context menu to:
|
||||
- Play/queue a video or a playlist
|
||||
- Open the channel of a playlist or of a video
|
||||
- Manage bookmarks
|
||||
- Local DASH manifest generation
|
||||
- This adds support for multi languages audio tracks
|
||||
- Also adds thumbnails/preview in trick play mode
|
||||
- Known issue: thumbnails might appear cropped/misaligned at the end of videos. This will be addressed in a later release.
|
||||
- Search filters in web app
|
||||
- Channels and Playlists can be opened on TV from web app
|
||||
- Channel links can be drag and dropped into the web app
|
||||
|
||||
### Fixed
|
||||
|
||||
- Layout in channel view so that the upload time and view count of videos is visible
|
||||
- A few things in the logger
|
||||
- A bug where channels show "0 videos". Channel handle is shown instead.
|
||||
|
||||
### Changed
|
||||
|
||||
- Cache format so it does less parsing work
|
||||
- Removed "chapter" from SponsorBlock categories
|
||||
|
||||
## [0.13.1] - 2023-10-08
|
||||
|
||||
### Added
|
||||
|
||||
- Support to pause/play while picture-in-picture
|
||||
|
||||
### Fixed
|
||||
|
||||
- (potentionally) a bug where many dialogs could cause an execution timeout
|
||||
- Mutltiple rare crashes when component content is set before component initialization
|
||||
- Error dialog for loading "Popular" when "Popular" is disabled
|
||||
|
||||
## [0.13.0] - 2023-10-02
|
||||
|
||||
### Added
|
||||
|
||||
- Playlists, streams, podcasts and related channels to Channel UI
|
||||
- Pagination supported
|
||||
- Channels show up in web app (but no UI for channel details yet)
|
||||
- Support for `Etag` header on the web server to improve performance with caching
|
||||
|
||||
### Fixed
|
||||
|
||||
- Another bug where the app crashes if an error happens loading channel info
|
||||
- Issue with default instance (by changing default instance)
|
||||
- Cropped text in a couple of buttons
|
||||
|
||||
### Removed
|
||||
|
||||
- Partial content (`Range` header) from the web server, since we never serve very big files
|
||||
|
||||
## [0.12.1] - 2023-09-19
|
||||
|
||||
### Added
|
||||
|
||||
- New logger: less features, and less rendezvous
|
||||
|
||||
### Fixed
|
||||
|
||||
- A bug where the app crashes if an error happens loading channel info
|
||||
|
||||
### Removed
|
||||
|
||||
- `roku-log` package
|
||||
- `ropm`
|
||||
|
||||
## [0.12.0] - 2023-09-17
|
||||
|
||||
### Added
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ could be public instances hosted by volenteers. These instances are available
|
||||
While invidious does no data collection by default, and it is in fact built to
|
||||
be privacy driven, but in theory, from a playlet request it is possible to
|
||||
know the IP address of a user, the identifiers of watched video, and search
|
||||
keywords. In case the user is unreasonably paranoid, they can host their own
|
||||
keywords. In case the user has privacy concerns, they can host their own
|
||||
Invidious instance and use it from Playlet.
|
||||
|
||||
## SponsorBlock
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
# Playlet
|
||||
|
||||
<!-- markdownlint-disable MD033 -->
|
||||
<!-- markdownlint-disable MD033 MD041 -->
|
||||
<p align="center">
|
||||
<img src="docs/banner.png" style="display:block;text-align:center" alt="Playlet Logo" width="800"/>
|
||||
<br/><br/>
|
||||
@@ -19,6 +17,8 @@
|
||||
</a>
|
||||
</p>
|
||||
|
||||
# Playlet
|
||||
|
||||
Playlet is an unofficial Youtube client for Roku 📺
|
||||
|
||||
## Screenshots
|
||||
@@ -62,14 +62,25 @@ More under [Screenshots](./docs/screenshots/README.md)
|
||||
### Customize Invidious instance
|
||||
|
||||
1. Open settings in Playlet
|
||||
1. Scan QR Code with Phone
|
||||
1. Change the Invidious instance
|
||||
1. You can also do this from the settings tab
|
||||
1. Select Invidious -> Instance
|
||||
1. Set a custom instance, or choose a public one hosted by volunteers (from https://api.invidious.io/)
|
||||
1. Optionally, Select `Test instance` to make sure it works
|
||||
1. Hit save
|
||||
|
||||
> ℹ️ **Note**: If you are logged in when you change the instance, you will remain logged in to the old instance. In this case, Playlet will use the old instance to retrieve your subscriptions and your playlists, but will use the new instance for everything else. After switching to a new instance, you can log out and log in again to use your profile on the new instance.
|
||||
|
||||
## Development
|
||||
|
||||
For everything related to Playlet app development, please see the [documentation](./docs/README.md)
|
||||
|
||||
## Analytics and reporting
|
||||
|
||||
We do not collect any usage data, anonymous or not. But Roku does, and you can find the data made available to Playlet in the [Wiki](https://github.com/iBicha/playlet/wiki).
|
||||
Most software in the wild collect some data to make sure things work, and to prioritize features.
|
||||
Because we don't do that, we wouldn't know if people using Playlet are facing issues, unless these issues get reported.
|
||||
Playlet could run on variaty of devices, with different capabilities and screen sizes, and different Invidious instances.
|
||||
That's why it's important to report any issues you encouter using Playlet, otherwise it's unlikely that they get addressed.
|
||||
|
||||
## Why Playlet
|
||||
|
||||
```none
|
||||
|
||||
@@ -26,7 +26,8 @@
|
||||
"source/**",
|
||||
"components/**",
|
||||
"images/**",
|
||||
"!images/vector/**",
|
||||
"!**/*.svg",
|
||||
"!**/*.svg.meta.json5",
|
||||
"fonts/**",
|
||||
"config/**",
|
||||
"lib/**",
|
||||
@@ -39,7 +40,6 @@
|
||||
],
|
||||
"lintConfig": "./config/bslint.jsonc",
|
||||
"plugins": [
|
||||
"roku-log-bsc-plugin",
|
||||
"@rokucommunity/bslint",
|
||||
"../tools/bs-plugins/asynctask-plugin.ts",
|
||||
"../tools/bs-plugins/manifest-edit-plugin.ts",
|
||||
@@ -48,7 +48,9 @@
|
||||
"../tools/bs-plugins/oninit-plugin.ts",
|
||||
"../tools/bs-plugins/track-transpiled-plugin.ts",
|
||||
"../tools/bs-plugins/json-yaml-plugin.ts",
|
||||
"../tools/bs-plugins/validation-plugin.ts"
|
||||
"../tools/bs-plugins/validation-plugin.ts",
|
||||
"../tools/bs-plugins/logger-plugin.ts",
|
||||
"../tools/bs-plugins/image-gen-plugin.ts"
|
||||
],
|
||||
"retainStagingDir": true,
|
||||
"require": [
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
"source/**",
|
||||
"components/**",
|
||||
"images/**",
|
||||
"!images/vector/**",
|
||||
"!**/*.svg",
|
||||
"!**/*.svg.meta.json5",
|
||||
"fonts/**",
|
||||
"config/**",
|
||||
"lib/**",
|
||||
@@ -14,7 +15,6 @@
|
||||
"!**/*.transpiled.*"
|
||||
],
|
||||
"plugins": [
|
||||
"roku-log-bsc-plugin",
|
||||
"@rokucommunity/bslint",
|
||||
"rooibos-roku",
|
||||
"../tools/bs-plugins/asynctask-plugin.ts",
|
||||
@@ -24,7 +24,9 @@
|
||||
"../tools/bs-plugins/oninit-plugin.ts",
|
||||
"../tools/bs-plugins/track-transpiled-plugin.ts",
|
||||
"../tools/bs-plugins/json-yaml-plugin.ts",
|
||||
"../tools/bs-plugins/validation-plugin.ts"
|
||||
"../tools/bs-plugins/validation-plugin.ts",
|
||||
"../tools/bs-plugins/logger-plugin.ts",
|
||||
"../tools/bs-plugins/image-gen-plugin.ts"
|
||||
],
|
||||
"rooibos": {
|
||||
"logLevel": 2,
|
||||
|
||||
+3
-1
@@ -17,5 +17,7 @@
|
||||
// Enforces all keywords and types to be lowercase.
|
||||
"keywordCase": "lower",
|
||||
// Remove trailing whitespace at the end of each line.
|
||||
"removeTrailingWhiteSpace": true
|
||||
"removeTrailingWhiteSpace": true,
|
||||
// Sort imports alphabetically.
|
||||
"sortImports": true
|
||||
}
|
||||
+6
-6
@@ -143,7 +143,7 @@ That's pretty much it.
|
||||
There are a few reasons we made this separation:
|
||||
|
||||
- Playlet relies on [Invidious](https://github.com/iv-org/invidious). Invidious tries to keep up with Youtube making changes to their platform, but sometimes, a breaking change happens that requires Playlet to react quickly. Releasing through the Roku Channel store can take days, or a week. During this time, Playlet would be not functional, and that's not acceptable.
|
||||
- The ability to roll back: Sometimes an app breaking bug gets released. Allowing users to choose a seperate version is a flexible way to keep things working. Although right now rollbacks are behind a - hidden by default - developer menu, the reasoning still stands.
|
||||
- The ability to roll back: Sometimes an app breaking bug gets released. Allowing users to choose a seperate version is a flexible way to keep things working. For example, it's possible to choose a different verrsion from the developer settings in the web app.
|
||||
- It is simply easier to release: Releasing Playlet Lib on Github, and everyone receives the latest version immediately, is very conveninct and less of a hassle, than going through the Roku Channel store.
|
||||
- I've had instances where I was trying to pass the certfication for Playlet to publish it. One of the criterias is to pass a some automated tests. But the tests were failing because their system could not connect to their Roku test devices (connection keeps timing out). My only option was to keep trying over and over until it worked.
|
||||
- It might sound that Playlet Lib is just a workaround for the Roku Channel release process. But phrased differently, Roku Channel release process is not good enough of what we need for Playlet.
|
||||
@@ -185,11 +185,11 @@ Since Component Libraries are simply zip files hosted at some https endpoint, Gi
|
||||
|
||||
### Dev library hosted by VS Code Extension
|
||||
|
||||
When in debug mode, Playlet lib is packaged and served locally on port 8080, and Playlet app would use it instead of the Playlet lib from Github. This is an important detail, because once you stop debugging in VS Code, the dev app on your Roku TV won't function anymore, with an error:
|
||||
When in debug mode, Playlet lib is packaged and served locally on port 8086, and Playlet app would use it instead of the Playlet lib from Github. This is an important detail, because once you stop debugging in VS Code, the dev app on your Roku TV won't function anymore, with an error:
|
||||
|
||||
> Could not load Playlet component library from any of the following urls:
|
||||
>
|
||||
> - \[debug\] http://192.168.1.x:8080/playlet-lib.zip <!-- markdownlint-disable-line -->
|
||||
> - \[debug\] http://192.168.1.x:8086/playlet-lib.zip <!-- markdownlint-disable-line -->
|
||||
> Please restart Playlet.
|
||||
> If the problem persist, contact Playlet authors.
|
||||
|
||||
@@ -210,13 +210,13 @@ Additionally, the web server exposes the settings under `/api/preferences`, whic
|
||||
|
||||
When Playlet starts, it shows a video feed on the screen. Subscription, Trending videos, and so on.
|
||||
|
||||
The layout is defined under [playlet-lib/src/config/default_home_layout.json5](/playlet-lib/src/config/default_home_layout.json5).
|
||||
The layout is defined under [playlet-lib/src/config/default_home_layout.yaml](/playlet-lib/src/config/default_home_layout.yaml).
|
||||
|
||||
This could allow users to define custom layouts, so they can see what they find relevant in the home page. This can include Subscription, Trending, Popular videos, Search per keywords, or Playlists.
|
||||
|
||||
Additionally each feed has information on how it is fetched. For now, only Invidious can be data source, but other systems should be configured in the same way.
|
||||
|
||||
Invidious API definitions are defined under [playlet-lib/src/config/invidious_video_api.json5](/playlet-lib/src/config/invidious_video_api.json5), and Playlet parses these at runtime and make the right API calls to fetch the data.
|
||||
Invidious API definitions are defined under [playlet-lib/src/config/invidious_video_api.yaml](/playlet-lib/src/config/invidious_video_api.yaml), and Playlet parses these at runtime and make the right API calls to fetch the data.
|
||||
|
||||
Finally, this layout system is what allows both the BrightScript app and the Web app to display the same homepage.
|
||||
|
||||
@@ -256,7 +256,7 @@ The web app uses [Svelte](https://svelte.dev/), [Vite](https://vitejs.dev/) and
|
||||
|
||||
Since modifying the web app code requires building all three projects (Playlet, Playlet lib, and Playlet web app) this makes the iteration speed very slow, and we lose the benefits of web development, such as hot reloads.
|
||||
|
||||
For that reason, the recommended iteration when working on the dev app is:
|
||||
For that reason, the recommended iteration when working on the web app is:
|
||||
|
||||
1. Start `Playlet (dev)` (by selecting `Playlet (dev)` and pressing Play in VS Code)
|
||||
1. Once Playlet starts, switch to `Playlet Web (dev)` and press play. Do not stop `Playlet (dev)`
|
||||
|
||||
+3
-1
@@ -43,6 +43,8 @@ These are mostly the steps when releasing a new version:
|
||||
For releasing to the store (when needed), this is done following a Playlet lib release:
|
||||
|
||||
- Switch to main branch and pull changes - **match commit corresponding to the release.**
|
||||
- `npm run build:release`
|
||||
- `npm run build:release:ci`
|
||||
- This makes sure to have a valid app in the staging folder
|
||||
- `npm run sign-released-package`
|
||||
- This should create the signed package under `release/playlet.pkg`
|
||||
- Upload to dashboard, and schedule a release (takes a couple of days)
|
||||
@@ -0,0 +1,48 @@
|
||||
<!-- TODO:P1 document models better -->
|
||||
|
||||
# Models
|
||||
|
||||
ApiEndpoint:
|
||||
|
||||
- id
|
||||
- url
|
||||
- queryParams
|
||||
- pathParams
|
||||
- cacheSeconds
|
||||
- paginationType
|
||||
- authenticated
|
||||
- responseHandler
|
||||
|
||||
FeedSource:
|
||||
|
||||
- id
|
||||
- title
|
||||
- apiType: string ("Invidious")
|
||||
- endpoint: ApiEndpoint
|
||||
- pathParams
|
||||
- queryParams
|
||||
- state:
|
||||
- paginationtype (Runtime field)
|
||||
- page (Runtime field)
|
||||
- continuation (Runtime field)
|
||||
- queryParams.page (Runtime field)
|
||||
- queryParams.continuation (Runtime field)
|
||||
|
||||
Feed/FeedContentNode:
|
||||
|
||||
- Title
|
||||
- feedSources: FeedSource[]
|
||||
- feedSourceIndex (Runtime field)
|
||||
|
||||
RowListLayout
|
||||
|
||||
- Feed[]
|
||||
|
||||
Bookmarks
|
||||
|
||||
- BookmarkGroup[]
|
||||
|
||||
BookmarkGroup
|
||||
|
||||
- title
|
||||
- feedSources: FeedSource[]
|
||||
@@ -2,7 +2,7 @@ openapi: 3.0.0
|
||||
|
||||
info:
|
||||
title: Playlet Web API
|
||||
version: 0.12.0
|
||||
version: 0.17.2
|
||||
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
|
||||
@@ -204,6 +204,29 @@ paths:
|
||||
responses:
|
||||
"204":
|
||||
description: No Content
|
||||
/api/view/open:
|
||||
get:
|
||||
summary: Open a channel view or a playlist view
|
||||
description: Open a channel view or a playlist view. If a video is playing in full screen, it is shrinked.
|
||||
operationId: openView
|
||||
parameters:
|
||||
- name: channelId
|
||||
in: query
|
||||
description: The ID of the channel to open
|
||||
required: false
|
||||
schema:
|
||||
type: string
|
||||
- name: playlistId
|
||||
in: query
|
||||
description: The ID of the playlist to open
|
||||
required: false
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
"204":
|
||||
description: No Content
|
||||
"400":
|
||||
description: Bad Request
|
||||
/api/playlet-lib-urls:
|
||||
get:
|
||||
summary: Get Playlet lib URLs
|
||||
@@ -515,6 +538,7 @@ components:
|
||||
type: boolean
|
||||
sponsorblock.show_notifications:
|
||||
type: boolean
|
||||
# TODO:P1 add the rest of properties
|
||||
PlayQueueObject:
|
||||
type: object
|
||||
properties:
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# Playlet Brighterscript Plugins
|
||||
|
||||
- [Json5/Yaml support](#json5yaml-support)
|
||||
- [Convert images](#convert-images)
|
||||
- [Manifest editing](#manifest-editing)
|
||||
- [Validation](#validation)
|
||||
- [Includes](#includes)
|
||||
@@ -8,6 +9,7 @@
|
||||
- [Bindings](#bindings)
|
||||
- [Async Task Generator](#async-task-generator)
|
||||
- [Tracking transpilied files](#tracking-transpilied-files)
|
||||
- [Logger](#logger)
|
||||
|
||||
Playlet implements a few [Brighterscript Plugins](https://github.com/rokucommunity/brighterscript/blob/master/docs/plugins.md). The plugins inject themselves in the compilation process, allowing the modification of bs scripts, xml components, and even assets or the app manifest. Let's start with a simple one:
|
||||
|
||||
@@ -27,6 +29,21 @@ Brightscript can only parse json natively using [ParseJson](https://developer.ro
|
||||
|
||||
At the end of the build, the plugin scans for certain files (`jsonc`, `json`, `json5` and `yaml`), and converts them to plain json, while keeping the original file name. That way they are all parsable by the [ParseJson](https://developer.roku.com/en-ca/docs/references/brightscript/language/global-utility-functions.md#parsejsonjsonstring-as-string-flags---as-string-as-object) function, even though their original format is not compatible.
|
||||
|
||||
## Convert images
|
||||
|
||||
**[Source](/tools/bs-plugins/image-gen-plugin.ts)**
|
||||
|
||||
This plugin allows us to convert svg files to png files.
|
||||
|
||||
### Why
|
||||
|
||||
This is used to convert splash screen, app poster, as well as icons in the app. Having svg images (or vector images in general) as the source of truth is better, in case images need to be modified or resized. Since Roku can't load them, we convert them to png.
|
||||
|
||||
### How
|
||||
|
||||
Each `.svg` file found will have an associated `.svg.meta.json5` file, which will contain the hash (MD5) of the svg, conversion paramters, and the hash of the output files. This allows us to hash existing files and see if a conversion is needed.
|
||||
Notice how each `.svg` file can be configured to generate multiple png files. This is especially the case to generate the app artwork (splash screen/poster) with different sizes from the same logo `.svg` file.
|
||||
|
||||
## Manifest editing
|
||||
|
||||
**[Source](/tools/bs-plugins/manifest-edit-plugin.ts)**
|
||||
@@ -483,3 +500,37 @@ Additionally, if there's a folder `MyFolder` and `MyFolder.transpiled` in the so
|
||||
To reduce the noise of this plugin, it only runs when we're making a test build.
|
||||
|
||||
Because we continiously make test build in Github actions, the tracked transpilied files will be automatically added to PRs, so that we notice if outputs do not look right.
|
||||
|
||||
## Logger
|
||||
|
||||
**[Source](/tools/bs-plugins/logger-plugin.ts)**
|
||||
|
||||
### Why
|
||||
|
||||
The logger plugin does some code transformation to log calls, which can add caller path at compile time, or the filename, based on debug/release configuration.
|
||||
|
||||
### How
|
||||
|
||||
The logger plugin searches for calls to the predefined functions `LogError`, `LogWarn`, `LogInfo` and `LogDebug`. Once found, it does the following (we take `LogError` as an example):
|
||||
- It replaces calls of `LogError` with `LogErrorX` where X is the number of arguments.
|
||||
- For example, it replaces `LogError("Cannot complete operation:", error)` with `LogError2("Cannot complete operation:", error)`
|
||||
- Based on usage, it generates `LogErrorX` functions used. Example:
|
||||
```
|
||||
function LogError2(arg0, arg1) as void
|
||||
logger = m.global.logger
|
||||
if logger.logLevel < 0
|
||||
return
|
||||
end if
|
||||
m.global.logger.logLine = "[ERROR]" + ToString(arg0) + " " + ToString(arg1)
|
||||
end function
|
||||
```
|
||||
- Finally, it adds the caller file and line number to the args.
|
||||
- `LogError("Cannot complete operation:", error)` is replaced with `LogError(CALLER, "Cannot complete operation:", error)`
|
||||
- `CALLER` would be the full path to the source .bs file and line number, for easier debugging
|
||||
- In release mode, `CALLER` would be only the file name and line number, without the full path. This is so that dev directory does not get "leaked" in releases.
|
||||
|
||||
This is implemented to make it easy to identify where logs came from, and to generate log functions with the right number of parameters based on usage. This way we do not need all combination of functions (`LogError`, `LogWarn`, `LogInfo` and `LogDebug` multiplied by number of parameters, `LogError1`, `LogError2`, `LogError3`, and so on). Since brightscript does not support function templates or function overloading, it is either this method, or use optional parameters (but then we would have to check which parameter was passed, and which was is using the default value.) and end up with a log function with logs of if's else'es.
|
||||
|
||||
To understand more about what's being generated, download `playlet-lib.zip` from [releases](https://github.com/iBicha/playlet/releases), extract, and inspect the file `source/utils/Logging.brs`. You will see it contains log functions in the form `LogVerbX`, that are generated based on usage.
|
||||
|
||||
To give credit where credit is due, some of the ideas here (like adding the source location to the log) came from [roku-log](https://github.com/georgejecook/roku-log)
|
||||
Generated
+376
-635
File diff suppressed because it is too large.
Load diff
+19
-17
@@ -1,33 +1,35 @@
|
||||
{
|
||||
"name": "playlet",
|
||||
"version": "0.12.0",
|
||||
"version": "0.17.2",
|
||||
"description": "Unofficial Youtube client for Roku",
|
||||
"devDependencies": {
|
||||
"@rokucommunity/bslint": "^0.8.9",
|
||||
"@types/fs-extra": "^11.0.1",
|
||||
"@types/node": "^20.5.9",
|
||||
"@types/xml2js": "^0.4.12",
|
||||
"@rokucommunity/bslint": "^0.8.13",
|
||||
"@types/crypto-js": "^4.2.1",
|
||||
"@types/fs-extra": "^11.0.4",
|
||||
"@types/node": "^20.10.4",
|
||||
"@types/xml2js": "^0.4.14",
|
||||
"argparse": "^2.0.1",
|
||||
"brighterscript": "^0.65.5",
|
||||
"brighterscript-formatter": "^1.6.31",
|
||||
"brighterscript": "0.65.13",
|
||||
"brighterscript-formatter": "^1.6.36",
|
||||
"convert-svg-to-png": "^0.6.4",
|
||||
"cross-fetch": "^4.0.0",
|
||||
"crypto-js": "^4.2.0",
|
||||
"dotenv": "^16.3.1",
|
||||
"express": "^4.18.2",
|
||||
"fs-extra": "^11.1.1",
|
||||
"glob": "^10.3.4",
|
||||
"fs-extra": "^11.2.0",
|
||||
"glob": "^10.3.10",
|
||||
"imap": "^0.8.19",
|
||||
"ip": "^1.1.8",
|
||||
"json5": "^2.2.3",
|
||||
"roku-deploy": "^3.10.3",
|
||||
"roku-log-bsc-plugin": "^0.8.1",
|
||||
"rooibos-roku": "^5.7.0",
|
||||
"ropm": "^0.10.16",
|
||||
"mailparser": "^3.6.5",
|
||||
"roku-deploy": "^3.11.1",
|
||||
"rooibos-roku": "^5.8.0",
|
||||
"semver": "^7.5.4",
|
||||
"shelljs": "^0.8.5",
|
||||
"ts-node": "^10.9.1",
|
||||
"typescript": "^5.2.2",
|
||||
"ts-node": "^10.9.2",
|
||||
"typescript": "^5.3.3",
|
||||
"xml2js": "^0.6.2",
|
||||
"yaml": "^2.3.2"
|
||||
"yaml": "^2.3.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": "18"
|
||||
@@ -54,10 +56,10 @@
|
||||
"test:build:app": "cd playlet-app && npm run test:build",
|
||||
"test:lib": "cd playlet-lib && npm run test",
|
||||
"test:build:lib": "cd playlet-lib && npm run test:build",
|
||||
"generate-images": "node tools/generate-images.js",
|
||||
"version-sync": "node tools/version-sync.js",
|
||||
"manifest-git-hash": "node tools/update-manifest-git-hash.js",
|
||||
"sign-package": "node tools/sign-package.js",
|
||||
"sign-released-package": "node tools/sign-released-package.js",
|
||||
"screenshot": "node tools/screenshot.js",
|
||||
"profile-sync": "node tools/profile-sync.js",
|
||||
"generate-sponsorblock-config": "node tools/generate-sponsorblock-config.js",
|
||||
|
||||
Generated
+2
-19
@@ -1,29 +1,12 @@
|
||||
{
|
||||
"name": "playlet-app",
|
||||
"version": "0.12.0",
|
||||
"version": "0.17.2",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "playlet-app",
|
||||
"version": "0.12.0",
|
||||
"hasInstallScript": true,
|
||||
"dependencies": {
|
||||
"bslib": "npm:@rokucommunity/bslib@^0.1.1"
|
||||
}
|
||||
},
|
||||
"node_modules/bslib": {
|
||||
"name": "@rokucommunity/bslib",
|
||||
"version": "0.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@rokucommunity/bslib/-/bslib-0.1.1.tgz",
|
||||
"integrity": "sha512-2ox6EUL+UTtccTbD4dbVjZK3QHa0PHCqpoKMF8lZz9ayzzEP3iVPF8KZR6hOi6bxsIcbGXVjqmtCVkpC4P9SrA=="
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"bslib": {
|
||||
"version": "npm:@rokucommunity/bslib@0.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@rokucommunity/bslib/-/bslib-0.1.1.tgz",
|
||||
"integrity": "sha512-2ox6EUL+UTtccTbD4dbVjZK3QHa0PHCqpoKMF8lZz9ayzzEP3iVPF8KZR6hOi6bxsIcbGXVjqmtCVkpC4P9SrA=="
|
||||
"version": "0.17.2"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,7 @@
|
||||
{
|
||||
"name": "playlet-app",
|
||||
"version": "0.12.0",
|
||||
"version": "0.17.2",
|
||||
"description": "Unofficial Youtube client for Roku",
|
||||
"dependencies": {
|
||||
"bslib": "npm:@rokucommunity/bslib@^0.1.1"
|
||||
},
|
||||
"ropm": {
|
||||
"rootDir": "./src"
|
||||
},
|
||||
"scripts": {
|
||||
"prebuild": "rm -rf build/playlet-app",
|
||||
"prebuild:dev": "npm run prebuild",
|
||||
@@ -22,7 +16,6 @@
|
||||
"format:fix": "npm run format:base -- --write",
|
||||
"test": "npm run test:build && npm run test:run",
|
||||
"test:build": "bsc --project bsconfig.tests.json --create-package --sourceMap=true --debug --test-mode --lintConfig ../config/bslint.jsonc",
|
||||
"test:run": "node ../tools/run-test-app.js --package ../build/playlet-app-tests.zip",
|
||||
"postinstall": "npx ropm copy"
|
||||
"test:run": "node ../tools/run-test-app.js --package ../build/playlet-app-tests.zip"
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,17 @@
|
||||
import "LoadingMessages.bs"
|
||||
|
||||
function Init() as void
|
||||
m.top.backgroundColor = "0x242424FF"
|
||||
m.top.backgroundURI = ""
|
||||
|
||||
m.loadingIndicator = m.top.findNode("LoadingIndicator")
|
||||
m.loadingIndicator.visible = true
|
||||
m.global.addFields({
|
||||
loadingIndicator: m.loadingIndicator
|
||||
})
|
||||
|
||||
m.loadingIndicator.visible = true
|
||||
m.loadingIndicator.message = GetLoadingMessage()
|
||||
|
||||
m.playletLibUrls = GetPlayletLibUrls()
|
||||
m.playletLibUrlIndex = 0
|
||||
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<component name="BootstrapScene" extends="Scene">
|
||||
<interface>
|
||||
<field id="exitChannel" type="bool" alwaysNotify="true" />
|
||||
<field id="launchArgs" type="assocarray" />
|
||||
<field id="inputArgs" type="assocarray" alwaysNotify="true" />
|
||||
<field id="playletLibLoadedUrl" type="assocarray" />
|
||||
<field id="systemLogEvent" type="assocarray" alwaysNotify="true" />
|
||||
</interface>
|
||||
<script type="text/brightscript" uri="pkg:/source/Dialog.bs" />
|
||||
<script type="text/brightscript" uri="pkg:/source/Manifest.bs" />
|
||||
<script type="text/brightscript" uri="pkg:/source/Registry.bs" />
|
||||
<children>
|
||||
<Group id="MainSceneContainer"/>
|
||||
<Group id="MainSceneContainer" />
|
||||
<LoadingIndicator id="LoadingIndicator" />
|
||||
</children>
|
||||
</component>
|
||||
@@ -0,0 +1,29 @@
|
||||
function GetLoadingMessage() as string
|
||||
messages = GetLoadingMessagesFromCache()
|
||||
if messages = invalid or messages.count() = 0
|
||||
messages = [
|
||||
"Now loading Playlet...",
|
||||
"One moment please...",
|
||||
"Downloading the internet...",
|
||||
"Unclogging the tubes...",
|
||||
"Warming up the flux capacitor...",
|
||||
"Loading, ehm, stuff...",
|
||||
"Restoring quantum entanglement...",
|
||||
"Searching for kitten videos...",
|
||||
"One Mississippi... two Mississippi...",
|
||||
"Checking the TV's extended warranty...",
|
||||
"Deleting system32...",
|
||||
"Updating: 3 hours 32 minutes remaining...",
|
||||
]
|
||||
end if
|
||||
index = Rnd(messages.count()) - 1
|
||||
return messages[index]
|
||||
end function
|
||||
|
||||
function GetLoadingMessagesFromCache() as object
|
||||
messagesFile = ReadAsciiFile("cachefs:/loading_messages_v1.json")
|
||||
if messagesFile = invalid or messagesFile = ""
|
||||
return invalid
|
||||
end if
|
||||
return ParseJson(messagesFile)
|
||||
end function
|
||||
@@ -14,12 +14,10 @@ function PositionSpinner()
|
||||
centerx = (1280 - m.busyspinner.poster.width) / 2
|
||||
centery = (720 - m.busyspinner.poster.height) / 2
|
||||
m.busyspinner.translation = [centerx, centery]
|
||||
m.busyspinner.visible = true
|
||||
end if
|
||||
end function
|
||||
|
||||
function OnVisibleChange()
|
||||
m.busyspinner.visible = m.top.visible
|
||||
if m.busyspinner.visible
|
||||
m.busyspinner.control = "start"
|
||||
else
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<component name="LoadingIndicator" extends="Group">
|
||||
<interface>
|
||||
<field id="message" type="string" alias="messageLabel.text" />
|
||||
</interface>
|
||||
<children>
|
||||
<Rectangle
|
||||
width="1280"
|
||||
@@ -11,6 +12,16 @@
|
||||
id="busySpinner"
|
||||
inheritParentOpacity="false"
|
||||
spinInterval="1" />
|
||||
<Label
|
||||
id="messageLabel"
|
||||
inheritParentOpacity="false"
|
||||
width="1280"
|
||||
height="50"
|
||||
horizAlign="center"
|
||||
vertAlign="center"
|
||||
translation="[0,450]">
|
||||
<Font role="font" uri="font:SystemFontFile" size="28" />
|
||||
</Label>
|
||||
</Rectangle>
|
||||
</children>
|
||||
</component>
|
||||
@@ -0,0 +1,26 @@
|
||||
{
|
||||
inputHash: '0536f51fa72c2e4e368ea0e901aadfc1',
|
||||
outputs: [
|
||||
{
|
||||
outputFilePath: 'images/splash-screen_fhd.jpg',
|
||||
outputHash: 'b15f3a3f1ccc459cbca12cb828b78d16',
|
||||
width: 1920,
|
||||
height: 1080,
|
||||
background: '#242424',
|
||||
},
|
||||
{
|
||||
outputFilePath: 'images/splash-screen_hd.jpg',
|
||||
outputHash: '25e9c4220f8a42101d6333e548e33aa8',
|
||||
width: 1280,
|
||||
height: 720,
|
||||
background: '#242424',
|
||||
},
|
||||
{
|
||||
outputFilePath: 'images/splash-screen_sd.jpg',
|
||||
outputHash: 'c54a2f7fa65f443263806962450f2c04',
|
||||
width: 720,
|
||||
height: 480,
|
||||
background: '#242424',
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
inputHash: 'd61131ccc714d8df0b4514ca76883494',
|
||||
outputs: [],
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
{
|
||||
inputHash: '3452c6ea1c84f59aedf5530bf86a7a51',
|
||||
outputs: [
|
||||
{
|
||||
outputFilePath: 'images/channel-poster_fhd.png',
|
||||
outputHash: 'd644a0db84deed0bcc41a41d08a4ef75',
|
||||
width: 540,
|
||||
height: 405,
|
||||
background: '#FFFFFF',
|
||||
},
|
||||
{
|
||||
outputFilePath: 'images/channel-poster_hd.png',
|
||||
outputHash: 'd07a4ffaa021b55528bee91710f4e9d2',
|
||||
width: 290,
|
||||
height: 218,
|
||||
background: '#FFFFFF',
|
||||
},
|
||||
{
|
||||
outputFilePath: 'images/channel-poster_sd.png',
|
||||
outputHash: '66a311c639f89ff009e4624468282b2f',
|
||||
width: 246,
|
||||
height: 140,
|
||||
background: '#FFFFFF',
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -2,14 +2,14 @@ title=Playlet
|
||||
|
||||
# Do not update version manually, it is auto updated from package.json
|
||||
major_version=0
|
||||
minor_version=12
|
||||
build_version=00000
|
||||
minor_version=17
|
||||
build_version=00002
|
||||
|
||||
ui_resolutions=hd
|
||||
|
||||
## Channel Assets
|
||||
### Main Menu Icons / Channel Poster Artwork
|
||||
#### Image sizes are FHD: 540x405px | HD: 290x218px | SD: 214x144px
|
||||
#### Image sizes are FHD: 540x405px | HD: 290x218px | SD: 246x140px
|
||||
mm_icon_focus_fhd=pkg:/images/channel-poster_fhd.png
|
||||
mm_icon_focus_hd=pkg:/images/channel-poster_hd.png
|
||||
mm_icon_focus_sd=pkg:/images/channel-poster_sd.png
|
||||
@@ -29,7 +29,7 @@ supports_input_launch=1
|
||||
|
||||
playlet_lib_remote_url=https://github.com/iBicha/playlet/releases/latest/download/playlet-lib.zip
|
||||
playlet_lib_embedded_url=pkg:/lib/playlet-lib.zip
|
||||
playlet_lib_debug_url=http://DEBUG_HOST_IP_ADDRESS:8080/playlet-lib.zip
|
||||
playlet_lib_debug_url=http://DEBUG_HOST_IP_ADDRESS:8086/playlet-lib.zip
|
||||
|
||||
git_commit_sha=unknown
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
function ShowErrorDialog(message as object, bulletText as object, bottomMessage as object)
|
||||
' TODO:P2 a null check on StandardMessageDialog, only available on 10.0 and later
|
||||
dialog = CreateObject("roSGNode", "StandardMessageDialog")
|
||||
dialog.message = message
|
||||
dialog.bulletText = bulletText
|
||||
@@ -19,5 +20,7 @@ function OnButtonSelected()
|
||||
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
|
||||
@@ -1,5 +1,5 @@
|
||||
' Playlet (App to play videos from an Invidious server on Roku TVs)
|
||||
' Copyright (C) 2022 Brahim Hadriche
|
||||
' Copyright (C) 2023 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
|
||||
@@ -16,8 +16,8 @@
|
||||
|
||||
function Main(args as object) as void
|
||||
screen = CreateObject("roSGScreen")
|
||||
m.port = CreateObject("roMessagePort")
|
||||
screen.setMessagePort(m.port)
|
||||
port = CreateObject("roMessagePort")
|
||||
screen.setMessagePort(port)
|
||||
m.global = screen.getGlobalNode()
|
||||
|
||||
ClearPlayletLibUrlsIfNeeded(args)
|
||||
@@ -25,24 +25,33 @@ function Main(args as object) as void
|
||||
scene = screen.CreateScene("BootstrapScene")
|
||||
screen.show()
|
||||
|
||||
scene.ObserveField("exitChannel", m.port)
|
||||
scene.ObserveField("exitChannel", port)
|
||||
scene.launchArgs = args
|
||||
|
||||
' These vars are needed to pass certification.
|
||||
' The actual work is done in Playlet Lib
|
||||
' bs:disable-next-line LINT1005
|
||||
contentId = args.contentId
|
||||
' bs:disable-next-line LINT1005
|
||||
mediaType = args.mediaType
|
||||
|
||||
' Do not signal app launch complete here, we're doing it over at Playlet Lib
|
||||
' This is needed to pass cetification
|
||||
if false
|
||||
' These vars are needed to pass certification.
|
||||
' The actual work is done in Playlet Lib
|
||||
' bs:disable-next-line LINT1005
|
||||
contentId = args.contentId
|
||||
' bs:disable-next-line LINT1005
|
||||
mediaType = args.mediaType
|
||||
|
||||
' Do not signal app launch complete here, we're doing it over at Playlet Lib
|
||||
' This is needed to pass cetification
|
||||
scene.signalBeacon("AppLaunchComplete")
|
||||
end if
|
||||
|
||||
input = CreateObject("roInput")
|
||||
input.setMessagePort(m.port)
|
||||
input.setMessagePort(port)
|
||||
|
||||
' TODO:P1 follow up on bug where roSystemLog does not fire for a video player in ComponentLibrary
|
||||
' https://community.roku.com/t5/Roku-Developer-Program/BUG-roSystemLog-not-firing-with-ComponentLibrary/td-p/906075
|
||||
systemLog = CreateObject("roSystemLog")
|
||||
systemLog.SetMessagePort(port)
|
||||
systemLog.EnableType("http.connect")
|
||||
systemLog.EnableType("http.error")
|
||||
systemLog.EnableType("http.complete")
|
||||
systemLog.EnableType("bandwidth.minute")
|
||||
|
||||
#if DEBUG
|
||||
' The following comment is to enable the SceneGraph inspector
|
||||
@@ -54,9 +63,13 @@ function Main(args as object) as void
|
||||
#end if
|
||||
|
||||
while true
|
||||
msg = wait(0, m.port)
|
||||
msg = wait(0, port)
|
||||
msgType = type(msg)
|
||||
if msgType = "roSGScreenEvent"
|
||||
if msgType = "roSystemLogEvent"
|
||||
info = msg.GetInfo()
|
||||
info.DateTime = info.DateTime.ToISOString()
|
||||
scene.systemLogEvent = info
|
||||
else if msgType = "roSGScreenEvent"
|
||||
if msg.isScreenClosed()
|
||||
return
|
||||
end if
|
||||
@@ -72,10 +85,3 @@ function Main(args as object) as void
|
||||
end while
|
||||
|
||||
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
|
||||
@@ -20,3 +20,10 @@ function GetPlayletLibUrlsFromRegistry() as object
|
||||
urls = ParseJson(urlsJson)
|
||||
return urls
|
||||
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
|
||||
Generated
+2
-37
@@ -1,47 +1,12 @@
|
||||
{
|
||||
"name": "playlet-lib",
|
||||
"version": "0.12.0",
|
||||
"version": "0.17.2",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "playlet-lib",
|
||||
"version": "0.12.0",
|
||||
"hasInstallScript": true,
|
||||
"dependencies": {
|
||||
"bslib": "npm:@rokucommunity/bslib@^0.1.1",
|
||||
"log": "npm:roku-log@^0.9.3"
|
||||
}
|
||||
},
|
||||
"node_modules/bslib": {
|
||||
"name": "@rokucommunity/bslib",
|
||||
"version": "0.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@rokucommunity/bslib/-/bslib-0.1.1.tgz",
|
||||
"integrity": "sha512-2ox6EUL+UTtccTbD4dbVjZK3QHa0PHCqpoKMF8lZz9ayzzEP3iVPF8KZR6hOi6bxsIcbGXVjqmtCVkpC4P9SrA=="
|
||||
},
|
||||
"node_modules/log": {
|
||||
"name": "roku-log",
|
||||
"version": "0.9.3",
|
||||
"resolved": "https://registry.npmjs.org/roku-log/-/roku-log-0.9.3.tgz",
|
||||
"integrity": "sha512-YzvtSCdmZJeimyZZ/C5Y7tdw6vpNMrZV90pg8EPn3vLAtRjtxN3dOt73s48BVOx2W00M0BEGmeaECObS2RdIqg==",
|
||||
"dependencies": {
|
||||
"bslib": "npm:@rokucommunity/bslib@^0.1.1"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"bslib": {
|
||||
"version": "npm:@rokucommunity/bslib@0.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@rokucommunity/bslib/-/bslib-0.1.1.tgz",
|
||||
"integrity": "sha512-2ox6EUL+UTtccTbD4dbVjZK3QHa0PHCqpoKMF8lZz9ayzzEP3iVPF8KZR6hOi6bxsIcbGXVjqmtCVkpC4P9SrA=="
|
||||
},
|
||||
"log": {
|
||||
"version": "npm:roku-log@0.9.3",
|
||||
"resolved": "https://registry.npmjs.org/roku-log/-/roku-log-0.9.3.tgz",
|
||||
"integrity": "sha512-YzvtSCdmZJeimyZZ/C5Y7tdw6vpNMrZV90pg8EPn3vLAtRjtxN3dOt73s48BVOx2W00M0BEGmeaECObS2RdIqg==",
|
||||
"requires": {
|
||||
"bslib": "npm:@rokucommunity/bslib@^0.1.1"
|
||||
}
|
||||
"version": "0.17.2"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,7 @@
|
||||
{
|
||||
"name": "playlet-lib",
|
||||
"version": "0.12.0",
|
||||
"version": "0.17.2",
|
||||
"description": "Unofficial Youtube client for Roku",
|
||||
"dependencies": {
|
||||
"bslib": "npm:@rokucommunity/bslib@^0.1.1",
|
||||
"log": "npm:roku-log@^0.9.3"
|
||||
},
|
||||
"ropm": {
|
||||
"rootDir": "./src"
|
||||
},
|
||||
"scripts": {
|
||||
"prebuild": "rm -rf build/playlet-lib",
|
||||
"prebuild:dev": "npm run prebuild",
|
||||
@@ -25,7 +18,6 @@
|
||||
"format:fix": "npm run format:base -- --write",
|
||||
"test": "npm run test:build && npm run test:run",
|
||||
"test:build": "bsc --project bsconfig.tests.json --create-package --sourceMap=true --debug --test-mode --lintConfig ../config/bslint.jsonc",
|
||||
"test:run": "node ../tools/run-test-app.js --package ../build/playlet-lib-tests.zip",
|
||||
"postinstall": "npx ropm copy"
|
||||
"test:run": "node ../tools/run-test-app.js --package ../build/playlet-lib-tests.zip"
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,18 @@
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
import "pkg:/source/utils/StringUtils.bs"
|
||||
import "pkg:/source/utils/FocusManagement.bs"
|
||||
import "pkg:/components/Dialog/DialogUtils.bs"
|
||||
import "pkg:/source/roku_modules/log/LogMixin.brs"
|
||||
import "pkg:/components/Navigation/LongPress.bs"
|
||||
import "pkg:/components/PlayQueue/PlayQueueViewUtils.bs"
|
||||
import "pkg:/components/VideoPlayer/VideoUtils.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"
|
||||
|
||||
function Init()
|
||||
m.screens = {}
|
||||
end function
|
||||
|
||||
function OnNodeReady()
|
||||
m.log = new log.Logger("AppController")
|
||||
|
||||
InitializeLongPress(["options"])
|
||||
NodeSetFocus(m.top.root, true)
|
||||
end function
|
||||
|
||||
@@ -80,12 +81,50 @@ function GetRootScreen(screenName as string) as object
|
||||
end function
|
||||
|
||||
function onKeyEvent(key as string, press as boolean) as boolean
|
||||
if LongPressHandler(key, press)
|
||||
return true
|
||||
end if
|
||||
|
||||
if key = OPTIONS_LONG_PRESS_KEY and press
|
||||
LogInfo("Opening PlayQueueView")
|
||||
PlayQueueViewUtils.Open(m.top.playQueue, m.top)
|
||||
return true
|
||||
end if
|
||||
|
||||
if key = "options" and not press
|
||||
if VideoUtils.ToggleVideoPictureInPicture()
|
||||
return true
|
||||
end if
|
||||
end if
|
||||
|
||||
if not press
|
||||
return false
|
||||
end if
|
||||
if key = "options"
|
||||
VideoUtils.ToggleVideoPictureInPicture()
|
||||
else if key = "back"
|
||||
|
||||
if key = "play"
|
||||
if VideoUtils.TogglePause()
|
||||
return true
|
||||
end if
|
||||
end if
|
||||
|
||||
if key = "pause"
|
||||
if VideoUtils.PauseVideo()
|
||||
return true
|
||||
end if
|
||||
end if
|
||||
|
||||
if key = "playonly"
|
||||
if VideoUtils.ResumeVideo()
|
||||
return true
|
||||
end if
|
||||
end if
|
||||
|
||||
if key = "back"
|
||||
if VideoUtils.IsVideoPlayerOpen() and not VideoUtils.IsVideoPlayerFullScreen()
|
||||
if VideoUtils.ToggleVideoPictureInPicture()
|
||||
return true
|
||||
end if
|
||||
end if
|
||||
dialog = DialogUtils.ShowDialogButtons("Do you want to exit Playlet?", "Exit", ["Exit", "Cancel"])
|
||||
dialog.observeField("buttonSelected", FuncName(OnExitDialog), ["buttonSelected"])
|
||||
return true
|
||||
@@ -97,7 +136,7 @@ end function
|
||||
function OnExitDialog(event as object)
|
||||
buttonIndex = event.GetData()
|
||||
if buttonIndex = 0 ' Exit
|
||||
m.log.info("Exiting app")
|
||||
LogInfo("Exiting app")
|
||||
m.top.getScene().exitChannel = true
|
||||
end if
|
||||
end function
|
||||
@@ -1,9 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<component name="AppController" extends="Group" includes="AutoBind">
|
||||
<interface>
|
||||
<field id="root" type="node" />
|
||||
<field id="stack" type="node" />
|
||||
<field id="playQueue" type="node" />
|
||||
<function name="PushScreen" />
|
||||
<function name="PopScreen" />
|
||||
<function name="FocusTopScreen" />
|
||||
|
||||
@@ -1,4 +1,2 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<component name="AppRoot" extends="Group" includes="Focus">
|
||||
</component>
|
||||
@@ -1,7 +1,10 @@
|
||||
namespace ChannelUtils
|
||||
function Open(contentNode as object)
|
||||
function Open(contentNode as object, appController = invalid as object)
|
||||
channelView = CreateObject("roSGNode", "ChannelView")
|
||||
m.appController@.PushScreen(channelView)
|
||||
if appController = invalid
|
||||
appController = m.appController
|
||||
end if
|
||||
appController@.PushScreen(channelView)
|
||||
channelView@.BindNode(invalid)
|
||||
channelView.content = contentNode
|
||||
end function
|
||||
|
||||
@@ -1,21 +1,46 @@
|
||||
import "pkg:/source/roku_modules/log/LogMixin.brs"
|
||||
import "pkg:/components/Navigation/Navigation.bs"
|
||||
import "pkg:/source/asyncTask/asyncTask.bs"
|
||||
import "pkg:/source/utils/DisposableObserve.bs"
|
||||
import "pkg:/source/utils/FocusManagement.bs"
|
||||
import "pkg:/source/utils/Types.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.log = new log.Logger("ChannelView")
|
||||
m.container = m.top.findNode("container")
|
||||
m.scrollAnimation = m.top.findNode("scrollAnimation")
|
||||
m.containerTranslation = m.scrollAnimation.findNode("containerTranslation")
|
||||
m.bannerTranslation = m.scrollAnimation.findNode("bannerTranslation")
|
||||
|
||||
m.banner = m.top.findNode("banner")
|
||||
m.thumbnail = m.top.findNode("thumbnail")
|
||||
m.authorLabel = m.top.findNode("authorLabel")
|
||||
m.subscribeButton = m.top.findNode("subscribeButton")
|
||||
m.rowList = m.top.FindNode("rowList")
|
||||
m.rowList.focusable = true
|
||||
m.rowList.screen = m.top
|
||||
|
||||
m.banner.ObserveField("loadStatus", FuncName(OnBannerLoadStatus))
|
||||
DisposableObserveFieldScoped(m.banner, "loadStatus", FuncName(OnBannerLoadStatus))
|
||||
m.author = ""
|
||||
m.authorId = ""
|
||||
|
||||
InitializeTabs()
|
||||
end function
|
||||
|
||||
function OnNodeready()
|
||||
m.rowList@.BindNode(invalid)
|
||||
|
||||
SetNavigation(m.rowList, "up", m.subscribeButton)
|
||||
SetNavigation(m.subscribeButton, "down", m.rowList)
|
||||
|
||||
m.subscribeButton.text = "Subscribe"
|
||||
DisposableObserveFieldScoped(m.subscribeButton, "buttonSelected", FuncName(OnSubscribeButtonSelected))
|
||||
|
||||
SetSubscribeButtonVisibility()
|
||||
DisposableObserveFieldScoped(m.invidious, "authToken", FuncName(SetSubscribeButtonVisibility))
|
||||
OnSubscriptionChanged()
|
||||
DisposableObserveFieldScoped(m.invidious, "subscriptions", FuncName(OnSubscriptionChanged))
|
||||
end function
|
||||
|
||||
function OnFocusChange() as void
|
||||
@@ -29,12 +54,12 @@ end function
|
||||
function OnContentSet() as void
|
||||
content = m.top.content
|
||||
if content = invalid
|
||||
m.top.authorId = ""
|
||||
return
|
||||
end if
|
||||
|
||||
' NOTE: "_author" not "author". See PlaylistContentNode.xml for explanation.
|
||||
m.authorLabel.text = content._author
|
||||
' TODO:P1 handle case where there's no banner - a big portion of the screen is blank
|
||||
m.banner.uri = content.banner
|
||||
if StringUtils.IsNullOrEmpty(content.thumbnail)
|
||||
m.thumbnail.uri = ""
|
||||
@@ -45,12 +70,39 @@ function OnContentSet() as void
|
||||
end if
|
||||
end if
|
||||
|
||||
m.rowList.content = content
|
||||
|
||||
content@.LoadChannel(m.invidious)
|
||||
|
||||
authorId = ValidString(content.authorId)
|
||||
author = ValidString(content._author)
|
||||
m.top.authorId = authorId
|
||||
|
||||
if (authorId <> m.authorId or author <> m.author) and IsArray(content.tabs)
|
||||
m.authorId = authorId
|
||||
m.author = author
|
||||
m.rowList.feeds = CreateChannelFeeds(m.authorId, author, content.tabs)
|
||||
end if
|
||||
end function
|
||||
|
||||
function CreateChannelFeeds(authorId as string, author as string, tabs as object) as object
|
||||
if authorId = ""
|
||||
return invalid
|
||||
end if
|
||||
|
||||
feeds = []
|
||||
for i = 0 to tabs.count() - 1
|
||||
tabName = tabs[i]
|
||||
if m.tabs.DoesExist(tabName)
|
||||
feeds.Push(m.tabs[tabName](authorId, author))
|
||||
end if
|
||||
end for
|
||||
return feeds
|
||||
end function
|
||||
|
||||
function OnkeyEvent(key as string, press as boolean) as boolean
|
||||
if NavigationKeyHandler(key, press).handled
|
||||
return true
|
||||
end if
|
||||
|
||||
if press = false
|
||||
return false
|
||||
end if
|
||||
@@ -64,6 +116,29 @@ end function
|
||||
|
||||
function Close()
|
||||
m.appController@.PopScreen(invalid)
|
||||
m.top.dispose = true
|
||||
end function
|
||||
|
||||
function OnDispose()
|
||||
m.rowList.dispose = true
|
||||
DisposeObservers()
|
||||
if m.subscribeTask <> invalid
|
||||
m.subscribeTask.cancel = true
|
||||
m.subscribeTask = invalid
|
||||
end if
|
||||
end function
|
||||
|
||||
function OnSubscribeButtonSelected()
|
||||
if m.subscribeTask <> invalid
|
||||
m.subscribeTask.cancel = true
|
||||
end if
|
||||
|
||||
isSubbed = IsSubscribed()
|
||||
m.subscribeTask = StartAsyncTask(SubscribeTask, {
|
||||
invidious: m.invidious,
|
||||
ucid: m.authorId,
|
||||
subscribe: not isSubbed
|
||||
})
|
||||
end function
|
||||
|
||||
function OnBannerLoadStatus() as void
|
||||
@@ -72,6 +147,111 @@ function OnBannerLoadStatus() as void
|
||||
return
|
||||
end if
|
||||
|
||||
aspect = m.banner.bitmapWidth / m.banner.bitmapHeight
|
||||
m.banner.height = m.banner.width / aspect
|
||||
bannerAspect = m.banner.bitmapWidth / m.banner.bitmapHeight
|
||||
bannerHeight = m.banner.width / bannerAspect
|
||||
m.banner.height = bannerHeight
|
||||
m.banner.translation = [0, -bannerHeight]
|
||||
m.banner.visible = true
|
||||
|
||||
startPos = [0, -bannerHeight]
|
||||
endPos = [0, 0]
|
||||
midPos = [0, (startPos[1] + endPos[1]) / 2]
|
||||
|
||||
m.bannerTranslation.keyValue = [startPos, midPos, endPos]
|
||||
|
||||
startPos = [0, 0]
|
||||
endPos = [0, bannerHeight - m.thumbnail.height * 0.4]
|
||||
midPos = [0, (startPos[1] + endPos[1]) / 2]
|
||||
|
||||
m.containerTranslation.keyValue = [startPos, midPos, endPos]
|
||||
|
||||
m.scrollAnimation.control = "start"
|
||||
end function
|
||||
|
||||
function InitializeTabs()
|
||||
m.tabs = {
|
||||
videos: function(authorId as string, author as string) as object
|
||||
return CreateChannelFeed("Latest videos", "channel_videos", authorId, author)
|
||||
end function,
|
||||
shorts: function(authorId as string, author as string) as object
|
||||
return CreateChannelFeed("Shorts", "channel_shorts", authorId, author)
|
||||
end function,
|
||||
streams: function(authorId as string, author as string) as object
|
||||
return CreateChannelFeed("Live", "channel_streams", authorId, author)
|
||||
end function,
|
||||
podcasts: function(authorId as string, author as string) as object
|
||||
return CreateChannelFeed("Podcasts", "channel_podcasts", authorId, author)
|
||||
end function,
|
||||
playlists: function(authorId as string, author as string) as object
|
||||
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
|
||||
|
||||
function CreateChannelFeed(title as string, endpoint as string, ucid as string, author as string) as object
|
||||
return {
|
||||
title: title,
|
||||
feedSources: [{
|
||||
"id": `inv_${endpoint}_${ucid}`,
|
||||
"title": `${author} - ${title}`,
|
||||
"apiType": "Invidious",
|
||||
"endpoint": endpoint,
|
||||
"pathParams": {
|
||||
"ucid": ucid
|
||||
}
|
||||
}]
|
||||
}
|
||||
end function
|
||||
|
||||
function GetContextMenuOptionsForItem(video as object) as object
|
||||
if StringUtils.IsNullOrEmpty(m.top.authorId)
|
||||
return []
|
||||
end if
|
||||
return m.bookmarks@.GetMenuForChannel(m.top.content)
|
||||
end function
|
||||
|
||||
function IsLoggedIn() as boolean
|
||||
return m.invidious.authToken <> invalid
|
||||
end function
|
||||
|
||||
function IsSubscribed() as boolean
|
||||
authorId = m.top.authorId
|
||||
if StringUtils.IsNullOrEmpty(authorId)
|
||||
return false
|
||||
end if
|
||||
|
||||
subscriptions = m.invidious.subscriptions
|
||||
if subscriptions = invalid
|
||||
return false
|
||||
end if
|
||||
if not subscriptions.DoesExist(authorId)
|
||||
return false
|
||||
end if
|
||||
return subscriptions[authorId]
|
||||
end function
|
||||
|
||||
function OnAuthorIdChange()
|
||||
SetSubscribeButtonVisibility()
|
||||
OnSubscriptionChanged()
|
||||
end function
|
||||
|
||||
function SetSubscribeButtonVisibility()
|
||||
isLogged = IsLoggedIn()
|
||||
m.subscribeButton.visible = isLogged and not StringUtils.IsNullOrEmpty(m.top.authorId)
|
||||
m.subscribeButton.focusable = m.subscribeButton.visible
|
||||
if not m.subscribeButton.visible and m.subscribeButton.hasFocus()
|
||||
NodeSetFocus(m.rowList, true)
|
||||
end if
|
||||
end function
|
||||
|
||||
function OnSubscriptionChanged()
|
||||
isSubbed = IsSubscribed()
|
||||
if isSubbed
|
||||
m.subscribeButton.text = "Unsubscribe"
|
||||
else
|
||||
m.subscribeButton.text = "Subscribe"
|
||||
end if
|
||||
end function
|
||||
@@ -1,8 +1,10 @@
|
||||
<component name="ChannelView" extends="Group" includes="AutoBind,Focus">
|
||||
<component name="ChannelView" extends="Group" includes="AutoBind,Focus,ContextMenuProvider,Disposable">
|
||||
<interface>
|
||||
<field id="content" type="node" onChange="OnContentSet" />
|
||||
<field id="authorId" type="string" onChange="OnAuthorIdChange" />
|
||||
<field id="appController" type="node" bind="/AppController" />
|
||||
<field id="invidious" type="node" bind="/Invidious" />
|
||||
<field id="bookmarks" type="node" bind="/Bookmarks" />
|
||||
</interface>
|
||||
<children>
|
||||
<Rectangle
|
||||
@@ -13,42 +15,68 @@
|
||||
|
||||
<Poster
|
||||
id="banner"
|
||||
translation="[0,0]"
|
||||
width="1280" />
|
||||
width="1280"
|
||||
visible="false" />
|
||||
|
||||
<Poster
|
||||
translation="[115,180]"
|
||||
width="104"
|
||||
height="104"
|
||||
uri="pkg:/images/circle-mask-500.png">
|
||||
<Group id="container">
|
||||
<Poster
|
||||
translation="[115,20]"
|
||||
width="104"
|
||||
height="104"
|
||||
uri="pkg:/images/circle-mask-500.png">
|
||||
|
||||
<CirclePoster
|
||||
id="thumbnail"
|
||||
width="100"
|
||||
height="100"
|
||||
translation="[2,2]" />
|
||||
</Poster>
|
||||
<CirclePoster
|
||||
id="thumbnail"
|
||||
width="100"
|
||||
height="100"
|
||||
translation="[2,2]"
|
||||
failedBitmapUri="pkg:/images/thumbnail-missing.jpg" />
|
||||
|
||||
<Label
|
||||
id="authorLabel"
|
||||
translation="[228,226]"
|
||||
font="font:MediumBoldSystemFont" />
|
||||
<Label
|
||||
id="authorLabel"
|
||||
translation="[115,40]"
|
||||
font="font:MediumBoldSystemFont" />
|
||||
</Poster>
|
||||
|
||||
<VideoRowList
|
||||
itemComponentName="RowCell"
|
||||
id="rowList"
|
||||
focusable="false"
|
||||
translation="[0,320]"
|
||||
numRows="1"
|
||||
rowitemSize="[[350,196]]"
|
||||
rowItemSpacing="[[25,0]]"
|
||||
itemSize="[1280,326]"
|
||||
itemSpacing="[0,65]"
|
||||
rowLabelOffset="[[115,20]]"
|
||||
focusXOffset="[115]"
|
||||
showRowLabel="[true]"
|
||||
rowFocusAnimationStyle="floatingfocus"
|
||||
variableWidthItems="true"
|
||||
focusBitmapUri="pkg:/images/focus_grid.9.png" />
|
||||
<Button
|
||||
id="subscribeButton"
|
||||
iconUri=""
|
||||
focusedIconUri=""
|
||||
showFocusFootprint="true"
|
||||
minWidth="200"
|
||||
translation="[930,64]" />
|
||||
|
||||
<VideoRowList
|
||||
itemComponentName="RowCell"
|
||||
id="rowList"
|
||||
focusable="false"
|
||||
translation="[0,160]"
|
||||
numRows="2"
|
||||
rowitemSize="[[350,196]]"
|
||||
rowItemSpacing="[[25,0]]"
|
||||
itemSize="[1280,326]"
|
||||
itemSpacing="[0,65]"
|
||||
rowLabelOffset="[[115,20]]"
|
||||
focusXOffset="[115]"
|
||||
showRowLabel="[true]"
|
||||
rowFocusAnimationStyle="floatingfocus"
|
||||
variableWidthItems="true"
|
||||
focusBitmapUri="pkg:/images/focus_grid.9.png" />
|
||||
|
||||
<Animation
|
||||
id="scrollAnimation"
|
||||
delay="0.3"
|
||||
duration="0.6">
|
||||
<Vector2DFieldInterpolator
|
||||
id="bannerTranslation"
|
||||
key="[ 0.0, 0.5, 1.0 ]"
|
||||
fieldToInterp="banner.translation" />
|
||||
<Vector2DFieldInterpolator
|
||||
id="containerTranslation"
|
||||
key="[ 0.0, 0.5, 1.0 ]"
|
||||
fieldToInterp="container.translation" />
|
||||
</Animation>
|
||||
|
||||
</Group>
|
||||
</children>
|
||||
</component>
|
||||
@@ -0,0 +1,35 @@
|
||||
import "pkg:/components/Services/Invidious/InvidiousService.bs"
|
||||
|
||||
@asynctask
|
||||
function SubscribeTask(input as object) as object
|
||||
invidiousNode = input.invidious
|
||||
ucid = input.ucid
|
||||
subscribe = input.subscribe
|
||||
|
||||
if m.top.cancel
|
||||
return invalid
|
||||
end if
|
||||
|
||||
service = new Invidious.InvidiousService(invidiousNode)
|
||||
|
||||
if subscribe
|
||||
response = service.Subscribe(ucid)
|
||||
else
|
||||
response = service.Unsubscribe(ucid)
|
||||
end if
|
||||
|
||||
if not response.IsSuccess()
|
||||
error = response.ErrorMessage()
|
||||
LogError("Failed to subscribe/unsubscribe to channel:", error)
|
||||
return {
|
||||
success: false,
|
||||
error: error
|
||||
}
|
||||
end if
|
||||
|
||||
invidiousNode.refreshSubscribtions = true
|
||||
|
||||
return {
|
||||
success: true
|
||||
}
|
||||
end function
|
||||
@@ -4,21 +4,30 @@ function Init()
|
||||
end function
|
||||
|
||||
function UpdateMaskSize()
|
||||
width = m.top.poster.width
|
||||
height = m.top.poster.height
|
||||
width = m.top.width
|
||||
height = m.top.height
|
||||
|
||||
maskSize = [width * GetScaleFactor(), height * GetScaleFactor()]
|
||||
m.top.maskGroup.maskSize = maskSize
|
||||
m.top.maskSize = [width * GetUIScaleFactor(), height * GetUIScaleFactor()]
|
||||
end function
|
||||
|
||||
' MaskGroup component do not scale with with UI resolution
|
||||
function GetScaleFactor() as float
|
||||
if m.scaleFactor <> invalid
|
||||
return m.scaleFactor
|
||||
function GetUIScaleFactor() as float
|
||||
if m.uiScaleFactor <> invalid
|
||||
return m.uiScaleFactor
|
||||
end if
|
||||
|
||||
if m.global.uiScaleFactor <> invalid
|
||||
return m.global.uiScaleFactor
|
||||
end if
|
||||
|
||||
deviceInfo = CreateObject("roDeviceInfo")
|
||||
uiResolutionWidth = deviceInfo.GetUIResolution().width
|
||||
' divide by 1280 because we have ui_resolutions=hd in manifest
|
||||
m.scaleFactor = uiResolutionWidth / 1280
|
||||
return m.scaleFactor
|
||||
m.uiScaleFactor = uiResolutionWidth / 1280
|
||||
|
||||
if not m.global.hasField("uiScaleFactor")
|
||||
m.global.addField("uiScaleFactor", "float", false)
|
||||
end if
|
||||
m.global.uiScaleFactor = m.uiScaleFactor
|
||||
return m.uiScaleFactor
|
||||
end function
|
||||
@@ -11,6 +11,7 @@
|
||||
<field id="loadStatus" type="string" alias="Poster.loadStatus" />
|
||||
|
||||
<field id="maskUri" type="uri" value="pkg:/images/circle-mask-500.png" alias="MaskGroup.maskuri" />
|
||||
<field id="maskSize" type="vector2d" alias="MaskGroup.maskSize" />
|
||||
</interface>
|
||||
<children>
|
||||
<MaskGroup
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
<component name="BookmarkContentNode" extends="ContentNode">
|
||||
<interface>
|
||||
<field id="feedSource" type="assocarray" />
|
||||
</interface>
|
||||
</component>
|
||||
@@ -1,10 +1,9 @@
|
||||
import "pkg:/source/asyncTask/asyncTask.bs"
|
||||
import "pkg:/components/ContentNode/ChannelContentTask.bs"
|
||||
import "pkg:/source/utils/ErrorUtils.bs"
|
||||
import "pkg:/components/Dialog/DialogUtils.bs"
|
||||
import "pkg:/source/asyncTask/asyncTask.bs"
|
||||
import "pkg:/source/utils/ErrorUtils.bs"
|
||||
|
||||
function Init()
|
||||
m.top.latestVideos = m.top.findNode("latestVideos")
|
||||
end function
|
||||
|
||||
function LoadChannel(invidiousNode as object) as void
|
||||
@@ -39,10 +38,10 @@ function OnChannelContentTaskResult(output as object) as void
|
||||
error = output.result.error
|
||||
end if
|
||||
error = ErrorUtils.Format(error)
|
||||
m.log.error(error)
|
||||
playlistId = output.task.input.content.playlistId
|
||||
message = `Failed to load playlist ${playlistId}\n${error}`
|
||||
DialogUtils.ShowDialog(message, "Playlist load fail", true)
|
||||
LogError(error)
|
||||
authorId = output.task.input.content.authorId
|
||||
message = `Failed to load channel ${authorId}\n${error}`
|
||||
DialogUtils.ShowDialog(message, "Channel load fail", true)
|
||||
return
|
||||
end if
|
||||
end function
|
||||
@@ -1,28 +1,23 @@
|
||||
<component name="ChannelContentNode" extends="ContentNode">
|
||||
<interface>
|
||||
<field id="type" type="string" value="channel" />
|
||||
<field id="loadState" type="string" />
|
||||
<function name="LoadChannel" />
|
||||
|
||||
<field id="type" type="string" value="channel" />
|
||||
<field id="loadState" type="string" />
|
||||
<!-- index in a feed -->
|
||||
<field id="feedSourcesIndex" type="integer" value="-1" />
|
||||
<field id="HDItemWidth" type="float" value="196" />
|
||||
<!-- NOTE: "_author" not "author". See PlaylistContentNode.xml for explanation -->
|
||||
<field id="_author" type="string" />
|
||||
<field id="authorId" type="string" />
|
||||
<field id="banner" type="string" />
|
||||
<field id="channelHandle" type="string" />
|
||||
<field id="description" type="string" />
|
||||
<field id="subCount" type="integer" />
|
||||
<field id="subCountText" type="string" />
|
||||
<field id="tabs" type="array" />
|
||||
<field id="thumbnail" type="string" />
|
||||
<field id="videoCount" type="integer" />
|
||||
<field id="videoCountText" type="string" />
|
||||
<field id="thumbnail" type="string" />
|
||||
<field id="banner" type="string" />
|
||||
|
||||
<field id="latestVideos" type="node" />
|
||||
|
||||
<field id="HDItemWidth" type="float" value="196" />
|
||||
</interface>
|
||||
|
||||
<children>
|
||||
<ContentNode id="latestVideos" title="Latest Videos">
|
||||
|
||||
</ContentNode>
|
||||
</children>
|
||||
</component>
|
||||
@@ -0,0 +1,7 @@
|
||||
<component name="ContextMenuItemContentNode" extends="ContentNode">
|
||||
<interface>
|
||||
<field id="node" type="node" />
|
||||
<field id="func" type="string" />
|
||||
<field id="args" type="array" />
|
||||
</interface>
|
||||
</component>
|
||||
@@ -1,8 +1,7 @@
|
||||
<component name="FeedContentNode" extends="ContentNode">
|
||||
<interface>
|
||||
<field id="feed" type="assocarray" />
|
||||
<field id="feedSources" type="array" />
|
||||
<field id="feedSourcesIndex" type="integer" />
|
||||
<field id="loadState" type="string" />
|
||||
<field id="pagination" type="boolean" />
|
||||
<field id="page" type="integer" value="0" />
|
||||
</interface>
|
||||
</component>
|
||||
@@ -2,7 +2,9 @@
|
||||
<interface>
|
||||
<field id="type" type="string" value="playlist" />
|
||||
<field id="loadState" type="string" />
|
||||
<!--
|
||||
<!-- index in a feed -->
|
||||
<field id="feedSourcesIndex" type="integer" value="-1" />
|
||||
<!--
|
||||
For some strange reason, the "author" field can only be set once.
|
||||
If you try to set it again, it will not be updated, with type mismatch warning:
|
||||
|
||||
@@ -20,16 +22,19 @@
|
||||
Although we use the field "author" in other components, this is the only place where we modify it after
|
||||
we set it for the first time (because a saved Playlist belongs to the Invidious user at first, but then
|
||||
we can query it's original owner)
|
||||
|
||||
The issue happens on PlaylistContentNode and ChannelContentNode, but not VideoContentNode.
|
||||
-->
|
||||
<field id="_author" type="string" />
|
||||
<field id="authorId" type="string" />
|
||||
<field id="playlistId" type="string" />
|
||||
<field id="thumbnail" type="uri" />
|
||||
<field id="thumbnailBackground" type="uri" />
|
||||
<field id="updated" type="integer" />
|
||||
<field id="updatedText" type="string" />
|
||||
<field id="videoCount" type="integer" value="-1" />
|
||||
<field id="videoCountText" type="string" />
|
||||
<field id="viewCount" type="integer" />
|
||||
<field id="viewCountText" type="string" />
|
||||
<field id="updated" type="integer" />
|
||||
<field id="updatedText" type="string" />
|
||||
</interface>
|
||||
</component>
|
||||
@@ -1,11 +1,13 @@
|
||||
<component name="VideoContentNode" extends="ContentNode">
|
||||
<interface>
|
||||
<field id="type" type="string" value="video" />
|
||||
|
||||
<field id="author" type="string" />
|
||||
<field id="hlsUrl" type="uri" />
|
||||
<!-- index in a playlist -->
|
||||
<field id="index" type="integer" value="-1" />
|
||||
<!-- index in a feed -->
|
||||
<field id="feedSourcesIndex" type="integer" value="-1" />
|
||||
|
||||
<field id="author" type="string" />
|
||||
<field id="authorId" type="string" />
|
||||
<field id="isUpcoming" type="boolean" />
|
||||
<field id="lengthSeconds" type="integer" />
|
||||
<field id="lengthText" type="string" />
|
||||
|
||||
@@ -0,0 +1,171 @@
|
||||
import "pkg:/source/utils/FocusManagement.bs"
|
||||
import "pkg:/source/utils/Logging.bs"
|
||||
import "pkg:/source/utils/StringUtils.bs"
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
|
||||
' TODO:P0 Web app support
|
||||
' TODO:P0 Web apis and open api spec updates
|
||||
'
|
||||
' From the main screen:
|
||||
' When a video is selected:
|
||||
' - "Play" - DONE
|
||||
' - "Queue" - DONE
|
||||
' - "Open Channel" - DONE
|
||||
' - "Add to "Videos" bookmark" - DONE
|
||||
' - If video is already in a bookmark, "Remove from Bookmarks" - DONE
|
||||
'
|
||||
' When a channel is selected:
|
||||
' - "Open" - DONE
|
||||
' - "Add to "Channels" bookmark" - DONE
|
||||
' - "Add to <ChannelName> bookmark" - DONE
|
||||
' - If channel is already in a bookmark, "Remove from Bookmarks" - DONE
|
||||
' - PlaylistId starting with "IV" cannot be added to a bookmark - DONE
|
||||
'
|
||||
' When a playlist is selected:
|
||||
' - "Play" - DONE
|
||||
' - "Queue" - DONE
|
||||
' - "Open" - DONE
|
||||
' - "Add to "Playlists" bookmark" - DONE
|
||||
' - "Add to <PlaylistName> bookmark" - DONE
|
||||
' - If playlist is already in a bookmark, "Remove from Bookmarks" - DONE
|
||||
' When any:
|
||||
' - "Reload feed" - DONE
|
||||
'
|
||||
' From Playlist view:
|
||||
' When a video is selected:
|
||||
' - "Play" - DONE
|
||||
' - "Queue" - DONE
|
||||
' - "Play video" - DONE
|
||||
' - "Queue video" - DONE
|
||||
' - "Open Channel" - DONE
|
||||
' - "Add to "Playlists" bookmark" - DONE
|
||||
' - "Add to <PlaylistName> bookmark" - DONE
|
||||
' - "Add to "Videos" bookmark" - DONE
|
||||
'
|
||||
' From Channel view:
|
||||
' When a video is selected:
|
||||
' - "Play" - DONE
|
||||
' - "Queue" - DONE
|
||||
' - "Add to "Channels" bookmark" - DONE
|
||||
' - "Add to <ChannelName> - <feed> bookmark" feed being latest videos, live, shorts, etc - DONE
|
||||
' - "Add to "Videos" bookmark" - DONE
|
||||
'
|
||||
' When a playlist is selected:
|
||||
' - "Play" - DONE
|
||||
' - "Queue" - DONE
|
||||
' - "Open" - DONE
|
||||
' - "Add to "Channels" bookmark" - DONE
|
||||
' - "Add to <ChannelName> - <feed> bookmark" feed being latest videos, live, shorts, etc - DONE
|
||||
' - "Add to "Playlists" bookmark" - DONE
|
||||
' - "Add to <PlaylistName> bookmark" - DONE
|
||||
'
|
||||
' From search view:
|
||||
' When a video/channel/playlist is selected:
|
||||
' - Inherit options - DONE
|
||||
' - "Add to "Search - ${q}" bookmark" - this includes the search filters used - DONE
|
||||
'
|
||||
' From bookmarks view:
|
||||
' When a video/channel/playlist is selected:
|
||||
' - Inherit options
|
||||
' - "Remove item from Bookmarks"
|
||||
' - "Remove group from Bookmarks"
|
||||
' - "Reload bookmarks" - DONE
|
||||
'
|
||||
' TODO:P1 Playlist item seletected from the bookmarks need to play as a playlist, not as a single video
|
||||
' TODO:P1 Context menu might need to be scrollable (both horizontally and vertically)
|
||||
' TODO:P1 Context menu might need sections. Example:
|
||||
' In a Channel view, while selecting a playlist:
|
||||
' - Channel
|
||||
' - Add to "Channels" bookmark
|
||||
' - Other "Channels" related context menu items
|
||||
' - Playlist
|
||||
' - Add to "Playlists" bookmark
|
||||
' - "Play/Queue"
|
||||
' - Other "Playlists" related context menu items
|
||||
|
||||
function Init()
|
||||
m.optionsList = m.top.findNode("optionsList")
|
||||
m.showAnimation = m.top.findNode("showAnimation")
|
||||
end function
|
||||
|
||||
function Show(unsued as dynamic)
|
||||
m.optionsList.ObserveField("itemSelected", FuncName(OnItemSelected))
|
||||
m.showAnimation.control = "start"
|
||||
end function
|
||||
|
||||
function OnFocusChange() as void
|
||||
if not m.top.focus
|
||||
return
|
||||
end if
|
||||
NodeSetFocus(m.optionsList, true)
|
||||
end function
|
||||
|
||||
function OnOptionsSet() as void
|
||||
options = m.top.options
|
||||
if options = invalid
|
||||
return
|
||||
end if
|
||||
|
||||
content = CreateObject("roSGNode", "ContentNode")
|
||||
for each option in options
|
||||
optionNode = CreateObject("roSGNode", "ContentNode")
|
||||
optionNode.title = option.title
|
||||
content.appendChild(optionNode)
|
||||
end for
|
||||
|
||||
m.optionsList.content = content
|
||||
end function
|
||||
|
||||
function OnItemSelected(event as object) as void
|
||||
index = event.getData()
|
||||
button = m.optionsList.content.getChild(index)
|
||||
Close()
|
||||
LogInfo("Menu button selected:", button.title)
|
||||
|
||||
options = m.top.options
|
||||
if index >= options.count()
|
||||
LogError("Menu button index out of range:", index)
|
||||
return
|
||||
end if
|
||||
|
||||
option = options[index]
|
||||
|
||||
node = option.node
|
||||
func = option.func
|
||||
args = option.args
|
||||
|
||||
if node = invalid or StringUtils.IsNullOrEmpty(func) or args = invalid
|
||||
LogError("Menu button action is invalid")
|
||||
return
|
||||
end if
|
||||
|
||||
if args.count() = 1
|
||||
node.callFunc(func, args[0])
|
||||
else if args.count() = 2
|
||||
node.callFunc(func, args[0], args[1])
|
||||
else if args.count() = 3
|
||||
node.callFunc(func, args[0], args[1], args[2])
|
||||
else if args.count() = 4
|
||||
node.callFunc(func, args[0], args[1], args[2], args[3])
|
||||
else if args.count() = 5
|
||||
node.callFunc(func, args[0], args[1], args[2], args[3], args[4])
|
||||
else
|
||||
LogError("Menu button action has too many arguments")
|
||||
end if
|
||||
end function
|
||||
|
||||
function OnkeyEvent(key as string, press as boolean) as boolean
|
||||
if press = false
|
||||
return false
|
||||
end if
|
||||
|
||||
if key = "back"
|
||||
Close()
|
||||
return true
|
||||
end if
|
||||
return false
|
||||
end function
|
||||
|
||||
function Close()
|
||||
m.top.appController@.PopScreen(invalid)
|
||||
end function
|
||||
@@ -0,0 +1,70 @@
|
||||
<component name="ContextMenu" extends="Group" includes="Focus">
|
||||
<interface>
|
||||
<field id="thumbnail" type="uri" alias="thumbnail.uri" />
|
||||
<field id="title" type="string" alias="titleLabel.text" />
|
||||
<field id="subtitle" type="string" alias="subtitleLabel.text" />
|
||||
<field id="options" type="nodearray" onChange="OnOptionsSet" />
|
||||
<field id="appController" type="node" />
|
||||
<function name="Show" />
|
||||
</interface>
|
||||
<children>
|
||||
<Rectangle
|
||||
id="background"
|
||||
width="1280"
|
||||
height="720"
|
||||
color="#000000"
|
||||
opacity="0" />
|
||||
<Rectangle
|
||||
id="container"
|
||||
width="470"
|
||||
height="720"
|
||||
translation="[-470,0]"
|
||||
color="0x242424">
|
||||
<Poster
|
||||
id="thumbnail"
|
||||
width="190"
|
||||
height="110"
|
||||
loadDisplayMode="scaleToFit"
|
||||
translation="[40,50]" />
|
||||
|
||||
<LayoutGroup
|
||||
translation="[40,180]"
|
||||
itemSpacings="[10]">
|
||||
<Label
|
||||
id="titleLabel"
|
||||
width="390"
|
||||
maxLines="2"
|
||||
font="font:MediumBoldSystemFont"
|
||||
wrap="true" />
|
||||
<Label
|
||||
id="subtitleLabel"
|
||||
width="390"
|
||||
font="font:SmallestBoldSystemFont"
|
||||
wrap="true" />
|
||||
</LayoutGroup>
|
||||
|
||||
<MarkupList
|
||||
id="optionsList"
|
||||
itemSize="[420,50]"
|
||||
translation="[25,310]"
|
||||
itemComponentName="ContextMenuRow"
|
||||
vertFocusAnimationStyle="floatingFocus"
|
||||
numRows="8" />
|
||||
</Rectangle>
|
||||
|
||||
<Animation id="showAnimation"
|
||||
duration="0.3"
|
||||
optional="true">
|
||||
<FloatFieldInterpolator
|
||||
id="fadeInterpolator"
|
||||
key="[0.0, 0.5, 1.0]"
|
||||
keyValue="[0.0, 0.4, 0.8]"
|
||||
fieldToInterp="background.opacity" />
|
||||
<Vector2DFieldInterpolator
|
||||
id="translationInterpolator"
|
||||
key="[0.0, 0.5, 1.0]"
|
||||
keyValue="[[-470,0], [-235,0], [0,0]]"
|
||||
fieldToInterp="container.translation" />
|
||||
</Animation>
|
||||
</children>
|
||||
</component>
|
||||
@@ -0,0 +1,29 @@
|
||||
function OnContentSet() as void
|
||||
content = m.top.itemContent
|
||||
if content = invalid
|
||||
return
|
||||
end if
|
||||
|
||||
m.top.text = content.title
|
||||
end function
|
||||
|
||||
function OnItemHasFocus()
|
||||
hasFocus = m.top.itemHasFocus
|
||||
if hasFocus
|
||||
m.top.font = "font:SmallestBoldSystemFont"
|
||||
m.top.color = "0x262626ff"
|
||||
else
|
||||
m.top.font = "font:SmallestSystemFont"
|
||||
m.top.color = "0xddddddff"
|
||||
end if
|
||||
end function
|
||||
|
||||
function OnFocusPercent()
|
||||
if m.top.focusPercent > 0.5
|
||||
m.top.font = "font:SmallestBoldSystemFont"
|
||||
m.top.color = "0x262626ff"
|
||||
else
|
||||
m.top.font = "font:SmallestSystemFont"
|
||||
m.top.color = "0xddddddff"
|
||||
end if
|
||||
end function
|
||||
@@ -0,0 +1,19 @@
|
||||
<component name="ContextMenuRow" extends="Group">
|
||||
<interface>
|
||||
<field id="text" type="string" alias="label.text" />
|
||||
<field id="font" type="node" alias="label.font" />
|
||||
<field id="color" type="color" alias="label.color" />
|
||||
<field id="itemContent" type="node" onChange="OnContentSet" />
|
||||
<field id="itemHasFocus" type="boolean" onChange="OnItemHasFocus" />
|
||||
<field id="listHasFocus" type="boolean" />
|
||||
<field id="focusPercent" type="float" onChange="OnFocusPercent" />
|
||||
</interface>
|
||||
<children>
|
||||
<ScrollingLabel
|
||||
id="label"
|
||||
maxWidth="420"
|
||||
height="50"
|
||||
vertAlign="center"
|
||||
font="font:SmallestSystemFont" />
|
||||
</children>
|
||||
</component>
|
||||
@@ -0,0 +1,76 @@
|
||||
import "pkg:/source/utils/Logging.bs"
|
||||
|
||||
namespace ContextMenuUtils
|
||||
function Open(providers as object, appController as object, item as object) as object
|
||||
if item = invalid
|
||||
return invalid
|
||||
end if
|
||||
|
||||
options = GetOptions(item, providers)
|
||||
if options.Count() = 0
|
||||
LogWarn("No context menu options available for item")
|
||||
return invalid
|
||||
end if
|
||||
|
||||
contextMenu = CreateObject("roSGNode", "ContextMenu")
|
||||
contextMenu.appController = appController
|
||||
appController@.PushScreen(contextMenu)
|
||||
|
||||
ContextMenuUtils.SetItem(contextMenu, item)
|
||||
contextMenu.options = options
|
||||
|
||||
contextMenu@.Show(invalid)
|
||||
return contextMenu
|
||||
end function
|
||||
|
||||
function SetItem(contextMenu as object, item as object)
|
||||
title = ""
|
||||
subtitle = ""
|
||||
thumbnail = ""
|
||||
|
||||
if item.type = "video"
|
||||
LogInfo("Opening context menu for video:", item.videoId)
|
||||
title = item.title
|
||||
subtitle = item.author
|
||||
thumbnail = item.thumbnail
|
||||
else if item.type = "playlist"
|
||||
LogInfo("Opening context menu for playlist:", item.playlistId)
|
||||
title = item.title
|
||||
subtitle = item._author
|
||||
thumbnail = item.thumbnail
|
||||
else if item.type = "channel"
|
||||
LogInfo("Opening context menu for channel:", item.authorId)
|
||||
title = item._author
|
||||
thumbnail = item.thumbnail
|
||||
end if
|
||||
|
||||
contextMenu.title = title
|
||||
contextMenu.subtitle = subtitle
|
||||
contextMenu.thumbnail = thumbnail
|
||||
end function
|
||||
|
||||
function GetOptions(item as object, providers as object) as object
|
||||
allOptions = []
|
||||
|
||||
for each provider in providers
|
||||
if provider <> invalid and provider.hasField("supportsContextMenu") and provider.supportsContextMenu = true
|
||||
options = provider@.GetContextMenuOptionsForItem(item)
|
||||
if options <> invalid
|
||||
allOptions.append(options)
|
||||
end if
|
||||
end if
|
||||
|
||||
end for
|
||||
|
||||
return allOptions
|
||||
end function
|
||||
|
||||
function CreateOption(title as string, node as object, func as string, args as object) as object
|
||||
option = CreateObject("roSGNode", "ContextMenuItemContentNode")
|
||||
option.title = title
|
||||
option.node = node
|
||||
option.func = func
|
||||
option.args = args
|
||||
return option
|
||||
end function
|
||||
end namespace
|
||||
@@ -12,9 +12,12 @@ namespace DialogUtils
|
||||
dialog.title = title
|
||||
dialog.buttons = buttons
|
||||
if large
|
||||
deviceInfo = CreateObject("roDeviceInfo")
|
||||
displaySize = deviceInfo.GetDisplaySize()
|
||||
dialog.width = displaySize.w - 100
|
||||
if m._deviceDisplayWidth = invalid
|
||||
deviceInfo = CreateObject("roDeviceInfo")
|
||||
displaySize = deviceInfo.GetDisplaySize()
|
||||
m._deviceDisplayWidth = displaySize.w
|
||||
end if
|
||||
dialog.width = m._deviceDisplayWidth - 100
|
||||
end if
|
||||
m.top.getScene().dialog = dialog
|
||||
return dialog
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
import "pkg:/source/asyncTask/asyncTask.bs"
|
||||
import "pkg:/components/Screens/WebAppScreen/GenerateQrCodeTask.bs"
|
||||
import "pkg:/source/asyncTask/asyncTask.bs"
|
||||
import "pkg:/source/utils/StringUtils.bs"
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
|
||||
function Init()
|
||||
m.urlLabel = m.top.findNode("urlLabel")
|
||||
|
||||
@@ -26,11 +26,11 @@
|
||||
<Font role="font" uri="font:SystemFontFile" size="24" />
|
||||
</Label>
|
||||
<Poster
|
||||
id='QrCodePoster'
|
||||
width='300'
|
||||
height='300'
|
||||
loadWidth='300'
|
||||
loadHeight='300'
|
||||
id="QrCodePoster"
|
||||
width="300"
|
||||
height="300"
|
||||
loadWidth="300"
|
||||
loadHeight="300"
|
||||
translation="[50, 50]" />
|
||||
<Label
|
||||
id="urlLabel"
|
||||
|
||||
@@ -1,4 +1,2 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<component name="SimpleDialog" extends="StandardMessageDialog">
|
||||
</component>
|
||||
@@ -1,5 +1,6 @@
|
||||
import "pkg:/source/utils/StringUtils.bs"
|
||||
import "pkg:/components/VideoPlayer/VideoUtils.bs"
|
||||
import "pkg:/source/utils/Logging.bs"
|
||||
import "pkg:/source/utils/StringUtils.bs"
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
|
||||
function InitEcpArgs()
|
||||
@@ -14,13 +15,13 @@ end function
|
||||
|
||||
function LaunchArgumentsReceived() as void
|
||||
launchArgs = m.scene.launchArgs
|
||||
m.log.info("LaunchArgumentsReceived", launchArgs)
|
||||
LogInfo("LaunchArgumentsReceived", launchArgs)
|
||||
ProcessArguments(launchArgs)
|
||||
end function
|
||||
|
||||
function InputArgumentsReceived() as void
|
||||
inputArgs = m.scene.inputArgs
|
||||
m.log.info("InputArgumentsReceived", inputArgs)
|
||||
LogInfo("InputArgumentsReceived", inputArgs)
|
||||
ProcessArguments(inputArgs)
|
||||
end function
|
||||
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
import "pkg:/source/utils/Logging.bs"
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
|
||||
function Init()
|
||||
m.top.functionName = "LoggerLoop"
|
||||
|
||||
port = CreateObject("roMessagePort")
|
||||
|
||||
m.top.ObserveField("logLine", port)
|
||||
|
||||
scene = m.top.getScene()
|
||||
if scene.hasField("systemLogEvent")
|
||||
scene.ObserveFieldScoped("systemLogEvent", port)
|
||||
end if
|
||||
|
||||
m.port = port
|
||||
|
||||
StartLogger(m.top)
|
||||
end function
|
||||
|
||||
function StartLogger(logger as object, logLevel = LogLevel.Info as LogLevel) as void
|
||||
if m.global.logger <> invalid
|
||||
return
|
||||
end if
|
||||
|
||||
logger.logLevel = logLevel
|
||||
m.global.addFields({ logger: logger })
|
||||
logger.control = "run"
|
||||
end function
|
||||
|
||||
function LoggerLoop()
|
||||
port = m.port
|
||||
|
||||
buffer = CreateObject("roByteArray")
|
||||
previousLogsFile = m.top.folder + "/" + m.top.filenamePrevious
|
||||
logsFile = m.top.folder + "/" + m.top.filename
|
||||
|
||||
CreateDirectory(m.top.folder)
|
||||
DeleteFile(previousLogsFile)
|
||||
MoveFile(logsFile, previousLogsFile)
|
||||
|
||||
while true
|
||||
msg = wait(0, port)
|
||||
msgType = type(msg)
|
||||
if msgType = "roSGNodeEvent"
|
||||
field = msg.getField()
|
||||
if field = "logLine"
|
||||
OnLineLog(msg, logsFile, buffer)
|
||||
else if field = "systemLogEvent"
|
||||
OnLineSysLog(msg, logsFile, buffer)
|
||||
end if
|
||||
end if
|
||||
end while
|
||||
end function
|
||||
|
||||
function OnLineLog(event as object, logsFile as string, buffer as object)
|
||||
line = event.getData()
|
||||
' bs:disable-next-line LINT3012
|
||||
print line
|
||||
|
||||
buffer.FromAsciiString(line + `\n`)
|
||||
buffer.AppendFile(logsFile)
|
||||
end function
|
||||
|
||||
function OnLineSysLog(event as object, logsFile as string, buffer as object) as void
|
||||
info = event.getData()
|
||||
if info.LogType <> "http.error"
|
||||
return
|
||||
end if
|
||||
line = "[ERROR][SysLog] " + ToString(info)
|
||||
' bs:disable-next-line LINT3012
|
||||
print line
|
||||
|
||||
buffer.FromAsciiString(line + `\n`)
|
||||
buffer.AppendFile(logsFile)
|
||||
end function
|
||||
@@ -0,0 +1,9 @@
|
||||
<component name="Logger" extends="Task">
|
||||
<interface>
|
||||
<field id="logLevel" type="int" value="2" />
|
||||
<field id="logLine" type="string" alwaysNotify="true" />
|
||||
<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" />
|
||||
</interface>
|
||||
</component>
|
||||
@@ -1,19 +0,0 @@
|
||||
import "pkg:/source/asyncTask/asyncTask.bs"
|
||||
|
||||
function Init()
|
||||
m.buffer = CreateObject("roByteArray")
|
||||
|
||||
previousLogs = m.top.folder + "/" + m.top.filenamePrevious
|
||||
newLogs = m.top.folder + "/" + m.top.filename
|
||||
|
||||
CreateDirectory(m.top.folder)
|
||||
DeleteFile(previousLogs)
|
||||
MoveFile(newLogs, previousLogs)
|
||||
|
||||
m.logsPath = newLogs
|
||||
end function
|
||||
|
||||
function logItem(name as string, levelNum as integer, text as string) as void
|
||||
m.buffer.FromAsciiString(`[${name}] ${text}\n`)
|
||||
m.buffer.AppendFile(m.logsPath)
|
||||
end function
|
||||
@@ -1,10 +0,0 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<component name='log_FileTransport' extends='Node'>
|
||||
<interface>
|
||||
<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' />
|
||||
<function name='logItem' />
|
||||
</interface>
|
||||
<children />
|
||||
</component>
|
||||
@@ -1,11 +1,8 @@
|
||||
import "pkg:/components/EcpArgs.bs"
|
||||
import "pkg:/components/parts/AutoBind/AutoBind.part.bs"
|
||||
import "pkg:/source/utils/LoadingScreen.bs"
|
||||
import "pkg:/source/utils/Logging.bs"
|
||||
import "pkg:/components/EcpArgs.bs"
|
||||
|
||||
function Init()
|
||||
InitializeLogging()
|
||||
m.log = new log.Logger("MainScene")
|
||||
m.scene = m.top.getScene()
|
||||
' At this point, the "MainScene" node is not yet added to the scene, and does not have a parent yet.
|
||||
' Let's wait until it has one.
|
||||
@@ -19,6 +16,7 @@ function MainSceneContainerChanged()
|
||||
HideLoadingScreen()
|
||||
InitEcpArgs()
|
||||
m.scene.signalBeacon("AppLaunchComplete")
|
||||
CopyLoadingMessagesToCache()
|
||||
end function
|
||||
|
||||
function StartWebServer()
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
'import "pkg:/components/EcpArgs.bs"
|
||||
'import "pkg:/components/parts/AutoBind/AutoBind.part.bs"
|
||||
'import "pkg:/source/utils/LoadingScreen.bs"
|
||||
'import "pkg:/source/utils/Logging.bs"
|
||||
'import "pkg:/components/EcpArgs.bs"
|
||||
|
||||
function Init()
|
||||
InitializeBindings() ' auto-generated!
|
||||
InitializeLogging()
|
||||
m.log = log_Logger("MainScene")
|
||||
m.__le = m.log.enabled
|
||||
m.scene = m.top.getScene()
|
||||
' At this point, the "MainScene" node is not yet added to the scene, and does not have a parent yet.
|
||||
' Let's wait until it has one.
|
||||
@@ -21,6 +17,7 @@ function MainSceneContainerChanged()
|
||||
HideLoadingScreen()
|
||||
InitEcpArgs()
|
||||
m.scene.signalBeacon("AppLaunchComplete")
|
||||
CopyLoadingMessagesToCache()
|
||||
end function
|
||||
|
||||
function StartWebServer()
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<component name="MainScene" extends="Group">
|
||||
<interface>
|
||||
<field id="bindings" type="assocarray" onChange="OnBindingSetRegisterAutoBind" />
|
||||
@@ -10,24 +9,26 @@
|
||||
<script type="text/brightscript" uri="pkg:/components/parts/AutoBind/AutoBind.part.brs" />
|
||||
<script type="text/brightscript" uri="pkg:/components/MainScene_bindings.brs" />
|
||||
<script type="text/brightscript" uri="pkg:/components/MainScene.brs" />
|
||||
<script type="text/brightscript" uri="pkg:/source/utils/Logging.brs" />
|
||||
<script type="text/brightscript" uri="pkg:/source/roku_modules/log/LogMixin.brs" />
|
||||
<script type="text/brightscript" uri="pkg:/source/utils/LoadingScreen.brs" />
|
||||
<script type="text/brightscript" uri="pkg:/components/EcpArgs.brs" />
|
||||
<script type="text/brightscript" uri="pkg:/source/utils/Types.brs" />
|
||||
<script type="text/brightscript" uri="pkg:/source/utils/StringUtils.brs" />
|
||||
<script type="text/brightscript" uri="pkg:/source/utils/Logging.brs" />
|
||||
<script type="text/brightscript" uri="pkg:/components/VideoPlayer/VideoUtils.brs" />
|
||||
<script type="text/brightscript" uri="pkg:/source/utils/FocusManagement.brs" />
|
||||
<script type="text/brightscript" uri="pkg:/source/roku_modules/bslib/bslib.brs" />
|
||||
<script type="text/brightscript" uri="pkg:/components/Dialog/DialogUtils.brs" />
|
||||
<script type="text/brightscript" uri="pkg:/source/bslib.brs" />
|
||||
<children>
|
||||
<Logger id="Logger" />
|
||||
<AppController id="AppController">
|
||||
<Group id="Stack">
|
||||
<AppRoot id="AppRoot">
|
||||
<NavBar id="NavBar" focusIndex="1">
|
||||
<ContentNode role="items">
|
||||
<NavBarItem screen="SearchScreen" text="Search" icon="pkg:/images/icons/search.png" canFocus="true" />
|
||||
<NavBarItem screen="HomeScreen" text="Home" icon="pkg:/images/icons/home.png" canFocus="true" />
|
||||
<NavBarItem screen="SettingsScreen" text="Settings" icon="pkg:/images/icons/settings.png" canFocus="true" />
|
||||
<NavBarItem screen="SearchScreen" text="Search" icon="pkg:/images/icons/search.png" />
|
||||
<NavBarItem screen="HomeScreen" text="Home" icon="pkg:/images/icons/home.png" />
|
||||
<NavBarItem screen="BookmarksScreen" text="Bookmarks" icon="pkg:/images/icons/star.png" />
|
||||
<NavBarItem screen="SettingsScreen" text="Settings" icon="pkg:/images/icons/settings.png" />
|
||||
<NavBarItem screen="WebAppScreen" text="Web App" icon="pkg:/images/icons/phone.png" />
|
||||
<NavBarItem screen="AppInfoScreen" text="Info" icon="pkg:/images/icons/info.png" />
|
||||
</ContentNode>
|
||||
@@ -39,6 +40,8 @@
|
||||
<PlayQueue id="PlayQueue" />
|
||||
<ApplicationInfo id="ApplicationInfo" />
|
||||
<Preferences id="Preferences" />
|
||||
<Bookmarks id="Bookmarks" />
|
||||
<SearchHistory id="SearchHistory" />
|
||||
<Invidious id="Invidious" />
|
||||
<PlayletWebServer id="WebServer" port="8888" />
|
||||
</AppController>
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<component name="MainScene" extends="Group" includes="AutoBind">
|
||||
<children>
|
||||
<AppController id="AppController" root="bind:./AppRoot" stack="bind:./Stack">
|
||||
<!-- Logger should remain the first child, to make sure it is initialized first in the scene -->
|
||||
<Logger id="Logger" />
|
||||
<AppController id="AppController"
|
||||
root="bind:./AppRoot"
|
||||
stack="bind:./Stack"
|
||||
playQueue="bind:./PlayQueue">
|
||||
<Group id="Stack">
|
||||
<AppRoot id="AppRoot">
|
||||
<NavBar id="NavBar" focusIndex="1" appController="bind:/AppController">
|
||||
@@ -10,20 +13,22 @@
|
||||
<NavBarItem
|
||||
screen="SearchScreen"
|
||||
text="Search"
|
||||
icon="pkg:/images/icons/search.png"
|
||||
canFocus="true">
|
||||
icon="pkg:/images/icons/search.png">
|
||||
</NavBarItem>
|
||||
<NavBarItem
|
||||
screen="HomeScreen"
|
||||
text="Home"
|
||||
icon="pkg:/images/icons/home.png"
|
||||
canFocus="true">
|
||||
icon="pkg:/images/icons/home.png">
|
||||
</NavBarItem>
|
||||
<NavBarItem
|
||||
screen="BookmarksScreen"
|
||||
text="Bookmarks"
|
||||
icon="pkg:/images/icons/star.png">
|
||||
</NavBarItem>
|
||||
<NavBarItem
|
||||
screen="SettingsScreen"
|
||||
text="Settings"
|
||||
icon="pkg:/images/icons/settings.png"
|
||||
canFocus="true">
|
||||
icon="pkg:/images/icons/settings.png">
|
||||
</NavBarItem>
|
||||
<NavBarItem
|
||||
screen="WebAppScreen"
|
||||
@@ -45,9 +50,14 @@
|
||||
|
||||
<!-- No render nodes -->
|
||||
<PlayQueue id="PlayQueue"
|
||||
invidious="bind:../Invidious" />
|
||||
invidious="bind:../Invidious"
|
||||
notifications="bind:../Notifications"
|
||||
preferences="bind:../Preferences" />
|
||||
<ApplicationInfo id="ApplicationInfo" />
|
||||
<Preferences id="Preferences" />
|
||||
<Bookmarks id="Bookmarks" />
|
||||
<SearchHistory id="SearchHistory"
|
||||
preferences="bind:../Preferences" />
|
||||
|
||||
<Invidious id="Invidious"
|
||||
webServer="bind:../WebServer"
|
||||
@@ -57,10 +67,12 @@
|
||||
<PlayletWebServer
|
||||
id="WebServer"
|
||||
port="8888"
|
||||
appController="bind:/AppController"
|
||||
applicationInfo="bind:../ApplicationInfo"
|
||||
invidious="bind:../Invidious"
|
||||
preferences="bind:../Preferences"
|
||||
playQueue="bind:../PlayQueue" />
|
||||
playQueue="bind:../PlayQueue"
|
||||
bookmarks="bind:../Bookmarks" />
|
||||
</AppController>
|
||||
</children>
|
||||
</component>
|
||||
@@ -7,13 +7,19 @@ function InitializeBindings()
|
||||
childProps: {
|
||||
"AppController": {
|
||||
"root": "./AppRoot",
|
||||
"stack": "./Stack"
|
||||
"stack": "./Stack",
|
||||
"playQueue": "./PlayQueue"
|
||||
},
|
||||
"NavBar": {
|
||||
"appController": "/AppController"
|
||||
},
|
||||
"PlayQueue": {
|
||||
"invidious": "../Invidious"
|
||||
"invidious": "../Invidious",
|
||||
"notifications": "../Notifications",
|
||||
"preferences": "../Preferences"
|
||||
},
|
||||
"SearchHistory": {
|
||||
"preferences": "../Preferences"
|
||||
},
|
||||
"Invidious": {
|
||||
"webServer": "../WebServer",
|
||||
@@ -21,10 +27,12 @@ function InitializeBindings()
|
||||
"preferences": "../Preferences"
|
||||
},
|
||||
"WebServer": {
|
||||
"appController": "/AppController",
|
||||
"applicationInfo": "../ApplicationInfo",
|
||||
"invidious": "../Invidious",
|
||||
"preferences": "../Preferences",
|
||||
"playQueue": "../PlayQueue"
|
||||
"playQueue": "../PlayQueue",
|
||||
"bookmarks": "../Bookmarks"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,8 +50,8 @@ function setIconSize()
|
||||
m.buttonIcon.width = m.buttonIcon.height
|
||||
|
||||
m.buttonIcon.translation = [((width - m.buttonIcon.width) / 2), ((height - m.buttonIcon.height) / 2)]
|
||||
m.buttonText.translation = [0, height]
|
||||
m.buttonText.width = width
|
||||
m.buttonText.translation = [-5, height]
|
||||
m.buttonText.width = width + 10
|
||||
end if
|
||||
end function
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<component name="IconButton" extends="Group" includes="Focus">
|
||||
<children>
|
||||
<Poster id="buttonBackground" uri="pkg:/images/white.9.png" visible="false" />
|
||||
|
||||
@@ -47,6 +47,18 @@ function PopulateButtons() as void
|
||||
m.top.focusable = buttons.Count() > 0
|
||||
|
||||
m.top.focusIndex = m.top.focusIndex
|
||||
|
||||
CenterButtons()
|
||||
end function
|
||||
|
||||
function CenterButtons()
|
||||
parent = m.buttonGroup.getParent()
|
||||
parentWidth = parent.width
|
||||
parentHeight = parent.height
|
||||
|
||||
rect = m.buttonGroup.boundingRect()
|
||||
|
||||
m.buttonGroup.translation = [parentWidth / 2 - rect.width / 2, parentHeight / 2 - rect.height / 2]
|
||||
end function
|
||||
|
||||
function onKeyEvent(key as string, press as boolean) as boolean
|
||||
@@ -74,13 +86,13 @@ function onKeyEvent(key as string, press as boolean) as boolean
|
||||
return false
|
||||
end if
|
||||
navBarItem = m.top.items.getChild(m.top.focusIndex)
|
||||
if navBarItem.canFocus <> true
|
||||
return false
|
||||
end if
|
||||
screen = m.appController@.GetRootScreen(navBarItem.screen)
|
||||
if screen = invalid
|
||||
return false
|
||||
end if
|
||||
if not screen.focusable
|
||||
return false
|
||||
end if
|
||||
NodeSetFocus(screen, true)
|
||||
return true
|
||||
end if
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<component name="NavBar" extends="Group" includes="AutoBind">
|
||||
<interface>
|
||||
<field id="appController" type="node" />
|
||||
@@ -10,7 +8,7 @@
|
||||
<children>
|
||||
<Rectangle
|
||||
height="720"
|
||||
width="105"
|
||||
width="115"
|
||||
color="#242424"
|
||||
opacity="0.9">
|
||||
<LayoutGroup
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<component name="NavBarItem" extends="ContentNode">
|
||||
<interface>
|
||||
<field id="screen" type="string" />
|
||||
<field id="icon" type="string" />
|
||||
<field id="text" type="string" />
|
||||
<field id="canFocus" type="boolean" value="false" />
|
||||
</interface>
|
||||
</component>
|
||||
@@ -0,0 +1,91 @@
|
||||
const OK_LONG_PRESS_KEY = "OK_LONG_PRESS"
|
||||
const OPTIONS_LONG_PRESS_KEY = "OPTIONS_LONG_PRESS"
|
||||
|
||||
function InitializeLongPress(keys as object, duration = 1.0 as float)
|
||||
longPressKeyMap = {
|
||||
"OK": OK_LONG_PRESS_KEY,
|
||||
"options": OPTIONS_LONG_PRESS_KEY
|
||||
}
|
||||
m._longPressKeyMap = {}
|
||||
for each key in keys
|
||||
m._longPressKeyMap[key] = longPressKeyMap[key]
|
||||
end for
|
||||
|
||||
#if DEBUG
|
||||
' This is for testing long press using the VSCode extension.
|
||||
' Using the keyboard:
|
||||
' - press K to simulate an "OK" long press on the remote.
|
||||
' - press O to simulate an "options" long press on the remote.
|
||||
simulatedLongPressKeyMap = {
|
||||
"OK": "Lit_k",
|
||||
"options": "Lit_o"
|
||||
}
|
||||
|
||||
m._simulatedLongPressKeyMap = {}
|
||||
for each key in keys
|
||||
m._simulatedLongPressKeyMap[simulatedLongPressKeyMap[key]] = key
|
||||
end for
|
||||
#end if
|
||||
|
||||
m._longPressTimer = CreateObject("roSGNode", "Timer")
|
||||
m._longPressTimer.duration = duration
|
||||
m._longPressFired = false
|
||||
m._pressState = {}
|
||||
|
||||
m._longPressTimer.ObserveField("fire", FuncName(LongPressTimerFired))
|
||||
end function
|
||||
|
||||
function LongPressHandler(key as string, press as boolean) as boolean
|
||||
#if DEBUG
|
||||
if m._simulatedLongPressKeyMap.DoesExist(key)
|
||||
subtype = m.top.subtype()
|
||||
simulatedKey = m._simulatedLongPressKeyMap[key]
|
||||
LogInfo(`[${subtype}] Simulating`, simulatedKey, "long press using key:", key, "press:", press)
|
||||
longPressKey = m._longPressKeyMap[simulatedKey]
|
||||
m._longPressFired = true
|
||||
return OnkeyEvent(longPressKey, press)
|
||||
end if
|
||||
#end if
|
||||
|
||||
isLongPressKey = m._longPressKeyMap.DoesExist(key)
|
||||
if not isLongPressKey
|
||||
return false
|
||||
end if
|
||||
|
||||
if press
|
||||
m._longPressTimer.control = "stop"
|
||||
m._longPressTimer.control = "start"
|
||||
m._longPressFired = false
|
||||
m._longPressKey = key
|
||||
m._pressState[key] = true
|
||||
return true
|
||||
end if
|
||||
|
||||
if not press
|
||||
m._longPressTimer.control = "stop"
|
||||
if m._longPressFired = true
|
||||
m._longPressFired = false
|
||||
m._pressState[key] = false
|
||||
return true
|
||||
end if
|
||||
' This case is for handling a dialog: The dialog will be dismissed with the OK down event,
|
||||
' and we would trigger the action with the OK up event. The action should only happen if
|
||||
' we detected both down and up events.
|
||||
wasPressed = m._pressState[key]
|
||||
m._pressState[key] = false
|
||||
if wasPressed <> true
|
||||
return true
|
||||
end if
|
||||
end if
|
||||
|
||||
return false
|
||||
end function
|
||||
|
||||
function LongPressTimerFired() as void
|
||||
m._longPressFired = true
|
||||
if StringUtils.IsNullOrEmpty(m._longPressKey) or not m._longPressKeyMap.DoesExist(m._longPressKey)
|
||||
return
|
||||
end if
|
||||
|
||||
OnkeyEvent(m._longPressKeyMap[m._longPressKey], true)
|
||||
end function
|
||||
@@ -1,5 +1,3 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<component name="NavigationTestNode" extends="Node">
|
||||
<interface>
|
||||
<function name="SetNavigation" />
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
<component name="ContentNodeReference" extends="ContentNode">
|
||||
<interface>
|
||||
<field id="refNode" type="node" />
|
||||
</interface>
|
||||
</component>
|
||||
@@ -0,0 +1,41 @@
|
||||
' NodeByRef: these functions provides the ability to "wrap" a node in
|
||||
' another node, so it can be passed by reference. This is useful for
|
||||
' when a node is required to be a child of multiple nodes at once,
|
||||
' which is not possible.
|
||||
' Instead, the node is wrapped, passed around, and unwrapped when needed.
|
||||
import "pkg:/source/utils/StringUtils.bs"
|
||||
|
||||
namespace NodeByRef
|
||||
|
||||
function Wrap(node as object) as object
|
||||
if node = invalid
|
||||
return invalid
|
||||
end if
|
||||
|
||||
if node.refNode <> invalid
|
||||
return node
|
||||
end if
|
||||
|
||||
ref = CreateObject("roSGNode", "ContentNodeReference")
|
||||
ref.refNode = node
|
||||
if not StringUtils.IsNullOrEmpty(node.id)
|
||||
ref.id = node.id + "-ref"
|
||||
end if
|
||||
return ref
|
||||
end function
|
||||
|
||||
function Unwrap(node as object) as object
|
||||
if node = invalid
|
||||
return invalid
|
||||
end if
|
||||
|
||||
loopGuard = 0
|
||||
while node.refNode <> invalid and loopGuard < 10
|
||||
node = node.refNode
|
||||
loopGuard += 1
|
||||
end while
|
||||
|
||||
return node
|
||||
end function
|
||||
|
||||
end namespace
|
||||
@@ -0,0 +1,67 @@
|
||||
import "pkg:/components/NodeByRef/NodeByRef.bs"
|
||||
import "pkg:/source/utils/StringUtils.bs"
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
|
||||
' TODO:P2 a lot of shared logic with the SponsorBlock notification, should be refactored into a common notification
|
||||
function Init()
|
||||
m.translationAnimation = m.top.findNode("translationAnimation")
|
||||
m.translationAnimationInterpolator = m.top.findNode("translationAnimationInterpolator")
|
||||
m.animationTimer = m.top.findNode("animationTimer")
|
||||
|
||||
m.top.translation = [1280, 20]
|
||||
m.translationAnimation.observeField("state", FuncName(OnAnimationState))
|
||||
m.animationTimer.observeField("fire", FuncName(OnAnimationTimer))
|
||||
end function
|
||||
|
||||
function OnContentSet() as void
|
||||
content = m.top.content
|
||||
content = NodeByRef.Unwrap(content)
|
||||
if content = invalid
|
||||
return
|
||||
end if
|
||||
|
||||
if not StringUtils.IsNullOrEmpty(content.thumbnail)
|
||||
m.top.thumbnail = content.thumbnail
|
||||
else
|
||||
m.top.thumbnail = "pkg:/images/thumbnail-missing.jpg"
|
||||
end if
|
||||
|
||||
m.top.line1 = content.title
|
||||
end function
|
||||
|
||||
function OnShow()
|
||||
AnimateIn()
|
||||
end function
|
||||
|
||||
function OnAnimationTimer()
|
||||
AnimateOut()
|
||||
end function
|
||||
|
||||
function AnimateIn()
|
||||
m.translationAnimation.unobserveField("state")
|
||||
m.animationTimer.control = "stop"
|
||||
m.animationTimer.control = "start"
|
||||
m.translationAnimation.observeField("state", FuncName(OnAnimationState))
|
||||
|
||||
Animate(false)
|
||||
end function
|
||||
|
||||
function AnimateOut()
|
||||
Animate(true)
|
||||
end function
|
||||
|
||||
function Animate(reverse as boolean) as void
|
||||
' We are already animating in the requested direction
|
||||
if m.translationAnimationInterpolator.reverse = reverse and m.translationAnimation.control <> "none"
|
||||
return
|
||||
end if
|
||||
|
||||
m.translationAnimationInterpolator.reverse = reverse
|
||||
m.translationAnimation.control = "start"
|
||||
end function
|
||||
|
||||
function OnAnimationState()
|
||||
if m.translationAnimation.state = "stopped" and m.translationAnimationInterpolator.reverse = true
|
||||
m.top.getParent().removeChild(m.top)
|
||||
end if
|
||||
end function
|
||||
@@ -0,0 +1,64 @@
|
||||
<component name="PlayQueueNotification" extends="Group">
|
||||
<interface>
|
||||
<field id="content" type="node" onChange="OnContentSet" />
|
||||
<field id="thumbnail" type="uri" alias="thumbnailPoster.uri" />
|
||||
<field id="line1" type="string" alias="line1Label.text" />
|
||||
<field id="show" type="boolean" alwaysNotify="true" onChange="OnShow" />
|
||||
</interface>
|
||||
<children>
|
||||
<Poster
|
||||
width="500"
|
||||
height="144"
|
||||
opacity="0.9"
|
||||
uri="pkg:/images/white.9.png">
|
||||
|
||||
<Poster
|
||||
id="thumbnailPoster"
|
||||
loadDisplayMode="scaleToZoom"
|
||||
width="170"
|
||||
height="106"
|
||||
failedBitmapUri="pkg:/images/thumbnail-missing.jpg"
|
||||
translation="[10,10]">
|
||||
</Poster>
|
||||
|
||||
<LayoutGroup
|
||||
itemSpacings="[10]"
|
||||
translation="[190,10]">
|
||||
<Label
|
||||
width="300"
|
||||
font="font:SmallestBoldSystemFont"
|
||||
horizAlign="center"
|
||||
color="0x262626ff"
|
||||
text="Added to queue">
|
||||
<Font role="font" uri="font:BoldSystemFontFile" size="22" />
|
||||
</Label>
|
||||
<Label
|
||||
id="line1Label"
|
||||
width="300"
|
||||
font="font:SmallestSystemFont"
|
||||
maxLines="3"
|
||||
color="0x262626ff"
|
||||
wrap="true" />
|
||||
</LayoutGroup>
|
||||
<Label
|
||||
width="480"
|
||||
font="font:SmallestSystemFont"
|
||||
color="0x262626ff"
|
||||
text="Press and hold Options (*) to open the queue"
|
||||
translation="[10,120]" />
|
||||
</Poster>
|
||||
<Animation
|
||||
id="translationAnimation"
|
||||
duration="0.3"
|
||||
optional="true">
|
||||
<Vector2DFieldInterpolator
|
||||
id="translationAnimationInterpolator"
|
||||
key="[0.0, 0.5, 1.0]"
|
||||
keyValue="[ [1280.0, 20.0], [1020.0, 20.0], [760.0, 20.0] ]"
|
||||
fieldToInterp="PlayQueueNotification.translation" />
|
||||
</Animation>
|
||||
<Timer
|
||||
id="animationTimer"
|
||||
duration="3" />
|
||||
</children>
|
||||
</component>
|
||||
@@ -0,0 +1,28 @@
|
||||
namespace PlayQueue
|
||||
const NOTIFICATION_NODE_ID = "PlayQueueNotification"
|
||||
|
||||
function ShowNotifcation(notifications as object, contentNode as object) as void
|
||||
notification = notifications.findNode(NOTIFICATION_NODE_ID)
|
||||
if notification = invalid
|
||||
notification = notifications.createChild("PlayQueueNotification")
|
||||
notification.id = NOTIFICATION_NODE_ID
|
||||
end if
|
||||
notification.content = contentNode
|
||||
notification.show = true
|
||||
end function
|
||||
|
||||
function RemoveNotifcation(notifications as object) as void
|
||||
notification = notifications.findNode(NOTIFICATION_NODE_ID)
|
||||
if notification <> invalid
|
||||
notifications.RemoveChild(notification)
|
||||
end if
|
||||
end function
|
||||
|
||||
function SetVisible(notifications as object, visible as boolean)
|
||||
notification = notifications.findNode(NOTIFICATION_NODE_ID)
|
||||
if notification <> invalid
|
||||
notification.visible = visible
|
||||
end if
|
||||
end function
|
||||
|
||||
end namespace
|
||||
@@ -1,57 +1,83 @@
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
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:/components/VideoFeed/FeedLoadState.bs"
|
||||
import "pkg:/components/PlaylistView/PlaylistContentTask.bs"
|
||||
import "pkg:/source/roku_modules/log/LogMixin.brs"
|
||||
import "pkg:/source/utils/ErrorUtils.bs"
|
||||
import "pkg:/components/Dialog/DialogUtils.bs"
|
||||
import "pkg:/source/utils/ArrayUtils.bs"
|
||||
import "pkg:/source/utils/ErrorUtils.bs"
|
||||
import "pkg:/source/utils/Logging.bs"
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
|
||||
' TODO:P1 prevent adding duplicates of the same video/playlist
|
||||
function Init()
|
||||
m.log = new log.Logger("PlayQueue")
|
||||
m.pendingLoadTasks = {}
|
||||
' TODO:P1 prevent adding duplicates of the same video/playlist
|
||||
m.queue = CreateObject("roArray", 0, true)
|
||||
m.content = m.top.findNode("Content")
|
||||
m.top.content = m.content
|
||||
m.content.addField("index", "integer", false)
|
||||
m.content.index = m.top.index
|
||||
end function
|
||||
|
||||
function Play(node as object, playlistIndex as integer)
|
||||
m.top.index += 1
|
||||
m.top.playlistIndex = playlistIndex
|
||||
|
||||
if m.top.index >= m.queue.Count()
|
||||
m.queue.push(node)
|
||||
m.top.index = m.queue.Count() - 1
|
||||
node = WrapWithIndexField(node)
|
||||
if m.top.index >= m.content.getChildCount()
|
||||
m.content.appendChild(node)
|
||||
m.top.index = m.content.getChildCount() - 1
|
||||
else
|
||||
ArrayUtils.Insert(m.queue, node, m.top.index)
|
||||
m.content.insertChild(node, m.top.index)
|
||||
end if
|
||||
|
||||
PlayItemAtCurrentIndex()
|
||||
end function
|
||||
|
||||
function AddToQueue(node as object)
|
||||
m.queue.push(node)
|
||||
node = WrapWithIndexField(node)
|
||||
m.content.appendChild(node)
|
||||
queueNotifications = m.top.preferences["misc.queue_notifications"]
|
||||
if queueNotifications
|
||||
PlayQueue.ShowNotifcation(m.top.notifications, node)
|
||||
end if
|
||||
end function
|
||||
|
||||
' TODO:P1 better model of the queue (Now playing, etc)
|
||||
function WrapWithIndexField(node as object) as object
|
||||
node = NodeByRef.Wrap(node)
|
||||
if not node.hasField("index")
|
||||
node.addField("index", "integer", false)
|
||||
end if
|
||||
node.index = m.top.index
|
||||
return node
|
||||
end function
|
||||
|
||||
' TODO:P0 better model of the queue (Now playing, etc)
|
||||
function GetQueue(unused as dynamic) as object
|
||||
queueNodes = m.content.getChildren(-1, 0)
|
||||
items = []
|
||||
for each item in m.queue
|
||||
if item.type = "video"
|
||||
for each node in queueNodes
|
||||
node = NodeByRef.Unwrap(node)
|
||||
if node = invalid
|
||||
continue for
|
||||
end if
|
||||
|
||||
nodeType = node.type
|
||||
if nodeType = "video"
|
||||
items.push({
|
||||
type: item.type,
|
||||
videoId: item.videoId,
|
||||
title: item.title,
|
||||
author: item.author,
|
||||
thumbnail: item.thumbnail
|
||||
type: nodeType,
|
||||
videoId: node.videoId,
|
||||
title: node.title,
|
||||
author: node.author,
|
||||
thumbnail: node.thumbnail
|
||||
})
|
||||
else if item.type = "playlist"
|
||||
else if node.type = "playlist"
|
||||
items.push({
|
||||
type: item.type,
|
||||
playlistId: item.playlistId,
|
||||
title: item.title,
|
||||
thumbnail: item.thumbnail,
|
||||
videoCountText: item.videoCountText
|
||||
type: nodeType,
|
||||
playlistId: node.playlistId,
|
||||
title: node.title,
|
||||
thumbnail: node.thumbnail,
|
||||
videoCountText: node.videoCountText
|
||||
})
|
||||
end if
|
||||
end for
|
||||
@@ -64,21 +90,24 @@ function GetQueue(unused as dynamic) as object
|
||||
end function
|
||||
|
||||
function Clear(unused as dynamic)
|
||||
m.queue.Clear()
|
||||
m.content.removeChildrenIndex(m.content.getChildCount(), 0)
|
||||
m.top.index = -1
|
||||
m.top.playlistIndex = -1
|
||||
end function
|
||||
|
||||
function PlayNextItem(unused as dynamic) as boolean
|
||||
if m.queue.Count() = 0
|
||||
childCount = m.content.getChildCount()
|
||||
if childCount = 0
|
||||
return false
|
||||
end if
|
||||
|
||||
if m.top.index <> -1
|
||||
if m.top.index >= m.queue.Count()
|
||||
index = m.top.index
|
||||
if index <> -1
|
||||
if index >= childCount
|
||||
return false
|
||||
end if
|
||||
node = m.queue[m.top.index]
|
||||
node = m.content.getChild(index)
|
||||
node = NodeByRef.Unwrap(node)
|
||||
if node.type = "playlist"
|
||||
m.top.playlistIndex += 1
|
||||
if PlayPlaylistAtCurrentIndex(node)
|
||||
@@ -89,15 +118,22 @@ function PlayNextItem(unused as dynamic) as boolean
|
||||
|
||||
m.top.index += 1
|
||||
m.top.playlistIndex = -1
|
||||
if m.top.index >= m.queue.Count()
|
||||
if m.top.index >= childCount
|
||||
return false
|
||||
end if
|
||||
|
||||
return PlayItemAtCurrentIndex()
|
||||
end function
|
||||
|
||||
function PlayItemAtIndex(index as integer) as boolean
|
||||
m.top.index = index
|
||||
m.top.playlistIndex = -1
|
||||
return PlayItemAtCurrentIndex()
|
||||
end function
|
||||
|
||||
function PlayItemAtCurrentIndex() as boolean
|
||||
node = m.queue[m.top.index]
|
||||
node = m.content.getChild(m.top.index)
|
||||
node = NodeByRef.Unwrap(node)
|
||||
if node = invalid
|
||||
return false
|
||||
end if
|
||||
@@ -114,17 +150,18 @@ function PlayItemAtCurrentIndex() as boolean
|
||||
end function
|
||||
|
||||
function PlayPlaylistAtCurrentIndex(playlist as object) as boolean
|
||||
playlist = NodeByRef.Unwrap(playlist)
|
||||
if playlist.videoCount < 0
|
||||
LoadPlaylist(playlist)
|
||||
return true
|
||||
end if
|
||||
index = m.top.playlistIndex
|
||||
if index < 0 or index >= playlist.videoCount
|
||||
playlistIndex = m.top.playlistIndex
|
||||
if playlistIndex < 0 or playlistIndex >= playlist.videoCount
|
||||
return false
|
||||
end if
|
||||
|
||||
if index < playlist.getChildCount()
|
||||
child = playlist.getChild(index)
|
||||
if playlistIndex < playlist.getChildCount()
|
||||
child = playlist.getChild(playlistIndex)
|
||||
VideoUtils.PlayVideo(child)
|
||||
return true
|
||||
end if
|
||||
@@ -163,7 +200,7 @@ function OnPlaylistContentTaskResult(output as object) as void
|
||||
error = output.result.error
|
||||
end if
|
||||
error = ErrorUtils.Format(error)
|
||||
m.log.error(error)
|
||||
LogError(error)
|
||||
playlistId = playlist.playlistId
|
||||
message = `Failed to load playlist ${playlistId}\n${error}`
|
||||
' TODO:P1 play next upon closing the dialog
|
||||
@@ -173,3 +210,12 @@ function OnPlaylistContentTaskResult(output as object) as void
|
||||
|
||||
PlayPlaylistAtCurrentIndex(playlist)
|
||||
end function
|
||||
|
||||
function OnIndexChange()
|
||||
index = m.top.index
|
||||
m.content.index = index
|
||||
children = m.top.content.getChildren(-1, 0)
|
||||
for each child in children
|
||||
child.index = index
|
||||
end for
|
||||
end function
|
||||
@@ -1,15 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<component name="PlayQueue" extends="Node">
|
||||
<interface>
|
||||
<field id="queue" type="array" />
|
||||
<field id="index" type="integer" value="-1" />
|
||||
<field id="content" type="node" />
|
||||
<field id="index" type="integer" value="-1" onChange="OnIndexChange" />
|
||||
<field id="playlistIndex" type="integer" value="-1" />
|
||||
<field id="invidious" type="node" />
|
||||
<field id="notifications" type="node" />
|
||||
<field id="preferences" type="node" />
|
||||
<function name="Play" />
|
||||
<function name="AddToQueue" />
|
||||
<function name="GetQueue" />
|
||||
<function name="Clear" />
|
||||
<function name="PlayNextItem" />
|
||||
<function name="PlayItemAtIndex" />
|
||||
</interface>
|
||||
<children>
|
||||
<ContentNode id="Content" />
|
||||
</children>
|
||||
</component>
|
||||
@@ -0,0 +1,83 @@
|
||||
import "pkg:/components/Navigation/Navigation.bs"
|
||||
import "pkg:/source/utils/FocusManagement.bs"
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
|
||||
function Init()
|
||||
m.queueList = m.top.findNode("queueList")
|
||||
m.queueLabel = m.top.findNode("queueLabel")
|
||||
m.clearButton = m.top.findNode("clearButton")
|
||||
m.showAnimation = m.top.findNode("showAnimation")
|
||||
|
||||
m.clearButton.ObserveField("buttonSelected", FuncName(OnClearButtonSelected))
|
||||
m.queueList.ObserveField("itemSelected", FuncName(OnItemSelected))
|
||||
|
||||
SetNavigation(m.queueList, "up", m.clearButton)
|
||||
SetNavigation(m.clearButton, "down", m.queueList)
|
||||
end function
|
||||
|
||||
function Show(unsued as dynamic)
|
||||
m.showAnimation.control = "start"
|
||||
end function
|
||||
|
||||
function OnFocusChange() as void
|
||||
if not m.top.focus
|
||||
return
|
||||
end if
|
||||
NodeSetFocus(m.queueList, true)
|
||||
end function
|
||||
|
||||
function OnContentSet() as void
|
||||
content = m.top.content
|
||||
if content = invalid
|
||||
return
|
||||
end if
|
||||
|
||||
if not content.isSameNode(m.queueList.content)
|
||||
m.queueList.content = content
|
||||
end if
|
||||
|
||||
index = content.index
|
||||
if IsInt(index) and index <> -1
|
||||
m.queueLabel.text = `Queue (${index + 1}/${content.getChildCount()})`
|
||||
else
|
||||
m.queueLabel.text = `Queue (${content.getChildCount()})`
|
||||
end if
|
||||
end function
|
||||
|
||||
function OnkeyEvent(key as string, press as boolean) as boolean
|
||||
if NavigationKeyHandler(key, press).handled
|
||||
return true
|
||||
end if
|
||||
|
||||
if press = false
|
||||
return false
|
||||
end if
|
||||
|
||||
if key = "back"
|
||||
Close()
|
||||
return true
|
||||
end if
|
||||
return false
|
||||
end function
|
||||
|
||||
function Close()
|
||||
m.top.appController@.PopScreen(invalid)
|
||||
end function
|
||||
|
||||
function OnClearButtonSelected()
|
||||
m.top.playQueue@.Clear(invalid)
|
||||
end function
|
||||
|
||||
function OnItemSelected() as void
|
||||
content = m.queueList.content
|
||||
if content = invalid
|
||||
return
|
||||
end if
|
||||
|
||||
index = m.queueList.itemSelected
|
||||
if index < 0 or index >= content.getChildCount()
|
||||
return
|
||||
end if
|
||||
|
||||
m.top.playQueue@.PlayItemAtIndex(index)
|
||||
end function
|
||||
@@ -0,0 +1,64 @@
|
||||
<component name="PlayQueueView" extends="Group" includes="Focus">
|
||||
<interface>
|
||||
<field id="content" type="node" onChange="OnContentSet" />
|
||||
<field id="jumpToItem" type="integer" alias="queueList.jumpToItem" />
|
||||
<field id="playQueue" type="node" />
|
||||
<field id="appController" type="node" />
|
||||
<function name="Show" />
|
||||
</interface>
|
||||
|
||||
<children>
|
||||
<Rectangle
|
||||
id="background"
|
||||
width="1280"
|
||||
height="720"
|
||||
color="#000000"
|
||||
opacity="0" />
|
||||
<Rectangle
|
||||
id="container"
|
||||
width="470"
|
||||
height="720"
|
||||
translation="[-470,0]"
|
||||
color="0x242424">
|
||||
<Label
|
||||
id="queueLabel"
|
||||
width="270"
|
||||
height="52"
|
||||
text="Queue"
|
||||
vertAlign="center"
|
||||
font="font:MediumBoldSystemFont"
|
||||
translation="[20,20]" />
|
||||
<Button
|
||||
id="clearButton"
|
||||
minWidth="150"
|
||||
height="52"
|
||||
text="Clear"
|
||||
showFocusFootprint="true"
|
||||
translation="[295,15]" />
|
||||
<MarkupGrid
|
||||
id="queueList"
|
||||
itemComponentName="PlayQueueViewCell"
|
||||
itemSize="[432,90]"
|
||||
itemSpacing="[0,15]"
|
||||
numColumns="1"
|
||||
numRows="6"
|
||||
vertFocusAnimationStyle="floatingFocus"
|
||||
translation="[20,90]" />
|
||||
</Rectangle>
|
||||
|
||||
<Animation id="showAnimation"
|
||||
duration="0.3"
|
||||
optional="true">
|
||||
<FloatFieldInterpolator
|
||||
id="fadeInterpolator"
|
||||
key="[0.0, 0.5, 1.0]"
|
||||
keyValue="[0.0, 0.4, 0.8]"
|
||||
fieldToInterp="background.opacity" />
|
||||
<Vector2DFieldInterpolator
|
||||
id="translationInterpolator"
|
||||
key="[0.0, 0.5, 1.0]"
|
||||
keyValue="[[-470,0], [-235,0], [0,0]]"
|
||||
fieldToInterp="container.translation" />
|
||||
</Animation>
|
||||
</children>
|
||||
</component>
|
||||
@@ -0,0 +1,75 @@
|
||||
import "pkg:/components/NodeByRef/NodeByRef.bs"
|
||||
import "pkg:/source/utils/Logging.bs"
|
||||
import "pkg:/source/utils/TimeUtils.bs"
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
|
||||
function Init()
|
||||
m.durationRect = m.top.FindNode("durationRect")
|
||||
m.durationLabel = m.top.FindNode("durationLabel")
|
||||
end function
|
||||
|
||||
function OnContentSet() as void
|
||||
content = m.top.itemContent
|
||||
content = NodeByRef.Unwrap(content)
|
||||
if content = invalid
|
||||
return
|
||||
end if
|
||||
|
||||
m.top.title = content.title
|
||||
m.top.thumbnailUri = content.thumbnail
|
||||
|
||||
contentType = ValidString(content.type)
|
||||
if contentType = "video" and ValidInt(content.lengthSeconds) <> 0
|
||||
SetDurationText(content.lengthText)
|
||||
m.top.durationRectVisible = true
|
||||
else if contentType = "playlist" and not StringUtils.IsNullOrEmpty(content.videoCountText)
|
||||
SetDurationText(content.videoCountText)
|
||||
m.top.durationRectVisible = true
|
||||
else
|
||||
m.top.durationRectVisible = false
|
||||
end if
|
||||
|
||||
SetHighlight()
|
||||
end function
|
||||
|
||||
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()
|
||||
size = label.localBoundingRect()
|
||||
|
||||
rect.width = size.width + 16
|
||||
rect.translation = [rectParent.width - rect.width, rect.translation[1]]
|
||||
end function
|
||||
|
||||
function SetHighlight() as void
|
||||
content = m.top.itemContent
|
||||
|
||||
playQueueContent = content.getParent()
|
||||
if playQueueContent = invalid
|
||||
return
|
||||
end if
|
||||
|
||||
playQueue = playQueueContent.getParent()
|
||||
if playQueue = invalid
|
||||
return
|
||||
end if
|
||||
|
||||
playQueueIndex = playQueue.index
|
||||
index = m.top.index
|
||||
|
||||
if playQueueIndex = index
|
||||
m.top.thumbnailBlendColor = "#FFFFFFFF"
|
||||
m.top.highlightUri = "pkg:/images/focus_grid.9.png"
|
||||
else
|
||||
m.top.thumbnailBlendColor = "#606060FF"
|
||||
m.top.highlightUri = ""
|
||||
end if
|
||||
end function
|
||||
@@ -0,0 +1,50 @@
|
||||
<component name="PlayQueueViewCell" extends="Group">
|
||||
<interface>
|
||||
<field id="itemContent" type="node" onChange="OnContentSet" />
|
||||
<field id="index" type="integer" />
|
||||
<field id="title" type="string" alias="titleLabel.text" />
|
||||
<field id="thumbnailUri" type="uri" alias="thumbnailPoster.uri" />
|
||||
<field id="thumbnailBlendColor" type="color" alias="thumbnailPoster.blendColor" />
|
||||
<field id="highlightUri" type="uri" alias="highlightPoster.uri" />
|
||||
<field id="duration" type="string" alias="durationLabel.text" />
|
||||
<field id="durationRectVisible" type="boolean" alias="durationRect.visible" />
|
||||
</interface>
|
||||
<children>
|
||||
<Poster
|
||||
id="thumbnailPoster"
|
||||
loadDisplayMode="scaleToZoom"
|
||||
width="160"
|
||||
height="90"
|
||||
failedBitmapUri="pkg:/images/thumbnail-missing.jpg"
|
||||
translation="[2,2]">
|
||||
<Rectangle
|
||||
id="durationRect"
|
||||
width="60"
|
||||
height="26"
|
||||
color="0x000000"
|
||||
opacity="0.8"
|
||||
translation="[100, 58]">
|
||||
<Label
|
||||
height="26"
|
||||
id="durationLabel"
|
||||
horizAlign="center"
|
||||
vertAlign="center"
|
||||
font="font:SmallestSystemFont"
|
||||
translation="[8, 0]" />
|
||||
</Rectangle>
|
||||
</Poster>
|
||||
<Poster
|
||||
id="highlightPoster"
|
||||
blendColor="0xFF0000"
|
||||
width="164"
|
||||
height="94" />
|
||||
|
||||
<Label
|
||||
id="titleLabel"
|
||||
width="260"
|
||||
font="font:SmallestBoldSystemFont"
|
||||
maxLines="3"
|
||||
wrap="true"
|
||||
translation="[172,2]" />
|
||||
</children>
|
||||
</component>
|
||||
@@ -0,0 +1,23 @@
|
||||
import "pkg:/components/Services/Invidious/InvidiousToContentNode.bs"
|
||||
|
||||
namespace PlayQueueViewUtils
|
||||
|
||||
function Open(playQueue as object, appController as object) as object
|
||||
playQueueView = CreateObject("roSGNode", "PlayQueueView")
|
||||
playQueueView.appController = appController
|
||||
playQueueView.playQueue = playQueue
|
||||
appController@.PushScreen(playQueueView)
|
||||
|
||||
content = playQueue.content
|
||||
index = playQueue.index
|
||||
|
||||
playQueueView.content = content
|
||||
if index > -1 and index < content.GetChildCount()
|
||||
playQueueView.jumpToItem = index
|
||||
end if
|
||||
|
||||
playQueueView@.Show(invalid)
|
||||
return playQueueView
|
||||
end function
|
||||
|
||||
end namespace
|
||||
@@ -1,7 +1,10 @@
|
||||
namespace PlaylistUtils
|
||||
function Open(contentNode as object)
|
||||
function Open(contentNode as object, appController = invalid as object)
|
||||
playlistView = CreateObject("roSGNode", "PlaylistView")
|
||||
m.appController@.PushScreen(playlistView)
|
||||
if appController = invalid
|
||||
appController = m.appController
|
||||
end if
|
||||
appController@.PushScreen(playlistView)
|
||||
playlistView@.BindNode(invalid)
|
||||
playlistView.content = contentNode
|
||||
end function
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
import "pkg:/source/utils/FocusManagement.bs"
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
import "pkg:/source/utils/StringUtils.bs"
|
||||
import "pkg:/components/VideoPlayer/VideoUtils.bs"
|
||||
import "pkg:/source/roku_modules/log/LogMixin.brs"
|
||||
import "pkg:/source/asyncTask/asyncTask.bs"
|
||||
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/VideoFeed/FeedLoadState.bs"
|
||||
import "pkg:/components/VideoPlayer/VideoUtils.bs"
|
||||
import "pkg:/source/asyncTask/asyncTask.bs"
|
||||
import "pkg:/source/utils/ErrorUtils.bs"
|
||||
import "pkg:/components/Dialog/DialogUtils.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"
|
||||
|
||||
function Init()
|
||||
m.log = new log.Logger("PlaylistView")
|
||||
|
||||
m.background = m.top.findNode("background")
|
||||
m.backgroundSmall = m.top.findNode("backgroundSmall")
|
||||
m.titleLabel = m.top.findNode("titleLabel")
|
||||
@@ -23,7 +24,7 @@ end function
|
||||
|
||||
function OnNodeReady()
|
||||
m.list.ObserveField("itemFocused", FuncName(OnItemFocused))
|
||||
m.list.observeField("itemSelected", FuncName(OnItemSelected))
|
||||
InitializeLongPress(["OK"])
|
||||
end function
|
||||
|
||||
function OnFocusChange() as void
|
||||
@@ -52,7 +53,9 @@ function OnContentSet() as void
|
||||
m.background.uri = content.thumbnailBackground
|
||||
|
||||
itemFocused = m.list.itemFocused
|
||||
m.list.content = content
|
||||
if not content.isSameNode(m.list.content)
|
||||
m.list.content = content
|
||||
end if
|
||||
if itemFocused > -1 and content.getChildCount() > itemFocused
|
||||
m.list.jumpToItem = itemFocused
|
||||
end if
|
||||
@@ -60,6 +63,20 @@ function OnContentSet() as void
|
||||
end function
|
||||
|
||||
function OnkeyEvent(key as string, press as boolean) as boolean
|
||||
if LongPressHandler(key, press)
|
||||
return true
|
||||
end if
|
||||
|
||||
if key = OK_LONG_PRESS_KEY and press
|
||||
OnItemLongPressed(m.list.itemFocused)
|
||||
return true
|
||||
end if
|
||||
|
||||
if key = "OK" and not press
|
||||
OnItemSelected(m.list.itemFocused)
|
||||
return true
|
||||
end if
|
||||
|
||||
if press = false
|
||||
return false
|
||||
end if
|
||||
@@ -74,6 +91,7 @@ end function
|
||||
function Close()
|
||||
if m.playlistLoadTask <> invalid
|
||||
m.playlistLoadTask.cancel = true
|
||||
m.playlistLoadTask = invalid
|
||||
end if
|
||||
|
||||
m.appController@.PopScreen(invalid)
|
||||
@@ -83,18 +101,97 @@ function OnItemFocused()
|
||||
LoadPlaylistIfNeeded()
|
||||
end function
|
||||
|
||||
function OnItemSelected(event as object)
|
||||
index = event.getData()
|
||||
function OnItemSelected(index as integer) as void
|
||||
playlist = m.list.content
|
||||
if playlist = invalid
|
||||
return
|
||||
end if
|
||||
|
||||
if index < 0 or index >= playlist.getChildCount()
|
||||
return
|
||||
end if
|
||||
|
||||
playlistId = playlist.playlistId
|
||||
video = playlist.getChild(index)
|
||||
videoId = video.videoId
|
||||
if not StringUtils.IsNullOrEmpty(videoId)
|
||||
m.log.info("Play playlist: " + playlistId + " video: " + videoId)
|
||||
LogInfo("Play playlist:", playlistId, "video:", videoId)
|
||||
m.playQueue@.Play(playlist, index)
|
||||
end if
|
||||
end function
|
||||
|
||||
function OnItemLongPressed(index as integer) as void
|
||||
playlist = m.list.content
|
||||
if playlist = invalid
|
||||
return
|
||||
end if
|
||||
|
||||
if index < 0 or index >= playlist.getChildCount()
|
||||
return
|
||||
end if
|
||||
|
||||
playlistId = playlist.playlistId
|
||||
video = playlist.getChild(index)
|
||||
videoId = video.videoId
|
||||
if StringUtils.IsNullOrEmpty(videoId)
|
||||
LogWarn("Long press video with no id in playlist/ playlist:", playlistId, "video:", videoId)
|
||||
return
|
||||
end if
|
||||
|
||||
LogInfo("Long press: playlist:", playlistId, "video:", videoId)
|
||||
|
||||
' TODO:P1 handle case of opening the channel
|
||||
' - Owner of a video
|
||||
' - Owner of a playlist
|
||||
contextMenuProviders = [m.top]
|
||||
ContextMenuUtils.Open(contextMenuProviders, m.appController, video)
|
||||
end function
|
||||
|
||||
function GetContextMenuOptionsForItem(video as object) as object
|
||||
playlist = m.list.content
|
||||
if playlist = invalid
|
||||
return []
|
||||
end if
|
||||
|
||||
index = m.list.itemFocused
|
||||
if index < 0 or index >= playlist.getChildCount()
|
||||
return []
|
||||
end if
|
||||
|
||||
selectedVideo = playlist.getChild(m.list.itemFocused)
|
||||
if selectedVideo = invalid or not selectedVideo.isSameNode(video)
|
||||
return []
|
||||
end if
|
||||
|
||||
options = [
|
||||
ContextMenuUtils.CreateOption("Play", m.playQueue, "Play", [playlist, index]),
|
||||
ContextMenuUtils.CreateOption("Queue", m.playQueue, "AddToQueue", [playlist])
|
||||
ContextMenuUtils.CreateOption("Play video", m.playQueue, "Play", [video, -1]),
|
||||
ContextMenuUtils.CreateOption("Queue video", m.playQueue, "AddToQueue", [video]),
|
||||
]
|
||||
|
||||
if not StringUtils.IsNullOrEmpty(playlist.authorId)
|
||||
options.push(ContextMenuUtils.CreateOption("Open channel", m.top, "OpenPlaylistChannel", [playlist]))
|
||||
end if
|
||||
|
||||
options.append(m.bookmarks@.GetMenuForPlaylist(playlist))
|
||||
options.append(m.bookmarks@.GetMenuForVideo(video))
|
||||
|
||||
return options
|
||||
end function
|
||||
|
||||
function OpenPlaylistChannel(playlist as object) as void
|
||||
authorId = playlist.authorId
|
||||
if StringUtils.IsNullOrEmpty(authorId)
|
||||
LogWarn("Invalid authorId:", authorId)
|
||||
return
|
||||
end if
|
||||
channel = InvidiousContent.ToChannelContentNode(invalid, { authorId: authorId }, invalid)
|
||||
ChannelUtils.Open(channel)
|
||||
end function
|
||||
|
||||
'TODO:P1 a playlist could have been opened from the bookmarks, which can be as old as 3 days
|
||||
' We should make a request in this case, and let the cache handle freshness.
|
||||
function LoadPlaylistIfNeeded() as void
|
||||
content = m.top.content
|
||||
if content = invalid
|
||||
@@ -146,7 +243,7 @@ function OnPlaylistContentTaskResult(output as object) as void
|
||||
error = output.result.error
|
||||
end if
|
||||
error = ErrorUtils.Format(error)
|
||||
m.log.error(error)
|
||||
LogError(error)
|
||||
playlistId = output.task.input.content.playlistId
|
||||
message = `Failed to load playlist ${playlistId}\n${error}`
|
||||
DialogUtils.ShowDialog(message, "Playlist load fail", true)
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
<component name="PlaylistView" extends="Group" includes="AutoBind,Focus">
|
||||
<component name="PlaylistView" extends="Group" includes="AutoBind,Focus,ContextMenuProvider">
|
||||
<interface>
|
||||
<field id="content" type="node" onChange="OnContentSet" />
|
||||
<field id="appController" type="node" bind="/AppController" />
|
||||
<field id="invidious" type="node" bind="/Invidious" />
|
||||
<field id="playQueue" type="node" bind="/PlayQueue" />
|
||||
<field id="bookmarks" type="node" bind="/Bookmarks" />
|
||||
<function name="OpenPlaylistChannel" />
|
||||
</interface>
|
||||
<children>
|
||||
<Rectangle
|
||||
width="1280"
|
||||
height="720"
|
||||
color="0x242424">
|
||||
</Rectangle>
|
||||
color="0x242424" />
|
||||
<Poster
|
||||
id="backgroundSmall"
|
||||
width="1280"
|
||||
|
||||
@@ -1,14 +1,9 @@
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
import "pkg:/source/utils/TimeUtils.bs"
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
|
||||
function Init()
|
||||
m.titleLabel = m.top.findNode("titleLabel")
|
||||
m.authorLabel = m.top.findNode("authorLabel")
|
||||
m.thumbnail = m.top.findNode("thumbnail")
|
||||
m.durationRect = m.top.FindNode("durationRect")
|
||||
m.durationLabel = m.top.FindNode("durationLabel")
|
||||
|
||||
m.thumbnail.failedBitmapUri = "pkg:/images/thumbnail-missing.jpg"
|
||||
end function
|
||||
|
||||
function OnContentSet() as void
|
||||
@@ -18,27 +13,31 @@ function OnContentSet() as void
|
||||
return
|
||||
end if
|
||||
|
||||
m.titleLabel.text = content.title
|
||||
m.authorLabel.text = content.author
|
||||
m.top.title = content.title
|
||||
m.top.author = content.author
|
||||
m.top.thumbnailUri = content.thumbnail
|
||||
|
||||
m.thumbnail.uri = content.thumbnail
|
||||
if ValidInt(content.lengthSeconds) <> 0
|
||||
SetDurationText(content.lengthText)
|
||||
m.durationRect.visible = true
|
||||
m.top.durationRectVisible = true
|
||||
else
|
||||
m.durationRect.visible = false
|
||||
m.top.durationRectVisible = false
|
||||
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
|
||||
|
||||
rectParent = rect.getParent()
|
||||
if label = invalid or rect = invalid
|
||||
return
|
||||
end if
|
||||
|
||||
label.text = text
|
||||
rectParent = rect.getParent()
|
||||
size = label.localBoundingRect()
|
||||
|
||||
rect.width = size.width + 16
|
||||
rect.translation = [rectParent.width - rect.width, 72]
|
||||
rect.translation = [rectParent.width - rect.width, rect.translation[1]]
|
||||
end function
|
||||
@@ -1,13 +1,19 @@
|
||||
<component name="PlaylistViewCell" extends="Group">
|
||||
<interface>
|
||||
<field id="itemContent" type="node" onChange="OnContentSet" />
|
||||
<field id="title" type="string" alias="titleLabel.text" />
|
||||
<field id="author" type="string" alias="authorLabel.text" />
|
||||
<field id="thumbnailUri" type="uri" alias="thumbnailPoster.uri" />
|
||||
<field id="duration" type="string" alias="durationLabel.text" />
|
||||
<field id="durationRectVisible" type="boolean" alias="durationRect.visible" />
|
||||
</interface>
|
||||
<children>
|
||||
<Poster
|
||||
id="thumbnail"
|
||||
id="thumbnailPoster"
|
||||
loadDisplayMode="scaleToZoom"
|
||||
width="190"
|
||||
height="106">
|
||||
height="106"
|
||||
failedBitmapUri="pkg:/images/thumbnail-missing.jpg">
|
||||
<Rectangle
|
||||
id="durationRect"
|
||||
width="60"
|
||||
|
||||
@@ -1,16 +1,32 @@
|
||||
import "pkg:/source/asyncTask/asyncTask.bs"
|
||||
|
||||
function Init()
|
||||
m.displayNames = {
|
||||
"version": "Playlet Version",
|
||||
"lib_version": "Playlet Library Version",
|
||||
"lib_version_latest": "Playlet Library Latest Version",
|
||||
"lib_url": "Playlet Library URL",
|
||||
"lib_url_type": "Playlet Library URL Type",
|
||||
"git_commit_hash": "Playlet Git Commit Hash",
|
||||
"lib_git_commit_hash": "Playlet Library Git Commit Hash",
|
||||
"id": "App ID"
|
||||
}
|
||||
' TODO:P2 Add tooltip to each field with description of what it means
|
||||
m.displayNames = [{
|
||||
key: "app_version",
|
||||
displayText: "Playlet App Version"
|
||||
}, {
|
||||
key: "lib_version",
|
||||
displayText: "Playlet Library Version"
|
||||
}, {
|
||||
key: "lib_version_latest",
|
||||
displayText: "Playlet Library Latest Version"
|
||||
}, {
|
||||
key: "lib_url",
|
||||
displayText: "Playlet Library URL"
|
||||
}, {
|
||||
key: "lib_url_type",
|
||||
displayText: "Playlet Library URL Type"
|
||||
}, {
|
||||
key: "app_git_commit_hash",
|
||||
displayText: "Playlet App Git Commit Hash"
|
||||
}, {
|
||||
key: "lib_git_commit_hash",
|
||||
displayText: "Playlet Library Git Commit Hash"
|
||||
}, {
|
||||
key: "id",
|
||||
displayText: "App ID"
|
||||
}]
|
||||
|
||||
m.keyValueList = m.top.findNode("KeyValueListContent")
|
||||
end function
|
||||
@@ -35,8 +51,8 @@ function UpdateKeyValueList()
|
||||
m.keyValueList.removeChildIndex(0)
|
||||
end while
|
||||
|
||||
for each item in m.appInfo
|
||||
value = `${m.displayNames[item]}: ${m.appInfo[item]}`
|
||||
for each item in m.displayNames
|
||||
value = `${item.displayText}: ${m.appInfo[item.key]}`
|
||||
contentNode = m.keyValueList.createChild("ContentNode")
|
||||
contentNode.title = value
|
||||
end for
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<component name="AppInfoScreen" extends="Group" includes="AutoBind">
|
||||
<interface>
|
||||
<field id="applicationInfo" type="node" bind="/ApplicationInfo" />
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
import "pkg:/components/ContextMenu/ContextMenuUtils.bs"
|
||||
import "pkg:/components/Navigation/Navigation.bs"
|
||||
import "pkg:/source/utils/FocusManagement.bs"
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
|
||||
function Init()
|
||||
m.noBookmarks = m.top.findNode("noBookmarks")
|
||||
m.yesBookmarks = m.top.findNode("yesBookmarks")
|
||||
m.rowList = m.top.FindNode("rowList")
|
||||
m.rowList.screen = m.top
|
||||
m.isDirty = true
|
||||
|
||||
m.top.ObserveField("visible", FuncName(OnVisibleChange))
|
||||
end function
|
||||
|
||||
function OnNodeReady()
|
||||
SetNavigation(invalid, "back", m.navBar)
|
||||
SetNavigation(invalid, "left", m.navBar)
|
||||
|
||||
m.rowList@.BindNode(invalid)
|
||||
|
||||
OnBookmarksChange()
|
||||
m.bookmarks.ObserveField("contentChange", FuncName(OnBookmarksChange))
|
||||
end function
|
||||
|
||||
function OnFocusChange() as void
|
||||
if not m.top.focus
|
||||
return
|
||||
end if
|
||||
|
||||
if m.yesBookmarks.visible
|
||||
NodeSetFocus(m.rowList, true)
|
||||
else
|
||||
NodeSetFocus(m.navBar, true)
|
||||
end if
|
||||
end function
|
||||
|
||||
function OnVisibleChange()
|
||||
if m.top.visible and m.isDirty
|
||||
OnBookmarksChange()
|
||||
end if
|
||||
end function
|
||||
|
||||
function Refresh(unused as dynamic)
|
||||
m.isDirty = true
|
||||
OnBookmarksChange()
|
||||
end function
|
||||
|
||||
function OnBookmarksChange() as void
|
||||
if not m.top.visible
|
||||
m.isDirty = true
|
||||
return
|
||||
end if
|
||||
m.isDirty = false
|
||||
|
||||
hasBookmarks = m.bookmarks.content.getChildCount() > 0
|
||||
m.noBookmarks.visible = not hasBookmarks
|
||||
m.yesBookmarks.visible = hasBookmarks
|
||||
m.top.focusable = hasBookmarks
|
||||
|
||||
if hasBookmarks
|
||||
SetRowListContent(m.bookmarks.content)
|
||||
else
|
||||
if m.rowList.hasFocus()
|
||||
NodeSetFocus(m.navBar, true)
|
||||
end if
|
||||
end if
|
||||
end function
|
||||
|
||||
function SetRowListContent(bookmarksContent as object)
|
||||
bookmarkGroupNodes = bookmarksContent.getChildren(-1, 0)
|
||||
|
||||
feeds = []
|
||||
for each bookmarkGroupNode in bookmarkGroupNodes
|
||||
bookmarkNodes = bookmarkGroupNode.getChildren(-1, 0)
|
||||
feedSources = []
|
||||
for each bookmarkNode in bookmarkNodes
|
||||
feedSources.push(bookmarkNode.feedSource)
|
||||
end for
|
||||
|
||||
feeds.push({
|
||||
"title": bookmarkGroupNode.title,
|
||||
"feedSources": feedSources
|
||||
})
|
||||
end for
|
||||
|
||||
m.rowList.feeds = feeds
|
||||
end function
|
||||
|
||||
function OnkeyEvent(key as string, press as boolean) as boolean
|
||||
if NavigationKeyHandler(key, press).handled
|
||||
return true
|
||||
end if
|
||||
return false
|
||||
end function
|
||||
|
||||
function GetContextMenuOptionsForItem(rowItem as object) as object
|
||||
refreshItem = ContextMenuUtils.CreateOption("Refresh Bookmarks", m.top, "Refresh", [invalid])
|
||||
return [refreshItem]
|
||||
end function
|
||||
@@ -0,0 +1,38 @@
|
||||
<component name="BookmarksScreen" extends="Group" includes="AutoBind,Focus,ContextMenuProvider">
|
||||
<interface>
|
||||
<field id="navBar" type="node" bind="/NavBar" />
|
||||
<field id="applicationInfo" type="node" bind="/ApplicationInfo" />
|
||||
<field id="bookmarks" type="node" bind="/Bookmarks" />
|
||||
<function name="Refresh" />
|
||||
</interface>
|
||||
<children>
|
||||
<Group id="noBookmarks" visible="false">
|
||||
<Label
|
||||
height="720"
|
||||
width="1280"
|
||||
font="font:MediumBoldSystemFont"
|
||||
horizAlign="center"
|
||||
vertAlign="center"
|
||||
text="You currently have no bookmarks.

To add bookmarks, long-press 'OK' on a video, playlist or channel.

Please note that Bookmarks is an experimental feature."
|
||||
wrap="true" />
|
||||
</Group>
|
||||
<Group id="yesBookmarks" visible="false">
|
||||
<VideoRowList
|
||||
itemComponentName="RowCell"
|
||||
id="rowList"
|
||||
translation="[0,50]"
|
||||
numRows="2"
|
||||
rowitemSize="[[350,196]]"
|
||||
rowItemSpacing="[[25,0]]"
|
||||
itemSize="[1280,326]"
|
||||
itemSpacing="[0,65]"
|
||||
rowLabelOffset="[[125,20]]"
|
||||
focusXOffset="[125]"
|
||||
showRowLabel="[true]"
|
||||
rowFocusAnimationStyle="floatingfocus"
|
||||
variableWidthItems="true"
|
||||
focusBitmapUri="pkg:/images/focus_grid.9.png"
|
||||
/>
|
||||
</Group>
|
||||
</children>
|
||||
</component>
|
||||
@@ -1,8 +1,11 @@
|
||||
import "pkg:/source/utils/FocusManagement.bs"
|
||||
import "pkg:/components/ContextMenu/ContextMenuUtils.bs"
|
||||
import "pkg:/components/Navigation/Navigation.bs"
|
||||
import "pkg:/source/utils/FocusManagement.bs"
|
||||
|
||||
function Init()
|
||||
m.top.focusable = true
|
||||
m.rowList = m.top.FindNode("rowList")
|
||||
m.rowList.screen = m.top
|
||||
m.pendingLoadTasks = {}
|
||||
end function
|
||||
|
||||
@@ -11,7 +14,7 @@ function OnNodeReady()
|
||||
SetNavigation(invalid, "left", m.navBar)
|
||||
|
||||
m.rowList@.BindNode(invalid)
|
||||
m.rowList.contentData = ParseJson(ReadAsciiFile(m.top.feedFile))
|
||||
m.rowList.feeds = ParseJson(ReadAsciiFile(m.top.feedFile))
|
||||
end function
|
||||
|
||||
function OnFocusChange() as void
|
||||
@@ -27,3 +30,8 @@ function OnkeyEvent(key as string, press as boolean) as boolean
|
||||
end if
|
||||
return false
|
||||
end function
|
||||
|
||||
function GetContextMenuOptionsForItem(rowItem as object) as object
|
||||
refresh = ContextMenuUtils.CreateOption("Refresh Home", m.rowList, "Refresh", [invalid])
|
||||
return [refresh]
|
||||
end function
|
||||
@@ -1,10 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<component name="HomeScreen" extends="Group" includes="AutoBind,Focus">
|
||||
<component name="HomeScreen" extends="Group" includes="AutoBind,Focus,ContextMenuProvider">
|
||||
<interface>
|
||||
<field id="navBar" type="node" bind="/NavBar" />
|
||||
<field id="invidious" type="node" bind="/Invidious" />
|
||||
<field id="feedFile" type="string" value="libpkg:/config/default_home_layout.json5" />
|
||||
<field id="feedFile" type="string" value="libpkg:/config/default_home_layout.yaml" />
|
||||
</interface>
|
||||
<children>
|
||||
<VideoRowList
|
||||
@@ -16,8 +14,8 @@
|
||||
rowItemSpacing="[[25,0]]"
|
||||
itemSize="[1280,326]"
|
||||
itemSpacing="[0,65]"
|
||||
rowLabelOffset="[[115,20]]"
|
||||
focusXOffset="[115]"
|
||||
rowLabelOffset="[[125,20]]"
|
||||
focusXOffset="[125]"
|
||||
showRowLabel="[true]"
|
||||
rowFocusAnimationStyle="floatingfocus"
|
||||
variableWidthItems="true"
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import "pkg:/components/Navigation/Navigation.bs"
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
import "pkg:/source/roku_modules/log/LogMixin.brs"
|
||||
import "pkg:/source/utils/ArrayUtils.bs"
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
|
||||
function Init()
|
||||
options = {
|
||||
@@ -151,8 +150,6 @@ function PopulateLists(contentNodes as object, options as object)
|
||||
end function
|
||||
|
||||
function OnNodeReady()
|
||||
m.log = new log.Logger("SearchFilters")
|
||||
|
||||
RefreshUI()
|
||||
|
||||
m.controls.date.ObserveField("checkedItem", FuncName(OnListChecked))
|
||||
|
||||
Loaded 100 of 304 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user