Compare commits

...
18 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
54 changed files with 501 additions and 791 deletions

No files matched your search

+38
View File
@@ -5,6 +5,44 @@ 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 ## [0.38.0] - 2025-05-19
### Added ### Added
+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.38.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
+2 -2
View File
@@ -1,12 +1,12 @@
{ {
"name": "playlet", "name": "playlet",
"version": "0.38.0", "version": "0.39.0",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "playlet", "name": "playlet",
"version": "0.38.0", "version": "0.39.0",
"hasInstallScript": true, "hasInstallScript": true,
"devDependencies": { "devDependencies": {
"@rokucommunity/bslint": "^0.8.31", "@rokucommunity/bslint": "^0.8.31",
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "playlet", "name": "playlet",
"version": "0.38.0", "version": "0.39.0",
"description": "Unofficial YouTube client for Roku", "description": "Unofficial YouTube client for Roku",
"devDependencies": { "devDependencies": {
"@rokucommunity/bslint": "^0.8.31", "@rokucommunity/bslint": "^0.8.31",
+2 -2
View File
@@ -1,12 +1,12 @@
{ {
"name": "playlet-app", "name": "playlet-app",
"version": "0.38.0", "version": "0.39.0",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "playlet-app", "name": "playlet-app",
"version": "0.38.0" "version": "0.39.0"
} }
} }
} }
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "playlet-app", "name": "playlet-app",
"version": "0.38.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=38 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.38.0", "version": "0.39.0",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "playlet-lib", "name": "playlet-lib",
"version": "0.38.0" "version": "0.39.0"
} }
} }
} }
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "playlet-lib", "name": "playlet-lib",
"version": "0.38.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>
@@ -22,7 +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" /> <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
@@ -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,7 +303,7 @@ namespace InnertubeService
} }
end if end if
feeds = Innertube.ParseResponseDataForFeeds(response.Json()) feeds = Innertube.ParseResponseDataForFeeds(response.Json(), { disableShorts: disableShorts })
result = { result = {
feeds: feeds feeds: feeds
@@ -112,6 +112,7 @@ namespace Innertube
"searchBarRenderer": ParseNotImplemented "searchBarRenderer": ParseNotImplemented
"clickTrackingParams": ParseNotImplemented "clickTrackingParams": ParseNotImplemented
"promoShelfRenderer": ParseNotImplemented "promoShelfRenderer": ParseNotImplemented
"statementBannerRenderer": ParseNotImplemented
"adSlotRenderer": ParseNotImplemented "adSlotRenderer": ParseNotImplemented
"adsControlFlowOpportunityReceivedCommand": ParseNotImplemented "adsControlFlowOpportunityReceivedCommand": ParseNotImplemented
} }
@@ -156,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
@@ -179,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
@@ -276,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()
@@ -362,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
@@ -445,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
@@ -477,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)
@@ -516,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
@@ -867,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)
@@ -938,6 +979,8 @@ namespace Innertube
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
@@ -974,17 +1017,32 @@ namespace Innertube
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 parsedTimeStatusRenderer.isLive
isUpcoming = isUpcoming or parsedTimeStatusRenderer.isUpcoming
maybePercentDurationWatched = ObjectUtils.Dig(overlay, ["thumbnailOverlayResumePlaybackRenderer", "percentDurationWatched"]) maybePercentDurationWatched = ObjectUtils.Dig(overlay, ["thumbnailOverlayResumePlaybackRenderer", "percentDurationWatched"])
if maybePercentDurationWatched <> invalid if maybePercentDurationWatched <> invalid
percentDurationWatched = maybePercentDurationWatched percentDurationWatched = maybePercentDurationWatched
end if end if
liveNow = liveNow or (ValidString(ObjectUtils.Dig(overlay, ["thumbnailOverlayTimeStatusRenderer", "style"])) = "LIVE")
isUpcoming = isUpcoming or (ValidString(ObjectUtils.Dig(overlay, ["thumbnailOverlayTimeStatusRenderer", "style"])) = "UPCOMING")
end for end for
if liveNow or isUpcoming if liveNow or isUpcoming
lengthText = "" lengthText = ""
end if end if
@@ -1017,6 +1075,49 @@ namespace Innertube
return invalid return invalid
end function 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)
return invalid
end function
function TileRendererTypePlaylist(nodeData as object, context as object) as object function TileRendererTypePlaylist(nodeData as object, context as object) as object
playlistId = nodeData["contentId"] playlistId = nodeData["contentId"]
if not IsString(playlistId) if not IsString(playlistId)
@@ -1162,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,18 +70,30 @@ 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
@@ -732,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,7 @@ 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") SetIfExists(node, "percentDurationWatched", item, "percentDurationWatched")
return node return node
@@ -169,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
@@ -190,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
@@ -287,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" />
@@ -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
@@ -471,7 +471,6 @@ function SeekToPercentOfDuration() as void
if seekToPercent = invalid if seekToPercent = invalid
return return
end if end if
m.seekToPercent = invalid
duration = m.top.duration duration = m.top.duration
if duration = 0 if duration = 0
@@ -485,6 +484,7 @@ function SeekToPercentOfDuration() as void
return return
end if end if
m.seekToPercent = invalid
seek = (MathUtils.Clamp(seekToPercent, 0, 100) / 100.0) * duration seek = (MathUtils.Clamp(seekToPercent, 0, 100) / 100.0) * duration
if seek > 0 if seek > 0
LogInfo("Seeking to percent duration watched", seek) LogInfo("Seeking to percent duration watched", seek)
@@ -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,6 +67,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
if not StringUtils.IsNullOrEmpty(continuation) if not StringUtils.IsNullOrEmpty(continuation)
@@ -219,10 +222,6 @@ namespace Http
response.Json(result.feeds[0]) response.Json(result.feeds[0])
if result.DoesExist("cache-control")
response.headers["cache-control"] = result["cache-control"]
end if
return true return true
end function end function
@@ -251,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
} }
@@ -299,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
@@ -364,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
} }
@@ -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=38 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"
+2 -2
View File
@@ -1,12 +1,12 @@
{ {
"name": "playlet-web", "name": "playlet-web",
"version": "0.38.0", "version": "0.39.0",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "playlet-web", "name": "playlet-web",
"version": "0.38.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",
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "playlet-web", "name": "playlet-web",
"version": "0.38.0", "version": "0.39.0",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",
+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>
-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);