Compare commits

..
26 Commits
Author SHA1 Message Date
Brahim Hadriche 70e2608e59 Release v0.39.0 (#622) 2025-05-23 12:35:18 -04:00
Brahim Hadriche d2d875f124 Fix a couple of regressions 2025-05-23 12:29:53 -04:00
Brahim Hadriche 6a1069337d Ignore statementBannerRenderer 2025-05-23 10:58:10 -04:00
Brahim Hadriche eb67d9e4c0 Disable shorts (#620)
* Disable shorts

* Rename setting

* changelog
2025-05-22 22:13:44 -04:00
Brahim Hadriche 6d9117a2a0 [skip ci] Avoid loading old preferences every time if not needed 2025-05-22 18:36:10 -04:00
Brahim Hadriche ab246e8080 Release v0.38.2 (#619) 2025-05-22 18:06:24 -04:00
Brahim Hadriche 7f3591409e [skip ci] delete openapi spec 2025-05-22 18:03:08 -04:00
Brahim Hadriche 650e70f271 [skip ci] locale 2025-05-22 17:58:55 -04:00
Brahim Hadriche a9f70b48aa Remove open api spec 2025-05-22 17:46:52 -04:00
Brahim Hadriche becb8b04f5 Refactor settings 2025-05-22 17:41:47 -04:00
Brahim Hadriche 68a4f9fade Show lines in playlist view 2025-05-21 21:21:42 -04:00
Brahim Hadriche 07ebd011cf Refresh client versions 2025-05-21 20:17:53 -04:00
Brahim Hadriche d210d84d63 changelog 2025-05-21 12:08:48 -04:00
Weblate (bot)andLacey Anaya 1e129e9a73 Translated using Weblate (German) (#616)
Currently translated at 100.0% (320 of 320 strings)

Translation: Playlet/Playlet
Translate-URL: https://hosted.weblate.org/projects/playlet/playlet/de/

Co-authored-by: Lacey Anaya <yecakeh263@anawalls.com>
2025-05-21 12:08:35 -04:00
Brahim Hadriche 1c6b47a5a6 Handle TILE_CONTENT_TYPE_SHORTS 2025-05-21 09:06:17 -04:00
Brahim Hadriche 013e2f49ca Release v0.38.1 (#614) 2025-05-20 12:30:45 -04:00
Brahim Hadriche d2fbd59d6a Fix video does not continuing from previous progress when opened 2025-05-20 12:27:21 -04:00
Brahim Hadriche f681a7024c Fix history cache, show percent watched in web app 2025-05-19 18:56:07 -04:00
Brahim Hadriche e9c2ab9f76 Release v0.38.0 (#613) 2025-05-19 18:02:20 -04:00
Brahim Hadriche aed102f57a Fix a bug where watch history videos repeat indefinitely 2025-05-19 17:50:50 -04:00
Brahim Hadricheandgithub-action linter 8b123b18f5 Watching progress (#609)
* Watching progress

* watch time endpoint

* Lint fix

* Changelog

* options mandatory

* tweak

* tweak

---------

Co-authored-by: github-action linter <githubaction@githubaction.com>
2025-05-19 17:35:35 -04:00
Brahim Hadriche 158788b42e [skip ci] typo 2025-05-17 17:37:21 -04:00
Brahim Hadriche 8d42c0213b Fix proxying in dash manifest (#607)
* Fix proxying in dash manifest

* Changelog
2025-05-17 16:25:24 -04:00
Brahim Hadriche 7c1aa80819 Fix a bug where playlists with small number of videos has duplicates 2025-05-17 15:17:43 -04:00
Brahim Hadriche 30ea007502 A couple of fixes 2025-05-17 09:42:19 -04:00
Brahim Hadriche fc7a029147 [chore] update dependencies (#606)
* update dependencies

* Backend changes
2025-05-16 23:43:10 -04:00
63 changed files with 985 additions and 1013 deletions

No files matched your search

+54 -1
View File
@@ -5,6 +5,59 @@ 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.1.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [0.39.0] - 2025-05-23
### Added
- New settings category: `Content Feed`
- New setting: `Disable Shorts`
### Fixed
- A regression with thumbnails not showing from previous release
- Inability to login to Invidious when selected backend is Playlet (local)
## [0.38.2] - 2025-05-22
### Added
- German translation
### Changed
- Settings: Added a "backend" section, and removed backend selection from Playback to avoid confusion
### Removed
- [advanced users]: `playlet-web-api.yml` was removed. It was getting outdated, and too hard to maintain to justify keeping it
### Fixed
- Display issue in playlist view
## [0.38.1] - 2025-05-20
### Fixed
- Cache issue for watch history
- Video progress not showing in web app
- Video does not continuing from previous progress when opened
## [0.38.0] - 2025-05-19
### Added
- Watch progress for YouTube accounts: Progress is saved as you watch. Progress bar is shown on video thumbnails (only on user feeds, such as recommendations, subscriptions, and watch history)
- Known bug: Watch progress doesn't update for all videos.
### Fixed
- A few issues related to Playlet backend feeds and caching
- An error when Invidious doesn't return valid video metadata
- A bug where playlists with small number of videos has duplicates
- A bug where DASH manifest was not generated correctly for proxied Invidious videos
- A bug where watch history videos repeat indefinitely
## [0.37.0] - 2025-05-16 ## [0.37.0] - 2025-05-16
### Added ### Added
@@ -12,7 +65,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- YouTube account support. The following features are now available: - YouTube account support. The following features are now available:
- The ability to login to one or multiple accounts - The ability to login to one or multiple accounts
- Both YouTube accounts and Invidious accounts are supported side-by-side - Both YouTube accounts and Invidious accounts are supported side-by-side
- Subscritions - Subscriptions
- User playlists - User playlists
- Watch History - Watch History
- Watched videos on Playlet are added to the watch history - Watched videos on Playlet are added to the watch history
+1 -3
View File
@@ -166,8 +166,6 @@ Playlet lib comes equipped with a web server that runs on port 8888 when the app
The web server runs on a continuously running [Task](https://developer.roku.com/en-ca/docs/references/scenegraph/control-nodes/task.md) and uses a middeware system to manage routes, serve static files, [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS), and more. The web server runs on a continuously running [Task](https://developer.roku.com/en-ca/docs/references/scenegraph/control-nodes/task.md) and uses a middeware system to manage routes, serve static files, [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS), and more.
The server's API enpoints are described through the Open API spec file [playlet-web-api.yml](./playlet-web-api.yml)
Please note: while we would like to keep the API stable as much as possible, Playlet can't reasonbly maintain multiple versions of the API like traditional web apis, because it adds complexity and maintainablity burden on an app the runs in constrained environment. In short, we'll try not to break the API, but we might from time to time. Please note: while we would like to keep the API stable as much as possible, Playlet can't reasonbly maintain multiple versions of the API like traditional web apis, because it adds complexity and maintainablity burden on an app the runs in constrained environment. In short, we'll try not to break the API, but we might from time to time.
#### Debug endpoints #### Debug endpoints
@@ -276,7 +274,7 @@ The Playlet web app uses [Tailwind CSS](https://tailwindcss.com/) as its base st
### API calls ### API calls
The Playlet web app communicates with the Playlet Roku app using web APIs. Most of the APIs used are described in the OpenAPI spec [playlet-web-api.yml](./playlet-web-api.yml). The web app also uses Invidious apis documented at [https://docs.invidious.io/api](https://docs.invidious.io/api) The Playlet web app communicates with the Playlet Roku app using web APIs. The web app also uses Invidious apis documented at [https://docs.invidious.io/api](https://docs.invidious.io/api)
#### API calls (proxy authenticated) #### API calls (proxy authenticated)
-644
View File
@@ -1,644 +0,0 @@
openapi: 3.0.0
info:
title: Playlet Web API
version: 0.37.0
description:
Playlet Web API is a RESTful API for controlling the Playlet app on
Roku devices. The API is intended to be used by the Playlet web app, but can
also be used by other apps.
contact:
name: Brahim Hadriche
url: https://github.com/iBicha
email: brahim.hadriche@gmail.com
servers:
- url: http://{ROKU_DEV_TARGET}:{PORT}
description: Playlet server
variables:
ROKU_DEV_TARGET:
description: The IP address of the Roku device
default: 192.168.1.x
PORT:
description: The port number of the Playlet server
default: "8888"
paths:
/api/state:
get:
summary: Get Playlet app state
description: >
Get the current state of the Playlet app. The `key` parameter is
optional and can be omitted to get the entire state. If the `key`
parameter is specified, only the specified key(s) will be returned.
operationId: getPlayletState
parameters:
- name: key
in: query
description: specific key(s) to get
required: false
schema:
type: array
items:
type: string
enum:
- app
- device
- invidious
- preferences
- profiles
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/PlayletAppState"
/api/preferences:
get:
summary: Get preferences
description: |
Get the current user preferences.
operationId: getPreferences
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/PreferencesObject"
put:
summary: Set preferences
description: >
Set the current user preferences. The request body can contain some or
all of the preferences. Any preferences not specified in the request
body will be left unchanged.
operationId: setPreferences
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/PreferencesObject"
responses:
"204":
description: No Content
"400":
description: Bad Request
delete:
summary: Reset preferences
description: |
Reset the current user preferences to their default values.
operationId: resetPreferences
responses:
"204":
description: No Content
/api/search-history:
get:
summary: Get search history
description: |
Get the current search history.
operationId: getSearchHistory
responses:
"200":
description: OK
content:
application/json:
schema:
type: array
items:
type: string
post:
summary: Add to search history
description: |
Add a query to the search history.
operationId: addToSearchHistory
requestBody:
content:
application/json:
schema:
type: object
properties:
query:
type: string
responses:
"200":
description: OK
content:
application/json:
schema:
type: array
items:
type: string
"400":
description: Bad Request
delete:
summary: Clear search history
description: |
Clear the search history.
operationId: clearSearchHistory
responses:
"204":
description: No Content
/api/queue:
get:
summary: Get video queue
description: Get the current videos in the queue.
operationId: getVideoQueue
responses:
"200":
description: OK
content:
application/json:
schema:
type: object
properties:
items:
type: array
items:
$ref: "#/components/schemas/VideoQueueObject"
index:
type: integer
nowPlaying:
$ref: "#/components/schemas/VideoQueueObject"
post:
summary: Add to video queue
description: Add a video or a playlist to the queue.
operationId: addToVideoQueue
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/VideoQueueObject"
responses:
"204":
description: No Content
delete:
summary: Clear video queue
description: Clear the video queue.
operationId: clearVideoQueue
responses:
"204":
description: No Content
/api/queue/play:
post:
summary: Play video
description: Play a video or playlist. This adds the video or playlist to the current position in the queue and plays it.
operationId: playVideoQueue
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/VideoQueueObject"
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/home-layout:
get:
summary: Get home layout
description: Get the current home layout. This is the layout of the home screen, based on user preferences.
operationId: getHomeLayout
responses:
"200":
description: OK
content:
application/json:
schema:
type: array
items:
type: object
properties:
id:
type: string
title:
type: string
feedSources:
type: array
items:
type: object
properties:
apiType:
type: string
endpoint:
type: string
id:
type: string
queryParams:
type: object
additionalProperties: true
title:
type: string
/api/playlet-lib-urls:
get:
summary: Get Playlet lib URLs
description: Get the currently loaded Playlet lib url, and the saved ones to be loaded on next start.
operationId: getPlayletLibUrls
responses:
"200":
description: OK
content:
application/json:
schema:
type: object
properties:
loaded:
type: object
properties:
link:
type: string
type:
type: string
saved:
type: array
items:
type: object
properties:
link:
type: string
type:
type: string
post:
summary: Set Playlet lib URLs
description: >
Set a list of Playlet lib URLs to be loaded on next start. Playlet will try to load them one after the other
until one succeeds.
operationId: setPlayletLibUrls
requestBody:
content:
application/json:
schema:
type: array
items:
type: object
properties:
link:
type: string
type:
type: string
responses:
"204":
description: No Content
"400":
description: Bad Request
delete:
summary: Clear Playlet lib URLs
description: Clear the Playlet lib URLs. This affects the saved links in the registry, and will take effect on next start.
operationId: clearPlayletLibUrls
responses:
"204":
description: No Content
/invidious/login:
get:
summary: Redirect to the Invidious auth URL
description: Redirect to the Invidious auth URL, to allow authorizing an access token. Redirects to the Invidious auth URL.
operationId: invidiousLoginUrl
responses:
"302":
description: Found
headers:
Location:
schema:
type: string
format: uri
/api/profiles:
get:
summary: Get profiles
description: Get the logged profiles, and the currently active profile.
operationId: getProfiles
responses:
"200":
description: OK
content:
application/json:
schema:
type: object
properties:
currentProfile:
type: string
profiles:
type: array
items:
$ref: "#/components/schemas/ProfileObject"
delete:
summary: Logout from a profile
description: Logout from a profile. This will remove the profile from the list of logged profiles.
operationId: logoutProfile
parameters:
- name: id
in: query
description: The ID of the profile to logout
required: true
schema:
type: string
responses:
"200":
description: OK
"400":
description: Bad Request
"404":
description: Not Found
/api/profiles/activate:
post:
summary: Activate a profile
description: Activate a profile. This will set the profile as the active profile.
operationId: activateProfile
requestBody:
content:
application/json:
schema:
type: object
properties:
id:
type: string
responses:
"200":
description: OK
"400":
description: Bad Request
"404":
description: Not Found
# Roku External Control Protocol (ECP)
/input/{appId}:
servers:
- url: http://{ROKU_DEV_TARGET}:8060
description: Roku ECP endpoint
variables:
ROKU_DEV_TARGET:
description: The IP address of the Roku device
default: 192.168.1.x
parameters:
- $ref: "#/components/parameters/ecpAppId"
post:
summary: Send input to Playlet through ECP
description: Send input to Playlet through Roku External Control Protocol (ECP). This enables the deep-linking functionality.
operationId: ecpInput
parameters:
- $ref: "#/components/parameters/ecpContentId"
- $ref: "#/components/parameters/ecpMediaType"
- $ref: "#/components/parameters/ecpVideoId"
- $ref: "#/components/parameters/ecpTimestamp"
- $ref: "#/components/parameters/ecpTitle"
- $ref: "#/components/parameters/ecpAuthor"
responses:
"200":
description: OK
/launch/{appId}:
servers:
- url: http://{ROKU_DEV_TARGET}:8060
description: Roku ECP endpoint
variables:
ROKU_DEV_TARGET:
description: The IP address of the Roku device
default: 192.168.1.x
parameters:
- $ref: "#/components/parameters/ecpAppId"
post:
summary: Launch Playlet using ECP with arguments
description: Launch Playlet through Roku External Control Protocol (ECP) with arguments. This enables the deep-linking functionality.
operationId: ecpLaunch
parameters:
- $ref: "#/components/parameters/ecpClearPlayletLibUrls"
- $ref: "#/components/parameters/ecpContentId"
- $ref: "#/components/parameters/ecpMediaType"
- $ref: "#/components/parameters/ecpVideoId"
- $ref: "#/components/parameters/ecpTimestamp"
- $ref: "#/components/parameters/ecpTitle"
- $ref: "#/components/parameters/ecpAuthor"
responses:
"200":
description: OK
components:
parameters:
ecpAppId:
name: appId
in: path
description: The app ID of the Playlet app
required: true
schema:
type: string
enum:
- "693751" # Playlet app id
- dev
default: "693751"
ecpContentId:
name: contentId
in: query
description: The ID of the content to play. If specified with mediaType=video, this is the videoId.
required: false
schema:
type: string
ecpMediaType:
name: mediaType
in: query
description: The type of the content of ContentId. To be used with the contentId argument.
required: false
schema:
type: string
enum:
- video
ecpVideoId:
name: videoId
in: query
description: The video ID of the video to play. If specified, the video will be played.
required: false
schema:
type: string
ecpTimestamp:
name: timestamp
in: query
description: The timestamp of the video to play. To be used with the contentId argument.
required: false
schema:
type: integer
ecpTitle:
name: title
in: query
description: The title of the video. This is optionally added so we can display the title while loading, or when displaying the "Added to queue" notification.
required: false
schema:
type: string
ecpAuthor:
name: author
in: query
description: The author of the video. This is optionally added so we can display the author while loading, or when displaying the "Added to queue" notification.
required: false
schema:
type: string
ecpClearPlayletLibUrls:
name: clearPlayletLibUrls
in: query
description: If specified, the Playlet lib URLs will be cleared.
required: false
schema:
type: string
schemas:
PlayletAppState:
type: object
properties:
app:
type: object
properties:
id:
type: string
version:
type: string
git_commit_hash:
type: string
lib_version:
type: string
lib_git_commit_hash:
type: string
lib_version_latest:
type: string
lib_url_type:
type: string
device:
type: object
properties:
model:
type: string
model_display_name:
type: string
model_type:
type: string
model_details:
type: object
additionalProperties: true
os_version:
type: object
properties:
build:
type: string
major:
type: string
minor:
type: string
revision:
type: string
display_type:
type: string
display_mode:
type: string
display_aspect_ratio:
type: string
display_size:
type: object
properties:
w:
type: integer
h:
type: integer
video_mode:
type: string
ui_resolution:
type: object
properties:
height:
type: integer
name:
type: string
width:
type: integer
graphics_platform:
type: string
internet_status:
type: boolean
user_country_code:
type: string
friendly_name:
type: string
current_locale:
type: string
invidious:
type: object
properties:
current_instance:
type: string
auth_url:
type: string
preferences:
$ref: "#/components/schemas/PreferencesObject"
profiles:
type: object
properties:
currentProfile:
type: string
profiles:
type: array
items:
$ref: "#/components/schemas/ProfileObject"
PreferencesObject:
type: object
properties:
invidious.instance:
type: string
invidious.proxy_videos:
type: string
enum:
- always
- if_needed
- never
playback.autoplay:
type: string
enum:
- auto
- 720p
playback.preferred_quality:
type: string
sponsorblock.enabled:
type: boolean
sponsorblock.show_notifications:
type: boolean
ProfileObject:
type: object
properties:
id:
type: string
type:
type: string
username:
type: string
serverUrl:
type: string
# TODO:P1 add the rest of properties
VideoQueueObject:
type: object
properties:
videoId:
type: string
playlistId:
type: string
playlistIndex:
type: integer
timestamp:
type: integer
title:
type: string
author:
type: string
+24 -24
View File
@@ -1,22 +1,22 @@
{ {
"name": "playlet", "name": "playlet",
"version": "0.37.0", "version": "0.39.0",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "playlet", "name": "playlet",
"version": "0.37.0", "version": "0.39.0",
"hasInstallScript": true, "hasInstallScript": true,
"devDependencies": { "devDependencies": {
"@rokucommunity/bslint": "^0.8.30", "@rokucommunity/bslint": "^0.8.31",
"@types/crypto-js": "^4.2.2", "@types/crypto-js": "^4.2.2",
"@types/fs-extra": "^11.0.4", "@types/fs-extra": "^11.0.4",
"@types/node": "^22.15.17", "@types/node": "^22.15.18",
"@types/xml2js": "^0.4.14", "@types/xml2js": "^0.4.14",
"argparse": "^2.0.1", "argparse": "^2.0.1",
"brighterscript": "0.68.5", "brighterscript": "0.68.5",
"brighterscript-formatter": "^1.7.13", "brighterscript-formatter": "^1.7.14",
"cheerio": "1.0.0-rc.11", "cheerio": "1.0.0-rc.11",
"convert-svg-to-png": "^0.6.4", "convert-svg-to-png": "^0.6.4",
"crypto-js": "^4.2.0", "crypto-js": "^4.2.0",
@@ -32,12 +32,12 @@
"roku-test-automation": "^2.0.13", "roku-test-automation": "^2.0.13",
"rooibos-roku": "5.15.7", "rooibos-roku": "5.15.7",
"rounded-rect-9patch": "^1.1.2", "rounded-rect-9patch": "^1.1.2",
"semver": "^7.7.1", "semver": "^7.7.2",
"shelljs": "^0.10.0", "shelljs": "^0.10.0",
"ts-node": "^10.9.2", "ts-node": "^10.9.2",
"typescript": "5.8.3", "typescript": "5.8.3",
"xml2js": "^0.6.2", "xml2js": "^0.6.2",
"yaml": "^2.7.1" "yaml": "^2.8.0"
}, },
"engines": { "engines": {
"node": "20" "node": "20"
@@ -438,9 +438,9 @@
"dev": true "dev": true
}, },
"node_modules/@rokucommunity/bslint": { "node_modules/@rokucommunity/bslint": {
"version": "0.8.30", "version": "0.8.31",
"resolved": "https://registry.npmjs.org/@rokucommunity/bslint/-/bslint-0.8.30.tgz", "resolved": "https://registry.npmjs.org/@rokucommunity/bslint/-/bslint-0.8.31.tgz",
"integrity": "sha512-OMXmVslummcvvK7+b7abXtGZc2t6IaxcPG1Uq3ZoNj4qqJn0z2zZLnDjizDPR0c2kaZGI3wPTHehrGMjPbkR0Q==", "integrity": "sha512-/VsycIH2OiEoNe7fCLqbQrDnX/JoKUV3Nufg0+auCM/DhCYzL4iM965VkSBebWzwUsnQXjILaKC4fRcMjpSBPQ==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
@@ -760,9 +760,9 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/@types/node": { "node_modules/@types/node": {
"version": "22.15.17", "version": "22.15.18",
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.15.17.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-22.15.18.tgz",
"integrity": "sha512-wIX2aSZL5FE+MR0JlvF87BNVrtFWf6AE6rxSE9X7OwnVvoyCQjpzSRJ+M87se/4QCkCiebQAqrJ0y6fwIyi7nw==", "integrity": "sha512-v1DKRfUdyW+jJhZNEI1PYy29S2YRxMV5AOO/x/SjKmW0acCIOqmbj6Haf9eHAhsPmrhlHSxEhv/1WszcLWV4cg==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
@@ -1360,13 +1360,13 @@
} }
}, },
"node_modules/brighterscript-formatter": { "node_modules/brighterscript-formatter": {
"version": "1.7.13", "version": "1.7.14",
"resolved": "https://registry.npmjs.org/brighterscript-formatter/-/brighterscript-formatter-1.7.13.tgz", "resolved": "https://registry.npmjs.org/brighterscript-formatter/-/brighterscript-formatter-1.7.14.tgz",
"integrity": "sha512-fv2s+9CdYufQllOiE/uLayqNGq7fqy7FmCWy8gOengrNK7pUp6BV1G+3fuhRSN7A2xLNcXIB+8q6tnCGdb6qeg==", "integrity": "sha512-rbK5lT2UZ/yD/JLryIsZC9Kng1vh4xFf9CO1tp8nMRaOTncscuD1mtMsmJXq0uQusxoRNBXB/tvSZQPKR9+SXQ==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"brighterscript": "^0.69.8", "brighterscript": "^0.69.9",
"glob-all": "^3.3.0", "glob-all": "^3.3.0",
"jsonc-parser": "^3.0.0", "jsonc-parser": "^3.0.0",
"source-map": "^0.7.3", "source-map": "^0.7.3",
@@ -6712,9 +6712,9 @@
} }
}, },
"node_modules/semver": { "node_modules/semver": {
"version": "7.7.1", "version": "7.7.2",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.7.1.tgz", "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz",
"integrity": "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==", "integrity": "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==",
"dev": true, "dev": true,
"license": "ISC", "license": "ISC",
"bin": { "bin": {
@@ -7925,16 +7925,16 @@
"dev": true "dev": true
}, },
"node_modules/yaml": { "node_modules/yaml": {
"version": "2.7.1", "version": "2.8.0",
"resolved": "https://registry.npmjs.org/yaml/-/yaml-2.7.1.tgz", "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.8.0.tgz",
"integrity": "sha512-10ULxpnOCQXxJvBgxsn9ptjq6uviG/htZKk9veJGhlqn3w/DxQ631zFF+nlQXLwmImeS5amR2dl2U8sg6U9jsQ==", "integrity": "sha512-4lLa/EcQCB0cJkyts+FpIRx5G/llPxfP6VQU5KByHEhLxY3IJCH0f0Hy1MHI8sClTvsIb8qwRJ6R/ZdlDJ/leQ==",
"dev": true, "dev": true,
"license": "ISC", "license": "ISC",
"bin": { "bin": {
"yaml": "bin.mjs" "yaml": "bin.mjs"
}, },
"engines": { "engines": {
"node": ">= 14" "node": ">= 14.6"
} }
}, },
"node_modules/yargs": { "node_modules/yargs": {
+6 -6
View File
@@ -1,16 +1,16 @@
{ {
"name": "playlet", "name": "playlet",
"version": "0.37.0", "version": "0.39.0",
"description": "Unofficial YouTube client for Roku", "description": "Unofficial YouTube client for Roku",
"devDependencies": { "devDependencies": {
"@rokucommunity/bslint": "^0.8.30", "@rokucommunity/bslint": "^0.8.31",
"@types/crypto-js": "^4.2.2", "@types/crypto-js": "^4.2.2",
"@types/fs-extra": "^11.0.4", "@types/fs-extra": "^11.0.4",
"@types/node": "^22.15.17", "@types/node": "^22.15.18",
"@types/xml2js": "^0.4.14", "@types/xml2js": "^0.4.14",
"argparse": "^2.0.1", "argparse": "^2.0.1",
"brighterscript": "0.68.5", "brighterscript": "0.68.5",
"brighterscript-formatter": "^1.7.13", "brighterscript-formatter": "^1.7.14",
"cheerio": "1.0.0-rc.11", "cheerio": "1.0.0-rc.11",
"convert-svg-to-png": "^0.6.4", "convert-svg-to-png": "^0.6.4",
"crypto-js": "^4.2.0", "crypto-js": "^4.2.0",
@@ -26,12 +26,12 @@
"roku-test-automation": "^2.0.13", "roku-test-automation": "^2.0.13",
"rooibos-roku": "5.15.7", "rooibos-roku": "5.15.7",
"rounded-rect-9patch": "^1.1.2", "rounded-rect-9patch": "^1.1.2",
"semver": "^7.7.1", "semver": "^7.7.2",
"shelljs": "^0.10.0", "shelljs": "^0.10.0",
"ts-node": "^10.9.2", "ts-node": "^10.9.2",
"typescript": "5.8.3", "typescript": "5.8.3",
"xml2js": "^0.6.2", "xml2js": "^0.6.2",
"yaml": "^2.7.1" "yaml": "^2.8.0"
}, },
"engines": { "engines": {
"node": "20" "node": "20"
+2 -2
View File
@@ -1,12 +1,12 @@
{ {
"name": "playlet-app", "name": "playlet-app",
"version": "0.37.0", "version": "0.39.0",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "playlet-app", "name": "playlet-app",
"version": "0.37.0" "version": "0.39.0"
} }
} }
} }
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "playlet-app", "name": "playlet-app",
"version": "0.37.0", "version": "0.39.0",
"description": "Unofficial YouTube client for Roku", "description": "Unofficial YouTube client for Roku",
"scripts": { "scripts": {
"prebuild": "rm -rf ../build/playlet-app", "prebuild": "rm -rf ../build/playlet-app",
+1 -1
View File
@@ -2,7 +2,7 @@ title=Playlet
# Do not update version manually, it is auto updated from package.json # Do not update version manually, it is auto updated from package.json
major_version=0 major_version=0
minor_version=37 minor_version=39
build_version=00000 build_version=00000
ui_resolutions=hd ui_resolutions=hd
+2 -2
View File
@@ -1,12 +1,12 @@
{ {
"name": "playlet-lib", "name": "playlet-lib",
"version": "0.37.0", "version": "0.39.0",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "playlet-lib", "name": "playlet-lib",
"version": "0.37.0" "version": "0.39.0"
} }
} }
} }
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "playlet-lib", "name": "playlet-lib",
"version": "0.37.0", "version": "0.39.0",
"description": "Unofficial YouTube client for Roku", "description": "Unofficial YouTube client for Roku",
"scripts": { "scripts": {
"prebuild": "rm -rf ../build/playlet-lib", "prebuild": "rm -rf ../build/playlet-lib",
@@ -101,9 +101,16 @@ function CreateChannelFeeds(authorId as string, author as string, tabs as object
return invalid return invalid
end if end if
disableShorts = m.preferences["content_feed.disable_shorts"]
feeds = [] feeds = []
for i = 0 to tabs.count() - 1 for i = 0 to tabs.count() - 1
tabName = tabs[i] tabName = tabs[i]
if tabName = "shorts" and disableShorts
LogInfo(`Skipping "Shorts" tab based on user settings`)
continue for
end if
if m.tabs.DoesExist(tabName) if m.tabs.DoesExist(tabName)
if tabsParams <> invalid and tabsParams.DoesExist(tabName) if tabsParams <> invalid and tabsParams.DoesExist(tabName)
params = tabsParams[tabName] params = tabsParams[tabName]
@@ -5,6 +5,7 @@
<field id="isSubscribed" type="boolean" onChange="OnSubscriptionChanged" /> <field id="isSubscribed" type="boolean" onChange="OnSubscriptionChanged" />
<field id="appController" type="node" bind="/AppController" /> <field id="appController" type="node" bind="/AppController" />
<field id="invidious" type="node" bind="/Invidious" /> <field id="invidious" type="node" bind="/Invidious" />
<field id="preferences" type="node" bind="/Preferences" />
<field id="bookmarksService" type="node" bind="/BookmarksService" /> <field id="bookmarksService" type="node" bind="/BookmarksService" />
<function name="ShowSortDialog" /> <function name="ShowSortDialog" />
</interface> </interface>
@@ -54,18 +54,19 @@ function PlaylistContentTask(input as object) as object
} }
end if end if
beforeChildCount = contentNode.getChildCount()
InvidiousContent.ToPlaylistContentNode(contentNode, metadata, instance) InvidiousContent.ToPlaylistContentNode(contentNode, metadata, instance)
childCount = contentNode.getChildCount() afterChildCount = contentNode.getChildCount()
videoCount = ValidInt(metadata.videoCount) videoCount = ValidInt(metadata.videoCount)
hasContinuation = not StringUtils.IsNullOrEmpty(metadata.continuation) hasContinuation = not StringUtils.IsNullOrEmpty(metadata.continuation)
noMoreContinuation = hadContinuation and not hasContinuation noMoreContinuation = hadContinuation and not hasContinuation
noVideosReturned = metadata.videos.Count() = 0 noVideosAdded = afterChildCount = beforeChildCount
reachedVideoCount = videoCount <> -1 and childCount >= videoCount reachedVideoCount = videoCount <> -1 and afterChildCount >= videoCount
if noMoreContinuation or noVideosReturned or reachedVideoCount if noMoreContinuation or noVideosAdded or reachedVideoCount
contentNode.loadState = FeedLoadState.Loaded contentNode.loadState = FeedLoadState.Loaded
return { return {
success: true success: true
@@ -22,6 +22,10 @@
<field id="title" type="string" /> <field id="title" type="string" />
<field id="videoId" type="string" /> <field id="videoId" type="string" />
<field id="viewCountText" type="string" /> <field id="viewCountText" type="string" />
<!-- lines is from the tv client (author name + video info) -->
<field id="lines" type="stringarray" /> <field id="lines" type="stringarray" />
<!-- videoInfo is from web client -->
<field id="videoInfo" type="string" />
<field id="percentDurationWatched" type="float" />
</interface> </interface>
</component> </component>
@@ -1,3 +1,4 @@
import "pkg:/source/utils/StringUtils.bs"
import "pkg:/source/utils/TimeUtils.bs" import "pkg:/source/utils/TimeUtils.bs"
import "pkg:/source/utils/Types.bs" import "pkg:/source/utils/Types.bs"
@@ -15,7 +16,23 @@ function OnContentSet() as void
m.top.title = content.title m.top.title = content.title
' NOTE: "_author" not "author". See PlaylistContentNode.xml for explanation. ' NOTE: "_author" not "author". See PlaylistContentNode.xml for explanation.
m.top.author = content._author author = content._author
if not StringUtils.IsNullOrEmpty(author)
videoInfo = content.videoInfo
if not StringUtils.IsNullOrEmpty(videoInfo)
author += `\n` + videoInfo
end if
else
lines = content.lines
if IsArray(lines) and lines.Count() > 0
author = lines[0]
if lines.Count() > 1
author += `\n` + lines[1]
end if
end if
end if
m.top.author = author
m.top.thumbnailUri = content.thumbnail m.top.thumbnailUri = content.thumbnail
SetDurationText(content.lengthText) SetDurationText(content.lengthText)
@@ -44,8 +44,9 @@
<Label <Label
id="authorLabel" id="authorLabel"
width="350" width="350"
height="25" font="font:SmallestSystemFont"
font="font:SmallestSystemFont" /> maxLines="2"
wrap="true" />
</LayoutGroup> </LayoutGroup>
</children> </children>
@@ -17,7 +17,7 @@ function SearchSuggestionsTask(input as object) as object
suggestions: [] suggestions: []
} }
else else
backend = preferencesNode["playback.backend"] backend = preferencesNode["backend.selected"]
if backend = "playlet" if backend = "playlet"
searchSuggestsions = InnertubeService.SearchSuggestions(q, m.top.cancellation) searchSuggestsions = InnertubeService.SearchSuggestions(q, m.top.cancellation)
else else
@@ -12,7 +12,6 @@ class DashManifest
m.invidiousInstance = invidiousInstance m.invidiousInstance = invidiousInstance
m.utils = new Http.Utils() m.utils = new Http.Utils()
m.urlRegex = /https?:\/\/\S+(\/\S+)/i
' https://github.com/LuanRT/YouTube.js/blob/6082b4a52ee07a622735e6e9128a0531a5ae3bfb/src/utils/StreamingInfo.ts#L332-L349 ' https://github.com/LuanRT/YouTube.js/blob/6082b4a52ee07a622735e6e9128a0531a5ae3bfb/src/utils/StreamingInfo.ts#L332-L349
m.colorInfo = { m.colorInfo = {
@@ -38,8 +37,11 @@ class DashManifest
adaptiveFormats.Append(metadata.adaptiveFormats) adaptiveFormats.Append(metadata.adaptiveFormats)
if local if local
parsedInvidiousUrl = UrlUtils.ParseUrl(m.invidiousInstance)
for i = 0 to adaptiveFormats.Count() - 1 for i = 0 to adaptiveFormats.Count() - 1
adaptiveFormats[i].url = m.urlRegex.replace(adaptiveFormats[i].url, m.invidiousInstance + "\1") parsedUrl = UrlUtils.ParseUrl(adaptiveFormats[i].url)
parsedInvidiousUrl.path = UrlUtils.AppendQueryParams(parsedUrl.path, { host: parsedUrl.host })
adaptiveFormats[i].url = UrlUtils.BuildUrlFromParts(parsedInvidiousUrl)
end for end for
end if end if
@@ -1,19 +1,19 @@
const INNERTUBE_IOS_CLIENT_NAME = "5" const INNERTUBE_IOS_CLIENT_NAME = "5"
const INNERTUBE_IOS_CLIENT_VERSION = "19.49.7" const INNERTUBE_IOS_CLIENT_VERSION = "20.20.5"
const INNERTUBE_IOS_DEVICE_MODEL = "iPhone16,2" const INNERTUBE_IOS_DEVICE_MODEL = "iPhone16,2"
const INNERTUBE_IOS_OS_VERSION = "18.1" const INNERTUBE_IOS_OS_VERSION = "18.1"
const INNERTUBE_IOS_USER_AGENT = "com.google.ios.youtube/19.49.7 (iPhone16,2; U; CPU iOS 18_1_0 like Mac OS X)" const INNERTUBE_IOS_USER_AGENT = "com.google.ios.youtube/20.20.5 (iPhone16,2; U; CPU iOS 18_1_0 like Mac OS X)"
const INNERTUBE_WEB_BROWSER_NAME = "Chrome" const INNERTUBE_WEB_BROWSER_NAME = "Chrome"
const INNERTUBE_WEB_BROWSER_VERSION = "135.0.0.0" const INNERTUBE_WEB_BROWSER_VERSION = "136.0.0.0"
const INNERTUBE_WEB_CLIENT_NAME = "1" const INNERTUBE_WEB_CLIENT_NAME = "1"
const INNERTUBE_WEB_CLIENT_VERSION = "2.20250502.01.00" const INNERTUBE_WEB_CLIENT_VERSION = "2.20250520.05.00"
const INNERTUBE_WEB_USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0" const INNERTUBE_WEB_USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0"
const INNERTUBE_TV_BROWSER_NAME = "LG Browser" const INNERTUBE_TV_BROWSER_NAME = "LG Browser"
const INNERTUBE_TV_BROWSER_VERSION = "7.00.00" const INNERTUBE_TV_BROWSER_VERSION = "7.00.00"
const INNERTUBE_TV_CLIENT_NAME = "2" const INNERTUBE_TV_CLIENT_NAME = "2"
const INNERTUBE_TV_CLIENT_VERSION = "7.20241211.14.01" const INNERTUBE_TV_CLIENT_VERSION = "7.20250519.12.01"
const INNERTUBE_TV_DEVICE_MAKE = "LGE" const INNERTUBE_TV_DEVICE_MAKE = "LGE"
const INNERTUBE_TV_DEVICE_MODEL = "24LF4820-BU" const INNERTUBE_TV_DEVICE_MODEL = "24LF4820-BU"
const INNERTUBE_TV_OS_NAME = "webOS" const INNERTUBE_TV_OS_NAME = "webOS"
@@ -147,6 +147,7 @@ namespace Innertube
"clientFormFactor": "UNKNOWN_FORM_FACTOR" "clientFormFactor": "UNKNOWN_FORM_FACTOR"
"webpSupport": false "webpSupport": false
"tvAppInfo": { "tvAppInfo": {
' "appQuality": "TV_APP_QUALITY_FULL_ANIMATION"
"appQuality": "TV_APP_QUALITY_LIMITED_MEMORY" "appQuality": "TV_APP_QUALITY_LIMITED_MEMORY"
"useStartPlaybackPreviewCommand": false "useStartPlaybackPreviewCommand": false
"supportsNativeScrolling": false "supportsNativeScrolling": false
@@ -182,32 +182,13 @@ namespace InnertubeService
end function end function
function Search(query as string, options = invalid as object) as object function Search(query as string, options = invalid as object) as object
searchFilters = invalid return Innertube.Search(query, options)
continuation = ""
cancellation = invalid
raw = false
if options <> invalid
if options.DoesExist("searchFilters")
searchFilters = options.searchFilters
end if
if options.DoesExist("continuation")
continuation = options.continuation
end if
if options.DoesExist("cancellation")
cancellation = options.cancellation
end if
if options.DoesExist("raw")
raw = options.raw
end if
end if
return Innertube.Search(query, searchFilters, continuation, cancellation, raw)
end function end function
function GetTrending(options = invalid as object) as object function GetTrending(options = invalid as object) as object
cancellation = invalid cancellation = invalid
params = "" params = ""
disableShorts = false
raw = false raw = false
if options <> invalid if options <> invalid
@@ -228,6 +209,9 @@ namespace InnertubeService
params = "4gIKGgh0cmFpbGVycw%3D%3D" params = "4gIKGgh0cmFpbGVycw%3D%3D"
end if end if
end if end if
if options.DoesExist("disableShorts")
disableShorts = options.disableShorts
end if
if options.DoesExist("raw") if options.DoesExist("raw")
raw = options.raw raw = options.raw
end if end if
@@ -252,7 +236,10 @@ namespace InnertubeService
return response.Json() return response.Json()
end if end if
feeds = Innertube.ParseResponseDataForFeeds(response.Json(), { skipCreatorOnTheRise: true }) feeds = Innertube.ParseResponseDataForFeeds(response.Json(), {
disableCreatorOnTheRise: true
disableShorts: disableShorts
})
result = { result = {
feeds: feeds feeds: feeds
@@ -286,6 +273,7 @@ namespace InnertubeService
cancellation = invalid cancellation = invalid
accessToken = invalid accessToken = invalid
continuation = "" continuation = ""
disableShorts = false
if options <> invalid if options <> invalid
if options.DoesExist("cancellation") if options.DoesExist("cancellation")
@@ -297,6 +285,9 @@ namespace InnertubeService
if options.DoesExist("continuation") if options.DoesExist("continuation")
continuation = options.continuation continuation = options.continuation
end if end if
if options.DoesExist("disableShorts")
disableShorts = options.disableShorts
end if
end if end if
request = Innertube.CreateBrowseRequest(browserId, Innertube.ClientType.Tv, "", continuation) request = Innertube.CreateBrowseRequest(browserId, Innertube.ClientType.Tv, "", continuation)
@@ -312,11 +303,21 @@ namespace InnertubeService
} }
end if end if
json = response.Json() feeds = Innertube.ParseResponseDataForFeeds(response.Json(), { disableShorts: disableShorts })
return Innertube.ParseResponseDataForFeeds(json)
result = {
feeds: feeds
}
cacheControl = Innertube.ParseResponseForCacheControl(response)
if cacheControl <> invalid
result["cache-control"] = cacheControl
end if
return result
end function end function
function AuthMarkVideoWatched(videoId as string, options as object) as boolean function AuthGetPlaybackTrackingUrls(videoId as string, options as object) as object
cancellation = invalid cancellation = invalid
accessToken = options.accessToken accessToken = options.accessToken
@@ -330,43 +331,95 @@ namespace InnertubeService
playerResponse = playerRequest.Await() playerResponse = playerRequest.Await()
if not playerResponse.IsSuccess() if not playerResponse.IsSuccess()
LogError("Error marking video as watched:", playerResponse.ErrorMessage()) return {
return false error: playerResponse.ErrorMessage()
end if }
if CancellationUtils.IsCancelled(cancellation)
return false
end if end if
json = playerResponse.Json() json = playerResponse.Json()
videostatsPlaybackUrl = ObjectUtils.Dig(json, ["playbackTracking", "videostatsPlaybackUrl", "baseUrl"]) videostatsPlaybackUrl = ObjectUtils.Dig(json, ["playbackTracking", "videostatsPlaybackUrl", "baseUrl"])
if StringUtils.IsNullOrEmpty(videostatsPlaybackUrl) videostatsWatchtimeUrl = ObjectUtils.Dig(json, ["playbackTracking", "videostatsWatchtimeUrl", "baseUrl"])
LogError("No videostatsPlaybackUrl found in response")
return false return {
videostatsPlaybackUrl: videostatsPlaybackUrl
videostatsWatchtimeUrl: videostatsWatchtimeUrl
}
end function
function AuthMarkVideoWatched(videostatsPlaybackUrl as string, options as object) as boolean
cancellation = invalid
accessToken = options.accessToken
if options.DoesExist("cancellation")
cancellation = options.cancellation
end if end if
videostatsPlaybackUrl = videostatsPlaybackUrl.replace("https://s.youtube.com", "https://www.youtube.com") videostatsPlaybackUrl = videostatsPlaybackUrl.replace("https://s.", "https://www.")
queryParams = UrlUtils.ParseQueryComponents(videostatsPlaybackUrl) queryParams = UrlUtils.ParseQueryComponents(videostatsPlaybackUrl)
queryParams["c"] = "TVHTML5" queryParams["c"] = "TVHTML5"
queryParams["cbrver"] = INNERTUBE_TV_CLIENT_VERSION queryParams["cbrver"] = INNERTUBE_TV_CLIENT_VERSION
queryParams["cver"] = INNERTUBE_TV_CLIENT_VERSION queryParams["cver"] = INNERTUBE_TV_CLIENT_VERSION
queryParams["cpn"] = InnertubeService.CreateClientPlaybackNonce()
queryParams["fmt"] = "251"
queryParams["rtn"] = "0"
queryParams["rt"] = "0"
queryParams["ver"] = "2" queryParams["ver"] = "2"
queryParams["cpn"] = InnertubeService.CreateClientPlaybackNonce()
queryParams["cmt"] = 0
queryParams["final"] = "1"
videostatsPlaybackUrl = UrlUtils.SetQueryParams(videostatsPlaybackUrl, queryParams) videostatsPlaybackUrl = UrlUtils.SetQueryParams(videostatsPlaybackUrl, queryParams)
trackingRequest = HttpClient.Get(videostatsPlaybackUrl) request = HttpClient.Get(videostatsPlaybackUrl)
trackingRequest.Header("Authorization", "Bearer " + accessToken) request.Cancellation(cancellation)
request.NoCache()
request.Headers(Innertube.CreateHeaders(Innertube.ClientType.Tv))
request.Header("Authorization", "Bearer " + accessToken)
trackingResponse = trackingRequest.Await() response = request.Await()
if not trackingResponse.IsSuccess() if not response.IsSuccess()
LogError("Error marking video as watched:", trackingResponse.ErrorMessage()) LogError("Error marking video as watched:", response.ErrorMessage())
return false return false
end if end if
LogDebug("Marked video as watched:", videoId) LogDebug("Marked video as watched")
return true
end function
function AuthMarkVideoWatchTime(time as float, videostatsWatchtimeUrl as string, options = invalid as object) as boolean
cancellation = invalid
accessToken = options.accessToken
if options <> invalid
if options.DoesExist("cancellation")
cancellation = options.cancellation
end if
end if
timeStr = time.ToStr("%.3f")
videostatsWatchtimeUrl = videostatsWatchtimeUrl.replace("https://s.", "https://www.")
queryParams = UrlUtils.ParseQueryComponents(videostatsWatchtimeUrl)
queryParams["c"] = "TVHTML5"
queryParams["cbrver"] = INNERTUBE_TV_CLIENT_VERSION
queryParams["cver"] = INNERTUBE_TV_CLIENT_VERSION
queryParams["ver"] = "2"
queryParams["cpn"] = InnertubeService.CreateClientPlaybackNonce()
queryParams["cmt"] = 0
queryParams["final"] = "1"
queryParams["st"] = timeStr
queryParams["et"] = timeStr
videostatsWatchtimeUrl = UrlUtils.SetQueryParams(videostatsWatchtimeUrl, queryParams)
request = HttpClient.Get(videostatsWatchtimeUrl)
request.Cancellation(cancellation)
request.NoCache()
request.Headers(Innertube.CreateHeaders(Innertube.ClientType.Tv))
request.Header("Authorization", "Bearer " + accessToken)
response = request.Await()
if not response.IsSuccess()
LogError("Error marking video watch time:", response.ErrorMessage())
return false
end if
LogDebug("Marked video watch time:", timeStr)
return true return true
end function end function
@@ -651,7 +704,14 @@ namespace InnertubeService
return response.Json() return response.Json()
end if end if
return Innertube.ParseMixPageResponseData(response.Json()) result = Innertube.ParseMixPageResponseData(response.Json())
cacheControl = Innertube.ParseResponseForCacheControl(response)
if cacheControl <> invalid
result["cache-control"] = cacheControl
end if
return result
end function end function
function ResolveUrl(url as string, options = invalid as object) as object function ResolveUrl(url as string, options = invalid as object) as object
@@ -106,10 +106,13 @@ namespace Innertube
"genericPromoRenderer": ParseNotImplemented "genericPromoRenderer": ParseNotImplemented
' "Sign in to see the latest videos tailored to your interests" ' "Sign in to see the latest videos tailored to your interests"
"feedNudgeRenderer": ParseNotImplemented "feedNudgeRenderer": ParseNotImplemented
' "No results found, Try different keywords or remove search filters"
"backgroundPromoRenderer": ParseNotImplemented
"videoSurveyShelfRenderer": ParseNotImplemented "videoSurveyShelfRenderer": ParseNotImplemented
"searchBarRenderer": ParseNotImplemented "searchBarRenderer": ParseNotImplemented
"clickTrackingParams": ParseNotImplemented "clickTrackingParams": ParseNotImplemented
"promoShelfRenderer": ParseNotImplemented "promoShelfRenderer": ParseNotImplemented
"statementBannerRenderer": ParseNotImplemented
"adSlotRenderer": ParseNotImplemented "adSlotRenderer": ParseNotImplemented
"adsControlFlowOpportunityReceivedCommand": ParseNotImplemented "adsControlFlowOpportunityReceivedCommand": ParseNotImplemented
} }
@@ -154,13 +157,13 @@ namespace Innertube
end function end function
function ParseShelfRenderer(nodeData as object, context as object) as object function ParseShelfRenderer(nodeData as object, context as object) as object
if context.skipCreatorOnTheRise = true if context.disableCreatorOnTheRise = true
badges = nodeData["badges"] badges = nodeData["badges"]
if IsArray(badges) if IsArray(badges)
for each badge in badges for each badge in badges
if ValidString(ObjectUtils.Dig(badge, ["metadataBadgeRenderer", "style"])) = "BADGE_STYLE_TYPE_FEATURED" if ValidString(ObjectUtils.Dig(badge, ["metadataBadgeRenderer", "style"])) = "BADGE_STYLE_TYPE_FEATURED"
label = ParseText(ObjectUtils.Dig(badge, ["metadataBadgeRenderer", "label"])) label = ParseText(ObjectUtils.Dig(badge, ["metadataBadgeRenderer", "label"]))
LogInfo(`Skipping 'Create on the Rise' shelf (${label})`) LogInfo(`Skipping 'Creator on the Rise' shelf (${label})`)
return invalid return invalid
end if end if
end for end for
@@ -177,7 +180,11 @@ namespace Innertube
return nodeData["contents"] return nodeData["contents"]
end function end function
function ParseReelShelfRenderer(nodeData as object, _context as object) as object function ParseReelShelfRenderer(nodeData as object, context as object) as object
if context.disableShorts = true
LogInfo("Skipping ReelShelfRenderer based on user settings")
return invalid
end if
' TODO: handle reelShelfRenderer.title ' TODO: handle reelShelfRenderer.title
return nodeData["items"] return nodeData["items"]
end function end function
@@ -274,20 +281,33 @@ namespace Innertube
end if end if
end if end if
liveNow = ValidString(ObjectUtils.Dig(nodeData, ["badges", 0, "metadataBadgeRenderer", "icon", "iconType"])) = "LIVE" isUpcoming = false
if not liveNow liveNow = false
thumbnailOverlays = nodeData["thumbnailOverlays"]
if IsArray(thumbnailOverlays) thumbnailOverlays = nodeData["thumbnailOverlays"]
for each overlay in thumbnailOverlays if IsArray(thumbnailOverlays)
if ValidString(ObjectUtils.Dig(overlay, ["thumbnailOverlayTimeStatusRenderer", "style"])) = "LIVE" for each overlay in thumbnailOverlays
liveNow = true parsedTimeStatusRenderer = ParseThumbnailOverlayTimeStatusRenderer(overlay)
exit for if parsedTimeStatusRenderer = invalid
continue for
end if
if parsedTimeStatusRenderer.isShort
if context.disableShorts = true
LogInfo("Skipping Short based on user settings")
return invalid
end if end if
end for end if
end if
liveNow = liveNow or parsedTimeStatusRenderer.isLive
isUpcoming = isUpcoming or parsedTimeStatusRenderer.isUpcoming
end for
end if
if ValidString(ObjectUtils.Dig(nodeData, ["badges", 0, "metadataBadgeRenderer", "icon", "iconType"])) = "LIVE"
liveNow = true
end if end if
isUpcoming = false
premiereTimestamp = ObjectUtils.Dig(nodeData, ["upcomingEventData", "startTime"]) premiereTimestamp = ObjectUtils.Dig(nodeData, ["upcomingEventData", "startTime"])
if IsString(premiereTimestamp) if IsString(premiereTimestamp)
premiereTimestamp = premiereTimestamp.ToInt() premiereTimestamp = premiereTimestamp.ToInt()
@@ -360,7 +380,11 @@ namespace Innertube
thumbnailOverlays = nodeData["thumbnailOverlays"] thumbnailOverlays = nodeData["thumbnailOverlays"]
if IsArray(thumbnailOverlays) if IsArray(thumbnailOverlays)
for each overlay in thumbnailOverlays for each overlay in thumbnailOverlays
lengthText = ParseText(ObjectUtils.Dig(overlay, ["thumbnailOverlayTimeStatusRenderer", "text"])) parsedTimeStatusRenderer = ParseThumbnailOverlayTimeStatusRenderer(overlay)
if parsedTimeStatusRenderer = invalid
continue for
end if
lengthText = parsedTimeStatusRenderer.text
if lengthText <> "" if lengthText <> ""
exit for exit for
end if end if
@@ -443,6 +467,7 @@ namespace Innertube
lengthText = ParseText(nodeData["lengthText"]) lengthText = ParseText(nodeData["lengthText"])
lengthSeconds = ValidString(nodeData["lengthSeconds"]).ToInt() lengthSeconds = ValidString(nodeData["lengthSeconds"]).ToInt()
videoInfo = ParseText(nodeData["videoInfo"])
author = invalid author = invalid
authorId = invalid authorId = invalid
@@ -475,6 +500,7 @@ namespace Innertube
"index": ParseText(nodeData["index"]).ToInt() "index": ParseText(nodeData["index"]).ToInt()
"lengthText": lengthText "lengthText": lengthText
"lengthSeconds": lengthSeconds "lengthSeconds": lengthSeconds
"videoInfo": videoInfo
} }
PushFeedItem(video, context) PushFeedItem(video, context)
@@ -514,8 +540,20 @@ namespace Innertube
thumbnailOverlays = nodeData["thumbnailOverlays"] thumbnailOverlays = nodeData["thumbnailOverlays"]
if IsArray(thumbnailOverlays) if IsArray(thumbnailOverlays)
for each overlay in thumbnailOverlays for each overlay in thumbnailOverlays
liveNow = liveNow or (ValidString(ObjectUtils.Dig(overlay, ["thumbnailOverlayTimeStatusRenderer", "style"])) = "LIVE") parsedTimeStatusRenderer = ParseThumbnailOverlayTimeStatusRenderer(overlay)
isUpcoming = isUpcoming or (ValidString(ObjectUtils.Dig(overlay, ["thumbnailOverlayTimeStatusRenderer", "style"])) = "UPCOMING") if parsedTimeStatusRenderer = invalid
continue for
end if
if parsedTimeStatusRenderer.isShort
if context.disableShorts = true
LogInfo("Skipping Short based on user settings")
return invalid
end if
end if
liveNow = liveNow or parsedTimeStatusRenderer.isLive
isUpcoming = isUpcoming or parsedTimeStatusRenderer.isUpcoming
end for end for
end if end if
@@ -865,6 +903,11 @@ namespace Innertube
end function end function
function ParseShortsLockupViewModel(nodeData as object, context as object) as object function ParseShortsLockupViewModel(nodeData as object, context as object) as object
if context.disableShorts = true
LogInfo("Skipping Short based on user settings")
return invalid
end if
videoId = ObjectUtils.Dig(nodeData, ["onTap", "innertubeCommand", "reelWatchEndpoint", "videoId"]) videoId = ObjectUtils.Dig(nodeData, ["onTap", "innertubeCommand", "reelWatchEndpoint", "videoId"])
if not IsString(videoId) if not IsString(videoId)
LogWarn("Invalid video ID", nodeData) LogWarn("Invalid video ID", nodeData)
@@ -927,8 +970,17 @@ namespace Innertube
function ParseTileRenderer(nodeData as object, context as object) as object function ParseTileRenderer(nodeData as object, context as object) as object
contentType = ValidString(nodeData["contentType"]) contentType = ValidString(nodeData["contentType"])
' A tileRenderer can be without a contentType, such as a
' button that says "Open YouTube Kids" or similar CTAs
if contentType = ""
LogWarn(`TileRenderer without contentType:\n`, nodeData)
return invalid
end if
if contentType = "TILE_CONTENT_TYPE_VIDEO" if contentType = "TILE_CONTENT_TYPE_VIDEO"
return TileRendererTypeVideo(nodeData, context) return TileRendererTypeVideo(nodeData, context)
else if contentType = "TILE_CONTENT_TYPE_SHORTS"
return TileRendererTypeShorts(nodeData, context)
else if contentType = "TILE_CONTENT_TYPE_PLAYLIST" else if contentType = "TILE_CONTENT_TYPE_PLAYLIST"
return TileRendererTypePlaylist(nodeData, context) return TileRendererTypePlaylist(nodeData, context)
end if end if
@@ -961,16 +1013,36 @@ namespace Innertube
lengthText = "" lengthText = ""
isUpcoming = false isUpcoming = false
liveNow = false liveNow = false
percentDurationWatched = 0
thumbnailOverlays = ObjectUtils.Dig(nodeData, ["header", "tileHeaderRenderer", "thumbnailOverlays"]) thumbnailOverlays = ObjectUtils.Dig(nodeData, ["header", "tileHeaderRenderer", "thumbnailOverlays"])
if IsArray(thumbnailOverlays) if IsArray(thumbnailOverlays)
for each overlay in thumbnailOverlays for each overlay in thumbnailOverlays
maybeLengthText = ParseText(ObjectUtils.Dig(overlay, ["thumbnailOverlayTimeStatusRenderer", "text"])) parsedTimeStatusRenderer = ParseThumbnailOverlayTimeStatusRenderer(overlay)
if parsedTimeStatusRenderer = invalid
continue for
end if
if parsedTimeStatusRenderer.isShort
if context.disableShorts = true
LogInfo("Skipping Short based on user settings")
return invalid
end if
end if
maybeLengthText = parsedTimeStatusRenderer.text
if maybeLengthText <> "" if maybeLengthText <> ""
lengthText = maybeLengthText lengthText = maybeLengthText
end if end if
liveNow = liveNow or (ValidString(ObjectUtils.Dig(overlay, ["thumbnailOverlayTimeStatusRenderer", "style"])) = "LIVE")
isUpcoming = isUpcoming or (ValidString(ObjectUtils.Dig(overlay, ["thumbnailOverlayTimeStatusRenderer", "style"])) = "UPCOMING") liveNow = liveNow or parsedTimeStatusRenderer.isLive
isUpcoming = isUpcoming or parsedTimeStatusRenderer.isUpcoming
maybePercentDurationWatched = ObjectUtils.Dig(overlay, ["thumbnailOverlayResumePlaybackRenderer", "percentDurationWatched"])
if maybePercentDurationWatched <> invalid
percentDurationWatched = maybePercentDurationWatched
end if
end for end for
if liveNow or isUpcoming if liveNow or isUpcoming
lengthText = "" lengthText = ""
end if end if
@@ -996,6 +1068,50 @@ namespace Innertube
"liveNow": liveNow "liveNow": liveNow
"isUpcoming": isUpcoming "isUpcoming": isUpcoming
"lines": renderedLines "lines": renderedLines
"percentDurationWatched": percentDurationWatched
}
PushFeedItem(video, context)
return invalid
end function
function TileRendererTypeShorts(nodeData as object, context as object) as object
if context.disableShorts = true
LogInfo("Skipping Short based on user settings")
return invalid
end if
videoId = nodeData["contentId"]
if not IsString(videoId)
LogWarn("Invalid video ID", nodeData)
return invalid
end if
if context.generateVideoThumbnails = true
videoThumbnails = GenerateVideoThumbnails(videoId)
else
videoThumbnails = ObjectUtils.Dig(nodeData, ["header", "tileHeaderRenderer", "thumbnail", "thumbnails"])
if videoThumbnails = invalid
videoThumbnails = GenerateVideoThumbnails(videoId)
end if
end if
title = ""
thumbnailOverlays = ObjectUtils.Dig(nodeData, ["header", "tileHeaderRenderer", "thumbnailOverlays"])
if IsArray(thumbnailOverlays)
for each overlay in thumbnailOverlays
title = ParseText(ObjectUtils.Dig(overlay, ["tileMetadataRenderer", "title"]))
if title <> ""
exit for
end if
end for
end if
video = {
"type": "video"
"videoId": videoId
"title": title
"videoThumbnails": videoThumbnails
} }
PushFeedItem(video, context) PushFeedItem(video, context)
@@ -1147,6 +1263,34 @@ namespace Innertube
return ParseText(data["text"]) return ParseText(data["text"])
end function end function
function ParseThumbnailOverlayTimeStatusRenderer(data as object) as object
if data = invalid
return invalid
end if
if not IsAssociativeArray(data) or not data.DoesExist("thumbnailOverlayTimeStatusRenderer")
return invalid
end if
renderer = data["thumbnailOverlayTimeStatusRenderer"]
if not IsAssociativeArray(renderer)
return invalid
end if
text = ParseText(renderer["text"])
overlayStyle = ValidString(renderer["style"])
isLive = overlayStyle = "LIVE"
isUpcoming = overlayStyle = "UPCOMING"
isShort = overlayStyle = "SHORTS"
return {
"text": text
"isLive": isLive
"isUpcoming": isUpcoming
"isShort": isShort
}
end function
function StartNewFeed(title as string, context as object) as void function StartNewFeed(title as string, context as object) as void
if context.currentFeed <> invalid if context.currentFeed <> invalid
if context.currentFeed.items.Count() = 0 and context.currentFeed.title = "" if context.currentFeed.items.Count() = 0 and context.currentFeed.title = ""
@@ -6,7 +6,31 @@ import "pkg:/source/utils/Types.bs"
namespace Innertube namespace Innertube
function Search(query as string, searchFilters as object, continuation = "" as string, cancellation = invalid as object, raw = false as boolean) as object function Search(query as string, options = invalid as object) as object
searchFilters = invalid
continuation = ""
cancellation = invalid
disableShorts = false
raw = false
if options <> invalid
if options.DoesExist("searchFilters")
searchFilters = options.searchFilters
end if
if options.DoesExist("continuation")
continuation = options.continuation
end if
if options.DoesExist("cancellation")
cancellation = options.cancellation
end if
if options.DoesExist("disableShorts")
disableShorts = options.disableShorts
end if
if options.DoesExist("raw")
raw = options.raw
end if
end if
deviceInfo = CreateObject("roDeviceInfo") deviceInfo = CreateObject("roDeviceInfo")
payload = { payload = {
@@ -51,7 +75,7 @@ namespace Innertube
return response.Json() return response.Json()
end if end if
feeds = ParseResponseDataForFeeds(response.Json()) feeds = ParseResponseDataForFeeds(response.Json(), { disableShorts: disableShorts })
result = { result = {
feeds: feeds feeds: feeds
@@ -7,10 +7,14 @@ function Init()
m.service = new Invidious.InvidiousService(m.top) m.service = new Invidious.InvidiousService(m.top)
end function end function
function GetCurrentInstance(_unused as dynamic) as string function GetInstance(_unused as dynamic) as string
return m.service.GetInstance() return m.service.GetInstance()
end function end function
function GetInvidiousInstance(_unused as dynamic) as string
return m.service.GetInvidiousInstance()
end function
function GetAuthorizeTokenLink(_unused as dynamic) as dynamic function GetAuthorizeTokenLink(_unused as dynamic) as dynamic
return m.service.GetAuthorizeTokenLink() return m.service.GetAuthorizeTokenLink()
end function end function
@@ -8,7 +8,8 @@
<field id="authToken" type="assocarray" /> <field id="authToken" type="assocarray" />
<field id="apiDefinitions" type="assocarray" /> <field id="apiDefinitions" type="assocarray" />
<function name="GetCurrentInstance" /> <function name="GetInstance" />
<function name="GetInvidiousInstance" />
<function name="GetAuthorizeTokenLink" /> <function name="GetAuthorizeTokenLink" />
</interface> </interface>
</component> </component>
@@ -15,7 +15,7 @@ import "pkg:/source/utils/TimeUtils.bs"
namespace Invidious namespace Invidious
const INSTANCES_API = "https://api.invidious.io/instances.json?sort_by=type,users" const INSTANCES_API = "https://api.invidious.io/instances.json?sort_by=type,users"
const DEFAULT_INSTANCE = "http://127.0.0.1:8888/playlet-invidious-backend" const PLAYLET_BUILT_IN_INSTANCE = "http://127.0.0.1:8888/playlet-invidious-backend"
const INSTANCE_EXAMPLE = "https://invidious.example.com" const INSTANCE_EXAMPLE = "https://invidious.example.com"
const TOKEN_CALLBACK = "/invidious/token_callback" const TOKEN_CALLBACK = "/invidious/token_callback"
@@ -70,22 +70,34 @@ namespace Invidious
if m.preferences = invalid if m.preferences = invalid
m.preferences = m.invidiousNode.preferences m.preferences = m.invidiousNode.preferences
end if end if
instance = m.preferences["invidious.instance"]
if not StringUtils.IsNullOrEmpty(instance) backend = m.preferences["backend.selected"]
return instance if backend = "invidious"
instance = m.GetInvidiousInstance()
if not StringUtils.IsNullOrEmpty(instance)
return instance
end if
end if end if
instance = DEFAULT_INSTANCE return m.GetPlayletBuiltinInstance()
if instance.StartsWith("http://127.0.0.1:8888") end function
address = m.invidiousNode.webServer@.GetServerAddress()
instance = instance.Replace("http://127.0.0.1:8888", address) function GetInvidiousInstance() as string
if m.preferences = invalid
m.preferences = m.invidiousNode.preferences
end if end if
return m.preferences["invidious.instance"]
end function
function GetPlayletBuiltinInstance() as string
instance = PLAYLET_BUILT_IN_INSTANCE
address = m.invidiousNode.webServer@.GetServerAddress()
instance = instance.Replace("http://127.0.0.1:8888", address)
return instance return instance
end function end function
function MarkVideoWatched(videoId as dynamic) as void function MarkVideoWatched(videoId as dynamic, cancellation = invalid as object) as void
if StringUtils.IsNullOrEmpty(videoId) if StringUtils.IsNullOrEmpty(videoId)
return return
end if end if
@@ -98,6 +110,7 @@ namespace Invidious
url = `${authToken.instance}${Invidious.HISTORY_ENDPOINT}/${videoId}` url = `${authToken.instance}${Invidious.HISTORY_ENDPOINT}/${videoId}`
request = HttpClient.Post(url, "") request = HttpClient.Post(url, "")
request.Headers(m.GetAuthenticationHeaders(authToken.token)) request.Headers(m.GetAuthenticationHeaders(authToken.token))
request.Cancellation(cancellation)
request.Await() request.Await()
end function end function
@@ -731,7 +744,11 @@ namespace Invidious
end function end function
function GetAuthorizeTokenLink() as dynamic function GetAuthorizeTokenLink() as dynamic
instance = m.GetInstance() instance = m.GetInvidiousInstance()
if StringUtils.IsNullOrEmpty(instance)
instance = m.GetPlayletBuiltinInstance()
end if
' Make sure the host is not on https, because https cannot redirect to http, which is our local server ' Make sure the host is not on https, because https cannot redirect to http, which is our local server
invidiousHost = instance.Replace("https://", "http://") invidiousHost = instance.Replace("https://", "http://")
@@ -52,6 +52,8 @@ namespace InvidiousContent
node.viewCountText = VideoGetViewCountText(item) node.viewCountText = VideoGetViewCountText(item)
SetIfExists(node, "index", item, "index") SetIfExists(node, "index", item, "index")
SetIfExists(node, "lines", item, "lines") SetIfExists(node, "lines", item, "lines")
SetIfExists(node, "videoInfo", item, "videoInfo")
SetIfExists(node, "percentDurationWatched", item, "percentDurationWatched")
return node return node
end function end function
@@ -80,19 +82,38 @@ namespace InvidiousContent
SetIfExists(node, "statsText", item, "statsText") SetIfExists(node, "statsText", item, "statsText")
SetIfExists(node, "lines", item, "lines") SetIfExists(node, "lines", item, "lines")
if item.videos <> invalid if IsArray(item.videos) and item.videos.Count() > 0
childCount = node.getChildCount() childCount = node.getChildCount()
' Innertube's TV client doesn't return the index for videos in playlists.
' So we rely on video ids to detect duplicates.
videosHasIndex = IsInt(item.videos[0].index)
videoIds = invalid
if not videosHasIndex
videoIds = {}
childVideos = node.getChildren(-1, 0)
for each child in childVideos
videoIds[child.videoId] = true
end for
end if
newNodes = [] newNodes = []
for each video in item.videos for each video in item.videos
' TODO:P1 sometimes we're parsing "recommended playlists" that ' Sometimes we're parsing "recommended playlists" that show up
' show up in the end of the playlist. We should ignore them, ' in the end of the playlist. In this context they are ignored.
' until the parsing is fixed.
if ValidString(video.type) = "playlist" if ValidString(video.type) = "playlist"
continue for continue for
end if end if
video.type = "video" video.type = "video"
videoNode = ToVideoContentNode(invalid, video, instance) videoNode = ToVideoContentNode(invalid, video, instance)
if videoNode <> invalid if videoNode <> invalid
if not videosHasIndex
if videoIds[video.videoId] = true
continue for
end if
end if
index = video.index index = video.index
if index <> invalid and index > -1 and index < childCount if index <> invalid and index > -1 and index < childCount
node.replaceChild(videoNode, index) node.replaceChild(videoNode, index)
@@ -101,6 +122,7 @@ namespace InvidiousContent
end if end if
end if end if
end for end for
if newNodes.Count() > 0 if newNodes.Count() > 0
node.appendChildren(newNodes) node.appendChildren(newNodes)
end if end if
@@ -148,15 +170,16 @@ namespace InvidiousContent
end if end if
end function end function
function VideoSetThumbnail(node as object, videoItem as object, instance as dynamic, quality = "medium" as string) as boolean function VideoSetThumbnail(node as object, videoItem as object, instance as dynamic, quality = "medium" as string) as void
videoThumbnails = videoItem.videoThumbnails videoThumbnails = videoItem.videoThumbnails
hasValidInstance = not StringUtils.IsNullOrEmpty(instance) and instance.InStr(":8888/playlet-invidious-backend") = -1
if videoThumbnails = invalid or videoThumbnails.Count() = 0 if videoThumbnails = invalid or videoThumbnails.Count() = 0
if StringUtils.IsNullOrEmpty(instance) if hasValidInstance
node.thumbnail = `https://i.ytimg.com/vi/${videoItem.videoId}/mqdefault.jpg`
else
node.thumbnail = `${instance}/vi/${videoItem.videoId}/mqdefault.jpg` node.thumbnail = `${instance}/vi/${videoItem.videoId}/mqdefault.jpg`
else
node.thumbnail = `https://i.ytimg.com/vi/${videoItem.videoId}/mqdefault.jpg`
end if end if
return false return
end if end if
url = invalid url = invalid
for each thumbnail in videoThumbnails for each thumbnail in videoThumbnails
@@ -169,13 +192,13 @@ namespace InvidiousContent
url = videoThumbnails[0].url url = videoThumbnails[0].url
end if end if
if url.startsWith("/") if url.startsWith("/")
if StringUtils.IsNullOrEmpty(instance) if hasValidInstance
return false url = instance + url
else
url = `https://i.ytimg.com/vi/${videoItem.videoId}/mqdefault.jpg`
end if end if
url = instance + url
end if end if
node.thumbnail = url node.thumbnail = url
return true
end function end function
function VideoIsLive(videoItem as object) as boolean function VideoIsLive(videoItem as object) as boolean
@@ -266,16 +289,16 @@ namespace InvidiousContent
end if end if
thumbnail = "" thumbnail = ""
hasValidInstance = not StringUtils.IsNullOrEmpty(instance) and instance.InStr(":8888/playlet-invidious-backend") = -1
if IsString(playlistItem.playlistThumbnail) if IsString(playlistItem.playlistThumbnail)
thumbnailUrl = playlistItem.playlistThumbnail thumbnailUrl = playlistItem.playlistThumbnail
if thumbnailUrl.startsWith("/") and not StringUtils.IsNullOrEmpty(playlistItem.instance) if thumbnailUrl.startsWith("/") and hasValidInstance
thumbnailUrl = playlistItem.instance + thumbnailUrl thumbnailUrl = playlistItem.instance + thumbnailUrl
end if end if
thumbnail = thumbnailUrl thumbnail = thumbnailUrl
else if playlistItem.videos <> invalid and playlistItem.videos.Count() > 0 and playlistItem.videos[0].index = 0 else if playlistItem.videos <> invalid and playlistItem.videos.Count() > 0 and playlistItem.videos[0].index = 0
if VideoSetThumbnail(node, playlistItem.videos[0], instance, quality) VideoSetThumbnail(node, playlistItem.videos[0], instance, quality)
return return
end if
else if node.getChildCount() > 0 else if node.getChildCount() > 0
thumbnail = node.getChild(0).thumbnail thumbnail = node.getChild(0).thumbnail
end if end if
@@ -1,4 +1,5 @@
import "pkg:/source/utils/RegistryUtils.bs" import "pkg:/source/utils/RegistryUtils.bs"
import "pkg:/source/utils/StringUtils.bs"
import "pkg:/source/utils/Types.bs" import "pkg:/source/utils/Types.bs"
function Init() function Init()
@@ -93,23 +94,21 @@ function MigrateExistingPreferences(userPrefs as object) as boolean
isDirty = false isDirty = false
' v0 -> v1 ' v0 -> v1
instances = RegistryUtils.Read(RegistryUtils.INVIDIOUS_INSTANCES) if ValidInt(userPrefs.__version) = 0
if instances <> invalid instances = RegistryUtils.Read(RegistryUtils.INVIDIOUS_INSTANCES)
currentInstance = userPrefs["invidious.instance"] if not StringUtils.IsNullOrEmpty(instances)
if currentInstance = invalid or currentInstance = "" currentInstance = userPrefs["invidious.instance"]
instances = ParseJson(instances) if StringUtils.IsNullOrEmpty(currentInstance)
if instances.Count() > 0 instances = ParseJson(instances)
instance = instances[0] if IsArray(instances) and instances.Count() > 0
if instance <> invalid and instance <> "" instance = instances[0]
userPrefs["invidious.instance"] = instance if not StringUtils.IsNullOrEmpty(instance)
isDirty = true userPrefs["invidious.instance"] = instance
end if
end if end if
end if end if
RegistryUtils.Delete(RegistryUtils.INVIDIOUS_INSTANCES)
end if end if
RegistryUtils.Delete(RegistryUtils.INVIDIOUS_INSTANCES)
end if
if ValidInt(userPrefs.__version) = 0
userPrefs.__version = 1 userPrefs.__version = 1
isDirty = true isDirty = true
end if end if
@@ -143,7 +142,23 @@ function MigrateExistingPreferences(userPrefs as object) as boolean
isDirty = true isDirty = true
end if end if
if userPrefs.__version = 3
if IsString(userPrefs["playback.backend"])
backend = userPrefs["playback.backend"]
userPrefs.Delete("playback.backend")
userPrefs["backend.selected"] = backend
end if
userPrefs.__version = 4
isDirty = true
end if
' TODO:P2 handle case where saved preferences version is higher than current version (e.g. user downgraded) ' TODO:P2 handle case where saved preferences version is higher than current version (e.g. user downgraded)
#if DEBUG
if userPrefs.__version <> m.top.__version
throw "Preferences version mismatch. Expected: " + m.top.__version + ", found: " + userPrefs.__version
end if
#end if
return isDirty return isDirty
end function end function
@@ -5,7 +5,7 @@
user prefs saved need to be migrated. If the version is less than the user prefs saved need to be migrated. If the version is less than the
current version, a migration is needed. current version, a migration is needed.
--> -->
<field id="__version" type="integer" value="2" /> <field id="__version" type="integer" value="4" />
<field id="prefsModel" type="array" /> <field id="prefsModel" type="array" />
<field id="preferenceFields" type="assocarray" /> <field id="preferenceFields" type="assocarray" />
<function name="GetUserPreferences" /> <function name="GetUserPreferences" />
@@ -1,4 +1,5 @@
import "pkg:/source/utils/Locale.bs" import "pkg:/source/utils/Locale.bs"
import "pkg:/source/utils/MathUtils.bs"
import "pkg:/source/utils/StringUtils.bs" import "pkg:/source/utils/StringUtils.bs"
import "pkg:/source/utils/TimeUtils.bs" import "pkg:/source/utils/TimeUtils.bs"
import "pkg:/source/utils/Types.bs" import "pkg:/source/utils/Types.bs"
@@ -8,6 +9,7 @@ function Init()
m.durationLabel = m.top.FindNode("durationLabel") m.durationLabel = m.top.FindNode("durationLabel")
m.smallestSystemFont = m.top.FindNode("smallestSystemFont") m.smallestSystemFont = m.top.FindNode("smallestSystemFont")
m.smallestBoldSystemFont = m.top.FindNode("smallestBoldSystemFont") m.smallestBoldSystemFont = m.top.FindNode("smallestBoldSystemFont")
m.progressRect = m.top.FindNode("progressRect")
end function end function
function OnContentSet() as void function OnContentSet() as void
@@ -53,6 +55,8 @@ function OnContentSet() as void
m.top.thumbnailUri = content.thumbnail m.top.thumbnailUri = content.thumbnail
m.top.percentDurationWatched = content.percentDurationWatched
if not StringUtils.IsNullOrEmpty(content.lengthText) if not StringUtils.IsNullOrEmpty(content.lengthText)
SetDurationLabel(content.lengthText, "#161616FF", 0.8, m.smallestSystemFont) SetDurationLabel(content.lengthText, "#161616FF", 0.8, m.smallestSystemFont)
m.top.durationRectVisible = true m.top.durationRectVisible = true
@@ -90,3 +94,11 @@ function SetDurationLabel(text as string, bgColor as string, bgOpacity as float,
rect.opacity = bgOpacity rect.opacity = bgOpacity
end function end function
function OnPercentDurationWatched() as void
if m.progressRect = invalid
return
end if
percent = MathUtils.Clamp(m.top.percentDurationWatched, 0, 100) / 100.0
m.progressRect.scale = [percent, 1]
end function
@@ -8,6 +8,7 @@
<field id="durationRectVisible" type="boolean" alias="durationRect.visible" /> <field id="durationRectVisible" type="boolean" alias="durationRect.visible" />
<field id="duration" type="string" alias="durationLabel.text" /> <field id="duration" type="string" alias="durationLabel.text" />
<field id="thumbnailUri" type="string" alias="thumbnail.uri" /> <field id="thumbnailUri" type="string" alias="thumbnail.uri" />
<field id="percentDurationWatched" type="float" onChange="OnPercentDurationWatched" />
</interface> </interface>
<children> <children>
<Font id="smallestSystemFont" uri="font:SystemFontFile" size="18" /> <Font id="smallestSystemFont" uri="font:SystemFontFile" size="18" />
@@ -36,6 +37,14 @@
font="font:SmallestSystemFont" font="font:SmallestSystemFont"
translation="[8, 0]" /> translation="[8, 0]" />
</Rectangle> </Rectangle>
<Rectangle
id="progressRect"
width="350"
height="5"
color="#FF0000"
translation="[0, 192]"
scale="[0, 1]">
</Rectangle>
</Poster> </Poster>
<Label <Label
id="titleLabel" id="titleLabel"
@@ -1,12 +1,74 @@
import "pkg:/components/Services/Innertube/InnertubeService.bs"
import "pkg:/components/Services/Invidious/InvidiousService.bs" import "pkg:/components/Services/Invidious/InvidiousService.bs"
import "pkg:/source/utils/MessagePortUtils.bs"
@asynctask @asynctask
function MarkVideoWatchedTask(input as object) as object function MarkVideoWatchedTask(input as object) as object
videoId = input.videoId videoId = input.videoId
invidiousNode = input.invidious invidiousNode = input.invidious
authToken = input.authToken
profileType = input.profileType
cancellation = m.top.cancellation
service = new Invidious.InvidiousService(invidiousNode) if profileType = "invidious"
service.MarkVideoWatched(videoId) service = new Invidious.InvidiousService(invidiousNode)
service.MarkVideoWatched(videoId, cancellation)
return invalid
end if
if profileType <> "youtube"
LogError("MarkVideoWatchedTask: Unsupported profile type:", profileType)
return invalid
end if
playbackTrackingUrls = InnertubeService.AuthGetPlaybackTrackingUrls(videoId, {
accessToken: authToken.token
cancellation: cancellation
})
if playbackTrackingUrls.error <> invalid
LogError("MarkVideoWatchedTask: Failed to get playback tracking URLs:", playbackTrackingUrls.error)
return invalid
end if
if StringUtils.IsNullOrEmpty(playbackTrackingUrls.videostatsPlaybackUrl)
LogError("MarkVideoWatchedTask: videostatsPlaybackUrl is empty")
return invalid
end if
markedAsWatched = InnertubeService.AuthMarkVideoWatched(playbackTrackingUrls.videostatsPlaybackUrl, {
accessToken: authToken.token
cancellation: cancellation
})
if not markedAsWatched
return invalid
end if
if StringUtils.IsNullOrEmpty(playbackTrackingUrls.videostatsWatchtimeUrl)
LogError("MarkVideoWatchedTask: videostatsWatchtimeUrl is empty")
return invalid
end if
if CancellationUtils.IsCancelled(cancellation)
return invalid
end if
port = CreateObject("roMessagePort")
MessagePortUtils.ObserveFieldScopedExSafe(m.top, "watchTime", port)
CancellationUtils.ObserveCancellationScoped(cancellation, port)
while true
message = wait(60000, port)
if CancellationUtils.IsCancellationEvent(cancellation, message)
return invalid
end if
if message = invalid
continue while
end if
watchTime = message.getData()
InnertubeService.AuthMarkVideoWatchTime(watchTime, playbackTrackingUrls.videostatsWatchtimeUrl, {
accessToken: authToken.token
cancellation: cancellation
})
end while
return invalid return invalid
end function end function
@@ -140,7 +140,6 @@ namespace SponsorBlock
m.top.trickPlayBar.filledBarBlendColor = "#FF000080" m.top.trickPlayBar.filledBarBlendColor = "#FF000080"
end if end if
m.top.UnobserveFieldScoped("position")
m.top.ObserveFieldScoped("position", FuncName(OnPositionChangeSkipSponsorBlockSections)) m.top.ObserveFieldScoped("position", FuncName(OnPositionChangeSkipSponsorBlockSections))
end function end function
@@ -20,7 +20,7 @@ function VideoContentTask(input as object) as object
service = new Invidious.InvidiousService(invidiousNode) service = new Invidious.InvidiousService(invidiousNode)
backend = preferencesNode["playback.backend"] backend = preferencesNode["backend.selected"]
if backend = "playlet" if backend = "playlet"
metadata = InnertubeService.GetVideoMetadata(contentNode.videoId, { metadata = InnertubeService.GetVideoMetadata(contentNode.videoId, {
"cancellation": m.top.cancellation "cancellation": m.top.cancellation
@@ -31,6 +31,13 @@ function VideoContentTask(input as object) as object
metadata = service.GetVideoMetadata(contentNode.videoId, { cancellation: m.top.cancellation }) metadata = service.GetVideoMetadata(contentNode.videoId, { cancellation: m.top.cancellation })
end if end if
if metadata = invalid
return {
success: false
error: "Failed to get video metadata"
}
end if
if m.top.cancel if m.top.cancel
return invalid return invalid
end if end if
@@ -21,6 +21,7 @@ function Init()
m.fullScreenHintTimer.ObserveField("fire", FuncName(OnFullScreenHintTimer)) m.fullScreenHintTimer.ObserveField("fire", FuncName(OnFullScreenHintTimer))
m.trickplayUITimer = m.top.findNode("trickplayUITimer") m.trickplayUITimer = m.top.findNode("trickplayUITimer")
m.trickplayUITimer.ObserveField("fire", FuncName(OnTrickplayUITimer)) m.trickplayUITimer.ObserveField("fire", FuncName(OnTrickplayUITimer))
m.top.notificationInterval = 1
' videoPlayingSuccess indicates if we started playing a video successfully ' videoPlayingSuccess indicates if we started playing a video successfully
' We use it to detect if we should try another link for a video, or if another error ' We use it to detect if we should try another link for a video, or if another error
@@ -126,6 +127,8 @@ function PlayWithContent(contentNode as object)
end if end if
if ValidInt(contentNode.timestamp) <> -1 if ValidInt(contentNode.timestamp) <> -1
videoContentNode.AddFields({ timestamp: contentNode.timestamp }) videoContentNode.AddFields({ timestamp: contentNode.timestamp })
else if contentNode.percentDurationWatched > 0 and contentNode.percentDurationWatched < 100
videoContentNode.AddFields({ percentDurationWatched: contentNode.percentDurationWatched })
end if end if
if not StringUtils.IsNullOrEmpty(contentNode.title) if not StringUtils.IsNullOrEmpty(contentNode.title)
videoContentNode.title = contentNode.title videoContentNode.title = contentNode.title
@@ -144,8 +147,6 @@ function StartVideoContentTask(videoContentNode as object)
m.videoContentTask.cancel = true m.videoContentTask.cancel = true
end if end if
MarkVideoWatched(videoContentNode.videoId)
m.top.content = videoContentNode m.top.content = videoContentNode
m.videoContentTask = AsyncTask.Start(Tasks.VideoContentTask, { m.videoContentTask = AsyncTask.Start(Tasks.VideoContentTask, {
@@ -194,22 +195,25 @@ function OnVideoContentTaskResults(output as object) as void
SponsorBlock.FetchSponsorBlock(content.metadata) SponsorBlock.FetchSponsorBlock(content.metadata)
timestamp = content.timestamp timestamp = content.timestamp
percentDurationWatched = content.percentDurationWatched
hasTimestamp = IsInt(timestamp) hasTimestamp = IsInt(timestamp)
hasPercentDurationWatched = IsFloat(percentDurationWatched)
if IsLiveVideo() and not hasTimestamp if IsLiveVideo() and not hasTimestamp and not hasPercentDurationWatched
duration = m.top.duration ' If live, seek to end of stream
if duration > 0 m.seekToPercent = 100.0
SeekToEndOfStream() SeekToPercentOfDuration()
else else
m.top.ObserveField("duration", FuncName(SeekToEndOfStream)) if hasTimestamp and timestamp > 0
m.top.seek = content.timestamp
else if hasPercentDurationWatched
m.seekToPercent = percentDurationWatched
SeekToPercentOfDuration()
end if end if
end if end if
PlayAfterPreviousPlayerHasStopped() PlayAfterPreviousPlayerHasStopped()
MarkVideoWatched(content.videoId)
if hasTimestamp and timestamp > 0
m.top.seek = content.timestamp
end if
end function end function
function PlayAfterPreviousPlayerHasStopped() as void function PlayAfterPreviousPlayerHasStopped() as void
@@ -272,12 +276,48 @@ function MarkVideoWatched(videoId as dynamic) as void
return return
end if end if
if m.top.invidious.authToken <> invalid invidious = m.top.invidious
AsyncTask.Start(Tasks.MarkVideoWatchedTask, { authToken = invidious.authToken
videoId: videoId if authToken = invalid
invidious: m.top.invidious return
})
end if end if
if m.markVideoWatchedTask <> invalid
m.markVideoWatchedTask.cancel = true
end if
profileType = authToken.profileNode.type
m.markVideoWatchedTask = AsyncTask.Create(Tasks.MarkVideoWatchedTask, {
videoId: videoId
invidious: invidious
authToken: authToken
profileType: profileType
})
m.markVideoWatchedTask.addField("watchTime", "float", false)
m.markVideoWatchedTask.control = "RUN"
if profileType <> "youtube"
return
end if
' Progress reported to Innertube. It is the position in seconds,
' with 20 second steps.
m.watchTimeMarker = -1
m.top.ObserveFieldScoped("position", FuncName(OnPositionChangeMarkWatchTime))
end function
function OnPositionChangeMarkWatchTime() as void
if m.markVideoWatchedTask = invalid
return
end if
currentPosition = m.top.position
currentWatchTimeMarker = m.watchTimeMarker
m.watchTimeMarker = (currentPosition \ 20) * 20
if currentWatchTimeMarker = currentPosition
return
end if
m.markVideoWatchedTask.watchTime = m.watchTimeMarker
end function end function
function OnClose() function OnClose()
@@ -285,6 +325,10 @@ function OnClose()
m.top.previousPlayer = invalid m.top.previousPlayer = invalid
if m.markVideoWatchedTask <> invalid
m.markVideoWatchedTask.cancel = true
m.markVideoWatchedTask = invalid
end if
if m.videoContentTask <> invalid if m.videoContentTask <> invalid
m.videoContentTask.cancel = true m.videoContentTask.cancel = true
m.videoContentTask = invalid m.videoContentTask = invalid
@@ -408,13 +452,43 @@ function OnVideoPlayerStateChange() as void
end if end if
end function end function
function SeekToEndOfStream() function SeekToEndOfStream() as void
m.top.UnobserveField("duration") m.top.UnobserveField("duration")
duration = m.top.duration duration = m.top.duration
' If the stream is less than 30 seconds, it's not worth seeking to the end ' If the stream is less than 30 seconds, it's not worth seeking
if duration > 30 if duration < 30
LogInfo("Seeking to end of live stream", duration) return
m.top.seek = duration end if
LogInfo("Seeking to end of live stream", duration)
m.top.seek = duration
end function
function SeekToPercentOfDuration() as void
m.top.UnobserveField("duration")
seekToPercent = m.seekToPercent
if seekToPercent = invalid
return
end if
duration = m.top.duration
if duration = 0
' If the duration is not available, wait for it to be set
m.top.ObserveField("duration", FuncName(SeekToPercentOfDuration))
return
end if
' If the stream is less than 30 seconds, it's not worth seeking
if duration < 30
return
end if
m.seekToPercent = invalid
seek = (MathUtils.Clamp(seekToPercent, 0, 100) / 100.0) * duration
if seek > 0
LogInfo("Seeking to percent duration watched", seek)
m.top.seek = seek
end if end if
end function end function
@@ -25,7 +25,7 @@ function VideoContentTaskDev(input as object) as object
backgroundPoster.uri = `${instance}/vi/${videoId}/maxresdefault.jpg` backgroundPoster.uri = `${instance}/vi/${videoId}/maxresdefault.jpg`
backend = preferencesNode["playback.backend"] backend = preferencesNode["backend.selected"]
if backend = "playlet" if backend = "playlet"
metadata = InnertubeService.GetVideoMetadata(videoId, { cancellation: m.top.cancellation }) metadata = InnertubeService.GetVideoMetadata(videoId, { cancellation: m.top.cancellation })
else else
@@ -152,7 +152,7 @@ namespace VideoQueueUtils
end if end if
LogInfo(`Playing next recommended video (${videoId})`) LogInfo(`Playing next recommended video (${videoId})`)
instance = invidiousNode@.GetCurrentInstance() instance = invidiousNode@.GetInstance()
node = InvidiousContent.ToVideoContentNode(invalid, recommendedVideo, instance) node = InvidiousContent.ToVideoContentNode(invalid, recommendedVideo, instance)
videoQueue.playVideo = node videoQueue.playVideo = node
return true return true
@@ -16,7 +16,7 @@ function VideoQueueViewContentTask(input as object) as object
index = MathUtils.Clamp(input.index - 2, 0, videoNodes.Count() - 1) index = MathUtils.Clamp(input.index - 2, 0, videoNodes.Count() - 1)
backend = preferencesNode["playback.backend"] backend = preferencesNode["backend.selected"]
requestOptions = { requestOptions = {
cacheSeconds: 8640000 ' 100 days cacheSeconds: 8640000 ' 100 days
@@ -8,7 +8,9 @@ namespace Http
function new(server as object) function new(server as object)
super() super()
m.innertube = server.task.innertube task = server.task
m.innertube = task.innertube
m.preferences = task.preferences
end function end function
@get("/playlet-invidious-backend/authorize_token") @get("/playlet-invidious-backend/authorize_token")
@@ -65,42 +67,42 @@ namespace Http
options = { options = {
"accessToken": accessToken.Mid("Bearer ".Len()) "accessToken": accessToken.Mid("Bearer ".Len())
"disableShorts": m.preferences["content_feed.disable_shorts"]
} }
continuation = request.query.continuation continuation = request.query.continuation
if not StringUtils.IsNullOrEmpty(continuation) if not StringUtils.IsNullOrEmpty(continuation)
options.continuation = continuation options.continuation = continuation
end if end if
feeds = InnertubeService.GetSubscriptions(options) result = InnertubeService.GetSubscriptions(options)
if feeds = invalid if result.error <> invalid
response.Json({ response.Json(result)
"error": "Failed to get auth feed"
})
response.http_code = 500 response.http_code = 500
return true return true
end if end if
if IsAssociativeArray(feeds) if not IsArray(result.feeds) or result.feeds.Count() = 0
if feeds.error <> invalid ' Not an error, just no subscriptions
response.Json(feeds) response.Json({
response.http_code = 500 "videos": []
return true })
end if
return true return true
end if end if
result = { responseBody = {
"videos": [] "videos": ValidArray(result.feeds[0].items)
} }
if feeds.Count() > 0 if result.feeds[0].DoesExist("continuation")
result["videos"] = ValidArray(feeds[0].items) responseBody.continuation = result.feeds[0].continuation
if feeds[0].DoesExist("continuation") end if
result["continuation"] = feeds[0].continuation
end if response.Json(responseBody)
if result.DoesExist("cache-control")
response.headers["cache-control"] = result["cache-control"]
end if end if
response.Json(result)
return true return true
end function end function
@@ -144,8 +146,14 @@ namespace Http
options.continuation = continuation options.continuation = continuation
end if end if
feeds = InnertubeService.GetPlaylists(options) result = InnertubeService.GetPlaylists(options)
if feeds = invalid if result.error <> invalid
response.Json(result)
response.http_code = 500
return true
end if
if not IsArray(result.feeds) or result.feeds.Count() = 0
response.Json({ response.Json({
"error": "Failed to get auth playlists" "error": "Failed to get auth playlists"
}) })
@@ -153,23 +161,12 @@ namespace Http
return true return true
end if end if
if IsAssociativeArray(feeds) response.Json(result.feeds[0])
if feeds.error <> invalid
response.Json(feeds) if result.DoesExist("cache-control")
response.http_code = 500 response.headers["cache-control"] = result["cache-control"]
return true
end if
return true
end if end if
if feeds.Count() > 0
response.Json(feeds[0])
return true
end if
response.Json({
"items": []
})
return true return true
end function end function
@@ -190,80 +187,41 @@ namespace Http
options = { options = {
"accessToken": accessToken.Mid("Bearer ".Len()) "accessToken": accessToken.Mid("Bearer ".Len())
} }
continuation = request.query.continuation continuation = request.query.continuation
if not StringUtils.IsNullOrEmpty(continuation) hasContinuation = not StringUtils.IsNullOrEmpty(continuation)
if hasContinuation
options.continuation = continuation options.continuation = continuation
end if end if
feeds = InnertubeService.GetWatchHistory(options) if not hasContinuation
if feeds = invalid page = ValidString(request.query.page).ToInt()
response.Json({ if page > 1
"error": "Failed to get auth history" LogError("Playlet backend does not use history pagination (use continuation instead)")
}) response.Json({
response.http_code = 500 "items": []
return true })
end if
if IsAssociativeArray(feeds)
if feeds.error <> invalid
response.Json(feeds)
response.http_code = 500
return true return true
end if end if
return true
end if end if
if feeds.Count() > 0 result = InnertubeService.GetWatchHistory(options)
response.Json(feeds[0]) if result.error <> invalid
return true response.Json(result)
end if
response.Json({
"items": []
})
return true
end function
function AuthMarkVideoWatched(context as object) as boolean
request = context.request
response = context.response
route = request.route
accessToken = request.headers["authorization"]
if StringUtils.IsNullOrEmpty(accessToken) or not accessToken.StartsWith("Bearer ")
response.Json({
"error": "Missing or invalid 'Authorization' header"
})
response.http_code = 403
return true
end if
videoId = route.Mid("/playlet-invidious-backend/api/v1/auth/history/".Len())
if videoId.InStr("?") > 0
videoId = videoId.Left(videoId.InStr("?"))
end if
if StringUtils.IsNullOrEmpty(videoId)
response.Json({
"error": "Missing 'videoId' path parameter"
})
response.http_code = 400
return true
end if
options = {
"accessToken": accessToken.Mid("Bearer ".Len())
}
if not InnertubeService.AuthMarkVideoWatched(videoId, options)
response.Json({
"error": "Failed to mark video as watched"
})
response.http_code = 500 response.http_code = 500
return true return true
end if end if
response.Default(204, "OK") if not IsArray(result.feeds) or result.feeds.Count() = 0
' Not an error, just no history
response.Json({
"items": []
})
return true
end if
response.Json(result.feeds[0])
return true return true
end function end function
@@ -292,6 +250,7 @@ namespace Http
raw = request.query.raw <> invalid raw = request.query.raw <> invalid
options = { options = {
"disableShorts": m.preferences["content_feed.disable_shorts"]
raw: raw raw: raw
type: request.query.type type: request.query.type
} }
@@ -317,6 +276,7 @@ namespace Http
end if end if
response.Json(ValidArray(result.feeds[0].items)) response.Json(ValidArray(result.feeds[0].items))
if result.DoesExist("cache-control") if result.DoesExist("cache-control")
response.headers["cache-control"] = result["cache-control"] response.headers["cache-control"] = result["cache-control"]
end if end if
@@ -339,6 +299,7 @@ namespace Http
options = { options = {
"accessToken": accessToken.Mid("Bearer ".Len()) "accessToken": accessToken.Mid("Bearer ".Len())
"disableShorts": m.preferences["content_feed.disable_shorts"]
} }
continuation = request.query.continuation continuation = request.query.continuation
@@ -346,36 +307,27 @@ namespace Http
options.continuation = continuation options.continuation = continuation
end if end if
feeds = InnertubeService.GetHome(options) result = InnertubeService.GetHome(options)
if feeds = invalid if result.error <> invalid
response.Json({ response.Json(result)
"error": "Failed to get auth home feed"
})
response.http_code = 500 response.http_code = 500
return true return true
end if end if
if IsAssociativeArray(feeds) if not IsArray(result.feeds) or result.feeds.Count() = 0
if feeds.error <> invalid ' Not an error, just no recommended videos, usually when there's no history
response.Json(feeds) response.Json({
response.http_code = 500 "items": []
return true })
end if
return true return true
end if end if
result = { response.Json(result.feeds[0])
"items": []
}
if feeds.Count() > 0 if result.DoesExist("cache-control")
result["items"] = ValidArray(feeds[0].items) response.headers["cache-control"] = result["cache-control"]
if feeds[0].DoesExist("continuation")
result["continuation"] = feeds[0].continuation
end if
end if end if
response.Json(result)
return true return true
end function end function
@@ -413,6 +365,7 @@ namespace Http
raw = request.query.raw <> invalid raw = request.query.raw <> invalid
options = { options = {
"disableShorts": m.preferences["content_feed.disable_shorts"]
raw: raw raw: raw
} }
@@ -460,7 +413,7 @@ namespace Http
if not IsArray(result.feeds) or result.feeds.Count() = 0 if not IsArray(result.feeds) or result.feeds.Count() = 0
response.Json({ response.Json({
"error": "Failed to search" "error": "Failed to search: no results found"
}) })
response.http_code = 500 response.http_code = 500
return true return true
@@ -581,9 +534,7 @@ namespace Http
request = context.request request = context.request
route = request.route route = request.route
if route.StartsWith("/playlet-invidious-backend/api/v1/auth/history/") if route.StartsWith("/playlet-invidious-backend/api/v1/auth/subscriptions/")
return m.AuthMarkVideoWatched(context)
else if route.StartsWith("/playlet-invidious-backend/api/v1/auth/subscriptions/")
return m.SubscribeToChannel(context) return m.SubscribeToChannel(context)
end if end if
@@ -65,7 +65,8 @@ namespace Http
if keysDict["invidious"] = true if keysDict["invidious"] = true
state["invidious"] = { state["invidious"] = {
current_instance: m.invidiousNode@.GetCurrentInstance() instance: m.invidiousNode@.GetInstance()
invidious_instance: m.invidiousNode@.GetInvidiousInstance()
auth_url: m.invidiousNode@.GetAuthorizeTokenLink() auth_url: m.invidiousNode@.GetAuthorizeTokenLink()
} }
end if end if
@@ -44,6 +44,12 @@ namespace Http
return true return true
end if end if
if IsString(payload.timestamp)
payload.timestamp = payload.timestamp.toInt()
else if IsString(payload.percentDurationWatched)
payload.percentDurationWatched = payload.percentDurationWatched.toFloat()
end if
instance = m.invidiousService.GetInstance() instance = m.invidiousService.GetInstance()
contentNode = InvidiousContent.ToRowCellContentNode(payload, instance) contentNode = InvidiousContent.ToRowCellContentNode(payload, instance)
@@ -79,6 +85,8 @@ namespace Http
if IsString(payload.timestamp) if IsString(payload.timestamp)
payload.timestamp = payload.timestamp.toInt() payload.timestamp = payload.timestamp.toInt()
else if IsString(payload.percentDurationWatched)
payload.percentDurationWatched = payload.percentDurationWatched.toFloat()
end if end if
instance = m.invidiousService.GetInstance() instance = m.invidiousService.GetInstance()
+28 -7
View File
@@ -27,25 +27,46 @@
visibility: "web", visibility: "web",
svelteComponent: "EditQualityControl", svelteComponent: "EditQualityControl",
}, },
],
},
{
displayText: "Backend",
key: "backend",
description: "Backend preferences",
children: [
{ {
displayText: "Backend", displayText: "Selected backend",
key: "playback.backend", key: "backend.selected",
description: "The backend used for fetching video data. The Playlet backend is experimental", description: "The backend used for browsing and playing videos.",
type: "radio", type: "radio",
defaultValue: "playlet", defaultValue: "playlet",
options: [ options: [
{
displayText: "Invidious",
value: "invidious",
},
{ {
displayText: "Playlet (local)", displayText: "Playlet (local)",
value: "playlet", value: "playlet",
}, },
{
displayText: "Invidious",
value: "invidious",
},
], ],
}, },
], ],
}, },
{
displayText: "Content Feed",
key: "content_feed",
description: "Feed preferences",
children: [
{
displayText: "Disable Shorts",
key: "content_feed.disable_shorts",
description: "Disable short videos.",
type: "boolean",
defaultValue: false,
},
],
},
{ {
displayText: "Invidious", displayText: "Invidious",
key: "invidious", key: "invidious",
@@ -1280,5 +1280,9 @@
<source>Playlet built-in backend</source> <source>Playlet built-in backend</source>
<translation>Playlet eingebautes Backend</translation> <translation>Playlet eingebautes Backend</translation>
</message> </message>
<message>
<source>Recommended</source>
<translation>Empfohlen</translation>
</message>
</context> </context>
</TS> </TS>
@@ -752,6 +752,38 @@
<source>Auto</source> <source>Auto</source>
<translation>Auto</translation> <translation>Auto</translation>
</message> </message>
<message>
<source>Backend</source>
<translation>Backend</translation>
</message>
<message>
<source>Backend preferences</source>
<translation>Backend preferences</translation>
</message>
<message>
<source>Selected backend</source>
<translation>Selected backend</translation>
</message>
<message>
<source>The backend used for browsing and playing videos.</source>
<translation>The backend used for browsing and playing videos.</translation>
</message>
<message>
<source>Content Feed</source>
<translation>Content Feed</translation>
</message>
<message>
<source>Feed preferences</source>
<translation>Feed preferences</translation>
</message>
<message>
<source>Disable Shorts</source>
<translation>Disable Shorts</translation>
</message>
<message>
<source>Disable short videos.</source>
<translation>Disable short videos.</translation>
</message>
<message> <message>
<source>Invidious preferences</source> <source>Invidious preferences</source>
<translation>Invidious preferences</translation> <translation>Invidious preferences</translation>
+1 -1
View File
@@ -2,7 +2,7 @@ title=PlayletLib
# Do not update version manually, it is auto updated from package.json # Do not update version manually, it is auto updated from package.json
major_version=0 major_version=0
minor_version=37 minor_version=39
build_version=00000 build_version=00000
ui_resolutions=hd ui_resolutions=hd
+10
View File
@@ -245,6 +245,16 @@ namespace Locale
PreferredQualityDescription = "Preferred video quality" PreferredQualityDescription = "Preferred video quality"
AutoQuality = "Auto" AutoQuality = "Auto"
Backend = "Backend"
BackendPreferences = "Backend preferences"
SelectedBackend = "Selected backend"
SelectedBackendDescription = "The backend used for browsing and playing videos."
ContentFeed = "Content Feed"
ContentPreferences = "Feed preferences"
DisableShorts = "Disable Shorts"
DisableShortsDescription = "Disable short videos."
' "Invidious" is used as node id, so we can't use it before refactoring node ids. ' "Invidious" is used as node id, so we can't use it before refactoring node ids.
' Either way, Invidious doesn't translate, so it's fine to skip it here ' Either way, Invidious doesn't translate, so it's fine to skip it here
' Invidious = "Invidious" ' Invidious = "Invidious"
@@ -1,6 +1,6 @@
namespace MessagePortUtils namespace MessagePortUtils
function ObserveFieldScopedExSafe(node as dynamic, field as string, port as dynamic) function ObserveFieldScopedExSafe(node as dynamic, field as string, port as dynamic) as void
' ObserveFieldScopedEx was added in 12.0 ' ObserveFieldScopedEx was added in 12.0
if FindMemberFunction(node, "ObserveFieldScopedEx") <> invalid if FindMemberFunction(node, "ObserveFieldScopedEx") <> invalid
' bs:disable-next-line NO_OBSERVE_FIELD_SCOPED_EX ' bs:disable-next-line NO_OBSERVE_FIELD_SCOPED_EX
+24
View File
@@ -246,4 +246,28 @@ namespace UrlUtils
} }
end function end function
function BuildUrlFromParts(parts as object) as string
url = ""
if not StringUtils.IsNullOrEmpty(parts.protocol)
url += parts.protocol + "://"
end if
if not StringUtils.IsNullOrEmpty(parts.host)
url += parts.host
end if
if (not StringUtils.IsNullOrEmpty(parts.port)) and ((parts.protocol = "http" and parts.port <> "80") or (parts.protocol = "https" and parts.port <> "443") or (parts.protocol <> "http" and parts.protocol <> "https"))
url += ":" + parts.port
end if
if not StringUtils.IsNullOrEmpty(parts.path)
if not parts.path.StartsWith("/")
url += "/"
end if
url += parts.path
end if
return url
end function
end namespace end namespace
+15 -15
View File
@@ -1,12 +1,12 @@
{ {
"name": "playlet-web", "name": "playlet-web",
"version": "0.37.0", "version": "0.39.0",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "playlet-web", "name": "playlet-web",
"version": "0.37.0", "version": "0.39.0",
"devDependencies": { "devDependencies": {
"@sveltejs/vite-plugin-svelte": "^5.0.3", "@sveltejs/vite-plugin-svelte": "^5.0.3",
"@tailwindcss/typography": "^0.5.16", "@tailwindcss/typography": "^0.5.16",
@@ -17,11 +17,11 @@
"dotenv": "^16.5.0", "dotenv": "^16.5.0",
"ip": "^2.0.1", "ip": "^2.0.1",
"postcss": "^8.5.3", "postcss": "^8.5.3",
"svelte": "^5.28.2", "svelte": "^5.30.1",
"svelte-check": "^4.1.7", "svelte-check": "^4.2.1",
"svelte-preprocess": "^6.0.3", "svelte-preprocess": "^6.0.3",
"tailwindcss": "^3.4.17", "tailwindcss": "^3.4.17",
"terser": "^5.39.0", "terser": "^5.39.2",
"tslib": "^2.8.1", "tslib": "^2.8.1",
"typescript": "^5.8.3", "typescript": "^5.8.3",
"vite": "^6.3.5", "vite": "^6.3.5",
@@ -4371,9 +4371,9 @@
} }
}, },
"node_modules/svelte": { "node_modules/svelte": {
"version": "5.28.2", "version": "5.30.1",
"resolved": "https://registry.npmjs.org/svelte/-/svelte-5.28.2.tgz", "resolved": "https://registry.npmjs.org/svelte/-/svelte-5.30.1.tgz",
"integrity": "sha512-FbWBxgWOpQfhKvoGJv/TFwzqb4EhJbwCD17dB0tEpQiw1XyUEKZJtgm4nA4xq3LLsMo7hu5UY/BOFmroAxKTMg==", "integrity": "sha512-QIYtKnJGkubWXtNkrUBKVCvyo9gjcccdbnvXfwsGNhvbeNNdQjRDTa/BiQcJ2kWXbXPQbWKyT7CUu53KIj1rfw==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
@@ -4397,9 +4397,9 @@
} }
}, },
"node_modules/svelte-check": { "node_modules/svelte-check": {
"version": "4.1.7", "version": "4.2.1",
"resolved": "https://registry.npmjs.org/svelte-check/-/svelte-check-4.1.7.tgz", "resolved": "https://registry.npmjs.org/svelte-check/-/svelte-check-4.2.1.tgz",
"integrity": "sha512-1jX4BzXrQJhC/Jt3SqYf6Ntu//vmfc6VWp07JkRfK2nn+22yIblspVUo96gzMkg0Zov8lQicxhxsMzOctwcMQQ==", "integrity": "sha512-e49SU1RStvQhoipkQ/aonDhHnG3qxHSBtNfBRb9pxVXoa+N7qybAo32KgA9wEb2PCYFNaDg7bZCdhLD1vHpdYA==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
@@ -4592,14 +4592,14 @@
} }
}, },
"node_modules/terser": { "node_modules/terser": {
"version": "5.39.0", "version": "5.39.2",
"resolved": "https://registry.npmjs.org/terser/-/terser-5.39.0.tgz", "resolved": "https://registry.npmjs.org/terser/-/terser-5.39.2.tgz",
"integrity": "sha512-LBAhFyLho16harJoWMg/nZsQYgTrg5jXOn2nCYjRUcZZEdE3qa2zb8QEDRUGVZBW4rlazf2fxkg8tztybTaqWw==", "integrity": "sha512-yEPUmWve+VA78bI71BW70Dh0TuV4HHd+I5SHOAfS1+QBOmvmCiiffgjR8ryyEd3KIfvPGFqoADt8LdQ6XpXIvg==",
"dev": true, "dev": true,
"license": "BSD-2-Clause", "license": "BSD-2-Clause",
"dependencies": { "dependencies": {
"@jridgewell/source-map": "^0.3.3", "@jridgewell/source-map": "^0.3.3",
"acorn": "^8.8.2", "acorn": "^8.14.0",
"commander": "^2.20.0", "commander": "^2.20.0",
"source-map-support": "~0.5.20" "source-map-support": "~0.5.20"
}, },
+4 -4
View File
@@ -1,6 +1,6 @@
{ {
"name": "playlet-web", "name": "playlet-web",
"version": "0.37.0", "version": "0.39.0",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",
@@ -18,11 +18,11 @@
"dotenv": "^16.5.0", "dotenv": "^16.5.0",
"ip": "^2.0.1", "ip": "^2.0.1",
"postcss": "^8.5.3", "postcss": "^8.5.3",
"svelte": "^5.28.2", "svelte": "^5.30.1",
"svelte-check": "^4.1.7", "svelte-check": "^4.2.1",
"svelte-preprocess": "^6.0.3", "svelte-preprocess": "^6.0.3",
"tailwindcss": "^3.4.17", "tailwindcss": "^3.4.17",
"terser": "^5.39.0", "terser": "^5.39.2",
"tslib": "^2.8.1", "tslib": "^2.8.1",
"typescript": "^5.8.3", "typescript": "^5.8.3",
"vite": "^6.3.5", "vite": "^6.3.5",
+14
View File
@@ -78,6 +78,13 @@ export class PlayletApi {
args.timestamp = parseInt(args.timestamp); args.timestamp = parseInt(args.timestamp);
} }
} }
if (args.percentDurationWatched !== undefined) {
if (typeof args.percentDurationWatched === "string") {
args.percentDurationWatched = parseFloat(args.percentDurationWatched);
}
}
await PlayletApi.postJson(`${PlayletApi.host()}/api/queue/play`, args); await PlayletApi.postJson(`${PlayletApi.host()}/api/queue/play`, args);
} }
@@ -99,6 +106,13 @@ export class PlayletApi {
args.timestamp = parseInt(args.timestamp); args.timestamp = parseInt(args.timestamp);
} }
} }
if (args.percentDurationWatched !== undefined) {
if (typeof args.percentDurationWatched === "string") {
args.percentDurationWatched = parseFloat(args.percentDurationWatched);
}
}
await PlayletApi.postJson(`${PlayletApi.host()}/api/queue`, args); await PlayletApi.postJson(`${PlayletApi.host()}/api/queue`, args);
} }
+1 -1
View File
@@ -24,7 +24,7 @@
let invidiousApi = new InvidiousApi(); let invidiousApi = new InvidiousApi();
playletStateStore.subscribe((value) => { playletStateStore.subscribe((value) => {
invidiousApi.instance = value?.invidious?.current_instance; invidiousApi.instance = value?.invidious?.instance;
}); });
onMount(async () => { onMount(async () => {
+2 -1
View File
@@ -32,7 +32,8 @@
playletStateStore.subscribe((value) => { playletStateStore.subscribe((value) => {
authUrl = value?.invidious?.auth_url; authUrl = value?.invidious?.auth_url;
currentInstance = value?.invidious?.current_instance || ""; currentInstance =
value?.invidious?.invidious_instance || value?.invidious?.instance || "";
if (currentInstance === `${host()}/playlet-invidious-backend`) { if (currentInstance === `${host()}/playlet-invidious-backend`) {
const trFn = get(translate); const trFn = get(translate);
currentInstanceName = trFn("Playlet built-in backend"); currentInstanceName = trFn("Playlet built-in backend");
@@ -31,7 +31,7 @@
let searchFiltersLabel; let searchFiltersLabel;
playletStateStore.subscribe((value) => { playletStateStore.subscribe((value) => {
invidiousApi.instance = value?.invidious?.current_instance; invidiousApi.instance = value?.invidious?.instance;
let userCountryCode = value?.device?.user_country_code; let userCountryCode = value?.device?.user_country_code;
if (!userCountryCode || userCountryCode === "OT") { if (!userCountryCode || userCountryCode === "OT") {
userCountryCode = "US"; userCountryCode = "US";
@@ -21,7 +21,7 @@
playletStateStore.subscribe((value) => { playletStateStore.subscribe((value) => {
tvName = value?.device?.friendly_name ?? "Roku TV"; tvName = value?.device?.friendly_name ?? "Roku TV";
invidiousInstance = value?.invidious?.current_instance; invidiousInstance = value?.invidious?.instance;
}); });
async function openOnTv() { async function openOnTv() {
@@ -24,7 +24,7 @@
playletStateStore.subscribe((value) => { playletStateStore.subscribe((value) => {
tvName = value?.device?.friendly_name ?? "Roku TV"; tvName = value?.device?.friendly_name ?? "Roku TV";
invidiousInstance = value?.invidious?.current_instance; invidiousInstance = value?.invidious?.instance;
}); });
async function playOnTv() { async function playOnTv() {
@@ -21,7 +21,7 @@
let invidiousInstance; let invidiousInstance;
playletStateStore.subscribe((value) => { playletStateStore.subscribe((value) => {
invidiousInstance = value?.invidious?.current_instance; invidiousInstance = value?.invidious?.instance;
}); });
function getUpdatedText() { function getUpdatedText() {
@@ -14,6 +14,7 @@
export let viewCount: number | undefined = undefined; export let viewCount: number | undefined = undefined;
export let isUpcoming: boolean = undefined; export let isUpcoming: boolean = undefined;
export let premiereTimestamp: number | undefined = undefined; export let premiereTimestamp: number | undefined = undefined;
export let percentDurationWatched: number | undefined = undefined;
export let videoStartAtChecked; export let videoStartAtChecked;
export let videoStartAtTimestamp; export let videoStartAtTimestamp;
@@ -37,7 +38,7 @@
playletStateStore.subscribe((value) => { playletStateStore.subscribe((value) => {
tvName = value?.device?.friendly_name ?? "Roku TV"; tvName = value?.device?.friendly_name ?? "Roku TV";
invidiousInstance = value?.invidious?.current_instance; invidiousInstance = value?.invidious?.instance;
}); });
async function playOnTv() { async function playOnTv() {
@@ -69,6 +70,7 @@
liveNow, liveNow,
viewCount, viewCount,
timestamp, timestamp,
percentDurationWatched,
}; };
} }
@@ -103,6 +105,7 @@
bind:isUpcoming bind:isUpcoming
bind:premiereTimestamp bind:premiereTimestamp
bind:invidiousInstance bind:invidiousInstance
bind:percentDurationWatched
/> />
</div> </div>
<div class="m-4">{title || ""}</div> <div class="m-4">{title || ""}</div>
@@ -19,6 +19,7 @@
export let lengthText: string | undefined = undefined; export let lengthText: string | undefined = undefined;
export let liveNow: boolean = undefined; export let liveNow: boolean = undefined;
export let lines: string[] | undefined = undefined; export let lines: string[] | undefined = undefined;
export let percentDurationWatched: number | undefined = undefined;
// svelte-ignore unused-export-let // svelte-ignore unused-export-let
export let type: string = undefined; export let type: string = undefined;
@@ -46,7 +47,7 @@
let invidiousInstance; let invidiousInstance;
playletStateStore.subscribe((value) => { playletStateStore.subscribe((value) => {
invidiousInstance = value?.invidious?.current_instance; invidiousInstance = value?.invidious?.instance;
}); });
function getViewCountDateText() { function getViewCountDateText() {
@@ -207,6 +208,7 @@
bind:lengthText bind:lengthText
bind:viewCount bind:viewCount
bind:invidiousInstance bind:invidiousInstance
bind:percentDurationWatched
/> />
<div class="card-body"> <div class="card-body">
<h3 class="card-title text-base line-clamp-2 min-h-12">{title || ""}</h3> <h3 class="card-title text-base line-clamp-2 min-h-12">{title || ""}</h3>
@@ -243,6 +245,7 @@
bind:isUpcoming bind:isUpcoming
bind:premiereTimestamp bind:premiereTimestamp
bind:viewCount bind:viewCount
bind:percentDurationWatched
videoStartAtChecked={false} videoStartAtChecked={false}
videoStartAtTimestamp={0} videoStartAtTimestamp={0}
/> />
@@ -86,7 +86,7 @@
let invidiousApi = new InvidiousApi(); let invidiousApi = new InvidiousApi();
playletStateStore.subscribe((value) => { playletStateStore.subscribe((value) => {
invidiousApi.instance = value?.invidious?.current_instance; invidiousApi.instance = value?.invidious?.instance;
let userCountryCode = value?.device?.user_country_code; let userCountryCode = value?.device?.user_country_code;
if (!userCountryCode || userCountryCode === "OT") { if (!userCountryCode || userCountryCode === "OT") {
userCountryCode = "US"; userCountryCode = "US";
@@ -10,6 +10,7 @@
export let viewCount: number | undefined = undefined; export let viewCount: number | undefined = undefined;
export let isUpcoming: boolean | undefined = undefined; export let isUpcoming: boolean | undefined = undefined;
export let premiereTimestamp: number | undefined = undefined; export let premiereTimestamp: number | undefined = undefined;
export let percentDurationWatched: number | undefined = undefined;
export let invidiousInstance; export let invidiousInstance;
@@ -21,8 +22,15 @@
videoThumbnails.find((thumbnail) => thumbnail.quality === "medium") || videoThumbnails.find((thumbnail) => thumbnail.quality === "medium") ||
videoThumbnails[0]; videoThumbnails[0];
let url = videoThumbnail.url; let url = videoThumbnail.url;
if (url.startsWith("/") && invidiousInstance) { if (url.startsWith("/")) {
url = invidiousInstance + url; if (
invidiousInstance &&
!invidiousInstance.includes(":8888/playlet-invidious-backend")
) {
url = invidiousInstance + url;
} else {
url = `https://i.ytimg.com/vi/${videoId}/mqdefault.jpg`;
}
} }
thumbnailUrl = url; thumbnailUrl = url;
} else if (invidiousInstance) { } else if (invidiousInstance) {
@@ -92,4 +100,10 @@
{getFormattedTime(lengthText, lengthSeconds)} {getFormattedTime(lengthText, lengthSeconds)}
</div> </div>
{/if} {/if}
{#if percentDurationWatched}
<div
class="absolute left-0 bottom-0 h-1 bg-red-600 rounded-box"
style="width: {Math.min(percentDurationWatched, 100)}%;"
></div>
{/if}
</figure> </figure>
+2 -1
View File
@@ -3,7 +3,8 @@ import { CompilerPlugin, Program, SourceObj } from "brighterscript";
const types = [ const types = [
{ name: 'Bool', interface: 'ifBoolean', type: 'boolean', defaultValue: 'false' }, { name: 'Bool', interface: 'ifBoolean', type: 'boolean', defaultValue: 'false' },
{ name: 'Int', interface: 'ifInt', type: 'integer', defaultValue: '0' }, { name: 'Int', interface: 'ifInt', type: 'integer', defaultValue: '0%' },
{ name: 'Float', interface: 'ifFloat', type: 'float', defaultValue: '0!' },
{ name: 'Double', interface: 'ifDouble', type: 'double', defaultValue: '0#' }, { name: 'Double', interface: 'ifDouble', type: 'double', defaultValue: '0#' },
{ name: 'String', interface: 'ifString', type: 'string', defaultValue: '""' }, { name: 'String', interface: 'ifString', type: 'string', defaultValue: '""' },
{ name: 'Array', interface: 'ifArray', type: 'object', defaultValue: '[]' }, { name: 'Array', interface: 'ifArray', type: 'object', defaultValue: '[]' },
-7
View File
@@ -30,10 +30,3 @@ const parsedVersion = semverParse(version);
[".", "playlet-app", "playlet-lib", "playlet-web"].forEach(function (packageFolder) { [".", "playlet-app", "playlet-lib", "playlet-web"].forEach(function (packageFolder) {
execSync(`npm version ${version} --allow-same-version --no-git-tag-version`, { cwd: packageFolder }); execSync(`npm version ${version} --allow-same-version --no-git-tag-version`, { cwd: packageFolder });
}); });
const webApi = "docs/playlet-web-api.yml"
let webApiContent = fs.readFileSync(webApi, { encoding: 'utf8', flag: 'r' });
// replace version in web api with regex
const webApiVersionPattern = /version: (\d+\.\d+\.\d+)/;
webApiContent = webApiContent.replace(webApiVersionPattern, `version: ${version}`);
fs.writeFileSync(webApi, webApiContent);