Compare commits

...
40 Commits
Author SHA1 Message Date
Brahim Hadriche 322232a027 Prepare 0.9.0 (#73) 2023-04-21 16:44:03 -04:00
Brahim Hadriche 8ee9acadad Changelog 2023-04-21 16:27:43 -04:00
Brahim Hadriche ca11978995 Update deps 2023-04-21 16:25:59 -04:00
Brahim Hadriche 4fb796b13b Add dev menu (#72) 2023-04-21 16:09:54 -04:00
Brahim Hadriche 763cb64ba7 Revert to using DASH (#71) 2023-04-21 12:47:57 -04:00
Brahim Hadriche 32bcc1dfc0 Feature/app info screen (#69)
* Add app info screen

* Better app info page

* Small refactor for the navbar screens

* Changelog
2023-04-18 16:52:15 -04:00
Brahim Hadriche 8169c7223d Update README.md 2023-04-07 13:07:57 -04:00
Brahim Hadricheandgithub-action linter 7d2d403e3f Add the ability to find a working caption (#67)
* Add the ability to find a working caption

* Lint fix

---------

Co-authored-by: github-action linter <githubaction@githubaction.com>
2023-04-06 15:19:53 -04:00
Brahim Hadriche 71045bf944 Fix for #63 (#66)
* Fix for #63

* Changelog
2023-04-06 11:51:45 -04:00
Brahim Hadriche 8f17be6036 Update dependencies 2023-04-05 19:06:14 -04:00
Brahim Hadriche 3ce2baf683 Another null check fix (#61) 2023-04-05 18:35:56 -04:00
Brahim Hadriche 8fa06bf05a Fix #57 (#60) 2023-04-05 18:15:57 -04:00
Brahim Hadricheandgithub-action linter 82162d52c1 Mark video watched (#59)
* Mark video watched

* Lint fix

* return type

* fix return type

* Changelog

---------

Co-authored-by: github-action linter <githubaction@githubaction.com>
2023-04-05 17:58:24 -04:00
Brahim Hadriche 53f9249b9f Delete install script 2023-03-05 09:57:26 -05:00
Brahim Hadriche 6adbe94a1e Release 0.8.0 (#54) 2023-03-02 16:36:12 -05:00
Brahim Hadriche aaea507fde Use format streams by default instead of DASH (#53) 2023-03-02 16:26:15 -05:00
Brahim Hadriche 52b4feb130 Fix return type 2023-03-01 18:01:32 -05:00
Brahim Hadriche 0d79c4975e Feature/cherrypick ws (#52)
* int to hex

* Websocket frame size

* Hash methods refactor

* Uri components fix
2023-02-27 20:10:21 -05:00
Brahim Hadriche 0e2be8d5bb Decode username https://github.com/iv-org/invidious/pull/3656 2023-02-22 09:00:41 -05:00
Brahim Hadriche 71453237c4 Add username to web app and state api (#50) 2023-02-21 13:54:13 -05:00
Brahim Hadriche 5baab67bb4 [PoC] Invidious import export (#45)
* Invidious import export

* Delete duplicate profiles

* Subscription cleanup

* No need for export

* Load user playlists

* Write profile to file

* playlist limit
2023-02-19 10:35:54 -05:00
Brahim Hadriche ece50b547e Update README.md 2023-02-17 09:07:52 -05:00
Brahim Hadriche 7a27bc673e Update README.md 2023-02-16 16:49:32 -05:00
Brahim Hadriche 822f95bb9d Update CHANGELOG.md 2023-02-14 19:14:28 -05:00
Brahim Hadriche 57f4c7a4a2 Add benchmark video 2023-02-14 19:08:38 -05:00
Brahim Hadriche d1cb877784 Format views for billions 2023-02-14 16:28:32 -05:00
Brahim Hadriche 0de521c525 Add git commit to the state api 2023-02-12 10:27:37 -05:00
Brahim Hadriche 447e58c336 Update release.yml 2023-02-12 10:09:40 -05:00
Brahim Hadriche 66cf61059b Update release.yml 2023-02-12 09:39:39 -05:00
Brahim Hadriche f1f1e550bc Update ci (#49)
* Update lint.yml

* Update release.yml

* Update release.yml

* Update release.yml

* Update release.yml
2023-02-12 09:34:36 -05:00
Brahim Hadriche fb7a898cfa Fix web build on ci 2023-02-12 08:57:25 -05:00
Brahim Hadriche f40e0b7471 Remove image generation from ci command 2023-02-11 22:11:41 -05:00
Brahim Hadriche 43f0159510 Update lint.yml 2023-02-10 21:02:21 -05:00
Brahim Hadriche 80d67cf417 Update release.yml 2023-02-10 20:59:50 -05:00
Brahim Hadriche b0bbb97626 Update release.yml 2023-02-10 20:58:08 -05:00
Brahim Hadriche beb607a2d0 Create release.yml 2023-02-10 20:56:36 -05:00
Brahim Hadriche 043a0e5301 [part 1] Feature/ci release (#48)
* Git status check

* Add git hash to manifest
2023-02-10 20:31:25 -05:00
Brahim Hadricheandgithub-action linter e0020ffa66 SponsorBlock Notification (#47)
* SponsorBlock Notification

* Lint fix

* Reuse animation for multiple skips

* Small change

* Rename color utils

* Lint fix

---------

Co-authored-by: github-action linter <githubaction@githubaction.com>
2023-02-10 15:20:08 -05:00
Brahim Hadriche 9697ac58d0 Fix crash in case GetLocalIpAddress returns invalid 2023-02-07 20:40:25 -05:00
Brahim Hadriche 97921aab6e Add comment 2023-02-05 17:42:25 -05:00
54 changed files with 2505 additions and 1373 deletions

No files matched your search

-2
View File
@@ -1,8 +1,6 @@
name: Linter
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
+35
View File
@@ -0,0 +1,35 @@
name: Release
on:
push:
branches: [ "main" ]
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- 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: Build Playlet
run: npm run build:release:ci
- name: Delete unstable release
run: gh release delete unstable --cleanup-tag --yes || echo "unstable release was not deleted"
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
- name: Create unstable release
run: gh release create unstable ./release/playlet.zip ./playlet/src/lib/playlet-lib.zip --notes "This is an automated release." --prerelease --title unstable
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
+24 -1
View File
@@ -4,6 +4,29 @@ 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.9.0] - 2023-04-21
### Added
- Add watched videos to Invidious watch history
- App info screen
- A dev menu selector to test newer or older versions of playlet lib
- Makes it possible to test unstable releases before they officially release
### Fixed
- A crash where the metadata of a video is not validated [#57](https://github.com/iBicha/playlet/issues/57)
- A crash where the video details in home screen are null [#56](https://github.com/iBicha/playlet/issues/56)
- A crash where the video details are not returned in json [#63](https://github.com/iBicha/playlet/issues/63)
- Revert to using DASH instead of 720p by default
- A crash where request cache fails [#62](https://github.com/iBicha/playlet/issues/62)
## [0.8.0] - 2023-03-02
### Added
- SponsorBlock notification
- Invidious username to web app v1
### Fixed
- Crash in case GetLocalIpAddress() returns invalid
- Use Format Stream (720p) instead of DASH (https://github.com/iv-org/invidious/issues/3666)
## [0.7.0] - 2023-02-04
### Added
- A script to sync between Youtube profile and and Invidious profile
@@ -34,7 +57,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Bug where DASH stream is not compatible. Play format stream as a fallback
- Showing upcoming videos correctly
# Removed
### Removed
- Dependency on [roku-promise](https://github.com/rokucommunity/roku-promise)
## [0.5.0] - 2022-12-02
+18 -22
View File
@@ -1,10 +1,21 @@
# Playlet
<p align="center">
<img src="banner.png" style="display:block;text-align:center" alt="Playlet Logo" width="800"/>
<br/><br/>
<a href="https://github.com/iBicha/playlet">
<img alt="AGPL-3.0 license" src="https://img.shields.io/github/license/iBicha/playlet.svg"/>
</a>
<a href="https://github.com/iBicha/playlet/releases">
<img alt="Current Release" src="https://img.shields.io/github/release/iBicha/playlet.svg"/>
<img alt="Total Downloads" src="https://img.shields.io/github/downloads/iBicha/playlet/latest/playlet-lib.zip.svg"/>
</a>
<a href="https://channelstore.roku.com/en-ca/details/840aec36f51bfe6d96cf6db9055a372a/playlet">
<img alt="Roku Channel Store" src="https://img.shields.io/badge/Roku%20Store-Install-blueviolet?logo=roku&logoColor=blueviolet&labelColor=white"/>
</a>
</p>
# Playlet
Unofficial Youtube client for Roku 📺
Playlet is an unofficial Youtube client for Roku 📺
## Features
- 🔥 No Ads (Not now, not ever)
@@ -13,6 +24,7 @@ Unofficial Youtube client for Roku 📺
- ⚔️ SponsorBlock integration (skips undesirable sections in videos)
- 📱 Cast from phone
- 🔮 Picture-in-picture mode
- ⚡ Fast! [Check out how we compare with the official Youtube app](https://youtu.be/qmSvA-QQW20)
### Cast from phone
1. Open settings in Playlet
@@ -30,13 +42,13 @@ Unofficial Youtube client for Roku 📺
1. Change the Invidious instance
## Screenshots
<img src="screenshot1.jpg" alt="Screenshot of Playlet" width="350"/>
<img src="screenshot2.jpg" alt="Screenshot of Playlet" width="350"/>
<img src="screenshot3.jpg" alt="Screenshot of Playlet" width="350"/>
| ![](screenshot1.jpg) | ![](screenshot2.jpg) | ![](screenshot3.jpg) |
|----------------------|----------------------|----------------------|
## Installation
### Roku Store (Published app)
Search for "Playlet" in the Roku Store, or use the link https://my.roku.com/account/add?channel=PLAYLET
[Playlet on Roku channel store](https://channelstore.roku.com/en-ca/details/840aec36f51bfe6d96cf6db9055a372a/playlet)
Or use the link https://my.roku.com/account/add?channel=PLAYLET
### Sideloaded (Dev app)
#### Enable Roku Developer Mode
@@ -56,22 +68,6 @@ By now, you should have the following
- Your Roku TV local IP address
- You can find this information in your TV network settings. It should look like 192.168.X.X or so
#### Install Playlet (command line)
Install Playlet as a dev channel using this command, and replace:
- `REPLACE_PASSWORD_HERE` : with your Roku Dev password
- `REPLACE_IP_ADDRESS_HERE` : with your Roku TV local IP address
```
curl https://raw.githubusercontent.com/iBicha/playlet/main/install.sh | ROKU_DEV_TARGET=REPLACE_IP_ADDRESS_HERE DEVPASSWORD=REPLACE_PASSWORD_HERE sh
```
Example:
```
curl https://raw.githubusercontent.com/iBicha/playlet/main/install.sh | ROKU_DEV_TARGET=192.168.1.2 DEVPASSWORD=1234 sh
```
If successful, you should see some output on your terminal, with `Status: 200`.
#### Install Playlet (Manual)
1. Go to `https://github.com/iBicha/playlet/releases` and download `playlet.zip`
2. Open `http://REPLACE_IP_ADDRESS_HERE/` (e.g. http://192.168.1.2/) in your browser
-30
View File
@@ -1,30 +0,0 @@
# Installs the playlet.zip app as a dev channel
if [ -z "$ROKU_DEV_TARGET" ];
then
echo "Variable ROKU_DEV_TARGET is not set. What is your Roku TV IP address? Example: 192.168.1.2";
read ROKU_DEV_TARGET
fi
if [ -z "$DEVPASSWORD" ];
then
echo "Variable DEVPASSWORD is not set. What is your Roku Dev password? Example: 1234";
read DEVPASSWORD
fi
tmp_folder=$(mktemp -d)
tmp_zip_file="$tmp_folder/playlet.zip"
tmp_http_response_file="$tmp_folder/roku-response.html"
echo "Downloading archive to temporary folder ..."
# TODO: Check for curl, use wget if curl is not available
curl -L https://github.com/iBicha/playlet/releases/latest/download/playlet.zip -o $tmp_zip_file
echo "Installing app on device at $ROKU_DEV_TARGET ..."
curl --user rokudev:$DEVPASSWORD --digest --silent --show-error -F "mysubmit=Install" -F "archive=@$tmp_zip_file" --output $tmp_http_response_file --write-out "Status: %{http_code}" http://$ROKU_DEV_TARGET/plugin_install
echo "\nDeleting temporary folder ..."
rm -rf $tmp_folder
+191 -85
View File
@@ -1,33 +1,34 @@
{
"name": "playlet",
"version": "0.6.0",
"version": "0.9.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "playlet",
"version": "0.6.0",
"version": "0.9.0",
"hasInstallScript": true,
"dependencies": {
"bslib": "npm:@rokucommunity/bslib@^0.1.1",
"log": "npm:roku-log@^0.9.3",
"roku-requests": "^1.1.0"
"roku-requests": "^1.2.0"
},
"devDependencies": {
"@rokucommunity/bslint": "^0.8.1",
"@types/node": "^18.11.18",
"@rokucommunity/bslint": "^0.8.3",
"@types/node": "^18.15.13",
"argparse": "^2.0.1",
"brighterscript": "^0.61.3",
"brighterscript-formatter": "^1.6.23",
"brighterscript": "^0.64.2",
"brighterscript-formatter": "^1.6.26",
"convert-svg-to-png": "^0.6.4",
"dotenv": "^16.0.3",
"express": "^4.18.2",
"ip": "^1.1.8",
"roku-log-bsc-plugin": "^0.7.0",
"ropm": "^0.10.11",
"semver": "^7.3.8",
"ropm": "^0.10.13",
"semver": "^7.5.0",
"shelljs": "^0.8.5",
"ts-node": "^10.9.1",
"typescript": "^4.9.5"
"typescript": "^5.0.4"
},
"engines": {
"node": "<19.0.0"
@@ -46,18 +47,18 @@
}
},
"node_modules/@jridgewell/resolve-uri": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz",
"integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==",
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz",
"integrity": "sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==",
"dev": true,
"engines": {
"node": ">=6.0.0"
}
},
"node_modules/@jridgewell/sourcemap-codec": {
"version": "1.4.14",
"resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz",
"integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==",
"version": "1.4.15",
"resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz",
"integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==",
"dev": true
},
"node_modules/@jridgewell/trace-mapping": {
@@ -112,9 +113,9 @@
"dev": true
},
"node_modules/@rokucommunity/bslint": {
"version": "0.8.1",
"resolved": "https://registry.npmjs.org/@rokucommunity/bslint/-/bslint-0.8.1.tgz",
"integrity": "sha512-G4XhWHMZzq6HJiNazd3Vpg8mstYkbOk6dQC4JD7vmBlSVqm0KkITmZRNlumn/x1v60E9dGONP89MkoBz3/DHaA==",
"version": "0.8.3",
"resolved": "https://registry.npmjs.org/@rokucommunity/bslint/-/bslint-0.8.3.tgz",
"integrity": "sha512-CgUemN0evVIQ1CriO2EXkcKlvtbSZn4iq5yKSzZIwjulHPeIJLfVaiX6mX1HE1tiWnJJHOQsc8OtBgBCFQCO2A==",
"dev": true,
"dependencies": {
"fs-extra": "^10.0.0",
@@ -154,9 +155,9 @@
"dev": true
},
"node_modules/@types/node": {
"version": "18.11.18",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.18.tgz",
"integrity": "sha512-DHQpWGjyQKSHj3ebjFI/wRKcqQcdR+MoFBygntYOZytCqNfkd2ZC4ARDJ2DQqhjH5p85Nnd3jhUJIXrszFX/JA==",
"version": "18.15.13",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.13.tgz",
"integrity": "sha512-N+0kuo9KgrUQ1Sn/ifDXsvg0TTleP7rIy4zOBGECxAljqvqfqpTfzx0Q1NUedOixRMBfe2Whhb056a42cWs26Q==",
"dev": true
},
"node_modules/@types/yauzl": {
@@ -479,9 +480,9 @@
}
},
"node_modules/bl/node_modules/readable-stream": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz",
"integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==",
"version": "3.6.2",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz",
"integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==",
"dev": true,
"dependencies": {
"inherits": "^2.0.3",
@@ -545,9 +546,9 @@
}
},
"node_modules/brighterscript": {
"version": "0.61.3",
"resolved": "https://registry.npmjs.org/brighterscript/-/brighterscript-0.61.3.tgz",
"integrity": "sha512-8BDpOSCdmkS/QcTdPTUW/99nCBypuoa/Zz6PZHI6OiVylqTBidtrGI7lBZotqY6yvQ3KJl24thhLHK5XuIT/6w==",
"version": "0.64.2",
"resolved": "https://registry.npmjs.org/brighterscript/-/brighterscript-0.64.2.tgz",
"integrity": "sha512-FoPsHDa3y89qPMoDH7zGuPdFXNFlfWXdXFgWIGPymdVgywLLFaphlj7mdlX+ZdTeVcXybjVWKfyjrPRbNzJZxA==",
"dev": true,
"dependencies": {
"@rokucommunity/bslib": "^0.1.1",
@@ -571,14 +572,14 @@
"p-settle": "^2.1.0",
"parse-ms": "^2.1.0",
"require-relative": "^0.8.7",
"roku-deploy": "^3.9.3",
"roku-deploy": "^3.10.1",
"serialize-error": "^7.0.1",
"source-map": "^0.7.4",
"vscode-languageserver": "7.0.0",
"vscode-languageserver-protocol": "3.16.0",
"vscode-languageserver-textdocument": "^1.0.1",
"vscode-uri": "^2.1.1",
"xml2js": "^0.4.19",
"xml2js": "^0.5.0",
"yargs": "^16.2.0"
},
"bin": {
@@ -586,12 +587,12 @@
}
},
"node_modules/brighterscript-formatter": {
"version": "1.6.23",
"resolved": "https://registry.npmjs.org/brighterscript-formatter/-/brighterscript-formatter-1.6.23.tgz",
"integrity": "sha512-nLxWG3fR8FK5LY7Olj/RpZ/Rq+qpB+c4Nfb26Fg6Db0S3/VORpLNpAG3+Pi6eR5gxSlWBjFmH1XZfGQIiEdnoQ==",
"version": "1.6.26",
"resolved": "https://registry.npmjs.org/brighterscript-formatter/-/brighterscript-formatter-1.6.26.tgz",
"integrity": "sha512-IT5BV+9HTr6Af23gB7hxH0Xyv8v0LIsLSsrKUFfmwHtJ1ILRI6kiyZDbZOlolYVPuX7y+0ed791CZGxfAIgm6w==",
"dev": true,
"dependencies": {
"brighterscript": "^0.61.3",
"brighterscript": "^0.64.2",
"glob-all": "^3.3.0",
"jsonc-parser": "^3.0.0",
"source-map": "^0.7.3",
@@ -682,9 +683,9 @@
}
},
"node_modules/brighterscript-formatter/node_modules/yargs": {
"version": "17.6.2",
"resolved": "https://registry.npmjs.org/yargs/-/yargs-17.6.2.tgz",
"integrity": "sha512-1/9UrdHjDZc0eOU0HxOHoS78C69UD3JRMvzlJ7S79S2nTaWRA/whGCTV8o9e/N/1Va9YIV7Q4sOxD8VV4pCWOw==",
"version": "17.7.1",
"resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.1.tgz",
"integrity": "sha512-cwiTb08Xuv5fqF4AovYacTFNxk62th7LKJ6BL9IGUpTJrWoU7/7WdQGTP2SjKf1dUNBGzDd28p/Yfs/GI6JrLw==",
"dev": true,
"dependencies": {
"cliui": "^8.0.1",
@@ -1529,9 +1530,9 @@
}
},
"node_modules/entities": {
"version": "4.4.0",
"resolved": "https://registry.npmjs.org/entities/-/entities-4.4.0.tgz",
"integrity": "sha512-oYp7156SP8LkeGD0GF85ad1X9Ai79WtRsZ2gxJqtBuzH+98YUV6jkHEKlZkMbcrjJjIVJNIDP/3WL9wQkoPbWA==",
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz",
"integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==",
"dev": true,
"engines": {
"node": ">=0.12"
@@ -2035,9 +2036,9 @@
}
},
"node_modules/graceful-fs": {
"version": "4.2.10",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz",
"integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==",
"version": "4.2.11",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz",
"integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==",
"dev": true
},
"node_modules/har-schema": {
@@ -2097,9 +2098,9 @@
}
},
"node_modules/htmlparser2": {
"version": "8.0.1",
"resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-8.0.1.tgz",
"integrity": "sha512-4lVbmc1diZC7GUJQtRQ5yBAeUCL1exyMwmForWkRLnwyzWBFxN633SALPMGYaWZvKe9j1pRZJpauvmxENSp/EA==",
"version": "8.0.2",
"resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-8.0.2.tgz",
"integrity": "sha512-GYdjWKDkbRLkZ5geuHs5NY1puJ+PXwP7+fHPRz06Eirsb9ugf6d8kkXav6ADhcODhFFPMIXyxkxSuMf3D6NCFA==",
"dev": true,
"funding": [
"https://github.com/fb55/htmlparser2?sponsor=1",
@@ -2110,9 +2111,9 @@
],
"dependencies": {
"domelementtype": "^2.3.0",
"domhandler": "^5.0.2",
"domhandler": "^5.0.3",
"domutils": "^3.0.1",
"entities": "^4.3.0"
"entities": "^4.4.0"
}
},
"node_modules/http-errors": {
@@ -2263,6 +2264,15 @@
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
"dev": true
},
"node_modules/interpret": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/interpret/-/interpret-1.4.0.tgz",
"integrity": "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==",
"dev": true,
"engines": {
"node": ">= 0.10"
}
},
"node_modules/ip": {
"version": "1.1.8",
"resolved": "https://registry.npmjs.org/ip/-/ip-1.1.8.tgz",
@@ -2290,6 +2300,18 @@
"node": ">=8"
}
},
"node_modules/is-core-module": {
"version": "2.12.0",
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.12.0.tgz",
"integrity": "sha512-RECHCBCd/viahWmwj6enj19sKbHfJrddi/6cBDsNTKbNq0f7VeaUkBo60BqzvPqo/W54ChS62Z5qyun7cfOMqQ==",
"dev": true,
"dependencies": {
"has": "^1.0.3"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/is-extglob": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
@@ -2957,6 +2979,12 @@
"node": ">=0.10.0"
}
},
"node_modules/path-parse": {
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz",
"integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==",
"dev": true
},
"node_modules/path-to-regexp": {
"version": "0.1.7",
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
@@ -3077,7 +3105,7 @@
"version": "13.7.0",
"resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-13.7.0.tgz",
"integrity": "sha512-U1uufzBjz3+PkpCxFrWzh4OrMIdIb2ztzCu0YEPfRHjHswcSwHZswnK+WdsOQJsRV8WeTg3jLhJR4D867+fjsA==",
"deprecated": "< 18.1.0 is no longer supported",
"deprecated": "< 19.4.0 is no longer supported",
"dev": true,
"hasInstallScript": true,
"dependencies": {
@@ -3181,9 +3209,9 @@
}
},
"node_modules/readable-stream": {
"version": "2.3.7",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz",
"integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==",
"version": "2.3.8",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz",
"integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==",
"dev": true,
"dependencies": {
"core-util-is": "~1.0.0",
@@ -3213,6 +3241,18 @@
"node": ">=8.10.0"
}
},
"node_modules/rechoir": {
"version": "0.6.2",
"resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz",
"integrity": "sha512-HFM8rkZ+i3zrV+4LQjwQ0W+ez98pApMGM3HUrN04j3CqzPOzl9nmP15Y8YXNm8QHGv/eacOVEjqhmWpkRV0NAw==",
"dev": true,
"dependencies": {
"resolve": "^1.1.6"
},
"engines": {
"node": ">= 0.10"
}
},
"node_modules/regexp-to-ast": {
"version": "0.5.0",
"resolved": "https://registry.npmjs.org/regexp-to-ast/-/regexp-to-ast-0.5.0.tgz",
@@ -3281,6 +3321,23 @@
"integrity": "sha512-AKGr4qvHiryxRb19m3PsLRGuKVAbJLUD7E6eOaHkfKhwc+vSgVOCY5xNvm9EkolBKTOf0GrQAZKLimOCz81Khg==",
"dev": true
},
"node_modules/resolve": {
"version": "1.22.2",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.2.tgz",
"integrity": "sha512-Sb+mjNHOULsBv818T40qSPeRiuWLyaGMa5ewydRLFimneixmVy2zdivRl+AF6jaYPC8ERxGDmFSiqui6SfPd+g==",
"dev": true,
"dependencies": {
"is-core-module": "^2.11.0",
"path-parse": "^1.0.7",
"supports-preserve-symlinks-flag": "^1.0.0"
},
"bin": {
"resolve": "bin/resolve"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/reusify": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz",
@@ -3327,25 +3384,25 @@
}
},
"node_modules/roku-deploy": {
"version": "3.9.3",
"resolved": "https://registry.npmjs.org/roku-deploy/-/roku-deploy-3.9.3.tgz",
"integrity": "sha512-cjTx5ffZNt07rQS+0s2sTBHkZKUk283y9f6UnbI77X03lQ60vYlCnqsKswWisFYMHPIdvsTLLSfKsshAPwKHEQ==",
"version": "3.10.1",
"resolved": "https://registry.npmjs.org/roku-deploy/-/roku-deploy-3.10.1.tgz",
"integrity": "sha512-utPNny0a2m/N0AQT6zyVLXtrr81KR5QeJqPUbc59VBcqGM+WIi7rQ9hBLmp5dFqIo/7JVKQYFs+nFGebOA6F7w==",
"dev": true,
"dependencies": {
"chalk": "^2.4.2",
"dateformat": "^3.0.3",
"dayjs": "^1.11.0",
"fast-glob": "^3.2.11",
"fast-glob": "^3.2.12",
"fs-extra": "^7.0.1",
"is-glob": "^4.0.3",
"jsonc-parser": "^2.3.0",
"jszip": "^3.6.0",
"micromatch": "^4.0.4",
"moment": "^2.29.1",
"parse-ms": "^2.1.0",
"picomatch": "^2.2.1",
"request": "^2.88.0",
"temp-dir": "^2.0.0",
"xml2js": "^0.4.23"
"xml2js": "^0.5.0"
},
"bin": {
"roku-deploy": "dist/cli.js"
@@ -3399,9 +3456,9 @@
}
},
"node_modules/roku-log-bsc-plugin/node_modules/@types/node": {
"version": "14.18.36",
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.36.tgz",
"integrity": "sha512-FXKWbsJ6a1hIrRxv+FoukuHnGTgEzKYGi7kilfMae96AL9UNkPFNWJEEYWzdRI9ooIkbr4AKldyuSTLql06vLQ==",
"version": "14.18.42",
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.42.tgz",
"integrity": "sha512-xefu+RBie4xWlK8hwAzGh3npDz/4VhF6icY/shU+zv/1fNn+ZVG7T7CRwe9LId9sAYRPxI+59QBPuKL3WpyGRg==",
"dev": true
},
"node_modules/roku-log-bsc-plugin/node_modules/vscode-jsonrpc": {
@@ -3442,25 +3499,25 @@
"dev": true
},
"node_modules/roku-requests": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/roku-requests/-/roku-requests-1.1.0.tgz",
"integrity": "sha512-Jnyn1WENAAgbi2cDsZXh8GN2O/9C3J11pQj6u/K3dqxjLPuTzUmGnZSrmF9NvK8t6ChGbaGc8Z4F0SzHYwTQNQ=="
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/roku-requests/-/roku-requests-1.2.0.tgz",
"integrity": "sha512-X6XakmJwxT8H+YNvjZOwH+k8rmYpD5o47k37WyZJ/brrSD6cw9xbNdxO203nz6jpso4maQJGwSJvLGZpzSQ0AA=="
},
"node_modules/ropm": {
"version": "0.10.11",
"resolved": "https://registry.npmjs.org/ropm/-/ropm-0.10.11.tgz",
"integrity": "sha512-D9Nfi2tuB32d9gJFdyBdUw6+sBo4lwG2trkL9S0jHJCKqAQWs6tgkmDRd+pp6ZrKEKSK1V2y0bi8xFOi2Rjr+Q==",
"version": "0.10.13",
"resolved": "https://registry.npmjs.org/ropm/-/ropm-0.10.13.tgz",
"integrity": "sha512-WlYorFMbnZGaNbKEXb6RX64wLOE/RHttzDuuQBkf2J7HbgQHseLbVdHBVaAb+SiS7BLK5xzJOoTsFbV2YTXsvg==",
"dev": true,
"dependencies": {
"@xml-tools/ast": "^5.0.5",
"@xml-tools/parser": "1.0.10",
"brighterscript": "^0.61.3",
"brighterscript": "^0.64.2",
"del": "6.0.0",
"fs-extra": "9.1.0",
"glob-all": "3.2.1",
"latinize": "0.5.0",
"npm-packlist": "2.1.4",
"roku-deploy": "^3.9.3",
"roku-deploy": "^3.10.1",
"semver": "7.3.4",
"yargs": "16.2.0"
},
@@ -3727,9 +3784,9 @@
"dev": true
},
"node_modules/semver": {
"version": "7.3.8",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz",
"integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==",
"version": "7.5.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.5.0.tgz",
"integrity": "sha512-+XC0AD/R7Q2mPSRuy2Id0+CGTZ98+8f+KvwirxOKIEyid+XSx6HbC63p+O4IndTHuX5Z+JxQ0TghCkO5Cg/2HA==",
"dev": true,
"dependencies": {
"lru-cache": "^6.0.0"
@@ -3819,6 +3876,43 @@
"integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==",
"dev": true
},
"node_modules/shelljs": {
"version": "0.8.5",
"resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.5.tgz",
"integrity": "sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow==",
"dev": true,
"dependencies": {
"glob": "^7.0.0",
"interpret": "^1.0.0",
"rechoir": "^0.6.2"
},
"bin": {
"shjs": "bin/shjs"
},
"engines": {
"node": ">=4"
}
},
"node_modules/shelljs/node_modules/glob": {
"version": "7.2.3",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
"integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==",
"dev": true,
"dependencies": {
"fs.realpath": "^1.0.0",
"inflight": "^1.0.4",
"inherits": "2",
"minimatch": "^3.1.1",
"once": "^1.3.0",
"path-is-absolute": "^1.0.0"
},
"engines": {
"node": "*"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/side-channel": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz",
@@ -3952,6 +4046,18 @@
"node": ">=4"
}
},
"node_modules/supports-preserve-symlinks-flag": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz",
"integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==",
"dev": true,
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/tar-fs": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.1.tgz",
@@ -3981,9 +4087,9 @@
}
},
"node_modules/tar-stream/node_modules/readable-stream": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz",
"integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==",
"version": "3.6.2",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz",
"integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==",
"dev": true,
"dependencies": {
"inherits": "^2.0.3",
@@ -4148,16 +4254,16 @@
}
},
"node_modules/typescript": {
"version": "4.9.5",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz",
"integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==",
"version": "5.0.4",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.4.tgz",
"integrity": "sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==",
"dev": true,
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
},
"engines": {
"node": ">=4.2.0"
"node": ">=12.20"
}
},
"node_modules/unbzip2-stream": {
@@ -4323,9 +4429,9 @@
}
},
"node_modules/which-module": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz",
"integrity": "sha512-B+enWhmw6cjfVC7kS8Pj9pCrKSc5txArRyaYGe088shv/FGWH+0Rjx/xPgtsWfsUtS27FkP697E4DDhgrgoc0Q==",
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.1.tgz",
"integrity": "sha512-iBdZ57RDvnOR9AGBhML2vFZf7h8vmBjhoaZqODJBFWHVtKkDmKuHai3cx5PgVMrX5YDNp27AofYbAwctSS+vhQ==",
"dev": true
},
"node_modules/wrap-ansi": {
@@ -4403,9 +4509,9 @@
}
},
"node_modules/xml2js": {
"version": "0.4.23",
"resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.23.tgz",
"integrity": "sha512-ySPiMjM0+pLDftHgXY4By0uswI3SPKLDw/i3UXbnO8M/p28zqexCUoPmQFrYD+/1BzhGJSs2i1ERWKJAtiLrug==",
"version": "0.5.0",
"resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.5.0.tgz",
"integrity": "sha512-drPFnkQJik/O+uPKpqSgr22mpuFHqKdbS835iAQrUC73L2F5WkboIRd63ai/2Yg6I1jzifPFKH2NTK+cfglkIA==",
"dev": true,
"dependencies": {
"sax": ">=0.6.0",
+14 -10
View File
@@ -1,27 +1,28 @@
{
"name": "playlet",
"version": "0.7.0",
"version": "0.9.0",
"description": "Unofficial Youtube client for Roku",
"dependencies": {
"bslib": "npm:@rokucommunity/bslib@^0.1.1",
"log": "npm:roku-log@^0.9.3",
"roku-requests": "^1.1.0"
"roku-requests": "^1.2.0"
},
"devDependencies": {
"@rokucommunity/bslint": "^0.8.1",
"@types/node": "^18.11.18",
"@rokucommunity/bslint": "^0.8.3",
"@types/node": "^18.15.13",
"argparse": "^2.0.1",
"brighterscript": "^0.61.3",
"brighterscript-formatter": "^1.6.23",
"brighterscript": "^0.64.2",
"brighterscript-formatter": "^1.6.26",
"convert-svg-to-png": "^0.6.4",
"dotenv": "^16.0.3",
"express": "^4.18.2",
"ip": "^1.1.8",
"roku-log-bsc-plugin": "^0.7.0",
"ropm": "^0.10.11",
"semver": "^7.3.8",
"ropm": "^0.10.13",
"semver": "^7.5.0",
"shelljs": "^0.8.5",
"ts-node": "^10.9.1",
"typescript": "^4.9.5"
"typescript": "^5.0.4"
},
"engines": {
"node": "<19.0.0"
@@ -37,7 +38,8 @@
"prebuild": "rm -rf dist",
"build:dev": "npm run build:web && npm run build:lib:dev && npm run build:app:dev",
"build:prod": "npm run build:web && npm run build:lib:prod && npm run build:app:prod",
"build:release": "npm run format:fix && npm run lint:fix && npm run manifest-version && npm run generate-images && npm run build:prod && npm run sign-package",
"build:release": "npm run build:release:ci && npm run sign-package",
"build:release:ci": "npm run format:fix && npm run lint:fix && npm run manifest-version && npm run manifest-git-hash && npm run build:prod",
"build:app": "cd playlet && bsc --create-package --lintConfig ../config/bslint.jsonc",
"build:app:dev": "npm run build:app -- --debug=true",
"build:app:prod": "npm run build:app -- --debug=false --sourceMap=false",
@@ -52,9 +54,11 @@
"format:fix": "npm run format:base -- --write",
"generate-images": "node tools/generate-images.js",
"manifest-version": "node tools/update-manifest-version.js",
"manifest-git-hash": "node tools/update-manifest-git-hash.js",
"sign-package": "node tools/sign-package.js",
"screenshot": "node tools/screenshot.js",
"profile-sync": "node tools/profile-sync.js",
"generate-sponsorblock-config": "node tools/generate-sponsorblock-config.js",
"postinstall": "npx ropm copy && cd playlet-web && npm install"
}
}
@@ -0,0 +1,52 @@
import "pkg:/source/utils/General.bs"
import "pkg:/components/AppInfoScreen/AppVersionTask.bs"
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"
}
m.keyValueList = m.top.findNode("KeyValueListContent")
m.appInfo = GetAppInfo()
m.appInfo["lib_version_latest"] = "N/A"
m.appInfo["lib_url"] = "N/A"
m.appInfo["lib_url_type"] = "N/A"
scene = m.top.getScene()
if scene.playletLibLoadedUrl <> invalid
m.appInfo["lib_url"] = scene.playletLibLoadedUrl.link
m.appInfo["lib_url_type"] = scene.playletLibLoadedUrl.type
end if
UpdateKeyValueList()
GetLatestVersion()
end function
function UpdateKeyValueList()
while m.keyValueList.getChildCount() > 0
m.keyValueList.removeChildIndex(0)
end while
for each item in m.appInfo
value = `${m.displayNames[item]}: ${m.appInfo[item]}`
contentNode = m.keyValueList.createChild("ContentNode")
contentNode.title = value
end for
end function
function GetLatestVersion()
StartAsyncTask(AppVersionTask, {}, function(output as object) as void
if output.result.latest <> invalid
m.appInfo["lib_version_latest"] = output.result.latest
UpdateKeyValueList()
end if
end function)
end function
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<component name="AppInfoScreen" extends="Group">
<interface>
</interface>
<children>
<LabelList
translation="[160,92]"
itemSize="[1020,48]"
font='font:SmallestBoldSystemFont'>
<ContentNode id="KeyValueListContent" role="content">
</ContentNode>
</LabelList>
</children>
</component>
@@ -57,10 +57,15 @@ function StartFetchTask() as void
StartAsyncTask(GetHomeScreenContent, {
index: currentLoadingIndex,
requestData: m.defaultLayout[currentLoadingIndex]
}, function(output as object)
}, function(output as object) as void
' TODO: this whole logic is not good.
' The view should have placeholder, and child nodes get replaced as
' They get ready.
if output = invalid
StartFetchTask()
return
end if
m.sortedContent.Push(output.result)
if output.result.rootChildren.Count() > 0
+20 -21
View File
@@ -15,11 +15,25 @@ function Init()
m.currentFocued = m.homeGridScreen
m.settingsScreen = m.top.findNode("SettingsScreen")
m.appInfoScreen = m.top.findNode("AppInfoScreen")
m.searchScreen = m.top.findNode("SearchScreen")
m.searchScreen.ObserveField("escape", "OnSearchScreenEscape")
m.navBar = m.top.findNode("NavBar")
m.navBarScreens = [{
node: m.searchScreen,
canEscape: true
}, {
node: m.homeGridScreen,
canEscape: true
}, {
node: m.settingsScreen,
canEscape: false
}, {
node: m.appInfoScreen,
canEscape: false
}]
m.navBar.ObserveField("escapeIndex", "OnNavBarEscape")
m.navBar.ObserveField("focusIndex", "OnNavIndexChange")
@@ -54,14 +68,9 @@ end function
function OnNavBarEscape()
index = m.navBar.escapeIndex
if index = 0
m.searchScreen.focus = true
m.currentFocued = m.searchScreen
else if index = 1
m.homeGridScreen.focus = true
m.currentFocued = m.homeGridScreen
else if index = 2
m.settingsScreen.focus = true
m.navBarScreens[index].node.focus = true
if m.navBarScreens[index].canEscape
m.currentFocued = m.navBarScreens[index].node
end if
end function
@@ -70,19 +79,9 @@ function OnNavIndexChange() as void
if index = -1
return
end if
if index = 0
m.searchScreen.visible = true
m.homeGridScreen.visible = false
m.settingsScreen.visible = false
else if index = 1
m.searchScreen.visible = false
m.homeGridScreen.visible = true
m.settingsScreen.visible = false
else if index = 2
m.searchScreen.visible = false
m.homeGridScreen.visible = false
m.settingsScreen.visible = true
end if
for i = 0 to m.navBarScreens.count() - 1
m.navBarScreens[i].node.visible = i = index
end for
end function
function OnWebServerLogin()
+1
View File
@@ -5,6 +5,7 @@
<SearchScreen id="SearchScreen" visible="false" />
<HomeGridScreen id="HomeGridScreen" />
<SettingsScreen id="SettingsScreen" visible="false" />
<AppInfoScreen id="AppInfoScreen" visible="false" />
<NavBar id="NavBar" />
<VideoContainer id="VideoContainer" />
</children>
+10 -1
View File
@@ -4,7 +4,7 @@
<interface>
<field id="focusIndex" type="int" alwaysNotify="true" />
<field id="escapeIndex" type="int" alwaysNotify="true" />
</interface>
</interface>
<children>
<Rectangle
height="720"
@@ -42,6 +42,15 @@
text="Settings"
height="50"
width="80" />
<IconButton
id="appInfoButton"
background="#242424"
focusBackground="#ff1c30"
padding="20"
icon="pkg:/images/icons/info.png"
text="Info"
height="50"
width="80" />
</ButtonGroup>
</Rectangle>
</children>
@@ -1,23 +1,9 @@
import "pkg:/source/utils/General.bs"
import "pkg:/source/utils/StringUtils.bs"
import "pkg:/source/asyncTask/asyncTask.bs"
import "pkg:/components/SettingsScreen/AppVersionTask.bs"
function Init()
m.versionLabel = m.top.findNode("VersionLabel")
m.playletLibUrlLabel = m.top.findNode("PlayletLibUrlLabel")
m.top.url = `http://${GetLocalIpAddress()}:8888`
appInfo = GetAppInfo()
m.top.appVersion = appInfo.version
m.top.libVersion = appInfo.lib_version
scene = m.top.getScene()
if scene.playletLibLoadedUrl <> invalid
m.top.libUrl = `[${scene.playletLibLoadedUrl.type}|${scene.playletLibLoadedUrl.link}]`
end if
GetLatestVersion()
end function
function OnUrlSet()
@@ -29,19 +15,3 @@ function OnUrlSet()
urlLabel = m.top.findNode("urlLabel")
urlLabel.text = url
end function
function GetLatestVersion()
StartAsyncTask(AppVersionTask, {}, function(output as object) as void
if output.result.latest <> invalid
m.top.latestVersion = output.result.latest
end if
end function)
end function
function SetVersionLabel()
m.versionLabel.text = `Playlet: ${m.top.appVersion} | Playlet-Lib: ${m.top.libVersion} | Latest: ${m.top.latestVersion}`
end function
function SetPlayletLibUrlLabel()
m.playletLibUrlLabel.text = `Playlet-Lib: ${m.top.libUrl}`
end function
@@ -2,28 +2,16 @@
<component name="SettingsScreen" extends="Group">
<interface>
<field id="appVersion" type="string" value="N/A" onChange="SetVersionLabel" />
<field id="libVersion" type="string" value="N/A" onChange="SetVersionLabel" />
<field id="latestVersion" type="string" value="N/A" onChange="SetVersionLabel" />
<field id="libUrl" type="string" value="N/A" onChange="SetPlayletLibUrlLabel" />
<field id="url" type="string" onChange="OnUrlSet" />
</interface>
<children>
<Label
id='VersionLabel'
height='60'
width='1280'
font='font:MediumBoldSystemFont'
horizAlign="center"
translation="[0,80]"
/>
<Label
id='PlayletLibUrlLabel'
height='60'
width='1280'
font='font:SmallestBoldSystemFont'
horizAlign="center"
translation="[0,120]"
translation="[0,92]"
text="Open in a web browser to configure Playlet:"
/>
<QRPoster
id='SettingsQRPoster'
@@ -0,0 +1,65 @@
import "pkg:/source/services/SponsorBlock.bs"
function Init()
m.categoryLabel = m.top.findNode("categoryLabel")
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", "OnAnimationState")
m.animationTimer.observeField("fire", "OnAnimationTimer")
end function
function OnSegmentSet()
category = m.top.segment.category
categoryTitle = SponsorBlock.SegmentShortTitle(category)
m.categoryLabel.text = "Skipped" + chr(10) + categoryTitle
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", "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.state = "running"
return
end if
' Check if we are already at the destination
if m.translationAnimation.state = "stopped"
if reverse
destination = m.translationAnimationInterpolator.keyValue[0][0]
else
destination = m.translationAnimationInterpolator.keyValue[1][0]
end if
current = m.top.translation[0]
if current = destination
return
end if
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,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<component name="SponsorBlockNotification" extends="Group">
<interface>
<field id="segment" type="assocarray" onChange="OnSegmentSet" />
</interface>
<children>
<Rectangle
width="250"
height="70"
color="#414141"
opacity="0.8">
<Poster
uri="libpkg:/images/LogoSponsorBlockSimple256px.png"
width="50"
height="50"
translation="[10,10]">
</Poster>
<Label
id="categoryLabel"
text="..."
font="font:SmallestBoldSystemFont"
lineSpacing="5"
horizAlign="center"
vertAlign="center"
wrap="true"
width="170"
height="70"
translation="[70,0]">
</Label>
</Rectangle>
<Animation
id="translationAnimation"
duration="0.3"
optional="true">
<Vector2DFieldInterpolator
id="translationAnimationInterpolator"
key="[0.0, 0.5, 1.0]"
keyValue="[ [1280.0, 20.0], [1140.0, 20.0], [1000.0, 20.0] ]"
fieldToInterp="SponsorBlockNotification.translation" />
</Animation>
<Timer
id="animationTimer"
duration="3"
/>
</children>
</component>
@@ -0,0 +1,27 @@
import "pkg:/components/VideoPlayer/Video.bs"
function ShowSponsorBlockNotifcation(segment as object)
videoContainer = GetVideoContainer()
notification = videoContainer.findNode("sponsorBlockNotification")
if notification = invalid
notification = videoContainer.createChild("SponsorBlockNotification")
notification.id = "sponsorBlockNotification"
end if
notification.segment = segment
end function
function RemoveSponsorBlockNotifcation()
videoContainer = GetVideoContainer()
notification = videoContainer.findNode("sponsorBlockNotification")
if notification <> invalid
videoContainer.RemoveChild(notification)
end if
end function
function SponsorBlockNotifcationSetVisible(visible as boolean)
videoContainer = GetVideoContainer()
notification = videoContainer.findNode("sponsorBlockNotification")
if notification <> invalid
notification.visible = visible
end if
end function
@@ -0,0 +1,11 @@
import "pkg:/source/services/Invidious.bs"
@asynctask
function MarkVideoWatchedTask(input as object) as object
videoId = input.videoId
success = Invidious.MarkVideoWatched(videoId)
return {
success: success
}
end function
@@ -1,5 +1,8 @@
import "pkg:/source/asyncTask/asyncTask.bs"
import "pkg:/source/services/Invidious.bs"
import "pkg:/components/Dialog/DialogUtils.bs"
import "pkg:/components/SponsorBlockNotification/SponsorBlockNotificationManager.bs"
import "pkg:/components/VideoPlayer/MarkVideoWatchedTask.bs"
function PlayVideo(videoId as string, args = invalid as object)
sender = args?.sender
@@ -23,6 +26,7 @@ function PlayVideo(videoId as string, args = invalid as object)
videoContainer.sender = sender
end if
videoContainer.videoPlayer = videoContainer.createChild("VideoPlayer")
videoContainer.insertChild(videoContainer.videoPlayer, 0)
videoContainer.videoPlayer.id = "VideoPlayer"
videoContainer.videoPlayer.metadata = metadata
videoContainer.videoPlayer.videoId = videoId
@@ -33,6 +37,8 @@ function PlayVideo(videoId as string, args = invalid as object)
if videoContainer.fullscreen
videoContainer.videoPlayer.SetFocus(true)
end if
StartAsyncTask(MarkVideoWatchedTask, { videoId: videoId })
end function
function CloseVideo(setFocus = true as boolean)
@@ -49,6 +55,7 @@ function CloseVideo(setFocus = true as boolean)
videoContainer.sender.SetFocus(true)
end if
end if
SponsorBlockNotifcationSetVisible(false)
end function
function ToggleVideoPictureInPicture(sender = invalid as object) as boolean
@@ -4,6 +4,8 @@ import "pkg:/components/VideoPlayer/Video.bs"
import "pkg:/components/VideoPlayer/VideoDetailsTask.bs"
function Init()
m.videoContainer = GetVideoContainer()
SetupSponsorBlock()
SetupAnimation()
SetupBusySpinner()
@@ -12,7 +14,6 @@ function Init()
m.top.bufferingBar.filledBarBlendColor = "0xFF0000FF"
m.top.retrievingBar.filledBarBlendColor = "0xFF0000FF"
m.videoContainer = GetVideoContainer()
m.top.enableUI = m.videoContainer.fullscreen
m.videoContainer.observeFieldScoped("fullscreen", "OnFullScreenChange")
@@ -86,7 +87,7 @@ function OnVideoDetailsTaskResults(output as object) as void
if videoId <> m.top.videoId
return
end if
if not metadata.success
if (not metadata.success) or (metadata.data = invalid)
m.busySpinner.visible = false
m.busySpinner.control = "stop"
message = `Failed to load video information for ${videoId}`
@@ -335,4 +336,5 @@ function OnFullScreenChange()
m.translationAnimation.control = "start"
m.top.enableUI = m.videoContainer.fullscreen
SponsorBlockNotifcationSetVisible(m.videoContainer.fullscreen)
end function
@@ -1,8 +1,12 @@
import "pkg:/components/VideoPlayer/VideoPlayerCaptionsTask.bs"
function SetCaptions(metadata as object, videoPlayer as object, contentNode as object) as void
if metadata.captions.Count() = 0
return
end if
isoLanguageList = ParseJson(ReadAsciiFile("libpkg:/config/ISO-639-1-to-ISO-639-2T.json"))
' TODO: loop through instances until valid captions are found
' Captions are rate limited https://github.com/iv-org/invidious/issues/2567
instance = InvidiousSettings.GetSelectedInstance()
subtitleTracks = []
@@ -16,4 +20,35 @@ function SetCaptions(metadata as object, videoPlayer as object, contentNode as o
end for
contentNode.ClosedCaptions = True
contentNode.SubtitleTracks = subtitleTracks
' Searching for a working caption could cause a delay in the video player start.
' This is why it is behind a feature flag.
#if CAPTION_INSTANCE_SEARCH
StartAsyncTask(VideoPlayerCaptionsTask, {
videoId: metadata.videoId,
instance: instance,
subtitleTracks: subtitleTracks
}, OnVideoPlayerCaptionsTaskResults)
#end if
end function
function OnVideoPlayerCaptionsTaskResults(output as object) as void
changed = output.result.changed
if not changed
return
end if
videoId = output.result.videoId
if m.top.videoId <> videoId
return
end if
state = m.top.state
contentNode = m.top.content
contentNode.Update({
SubtitleTracks: output.result.subtitleTracks
})
if state = "buffering" or state = "playing"
m.top.control = "play"
end if
end function
@@ -0,0 +1,62 @@
import "pkg:/source/roku_modules/rokurequests/Requests.brs"
import "pkg:/source/services/InvidiousSettings.bs"
@asynctask
function VideoPlayerCaptionsTask(input as object) as object
originalInstance = input.instance
subtitleTracks = input.subtitleTracks
if subtitleTracks.Count() = 0
return {
changed: false
}
end if
track = subtitleTracks[0]
url = track.TrackName
if IsValidSubtitleTrack(url)
return {
changed: false
}
end if
failedInstances = {}
failedInstances[originalInstance] = true
instances = InvidiousSettings.GetCurrentInstances()
for each instance in instances
if failedInstances[instance] = true
continue for
end if
instanceUrl = url.Replace(originalInstance, instance)
if IsValidSubtitleTrack(instanceUrl)
for i = 0 to subtitleTracks.Count() - 1
subtitleTracks[i].TrackName = subtitleTracks[i].TrackName.Replace(originalInstance, instance)
end for
return {
changed: true,
videoId: input.videoId,
subtitleTracks: subtitleTracks
}
else
failedInstances[instance] = true
end if
end for
return {
changed: false
}
end function
function IsValidSubtitleTrack(url as string) as boolean
response = Requests().get(url, { parseJson: false })
' A popular instance will return a valid format
' WEBVTT
' Kind: captions
' Language: en
' But won't include any caption items
return response.ok and response.text.StartsWith("WEBVTT") and response.text.len() > 50
end function
@@ -1,9 +1,13 @@
import "pkg:/source/asyncTask/asyncTask.bs"
import "pkg:/components/VideoPlayer/SponsorBlockTask.bs"
import "pkg:/components/VideoPlayer/SponsorBlockTrackingTask.bs"
import "pkg:/components/SponsorBlockNotification/SponsorBlockNotificationManager.bs"
function SetupSponsorBlock()
PositionChapterLabel()
SponsorBlockNotifcationSetVisible(m.videoContainer.fullscreen)
m.timeLabel = FindTimeLabel()
m.top.trickPlayBar.observeField("visible", "OnTrickPlayBarVisible")
m.chapterLabelTimer = m.top.findNode("chapterLabelTimer")
@@ -123,6 +127,7 @@ function OnPositionChangeSkipSponsorBlockSections() as void
' TODO: if segmentEnd is at the end of the video, close video
m.top.seek = segmentEnd
print("Skipping section:" + segment["category"])
ShowSponsorBlockNotifcation(segment)
SendSkippedSectionEvent(segment.UUID)
return
end if
@@ -87,7 +87,12 @@ function FormatViewCount(viewCount as dynamic) as string
end if
viewCount = viewCount / 1000
return `${FormatFloat(viewCount)}M views`
if viewCount < 1000
return `${FormatFloat(viewCount)}M views`
end if
viewCount = viewCount / 1000
return `${FormatFloat(viewCount)}B views`
end function
function FormatFloat(X as integer) as integer
@@ -31,6 +31,15 @@ namespace Http
RegistryUtils.Delete("search_history")
response.Default(204, "OK")
return true
else if payload.command = "set-playlet-lib-urls"
content = payload.content
if content = invalid
RegistryUtils.Delete("playlet_lib_urls")
else
RegistryUtils.Write("playlet_lib_urls", content)
end if
response.Default(204, "OK")
return true
end if
response.Default(400, `Invalid command: ${payload.command}`)
@@ -36,7 +36,13 @@ namespace Http
' Token is encoded twice for some reason
token = request.query["token"].DecodeUri().DecodeUriComponent()
referer = request.query["ref"].DecodeUri()
InvidiousSettings.SetAuthToken(token, referer)
username = request.query["username"]
' TODO: remove null check after 6 months of https://github.com/iv-org/invidious/pull/3603
if username <> invalid
username = username.DecodeUriComponent().DecodeUriComponent()
end if
InvidiousSettings.SetAuthToken(token, referer, username)
server.task.top.login = true
end if
response.Redirect("/")
@@ -38,7 +38,8 @@ namespace Http
selected_instance: InvidiousSettings.GetSelectedInstance(),
auth_url: Invidious.GetAuthorizeTokenLink(),
logged_in: authToken <> invalid,
logged_in_instance: authToken <> invalid ? authToken.instance : invalid
logged_in_instance: authToken <> invalid ? authToken.instance : invalid,
logged_in_username: authToken <> invalid ? authToken.username : invalid
}
end if
@@ -43,11 +43,12 @@ function WebServerLoop()
return true
end function)
if IsDebugMode()
#if DEBUG
allowedOrigin = "*"
else
#else
allowedOrigin = `http://${GetLocalIpAddress()}:8888`
end if
#end if
m.server.UseRouter(new Http.CorsMiddleware(allowedOrigin))
#if WEB_SOCKETS
m.server.UseRouter(new Http.WebSocketMiddleware())
@@ -58,17 +59,19 @@ function WebServerLoop()
m.server.UseRouter(new Http.StateApiRouter())
m.server.UseRouter(new Http.InvidiousRouter())
m.server.UseRouter(new Http.HttpStaticFilesRouter("/", m.settings.WwwRoot, false, false, false))
if IsDebugMode()
#if DEBUG
m.server.UseRouter(new Http.HttpStaticFilesRouter("/debug/libpkg", "libpkg:/", true, true, false))
m.server.UseRouter(new Http.HttpStaticFilesRouter("/debug/pkg", "pkg:/", true, true))
m.server.UseRouter(new Http.HttpStaticFilesRouter("/debug/tmp", "tmp:/", true, true))
m.server.UseRouter(new Http.HttpStaticFilesRouter("/debug/cachefs", "cachefs:/", true, true))
m.server.UseRouter(new Http.HttpStaticFilesRouter("/debug/common", "common:/", true, true))
end if
#end if
#if WEB_SERVER_BASIC_AUTH
m.server.UseRouter(new Http.BasicAuthMiddleware())
#end if
m.server.UseRouter(new Http.RegistryApiRouter())
#if DEBUG
m.server.UseRouter(new Http.RegistryApiRouter())
#end if
m.server.UseRouter(new Http.HttpDefaultRouter())
timeout = m.settings.Timeout
@@ -5,5 +5,4 @@
<field id="login" type="boolean" alwaysNotify="true" />
<field id="command" type="string" alwaysNotify="true" />
</interface>
<script type="text/brightscript" uri="pkg:/source/utils/Debug.bs" />
</component>
@@ -36,13 +36,11 @@ namespace Web
secondByte = m.ReadByte()
m.is_masked = (secondByte and &h80) <> 0
m.payload_size = secondByte and &h7F
if not m.is_masked
return false
end if
if m.payload_size >= 126
if not m.ReadPayloadSize(secondByte)
return false
end if
@@ -56,13 +54,41 @@ namespace Web
return true
end function
function ReadPayloadSize(secondByte as integer) as boolean
payloadSize = secondByte and &h7F
if payloadSize < 126
m.payload_size = payloadSize
return true
else if payloadSize = 126
payloadSize = (m.ReadByte() << 8) or m.ReadByte()
m.payload_size = payloadSize
return true
else
'TODO: Read size in 8 bytes
return false
end if
end function
function WritePayloadSize(payloadSize as integer)
if payloadSize < 126
m.WriteByte(payloadSize)
else if payloadSize < 65536
m.WriteByte(126)
m.WriteByte(payloadSize >> 8)
m.WriteByte(payloadSize and &hFF)
else
m.WriteByte(127)
'TODO: Write size in 8 bytes
end if
end function
function WriteToBuffer(buffer as object, index as integer, length as integer) as integer
m.buffer = buffer
m.index = index
m.length = length
m.WriteByte(m.fin or m.opcode)
m.WriteByte(m.payload_size)
m.WritePayloadSize(m.payload_size)
for i = 0 to m.payload_size - 1
m.buffer[m.index] = m.payload[i]
@@ -0,0 +1,115 @@
{
"serverAddress": "https://sponsor.ajay.app",
"categoryList": [
"sponsor",
"selfpromo",
"exclusive_access",
"interaction",
"poi_highlight",
"intro",
"outro",
"preview",
"filler",
"chapter",
"music_offtopic"
],
"categories": {
"sponsor": {
"title": "Sponsor",
"short_title": "Sponsor",
"categorySupport": [
"skip",
"mute",
"full"
],
"color": "#00d400B3"
},
"selfpromo": {
"title": "Unpaid/Self Promotion",
"short_title": "Unpaid/Self Promotion",
"categorySupport": [
"skip",
"mute",
"full"
],
"color": "#ffff00B3"
},
"exclusive_access": {
"title": "Exclusive Access",
"short_title": "Exclusive Access",
"categorySupport": [
"full"
],
"color": "#008a5cB3"
},
"interaction": {
"title": "Interaction Reminder (Subscribe)",
"short_title": "Interaction Reminder",
"categorySupport": [
"skip",
"mute"
],
"color": "#cc00ffB3"
},
"poi_highlight": {
"title": "Highlight",
"short_title": "Highlight",
"categorySupport": [
"poi"
],
"color": "#ff1684B3"
},
"intro": {
"title": "Intermission/Intro Animation",
"short_title": "Intermission",
"categorySupport": [
"skip",
"mute"
],
"color": "#00ffffB3"
},
"outro": {
"title": "Endcards/Credits",
"short_title": "Endcards/Credits",
"categorySupport": [
"skip",
"mute"
],
"color": "#0202edB3"
},
"preview": {
"title": "Preview/Recap",
"short_title": "Preview/Recap",
"categorySupport": [
"skip",
"mute"
],
"color": "#008fd6B3"
},
"filler": {
"title": "Filler Tangent/Jokes",
"short_title": "Filler",
"categorySupport": [
"skip",
"mute"
],
"color": "#7300FFE6"
},
"chapter": {
"title": "Chapter",
"short_title": "Chapter",
"categorySupport": [
"chapter"
],
"color": "#FFFFFFC8"
},
"music_offtopic": {
"title": "Music: Non-Music Section",
"short_title": "Non-Music",
"categorySupport": [
"skip"
],
"color": "#ff9900B3"
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

+4 -2
View File
@@ -2,10 +2,12 @@ title=PlayletLib
# Do not update version manually, it is auto updated from package.json
major_version=0
minor_version=7
minor_version=9
build_version=00000
sg_component_libs_provided=PlayletLib
hidden=1
bs_const=DEBUG=false;WEB_SERVER_BASIC_AUTH=false;DASH_THUMBNAILS=false;WEB_SOCKETS=true
git_commit_sha=unknown
bs_const=DEBUG=false;WEB_SERVER_BASIC_AUTH=false;DASH_THUMBNAILS=false;WEB_SOCKETS=true;CAPTION_INSTANCE_SEARCH=false
+23 -4
View File
@@ -13,11 +13,12 @@ namespace Invidious
const STATS_ENDPOINT = "/api/v1/stats"
const VIDEOS_ENDPOINT = "/api/v1/videos"
const HISTORY_ENDPOINT = "/api/v1/auth/history"
const SEARCH_SUGGEST_ENDPOINT = "/api/v1/search/suggestions"
const SEARCH_ENDPOINT = "/api/v1/search"
const AUTH_SCOPE = "GET:feed,GET:playlists,POST:tokens/unregister"
const AUTH_SCOPE = "GET:feed,GET:playlists,POST:tokens/unregister,POST:history*"
const AUTH_FEED = "/api/v1/auth/feed"
const AUTH_PLAYLISTS = "/api/v1/auth/playlists"
const AUTH_TOKENS_UNREGISTER = "/api/v1/auth/tokens/unregister"
@@ -60,12 +61,29 @@ namespace Invidious
response = Requests().get(url, args)
return {
success: response.statuscode = 200,
success: response.ok,
statusCode: response.statuscode,
data: response.json ?? response.text
data: response.json
}
end function
function MarkVideoWatched(videoId as string) as boolean
authToken = InvidiousSettings.GetAuthToken()
if authToken = invalid
return false
end if
url = `${authToken.instance}${Invidious.HISTORY_ENDPOINT}/${videoId}`
headers = Invidious.GetAuthenticationHeaders(authToken.token)
args = {
headers: headers,
parseJson: false
}
response = Requests().post(url, args)
return response.ok
end function
function SearchSuggestions(q as string) as object 'SearchSuggestionResult
instance = InvidiousSettings.GetSelectedInstance()
url = `${instance}${Invidious.SEARCH_SUGGEST_ENDPOINT}`
@@ -127,7 +145,8 @@ namespace Invidious
expire = TimeUtils.Now().AsSeconds() + 60 * 60 * 24 * 365 * 2 '2 years from now
callbackUrl = `http://${localIp}:${webServerPort}${Invidious.TOKEN_CALLBACK}?ref=${instance}`.EncodeUriComponent()
return `${invidiousHost}/authorize_token?scopes=${Invidious.AUTH_SCOPE}&callback_url=${callbackUrl}&expire=${expire}`
scope = `${Invidious.AUTH_SCOPE}`.EncodeUriComponent()
return `${invidiousHost}/authorize_token?scopes=${scope}&callback_url=${callbackUrl}&expire=${expire}`
end function
function GetAuthenticationHeaders(token as string) as object
@@ -1,3 +1,5 @@
import "pkg:/source/utils/RegistryUtils.bs"
namespace InvidiousSettings
const DEFAULT_INSTANCE = "https://vid.puffyan.us"
@@ -36,11 +38,16 @@ namespace InvidiousSettings
return instances[0]
end function
function SetAuthToken(token as string, instance as string)
json = FormatJson({
function SetAuthToken(token as string, instance as string, username as dynamic)
obj = {
token: token,
instance: instance
})
}
if username <> invalid
obj.username = username
end if
json = FormatJson(obj)
RegistryUtils.Write(RegistryUtils.INVIDIOUS_TOKEN, json)
instances = InvidiousSettings.GetCurrentInstances()
+34 -35
View File
@@ -1,54 +1,53 @@
import "pkg:/source/roku_modules/rokurequests/Requests.brs"
import "pkg:/source/utils/WebUtils.bs"
import "pkg:/source/utils/Crypto.bs"
import "pkg:/source/utils/ColorUtils.bs"
namespace SponsorBlock
const API_URL = "https://sponsor.ajay.app"
const SKIP_SEGMENT_ENDPOINT = "/api/skipSegments"
const VIEWED_SEGMENT_ENDPOINT = "/api/viewedVideoSponsorTime"
function SegmentColor(category as string) as integer
map = m.SponsorBlockColors
if map = invalid
map = {
sponsor: &h00D400FF,
selfpromo: &hFFFF00FF,
exclusive_access: &h008A5CFF,
interaction: &hCC00FFFF,
poi_highlight: &hFF1684FF,
intro: &h00FFFFFF,
outro: &h0202EDFF,
preview: &h008FD6FF,
filler: &h7300FFFF,
music_offtopic: &hFF9900FF
}
m.SponsorBlockColors = map
function GetSponsorBlockConfig() as object
if m.sponsorBlockConfig = invalid
m.sponsorBlockConfig = ParseJson(ReadAsciiFile("libpkg:/config/sponsorblock_config.json"))
end if
if map.doesexist(category)
return map[category]
return m.sponsorBlockConfig
end function
function SegmentColor(category as string) as integer
config = SponsorBlock.GetSponsorBlockConfig()
if config = invalid
return 0
end if
if config.categories.doesexist(category)
color = config.categories[category].color
return ColorUtils.HexToInt(color)
end if
return 0
end function
function SegmentTitle(category as string) as string
map = m.SponsorBlockTitles
if map = invalid
map = {
sponsor: "Sponsor",
selfpromo: "Unpaid/Self Promotion",
exclusive_access: "Exclusive Access",
interaction: "Interaction Reminder (Subscribe)",
poi_highlight: "Highlight",
intro: "Intermission/Intro Animation",
outro: "Endcards/Credits",
preview: "Preview/Recap",
filler: "Filler Tangent/Jokes",
music_offtopic: "Non-Music Section"
}
m.SponsorBlockTitles = map
config = SponsorBlock.GetSponsorBlockConfig()
if config = invalid
return ""
end if
if map.doesexist(category)
return map[category]
if config.categories.doesexist(category)
return config.categories[category].title
end if
return ""
end function
function SegmentShortTitle(category as string) as string
config = SponsorBlock.GetSponsorBlockConfig()
if config = invalid
return ""
end if
if config.categories.doesexist(category)
return config.categories[category].short_title
end if
return ""
end function
@@ -0,0 +1,30 @@
namespace ColorUtils
function HexToInt(color as dynamic) as integer
if color = invalid
return 0
end if
if color.left(1) = "#"
color = color.mid(1)
end if
value = Val(color.mid(0, 2), 16) * 16777216 + Val(color.mid(2, 2), 16) * 65536 + Val(color.mid(4, 2), 16) * 256
if color.Len() = 6
value += 255
else if color.Len() = 8
value += Val(color.mid(6, 2), 16)
end if
return value
end function
function IntToHex(color as integer) as string
hexDigits = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"]
hexString = "#"
for i = 7 to 0 step -1
hexString = hexString + hexDigits[(color >> (i * 4)) and &hF]
end for
return hexString
end function
end namespace
+10 -7
View File
@@ -1,17 +1,20 @@
function GetSha256(input as string) as string
buffer = CreateObject("roByteArray")
buffer.FromAsciiString(input)
digest = CreateObject("roEVPDigest")
digest.Setup("sha256")
return digest.Process(buffer)
return GetEvpDigest(input, "sha256")
end function
function GetSha1(input as string) as string
return GetEvpDigest(input, "sha1")
end function
function GetMd5(input as string) as string
return GetEvpDigest(input, "md5")
end function
function GetEvpDigest(input as string, method as string) as string
buffer = CreateObject("roByteArray")
buffer.FromAsciiString(input)
digest = CreateObject("roEVPDigest")
digest.Setup("sha1")
digest.Setup(method)
return digest.Process(buffer)
end function
-17
View File
@@ -1,17 +0,0 @@
function IsDebugMode() as boolean
appInfo = CreateObject("roAppInfo")
bsConst = appInfo.GetValue("bs_const")
symbols = bsConst.Tokenize(";")
for each symbol in symbols
keyValuePair = symbol.Tokenize("=")
if keyValuePair.Count() <> 2
continue for
end if
if UCase(keyValuePair[0]) = "DEBUG"
return UCase(keyValuePair[1]) = "TRUE"
end if
end for
return false
end function
+31 -17
View File
@@ -1,6 +1,6 @@
import "pkg:/source/utils/StringUtils.bs"
function GetLocalIpAddress() as string
function GetLocalIpAddress() as dynamic
if m.ipAddress = invalid or m.ipAddress = ""
di = CreateObject("roDeviceInfo")
ips = di.GetIPAddrs()
@@ -25,7 +25,9 @@ function GetAppInfo() as object
m.appInfo = {
id: appInfo.GetID(),
version: appInfo.GetVersion(),
lib_version: GetLibVersion()
git_commit_hash: appInfo.GetValue("git_commit_sha"),
lib_version: GetLibVersion(),
lib_git_commit_hash: GetLibGitCommitHash()
}
end if
return m.appInfo
@@ -41,22 +43,34 @@ function GetLibVersion() as string
return `${Major}.${Minor}.${Build}`
end function
function GetLibManifestValues() as object
libManifest = ReadAsciiFile("libpkg:/manifest")
lines = libManifest.Tokenize(UnixNL())
values = {}
for each line in lines
if line.left(1) = "#"
continue for
end if
keyValuePair = line.Tokenize("=")
if keyValuePair.Count() <> 2
continue for
end if
function GetLibGitCommitHash() as string
values = GetLibManifestValues()
values[keyValuePair[0]] = keyValuePair[1]
end for
return values
if values.doesexist("git_commit_sha")
return values["git_commit_sha"]
end if
return ""
end function
function GetLibManifestValues() as object
if m.linManifestValues = invalid
libManifest = ReadAsciiFile("libpkg:/manifest")
lines = libManifest.Tokenize(UnixNL())
values = {}
for each line in lines
if line.left(1) = "#"
continue for
end if
keyValuePair = line.Tokenize("=")
if keyValuePair.Count() <> 2
continue for
end if
values[keyValuePair[0]] = keyValuePair[1]
end for
m.linManifestValues = values
end if
return m.linManifestValues
end function
function GetDeviceInfo() as object
+5 -3
View File
@@ -13,7 +13,7 @@ namespace WebUtils
if Instr(0, component, "=")
keyValue = component.split("=")
key = keyValue[0]
value = keyValue[1]
value = keyValue[1].DecodeUriComponent()
hasValue = true
end if
@@ -22,11 +22,13 @@ namespace WebUtils
if GetInterface(oldValue, "ifArray") = invalid
oldValue = [oldValue]
end if
oldValue.push(value)
oldValue.push(value.DecodeUriComponent())
value = oldValue
end if
query[key] = value
if key <> ""
query[key] = value
end if
end for
return query
end function
+1142 -959
View File
File diff suppressed because it is too large. Load diff
+13 -13
View File
@@ -1,6 +1,6 @@
{
"name": "playlet-web",
"version": "0.7.0",
"version": "0.9.0",
"type": "module",
"scripts": {
"dev": "vite",
@@ -9,19 +9,19 @@
"check": "svelte-check --tsconfig ./tsconfig.json"
},
"devDependencies": {
"@sveltejs/vite-plugin-svelte": "^1.1.0",
"@tsconfig/svelte": "^3.0.0",
"autoprefixer": "^10.4.13",
"daisyui": "^2.42.1",
"@sveltejs/vite-plugin-svelte": "^2.1.0",
"@tsconfig/svelte": "^4.0.1",
"autoprefixer": "^10.4.14",
"daisyui": "^2.51.5",
"dotenv": "^16.0.3",
"internal-ip": "^7.0.0",
"postcss": "^8.4.19",
"svelte": "^3.52.0",
"svelte-check": "^2.9.2",
"svelte-preprocess": "^4.10.7",
"tailwindcss": "^3.2.4",
"tslib": "^2.4.0",
"typescript": "^4.6.4",
"vite": "^3.2.3"
"postcss": "^8.4.23",
"svelte": "^3.58.0",
"svelte-check": "^3.2.0",
"svelte-preprocess": "^5.0.3",
"tailwindcss": "^3.3.1",
"tslib": "^2.5.0",
"typescript": "^5.0.4",
"vite": "^4.3.1"
}
}
+64 -1
View File
@@ -76,6 +76,15 @@
<h5>Feedback is welcome over at: <a id="feedback-url" href="https://github.com/iBicha/playlet"
target="_blank">https://github.com/iBicha/playlet</a></h5>
<div id="dev-menu" style="display: none;">
<h4>Developer menu</h4>
<p><small>These are for testing purposes only, and are not meant to be used by end users.</small></p>
<label for="playlet-lib-tag">Playlet Lib Tag:</label>
<select name="playlet-lib-tag" id="playlet-lib-tag">
<option value="">latest (default)</option>
</select>
<button onclick="SetPlayletLibUrls()">Apply</button>
</div>
<script>
function Login() {
if (!window.appState) {
@@ -249,6 +258,49 @@ ${JSON.stringify(window.appState.invidious, null, 2)}
})
}
function FetchReleaseTags() {
fetch("https://api.github.com/repos/iBicha/playlet/releases")
.then(function (response) {
return response.json();
})
.then(function (releases) {
releases.filter(release => release.assets.filter(asset => asset.name === "playlet-lib.zip").length > 0)
.forEach(r => {
var option = document.createElement("option");
option.text = r.tag_name;
option.value = r.tag_name;
document.getElementById("playlet-lib-tag").add(option);
})
})
}
function SetPlayletLibUrls() {
var tags = document.getElementById("playlet-lib-tag");
var value = tags.value;
let content = null
if(value !== ""){
content = JSON.stringify([{
link: `https://github.com/iBicha/playlet/releases/download/${value}/playlet-lib.zip`,
type: 'custom'
}]);
}
PostJson('/api/command', { command: "set-playlet-lib-urls", content: content })
.then(function (response) {
alert("Playlet lib tag updated. Restart Playlet to reflect changes.");
window.location.reload();
})
.catch(function (err) {
alert(err)
});
}
function ShouldShowDevMenu() {
const urlSearchParams = new URLSearchParams(window.location.search);
return !!urlSearchParams.get('dev')
}
function Initialize() {
fetch("/api/state")
.then(function (response) {
@@ -261,7 +313,14 @@ ${JSON.stringify(window.appState.invidious, null, 2)}
document.getElementById("app-version").innerText = `Version: ${appState.app.version}`
if (appState.invidious.logged_in) {
document.getElementById("logged-in").innerHTML = `Logged In: true (<a href="${appState.invidious.logged_in_instance}" target="_blank">${appState.invidious.logged_in_instance}</a>)`
let loggedIn = 'Logged In '
if (appState.invidious.logged_in_username) {
loggedIn += `as "${appState.invidious.logged_in_username}"`
} else {
loggedIn += ": true"
}
loggedIn += ` (<a href="${appState.invidious.logged_in_instance}" target="_blank">${appState.invidious.logged_in_instance}</a>)`
document.getElementById("logged-in").innerHTML = loggedIn
} else {
document.getElementById("logged-in").innerHTML = "Logged In: false"
}
@@ -286,6 +345,10 @@ ${JSON.stringify(window.appState.invidious, null, 2)}
});
SetupWebSocket();
if(ShouldShowDevMenu()){
document.getElementById("dev-menu").style.display = "block";
FetchReleaseTags();
}
}
var tableRow;
+13 -10
View File
@@ -1,24 +1,27 @@
import { defineConfig } from 'vite'
import { defineConfig, UserConfig } from 'vite'
import { svelte } from '@sveltejs/vite-plugin-svelte'
import { readFileSync } from 'fs'
import { readFileSync, existsSync } from 'fs'
import { parse as dotEnvParse } from 'dotenv'
import { internalIpV4Sync } from 'internal-ip';
const envVars = dotEnvParse(readFileSync('../.vscode/.env'))
const PORT = 5173
// https://vitejs.dev/config/
/** @type {import('vite').UserConfig} */
export default defineConfig({
const config: UserConfig = {
plugins: [svelte()],
build: {
outDir: "../playlet-lib/src/www",
emptyOutDir: true
},
server: {
}
}
if (existsSync('../.vscode/.env')) {
const envVars = dotEnvParse(readFileSync('../.vscode/.env'))
config.server = {
host: true,
port: PORT,
open: `http://${internalIpV4Sync()}:${PORT}/?host=${envVars.ROKU_DEV_TARGET}:8888`
}
})
}
// https://vitejs.dev/config/
export default defineConfig(config)
+4
View File
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 122.88 122.88"
style="enable-background:new 0 0 122.88 122.88" xml:space="preserve"><g><path fill="#FFFFFF" d="M61.44,9.23c-1.85,0-3.64,0.08-5.35,0.25c-1.71,0.17-3.44,0.42-5.17,0.77c-1.72,0.34-3.39,0.77-5,1.26 c-1.59,0.49-3.16,1.07-4.7,1.72l-0.1,0.05l0,0c-1.63,0.7-3.18,1.45-4.67,2.25c-1.5,0.81-2.94,1.68-4.31,2.6 c-1.38,0.93-2.72,1.92-3.99,2.97c-1.27,1.05-2.5,2.16-3.68,3.35l-0.04,0.04c-1.18,1.18-2.29,2.4-3.33,3.66 c-1.05,1.28-2.04,2.61-2.97,3.99c-0.92,1.36-1.78,2.8-2.59,4.3c-0.8,1.49-1.56,3.05-2.26,4.67l-0.05,0.11l0,0l-0.07,0.14 c-0.63,1.5-1.19,3.04-1.67,4.61c-0.49,1.59-0.9,3.23-1.24,4.93c-0.35,1.73-0.6,3.45-0.77,5.17c-0.17,1.72-0.25,3.5-0.25,5.35 c0,1.85,0.08,3.64,0.25,5.35c0.17,1.71,0.42,3.44,0.77,5.17c0.35,1.72,0.77,3.39,1.27,5c0.49,1.57,1.05,3.13,1.7,4.66 c0.04,0.07,0.07,0.14,0.1,0.21c0.69,1.6,1.43,3.13,2.23,4.6c0.81,1.5,1.68,2.94,2.59,4.3c0.93,1.39,1.92,2.72,2.98,4 c1.02,1.24,2.11,2.44,3.26,3.59c0.07,0.06,0.13,0.12,0.19,0.19c1.16,1.16,2.36,2.24,3.59,3.26c1.28,1.05,2.61,2.04,3.99,2.97 c1.36,0.92,2.8,1.78,4.3,2.59c1.49,0.8,3.05,1.56,4.67,2.26l0.21,0.1c1.52,0.64,3.07,1.2,4.67,1.69c1.58,0.49,3.23,0.9,4.92,1.24 c1.73,0.35,3.45,0.6,5.17,0.77c1.72,0.17,3.5,0.25,5.35,0.25c1.85,0,3.64-0.08,5.35-0.25c1.71-0.17,3.44-0.42,5.17-0.77 c1.72-0.35,3.39-0.77,5-1.27c1.59-0.49,3.16-1.07,4.71-1.73l0.09-0.04l0-0.01c1.63-0.7,3.18-1.45,4.67-2.25 c1.5-0.81,2.94-1.68,4.31-2.6c1.38-0.93,2.72-1.92,3.99-2.97c1.25-1.03,2.45-2.12,3.62-3.29c0.06-0.06,0.11-0.12,0.18-0.18 c1.15-1.15,2.23-2.35,3.25-3.58c1.05-1.28,2.05-2.61,2.98-4c0.92-1.36,1.78-2.8,2.59-4.3c0.8-1.49,1.56-3.04,2.26-4.67l0.1-0.22 c0.64-1.51,1.2-3.06,1.69-4.65c0.49-1.59,0.9-3.23,1.24-4.93c0.35-1.73,0.6-3.45,0.77-5.17c0.17-1.72,0.25-3.5,0.25-5.35 c0-1.85-0.08-3.64-0.25-5.35c-0.17-1.71-0.42-3.44-0.77-5.17c-0.35-1.72-0.77-3.39-1.27-5c-0.49-1.59-1.07-3.16-1.73-4.71 l-0.04-0.09l0,0c-0.7-1.63-1.45-3.18-2.25-4.67c-0.81-1.5-1.68-2.94-2.59-4.3c-0.93-1.38-1.92-2.72-2.97-3.99 c-1.02-1.24-2.12-2.45-3.28-3.61c-0.07-0.06-0.13-0.12-0.18-0.18c-1.16-1.16-2.35-2.24-3.59-3.26c-1.28-1.05-2.61-2.04-3.99-2.97 c-1.37-0.92-2.8-1.78-4.3-2.59c-1.49-0.8-3.04-1.56-4.67-2.25l-0.19-0.09c-1.52-0.64-3.08-1.21-4.68-1.7 c-1.58-0.49-3.23-0.9-4.93-1.24c-1.73-0.35-3.45-0.6-5.17-0.77C65.08,9.31,63.29,9.23,61.44,9.23L61.44,9.23z M63.34,31.17 c2.19,0,3.91,0.63,5.16,1.88c1.24,1.25,1.87,2.96,1.87,5.17c0,2.24-1.07,4.22-3.21,5.97c-2.16,1.74-4.66,2.62-7.52,2.62 c-2.14,0-3.85-0.6-5.16-1.8c-1.31-1.22-1.96-2.79-1.96-4.75c0-2.47,1.07-4.59,3.19-6.4C57.82,32.06,60.37,31.17,63.34,31.17 L63.34,31.17L63.34,31.17z M75.55,91.71H47.33v-4.75h5.3V57.95h-5.3v-3.78h13.19c3.33,0,6.61-0.4,9.85-1.22v34.01h5.18L75.55,91.71 L75.55,91.71L75.55,91.71z M49.12,1.2c1.96-0.39,3.99-0.69,6.08-0.89C57.29,0.1,59.37,0,61.44,0c2.07,0,4.15,0.1,6.24,0.31 c2.09,0.2,4.12,0.5,6.08,0.89c1.94,0.39,3.88,0.88,5.82,1.48c1.88,0.58,3.74,1.26,5.58,2.04l0.19,0.07l0,0l0.06,0.02 c1.85,0.8,3.65,1.67,5.38,2.61c1.71,0.93,3.4,1.95,5.07,3.07c1.63,1.1,3.21,2.27,4.73,3.52c1.52,1.25,2.97,2.56,4.34,3.95 c1.38,1.38,2.7,2.83,3.95,4.34c1.25,1.52,2.42,3.09,3.52,4.73c1.09,1.63,2.11,3.32,3.06,5.06l0,0l0.01,0 c0.94,1.74,1.82,3.54,2.61,5.39c0.02,0.05,0.04,0.1,0.06,0.15c0.78,1.83,1.46,3.7,2.05,5.6c0.61,1.96,1.11,3.92,1.5,5.89 c0.39,1.96,0.69,3.99,0.89,6.08c0.2,2.09,0.3,4.17,0.3,6.24c0,2.07-0.1,4.15-0.31,6.24c-0.2,2.09-0.5,4.12-0.89,6.08 c-0.39,1.94-0.88,3.88-1.48,5.82c-0.58,1.89-1.27,3.76-2.05,5.62l-0.04,0.09l0,0l-0.05,0.11c-0.8,1.85-1.67,3.65-2.61,5.38 c-0.93,1.71-1.95,3.4-3.07,5.07c-1.1,1.63-2.27,3.21-3.52,4.73c-1.25,1.52-2.56,2.96-3.95,4.34c-1.38,1.38-2.83,2.7-4.35,3.95 c-1.52,1.25-3.09,2.42-4.72,3.51c-1.63,1.09-3.32,2.11-5.06,3.06c-1.78,0.96-3.57,1.84-5.39,2.62c-0.05,0.02-0.1,0.04-0.16,0.06 c-1.83,0.78-3.7,1.46-5.6,2.05c-1.96,0.61-3.92,1.11-5.88,1.5c-1.96,0.39-3.99,0.69-6.08,0.89c-2.09,0.2-4.17,0.3-6.24,0.3 s-4.15-0.1-6.24-0.3c-2.09-0.2-4.12-0.5-6.08-0.89c-1.94-0.39-3.88-0.88-5.82-1.48c-1.89-0.58-3.76-1.27-5.61-2.05l-0.2-0.08l0,0 c-1.85-0.8-3.65-1.67-5.38-2.61c-1.71-0.93-3.4-1.95-5.07-3.07c-1.63-1.09-3.21-2.27-4.72-3.51c-1.52-1.25-2.97-2.57-4.35-3.95 c-1.38-1.38-2.7-2.83-3.95-4.34c-1.25-1.52-2.42-3.1-3.52-4.73c-1.09-1.63-2.11-3.32-3.06-5.06c-0.97-1.78-1.84-3.58-2.62-5.4 c-0.02-0.05-0.04-0.1-0.06-0.15c-0.78-1.83-1.46-3.7-2.05-5.6c-0.61-1.96-1.11-3.93-1.5-5.89c-0.39-1.96-0.69-3.99-0.89-6.08 C0.1,65.59,0,63.51,0,61.44c0-2.07,0.1-4.15,0.31-6.24c0.2-2.09,0.5-4.12,0.89-6.08c0.39-1.94,0.88-3.88,1.48-5.82 c0.58-1.88,1.26-3.74,2.04-5.59l0.09-0.23l0,0c0.8-1.85,1.67-3.65,2.61-5.38c0.93-1.71,1.95-3.4,3.07-5.07 c1.1-1.63,2.27-3.21,3.52-4.73c1.25-1.52,2.56-2.96,3.95-4.34c1.38-1.38,2.83-2.7,4.34-3.95c1.52-1.25,3.09-2.42,4.73-3.52 c1.67-1.12,3.36-2.14,5.07-3.07l0.13-0.06c1.73-0.94,3.48-1.78,5.26-2.55c0.05-0.02,0.1-0.04,0.15-0.06 c1.83-0.78,3.7-1.46,5.6-2.05C45.19,2.09,47.15,1.59,49.12,1.2L49.12,1.2z"/></g></svg>

After

Width:  |  Height:  |  Size: 4.9 KiB

+3 -1
View File
@@ -2,7 +2,7 @@ title=Playlet
# Do not update version manually, it is auto updated from package.json
major_version=0
minor_version=7
minor_version=9
build_version=00000
## Channel Assets
@@ -27,4 +27,6 @@ playlet_lib_remote_url=https://github.com/iBicha/playlet/releases/latest/downloa
playlet_lib_embedded_url=pkg:/lib/playlet-lib.zip
playlet_lib_debug_url=http://DEBUG_HOST_IP_ADDRESS:8080/playlet-lib.zip
git_commit_sha=unknown
bs_const=DEBUG=false;WEB_SERVER_BASIC_AUTH=false;DASH_THUMBNAILS=false;WEB_SOCKETS=true
+129
View File
@@ -0,0 +1,129 @@
const fs = require('fs');
const path = require('path');
if (process.argv.length !== 3) {
console.error("Invalid usage! usage: npm run generate-sponsorblock-config -- sponsorblock_root");
exit(-1);
}
const PLAYLEY_CONFIG_PATH = "./playlet-lib/src/config/sponsorblock_config.json"
const sponsorblockRoot = process.argv[2];
const configExamplePath = path.join(sponsorblockRoot, "config.json.example")
const englishLocalePath = path.join(sponsorblockRoot, "public/_locales/en/messages.json")
let configExample = JSON.parse(fs.readFileSync(configExamplePath, { encoding: 'utf8', flag: 'r' }))
let englishLocale = JSON.parse(fs.readFileSync(englishLocalePath, { encoding: 'utf8', flag: 'r' }))
// https://github.com/ajayyy/SponsorBlock/blob/f4d80d88438ff31bc067ff480fd94112d972718d/src/config.ts#L251
const barTypes = {
"preview-chooseACategory": {
color: "#ffffff",
opacity: "0.7"
},
"sponsor": {
color: "#00d400",
opacity: "0.7"
},
"preview-sponsor": {
color: "#007800",
opacity: "0.7"
},
"selfpromo": {
color: "#ffff00",
opacity: "0.7"
},
"preview-selfpromo": {
color: "#bfbf35",
opacity: "0.7"
},
"exclusive_access": {
color: "#008a5c",
opacity: "0.7"
},
"interaction": {
color: "#cc00ff",
opacity: "0.7"
},
"preview-interaction": {
color: "#6c0087",
opacity: "0.7"
},
"intro": {
color: "#00ffff",
opacity: "0.7"
},
"preview-intro": {
color: "#008080",
opacity: "0.7"
},
"outro": {
color: "#0202ed",
opacity: "0.7"
},
"preview-outro": {
color: "#000070",
opacity: "0.7"
},
"preview": {
color: "#008fd6",
opacity: "0.7"
},
"preview-preview": {
color: "#005799",
opacity: "0.7"
},
"music_offtopic": {
color: "#ff9900",
opacity: "0.7"
},
"preview-music_offtopic": {
color: "#a6634a",
opacity: "0.7"
},
"poi_highlight": {
color: "#ff1684",
opacity: "0.7"
},
"preview-poi_highlight": {
color: "#9b044c",
opacity: "0.7"
},
"filler": {
color: "#7300FF",
opacity: "0.9"
},
"preview-filler": {
color: "#2E0066",
opacity: "0.7"
}
}
function getColor(obj) {
if (!obj) {
return "#FFFFFFC8"
}
const opacity = (Math.round(parseFloat(obj.opacity) * 255)).toString(16).toUpperCase().padStart(2, "0")
return obj.color + opacity;
}
let playletConfig = {
serverAddress: configExample.serverAddress,
categoryList: configExample.categoryList,
categories: {}
}
playletConfig.categoryList.forEach(categoryId => {
const category = {}
category.title = englishLocale[`category_${categoryId}`].message
category.short_title = englishLocale[`category_${categoryId}_short`]?.message ?? category.title;
category.categorySupport = configExample.categorySupport[categoryId];
category.color = getColor(barTypes[categoryId]);
playletConfig.categories[categoryId] = category;
});
fs.writeFileSync(PLAYLEY_CONFIG_PATH, JSON.stringify(playletConfig, null, 4));
+134 -66
View File
@@ -11,59 +11,51 @@ const ip = require('ip');
const config = dotenv.parse(fs.readFileSync('.vscode/.env'));
const PLAYLEY_SERVER = `http://${config.ROKU_DEV_TARGET}:8888`;
async function updateFeed(sourceUrl, destinationPlaylist, invidiousInstance, token, browser = undefined, limit = 50) {
console.log(`Updating playlist "${destinationPlaylist}" from feed "${sourceUrl}"`)
async function importInvidiousProfile(invidiousInstance, token, profile) {
console.log(`Importing Invidious profile`)
await fetch(`${invidiousInstance}/api/v1/auth/import/invidious`, {
headers: {
"Authorization": `Bearer ${token}`,
'Content-Type': 'application/json'
},
method: "POST",
body: JSON.stringify(profile)
})
}
const videos = await extractVideos(sourceUrl, browser, limit);
async function generatePlaylist(sourceUrl, playlistName, browser = undefined, limit = 100) {
console.log(`Updating playlist "${playlistName}" from feed "${sourceUrl}"`);
let playlist = await getPlaylist(invidiousInstance, token, destinationPlaylist)
if (playlist) {
await deletePlaylist(invidiousInstance, token, playlist)
}
const videos = await extractYtDlp(sourceUrl, browser, limit);
playlist = await createPlaylist(invidiousInstance, token, destinationPlaylist)
for (let i = 0; i < videos.length; i++) {
const videoId = videos[i];
console.log(`Adding video "${videoId}" (${i + 1}/${videos.length}) to playlist "${playlist.title}"`)
await addPlaylistVideo(invidiousInstance, token, playlist, videoId)
return {
title: playlistName,
description: "Imported from Youtube",
privacy: "private",
videos: videos
};
}
async function deletePlaylists(invidiousInstance, token, playlistNames) {
const playlistsToDelete = (await getPlaylists(invidiousInstance, token))
.filter(playlist => playlistNames.indexOf(playlist.title) !== -1);
for (let i = 0; i < playlistsToDelete.length; i++) {
const playlist = playlistsToDelete[i];
await deletePlaylist(invidiousInstance, token, playlist);
}
}
async function getPlaylist(invidiousInstance, token, playlistName) {
console.log(`Finding playlist ${playlistName}`)
async function getPlaylists(invidiousInstance, token) {
console.log(`Finding playlists`)
const response = await fetch(`${invidiousInstance}/api/v1/auth/playlists`, {
headers: {
"Authorization": `Bearer ${token}`
}
})
const playlists = await response.json()
return playlists.find(p => p.title === playlistName);
}
async function createPlaylist(invidiousInstance, token, playlistName) {
console.log(`Creating playlist "${playlistName}"`)
const response = await fetch(`${invidiousInstance}/api/v1/auth/playlists`, {
headers: {
"Authorization": `Bearer ${token}`,
'Content-Type': 'application/json'
},
method: "POST",
body: JSON.stringify({ title: playlistName, privacy: "private" })
})
return await response.json()
}
async function addPlaylistVideo(invidiousInstance, token, playlist, videoId) {
await fetch(`${invidiousInstance}/api/v1/auth/playlists/${playlist.playlistId}/videos`, {
headers: {
"Authorization": `Bearer ${token}`,
'Content-Type': 'application/json'
},
method: "POST",
body: JSON.stringify({ videoId: videoId })
})
}
async function deletePlaylist(invidiousInstance, token, playlist) {
console.log(`Playlist "${playlist.title}" exists. Deleting.`)
await fetch(`${invidiousInstance}/api/v1/auth/playlists/${playlist.playlistId}`, {
@@ -74,11 +66,59 @@ async function deletePlaylist(invidiousInstance, token, playlist) {
})
}
async function extractVideos(sourceUrl, browser = undefined, limit = 100) {
console.log(`Extracting videos from feed "${sourceUrl}" with limit "${limit}"`)
async function extractYtDlpPlaylists(browser) {
console.log(`Extracting playlists`)
return await new Promise(function (resolve, reject) {
let ytDlpErrors = ""
const videos = []
const items = []
args = ["https://www.youtube.com/feed/library", '--flat-playlist', '--lazy-playlist', '--dump-json', '--cookies-from-browser', browser]
const ytDlpProcess = spawn('yt-dlp', args);
ytDlpProcess.stdout.on('data', function (data) {
process.stdout.write('.')
newItems = data.toString()
.split('\n')
.map(item => item.trim())
.filter(i => i);
newItems.forEach(item => {
try {
const json = JSON.parse(item);
if (json.url?.startsWith("https://www.youtube.com/playlist?list")) {
items.push({
url: json.url,
title: json.title
})
}
} catch (error) {
console.error(error)
ytDlpErrors += error
}
});
});
ytDlpProcess.stderr.on('data', function (data) {
process.stdout.write('.')
ytDlpErrors += data.toString() + '\n'
});
ytDlpProcess.on('close', function (code) {
process.stdout.write('\n')
if (code === 0) {
resolve(items)
} else {
reject({ code: code, error: ytDlpErrors })
}
});
})
}
async function extractYtDlp(sourceUrl, browser = undefined, limit = 100) {
console.log(`Extracting from "${sourceUrl}" with limit "${limit}"`)
return await new Promise(function (resolve, reject) {
let ytDlpErrors = ""
const items = []
args = [sourceUrl, '--flat-playlist', '--lazy-playlist', '--print', '%(id)s']
if (browser) {
@@ -88,19 +128,19 @@ async function extractVideos(sourceUrl, browser = undefined, limit = 100) {
ytDlpProcess.stdout.on('data', function (data) {
process.stdout.write('.')
if (videos.length > limit) {
if (limit > 0 && items.length > limit) {
return;
}
newVideos = data.toString()
newItems = data.toString()
.split('\n')
.map(video => video.trim())
.map(item => item.trim())
.filter(i => i);
newVideos.forEach(video => {
videos.push(video)
newItems.forEach(item => {
items.push(item)
});
if (videos.length >= limit) {
if (limit > 0 && items.length >= limit) {
ytDlpProcess.kill()
}
});
@@ -112,8 +152,8 @@ async function extractVideos(sourceUrl, browser = undefined, limit = 100) {
ytDlpProcess.on('close', function (code) {
process.stdout.write('\n')
if (code === 0 || videos.length === limit) {
resolve(videos)
if (code === 0 || (limit > 0 && items.length === limit)) {
resolve(items)
} else {
reject({ code: code, error: ytDlpErrors })
}
@@ -170,7 +210,6 @@ async function deleteAccessToken(invidiousInstance, token) {
method: "POST",
body: token
})
}
(async () => {
@@ -183,28 +222,57 @@ async function deleteAccessToken(invidiousInstance, token) {
parser.add_argument('--browser', { help: 'Use cookies from browser' });
parser.add_argument('--invidious', { help: 'Invidious instance to sync to' });
parser.add_argument('--output-file', { help: 'Write profile to Invidious JSON compatible file' });
parser.add_argument('--playlist-limit', { help: 'Maximum playlist video count', default: 500 });
let args = parser.parse_args()
invidiousInstance = args.invidious
browser = args.browser
outputFile = args.output_file
playlistLimit = args.playlist_limit
if (!invidiousInstance) {
try {
invidiousInstance = await getInvidiousInstance()
} catch (error) {
throw new Error(`Could not connect to Playlet at ${PLAYLEY_SERVER}\n${error}`)
const profile = { playlists: [] }
profile.playlists.push(await generatePlaylist("https://www.youtube.com", "Recommended", browser, playlistLimit))
const playlistsToDelete = ["Recommended"]
if (browser) {
console.log("Updating subscriptions")
profile.subscriptions = await extractYtDlp("https://www.youtube.com/feed/channels", browser, -1)
console.log("Updating watch history")
profile.watch_history = await extractYtDlp("https://www.youtube.com/feed/history", browser, playlistLimit)
const playlists = await extractYtDlpPlaylists(browser);
for (let i = 0; i < playlists.length; i++) {
const playlist = playlists[i];
try {
profile.playlists.push(await generatePlaylist(playlist.url, playlist.title, browser, playlistLimit))
playlistsToDelete.push(playlist.title)
} catch (error) {
console.log(error)
}
}
}
token = await getAccessToken(invidiousInstance)
await updateFeed("https://www.youtube.com/", "Youtube - Recommended", invidiousInstance, token, browser)
if (browser) {
await updateFeed("https://www.youtube.com/feed/subscriptions", "Youtube - Subscriptions", invidiousInstance, token, browser)
await updateFeed("https://www.youtube.com/playlist?list=WL", "Youtube - Watch later", invidiousInstance, token, browser)
await updateFeed("https://www.youtube.com/playlist?list=LL", "Youtube - Liked Videos", invidiousInstance, token, browser)
await updateFeed("https://www.youtube.com/feed/history", "Youtube - History", invidiousInstance, token, browser)
if (outputFile) {
console.log(`Writing profile to ${outputFile}`)
fs.writeFileSync(outputFile, JSON.stringify(profile, null, 2))
} else {
if (!invidiousInstance) {
try {
invidiousInstance = await getInvidiousInstance()
} catch (error) {
throw new Error(`Could not connect to Playlet at ${PLAYLEY_SERVER}\n${error}`)
}
}
token = await getAccessToken(invidiousInstance)
await deletePlaylists(invidiousInstance, token, playlistsToDelete)
await importInvidiousProfile(invidiousInstance, token, profile);
}
}
catch (error) {
console.error(error);
@@ -213,7 +281,7 @@ async function deleteAccessToken(invidiousInstance, token) {
if (token) {
console.log("Deleting token")
await deleteAccessToken(invidiousInstance, token)
console.log("Done!")
}
console.log("Done!")
}
})();
+25
View File
@@ -0,0 +1,25 @@
const fs = require('fs');
const shell = require('shelljs');
if (!shell.which('git')) {
shell.echo('Sorry, this script requires git');
shell.exit(1);
}
const gitStatus = shell.exec('git status --porcelain=v1');
if (gitStatus.stdout !== '') {
shell.echo('Found changed files. Aborting.');
shell.exit(1);
}
const gitCommitHash = shell.exec('git rev-parse HEAD').stdout.trim();
["playlet/src/manifest", "playlet-lib/src/manifest"].forEach(function (manifestPath) {
let appManifestContent = fs.readFileSync(manifestPath, { encoding: 'utf8', flag: 'r' });
const gitHashPattern = /git_commit_sha=(\w+)/;
appManifestContent = appManifestContent.replace(gitHashPattern, `git_commit_sha=${gitCommitHash}`);
fs.writeFileSync(manifestPath, appManifestContent);
})
+2 -2
View File
@@ -1,4 +1,3 @@
const path = require('path');
const fs = require('fs');
const { execSync } = require("child_process");
@@ -24,4 +23,5 @@ const parsedVersion = semverParse(version);
fs.writeFileSync(manifestPath, appManifestContent);
})
execSync(`npm version ${version} --allow-same-version`, { cwd: 'playlet-web' });
execSync(`npm version ${version} --allow-same-version --no-git-tag-version`);
execSync(`npm version ${version} --allow-same-version --no-git-tag-version`, { cwd: 'playlet-web' });