Compare commits

...
11 Commits
Author SHA1 Message Date
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
34 changed files with 546 additions and 245 deletions

No files matched your search

+24 -1
View File
@@ -5,6 +5,29 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [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
### Added
@@ -12,7 +35,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- YouTube account support. The following features are now available:
- The ability to login to one or multiple accounts
- Both YouTube accounts and Invidious accounts are supported side-by-side
- Subscritions
- Subscriptions
- User playlists
- Watch History
- Watched videos on Playlet are added to the watch history
+1 -1
View File
@@ -2,7 +2,7 @@ openapi: 3.0.0
info:
title: Playlet Web API
version: 0.37.0
version: 0.38.1
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
+24 -24
View File
@@ -1,22 +1,22 @@
{
"name": "playlet",
"version": "0.37.0",
"version": "0.38.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "playlet",
"version": "0.37.0",
"version": "0.38.1",
"hasInstallScript": true,
"devDependencies": {
"@rokucommunity/bslint": "^0.8.30",
"@rokucommunity/bslint": "^0.8.31",
"@types/crypto-js": "^4.2.2",
"@types/fs-extra": "^11.0.4",
"@types/node": "^22.15.17",
"@types/node": "^22.15.18",
"@types/xml2js": "^0.4.14",
"argparse": "^2.0.1",
"brighterscript": "0.68.5",
"brighterscript-formatter": "^1.7.13",
"brighterscript-formatter": "^1.7.14",
"cheerio": "1.0.0-rc.11",
"convert-svg-to-png": "^0.6.4",
"crypto-js": "^4.2.0",
@@ -32,12 +32,12 @@
"roku-test-automation": "^2.0.13",
"rooibos-roku": "5.15.7",
"rounded-rect-9patch": "^1.1.2",
"semver": "^7.7.1",
"semver": "^7.7.2",
"shelljs": "^0.10.0",
"ts-node": "^10.9.2",
"typescript": "5.8.3",
"xml2js": "^0.6.2",
"yaml": "^2.7.1"
"yaml": "^2.8.0"
},
"engines": {
"node": "20"
@@ -438,9 +438,9 @@
"dev": true
},
"node_modules/@rokucommunity/bslint": {
"version": "0.8.30",
"resolved": "https://registry.npmjs.org/@rokucommunity/bslint/-/bslint-0.8.30.tgz",
"integrity": "sha512-OMXmVslummcvvK7+b7abXtGZc2t6IaxcPG1Uq3ZoNj4qqJn0z2zZLnDjizDPR0c2kaZGI3wPTHehrGMjPbkR0Q==",
"version": "0.8.31",
"resolved": "https://registry.npmjs.org/@rokucommunity/bslint/-/bslint-0.8.31.tgz",
"integrity": "sha512-/VsycIH2OiEoNe7fCLqbQrDnX/JoKUV3Nufg0+auCM/DhCYzL4iM965VkSBebWzwUsnQXjILaKC4fRcMjpSBPQ==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -760,9 +760,9 @@
"license": "MIT"
},
"node_modules/@types/node": {
"version": "22.15.17",
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.15.17.tgz",
"integrity": "sha512-wIX2aSZL5FE+MR0JlvF87BNVrtFWf6AE6rxSE9X7OwnVvoyCQjpzSRJ+M87se/4QCkCiebQAqrJ0y6fwIyi7nw==",
"version": "22.15.18",
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.15.18.tgz",
"integrity": "sha512-v1DKRfUdyW+jJhZNEI1PYy29S2YRxMV5AOO/x/SjKmW0acCIOqmbj6Haf9eHAhsPmrhlHSxEhv/1WszcLWV4cg==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -1360,13 +1360,13 @@
}
},
"node_modules/brighterscript-formatter": {
"version": "1.7.13",
"resolved": "https://registry.npmjs.org/brighterscript-formatter/-/brighterscript-formatter-1.7.13.tgz",
"integrity": "sha512-fv2s+9CdYufQllOiE/uLayqNGq7fqy7FmCWy8gOengrNK7pUp6BV1G+3fuhRSN7A2xLNcXIB+8q6tnCGdb6qeg==",
"version": "1.7.14",
"resolved": "https://registry.npmjs.org/brighterscript-formatter/-/brighterscript-formatter-1.7.14.tgz",
"integrity": "sha512-rbK5lT2UZ/yD/JLryIsZC9Kng1vh4xFf9CO1tp8nMRaOTncscuD1mtMsmJXq0uQusxoRNBXB/tvSZQPKR9+SXQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"brighterscript": "^0.69.8",
"brighterscript": "^0.69.9",
"glob-all": "^3.3.0",
"jsonc-parser": "^3.0.0",
"source-map": "^0.7.3",
@@ -6712,9 +6712,9 @@
}
},
"node_modules/semver": {
"version": "7.7.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.7.1.tgz",
"integrity": "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==",
"version": "7.7.2",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz",
"integrity": "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==",
"dev": true,
"license": "ISC",
"bin": {
@@ -7925,16 +7925,16 @@
"dev": true
},
"node_modules/yaml": {
"version": "2.7.1",
"resolved": "https://registry.npmjs.org/yaml/-/yaml-2.7.1.tgz",
"integrity": "sha512-10ULxpnOCQXxJvBgxsn9ptjq6uviG/htZKk9veJGhlqn3w/DxQ631zFF+nlQXLwmImeS5amR2dl2U8sg6U9jsQ==",
"version": "2.8.0",
"resolved": "https://registry.npmjs.org/yaml/-/yaml-2.8.0.tgz",
"integrity": "sha512-4lLa/EcQCB0cJkyts+FpIRx5G/llPxfP6VQU5KByHEhLxY3IJCH0f0Hy1MHI8sClTvsIb8qwRJ6R/ZdlDJ/leQ==",
"dev": true,
"license": "ISC",
"bin": {
"yaml": "bin.mjs"
},
"engines": {
"node": ">= 14"
"node": ">= 14.6"
}
},
"node_modules/yargs": {
+6 -6
View File
@@ -1,16 +1,16 @@
{
"name": "playlet",
"version": "0.37.0",
"version": "0.38.1",
"description": "Unofficial YouTube client for Roku",
"devDependencies": {
"@rokucommunity/bslint": "^0.8.30",
"@rokucommunity/bslint": "^0.8.31",
"@types/crypto-js": "^4.2.2",
"@types/fs-extra": "^11.0.4",
"@types/node": "^22.15.17",
"@types/node": "^22.15.18",
"@types/xml2js": "^0.4.14",
"argparse": "^2.0.1",
"brighterscript": "0.68.5",
"brighterscript-formatter": "^1.7.13",
"brighterscript-formatter": "^1.7.14",
"cheerio": "1.0.0-rc.11",
"convert-svg-to-png": "^0.6.4",
"crypto-js": "^4.2.0",
@@ -26,12 +26,12 @@
"roku-test-automation": "^2.0.13",
"rooibos-roku": "5.15.7",
"rounded-rect-9patch": "^1.1.2",
"semver": "^7.7.1",
"semver": "^7.7.2",
"shelljs": "^0.10.0",
"ts-node": "^10.9.2",
"typescript": "5.8.3",
"xml2js": "^0.6.2",
"yaml": "^2.7.1"
"yaml": "^2.8.0"
},
"engines": {
"node": "20"
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "playlet-app",
"version": "0.37.0",
"version": "0.38.1",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "playlet-app",
"version": "0.37.0"
"version": "0.38.1"
}
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "playlet-app",
"version": "0.37.0",
"version": "0.38.1",
"description": "Unofficial YouTube client for Roku",
"scripts": {
"prebuild": "rm -rf ../build/playlet-app",
+2 -2
View File
@@ -2,8 +2,8 @@ title=Playlet
# Do not update version manually, it is auto updated from package.json
major_version=0
minor_version=37
build_version=00000
minor_version=38
build_version=00001
ui_resolutions=hd
uri_resolution_autosub=$$RES$$,480p,720p,1080p
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "playlet-lib",
"version": "0.37.0",
"version": "0.38.1",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "playlet-lib",
"version": "0.37.0"
"version": "0.38.1"
}
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "playlet-lib",
"version": "0.37.0",
"version": "0.38.1",
"description": "Unofficial YouTube client for Roku",
"scripts": {
"prebuild": "rm -rf ../build/playlet-lib",
@@ -54,18 +54,19 @@ function PlaylistContentTask(input as object) as object
}
end if
beforeChildCount = contentNode.getChildCount()
InvidiousContent.ToPlaylistContentNode(contentNode, metadata, instance)
childCount = contentNode.getChildCount()
afterChildCount = contentNode.getChildCount()
videoCount = ValidInt(metadata.videoCount)
hasContinuation = not StringUtils.IsNullOrEmpty(metadata.continuation)
noMoreContinuation = hadContinuation and not hasContinuation
noVideosReturned = metadata.videos.Count() = 0
reachedVideoCount = videoCount <> -1 and childCount >= videoCount
noVideosAdded = afterChildCount = beforeChildCount
reachedVideoCount = videoCount <> -1 and afterChildCount >= videoCount
if noMoreContinuation or noVideosReturned or reachedVideoCount
if noMoreContinuation or noVideosAdded or reachedVideoCount
contentNode.loadState = FeedLoadState.Loaded
return {
success: true
@@ -23,5 +23,6 @@
<field id="videoId" type="string" />
<field id="viewCountText" type="string" />
<field id="lines" type="stringarray" />
<field id="percentDurationWatched" type="float" />
</interface>
</component>
@@ -12,7 +12,6 @@ class DashManifest
m.invidiousInstance = invidiousInstance
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
m.colorInfo = {
@@ -38,8 +37,11 @@ class DashManifest
adaptiveFormats.Append(metadata.adaptiveFormats)
if local
parsedInvidiousUrl = UrlUtils.ParseUrl(m.invidiousInstance)
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 if
@@ -312,11 +312,21 @@ namespace InnertubeService
}
end if
json = response.Json()
return Innertube.ParseResponseDataForFeeds(json)
feeds = Innertube.ParseResponseDataForFeeds(response.Json())
result = {
feeds: feeds
}
cacheControl = Innertube.ParseResponseForCacheControl(response)
if cacheControl <> invalid
result["cache-control"] = cacheControl
end if
return result
end function
function AuthMarkVideoWatched(videoId as string, options as object) as boolean
function AuthGetPlaybackTrackingUrls(videoId as string, options as object) as object
cancellation = invalid
accessToken = options.accessToken
@@ -330,43 +340,95 @@ namespace InnertubeService
playerResponse = playerRequest.Await()
if not playerResponse.IsSuccess()
LogError("Error marking video as watched:", playerResponse.ErrorMessage())
return false
end if
if CancellationUtils.IsCancelled(cancellation)
return false
return {
error: playerResponse.ErrorMessage()
}
end if
json = playerResponse.Json()
videostatsPlaybackUrl = ObjectUtils.Dig(json, ["playbackTracking", "videostatsPlaybackUrl", "baseUrl"])
if StringUtils.IsNullOrEmpty(videostatsPlaybackUrl)
LogError("No videostatsPlaybackUrl found in response")
return false
videostatsWatchtimeUrl = ObjectUtils.Dig(json, ["playbackTracking", "videostatsWatchtimeUrl", "baseUrl"])
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
videostatsPlaybackUrl = videostatsPlaybackUrl.replace("https://s.youtube.com", "https://www.youtube.com")
videostatsPlaybackUrl = videostatsPlaybackUrl.replace("https://s.", "https://www.")
queryParams = UrlUtils.ParseQueryComponents(videostatsPlaybackUrl)
queryParams["c"] = "TVHTML5"
queryParams["cbrver"] = 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["cpn"] = InnertubeService.CreateClientPlaybackNonce()
queryParams["cmt"] = 0
queryParams["final"] = "1"
videostatsPlaybackUrl = UrlUtils.SetQueryParams(videostatsPlaybackUrl, queryParams)
trackingRequest = HttpClient.Get(videostatsPlaybackUrl)
trackingRequest.Header("Authorization", "Bearer " + accessToken)
request = HttpClient.Get(videostatsPlaybackUrl)
request.Cancellation(cancellation)
request.NoCache()
request.Headers(Innertube.CreateHeaders(Innertube.ClientType.Tv))
request.Header("Authorization", "Bearer " + accessToken)
trackingResponse = trackingRequest.Await()
if not trackingResponse.IsSuccess()
LogError("Error marking video as watched:", trackingResponse.ErrorMessage())
response = request.Await()
if not response.IsSuccess()
LogError("Error marking video as watched:", response.ErrorMessage())
return false
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
end function
@@ -651,7 +713,14 @@ namespace InnertubeService
return response.Json()
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
function ResolveUrl(url as string, options = invalid as object) as object
@@ -106,6 +106,8 @@ namespace Innertube
"genericPromoRenderer": ParseNotImplemented
' "Sign in to see the latest videos tailored to your interests"
"feedNudgeRenderer": ParseNotImplemented
' "No results found, Try different keywords or remove search filters"
"backgroundPromoRenderer": ParseNotImplemented
"videoSurveyShelfRenderer": ParseNotImplemented
"searchBarRenderer": ParseNotImplemented
"clickTrackingParams": ParseNotImplemented
@@ -927,6 +929,13 @@ namespace Innertube
function ParseTileRenderer(nodeData as object, context as object) as object
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"
return TileRendererTypeVideo(nodeData, context)
else if contentType = "TILE_CONTENT_TYPE_PLAYLIST"
@@ -961,6 +970,7 @@ namespace Innertube
lengthText = ""
isUpcoming = false
liveNow = false
percentDurationWatched = 0
thumbnailOverlays = ObjectUtils.Dig(nodeData, ["header", "tileHeaderRenderer", "thumbnailOverlays"])
if IsArray(thumbnailOverlays)
for each overlay in thumbnailOverlays
@@ -968,6 +978,10 @@ namespace Innertube
if maybeLengthText <> ""
lengthText = maybeLengthText
end if
maybePercentDurationWatched = ObjectUtils.Dig(overlay, ["thumbnailOverlayResumePlaybackRenderer", "percentDurationWatched"])
if maybePercentDurationWatched <> invalid
percentDurationWatched = maybePercentDurationWatched
end if
liveNow = liveNow or (ValidString(ObjectUtils.Dig(overlay, ["thumbnailOverlayTimeStatusRenderer", "style"])) = "LIVE")
isUpcoming = isUpcoming or (ValidString(ObjectUtils.Dig(overlay, ["thumbnailOverlayTimeStatusRenderer", "style"])) = "UPCOMING")
end for
@@ -996,6 +1010,7 @@ namespace Innertube
"liveNow": liveNow
"isUpcoming": isUpcoming
"lines": renderedLines
"percentDurationWatched": percentDurationWatched
}
PushFeedItem(video, context)
@@ -85,7 +85,7 @@ namespace Invidious
return instance
end function
function MarkVideoWatched(videoId as dynamic) as void
function MarkVideoWatched(videoId as dynamic, cancellation = invalid as object) as void
if StringUtils.IsNullOrEmpty(videoId)
return
end if
@@ -98,6 +98,7 @@ namespace Invidious
url = `${authToken.instance}${Invidious.HISTORY_ENDPOINT}/${videoId}`
request = HttpClient.Post(url, "")
request.Headers(m.GetAuthenticationHeaders(authToken.token))
request.Cancellation(cancellation)
request.Await()
end function
@@ -52,6 +52,7 @@ namespace InvidiousContent
node.viewCountText = VideoGetViewCountText(item)
SetIfExists(node, "index", item, "index")
SetIfExists(node, "lines", item, "lines")
SetIfExists(node, "percentDurationWatched", item, "percentDurationWatched")
return node
end function
@@ -80,19 +81,38 @@ namespace InvidiousContent
SetIfExists(node, "statsText", item, "statsText")
SetIfExists(node, "lines", item, "lines")
if item.videos <> invalid
if IsArray(item.videos) and item.videos.Count() > 0
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 = []
for each video in item.videos
' TODO:P1 sometimes we're parsing "recommended playlists" that
' show up in the end of the playlist. We should ignore them,
' until the parsing is fixed.
' Sometimes we're parsing "recommended playlists" that show up
' in the end of the playlist. In this context they are ignored.
if ValidString(video.type) = "playlist"
continue for
end if
video.type = "video"
videoNode = ToVideoContentNode(invalid, video, instance)
if videoNode <> invalid
if not videosHasIndex
if videoIds[video.videoId] = true
continue for
end if
end if
index = video.index
if index <> invalid and index > -1 and index < childCount
node.replaceChild(videoNode, index)
@@ -101,6 +121,7 @@ namespace InvidiousContent
end if
end if
end for
if newNodes.Count() > 0
node.appendChildren(newNodes)
end if
@@ -1,4 +1,5 @@
import "pkg:/source/utils/Locale.bs"
import "pkg:/source/utils/MathUtils.bs"
import "pkg:/source/utils/StringUtils.bs"
import "pkg:/source/utils/TimeUtils.bs"
import "pkg:/source/utils/Types.bs"
@@ -8,6 +9,7 @@ function Init()
m.durationLabel = m.top.FindNode("durationLabel")
m.smallestSystemFont = m.top.FindNode("smallestSystemFont")
m.smallestBoldSystemFont = m.top.FindNode("smallestBoldSystemFont")
m.progressRect = m.top.FindNode("progressRect")
end function
function OnContentSet() as void
@@ -53,6 +55,8 @@ function OnContentSet() as void
m.top.thumbnailUri = content.thumbnail
m.top.percentDurationWatched = content.percentDurationWatched
if not StringUtils.IsNullOrEmpty(content.lengthText)
SetDurationLabel(content.lengthText, "#161616FF", 0.8, m.smallestSystemFont)
m.top.durationRectVisible = true
@@ -90,3 +94,11 @@ function SetDurationLabel(text as string, bgColor as string, bgOpacity as float,
rect.opacity = bgOpacity
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="duration" type="string" alias="durationLabel.text" />
<field id="thumbnailUri" type="string" alias="thumbnail.uri" />
<field id="percentDurationWatched" type="float" onChange="OnPercentDurationWatched" />
</interface>
<children>
<Font id="smallestSystemFont" uri="font:SystemFontFile" size="18" />
@@ -36,6 +37,14 @@
font="font:SmallestSystemFont"
translation="[8, 0]" />
</Rectangle>
<Rectangle
id="progressRect"
width="350"
height="5"
color="#FF0000"
translation="[0, 192]"
scale="[0, 1]">
</Rectangle>
</Poster>
<Label
id="titleLabel"
@@ -1,12 +1,74 @@
import "pkg:/components/Services/Innertube/InnertubeService.bs"
import "pkg:/components/Services/Invidious/InvidiousService.bs"
import "pkg:/source/utils/MessagePortUtils.bs"
@asynctask
function MarkVideoWatchedTask(input as object) as object
videoId = input.videoId
invidiousNode = input.invidious
authToken = input.authToken
profileType = input.profileType
cancellation = m.top.cancellation
service = new Invidious.InvidiousService(invidiousNode)
service.MarkVideoWatched(videoId)
if profileType = "invidious"
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
end function
@@ -140,7 +140,6 @@ namespace SponsorBlock
m.top.trickPlayBar.filledBarBlendColor = "#FF000080"
end if
m.top.UnobserveFieldScoped("position")
m.top.ObserveFieldScoped("position", FuncName(OnPositionChangeSkipSponsorBlockSections))
end function
@@ -31,6 +31,13 @@ function VideoContentTask(input as object) as object
metadata = service.GetVideoMetadata(contentNode.videoId, { cancellation: m.top.cancellation })
end if
if metadata = invalid
return {
success: false
error: "Failed to get video metadata"
}
end if
if m.top.cancel
return invalid
end if
@@ -21,6 +21,7 @@ function Init()
m.fullScreenHintTimer.ObserveField("fire", FuncName(OnFullScreenHintTimer))
m.trickplayUITimer = m.top.findNode("trickplayUITimer")
m.trickplayUITimer.ObserveField("fire", FuncName(OnTrickplayUITimer))
m.top.notificationInterval = 1
' 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
@@ -126,6 +127,8 @@ function PlayWithContent(contentNode as object)
end if
if ValidInt(contentNode.timestamp) <> -1
videoContentNode.AddFields({ timestamp: contentNode.timestamp })
else if contentNode.percentDurationWatched > 0 and contentNode.percentDurationWatched < 100
videoContentNode.AddFields({ percentDurationWatched: contentNode.percentDurationWatched })
end if
if not StringUtils.IsNullOrEmpty(contentNode.title)
videoContentNode.title = contentNode.title
@@ -144,8 +147,6 @@ function StartVideoContentTask(videoContentNode as object)
m.videoContentTask.cancel = true
end if
MarkVideoWatched(videoContentNode.videoId)
m.top.content = videoContentNode
m.videoContentTask = AsyncTask.Start(Tasks.VideoContentTask, {
@@ -194,22 +195,25 @@ function OnVideoContentTaskResults(output as object) as void
SponsorBlock.FetchSponsorBlock(content.metadata)
timestamp = content.timestamp
percentDurationWatched = content.percentDurationWatched
hasTimestamp = IsInt(timestamp)
hasPercentDurationWatched = IsFloat(percentDurationWatched)
if IsLiveVideo() and not hasTimestamp
duration = m.top.duration
if duration > 0
SeekToEndOfStream()
else
m.top.ObserveField("duration", FuncName(SeekToEndOfStream))
if IsLiveVideo() and not hasTimestamp and not hasPercentDurationWatched
' If live, seek to end of stream
m.seekToPercent = 100.0
SeekToPercentOfDuration()
else
if hasTimestamp and timestamp > 0
m.top.seek = content.timestamp
else if hasPercentDurationWatched
m.seekToPercent = percentDurationWatched
SeekToPercentOfDuration()
end if
end if
PlayAfterPreviousPlayerHasStopped()
if hasTimestamp and timestamp > 0
m.top.seek = content.timestamp
end if
MarkVideoWatched(content.videoId)
end function
function PlayAfterPreviousPlayerHasStopped() as void
@@ -272,12 +276,48 @@ function MarkVideoWatched(videoId as dynamic) as void
return
end if
if m.top.invidious.authToken <> invalid
AsyncTask.Start(Tasks.MarkVideoWatchedTask, {
videoId: videoId
invidious: m.top.invidious
})
invidious = m.top.invidious
authToken = invidious.authToken
if authToken = invalid
return
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
function OnClose()
@@ -285,6 +325,10 @@ function OnClose()
m.top.previousPlayer = invalid
if m.markVideoWatchedTask <> invalid
m.markVideoWatchedTask.cancel = true
m.markVideoWatchedTask = invalid
end if
if m.videoContentTask <> invalid
m.videoContentTask.cancel = true
m.videoContentTask = invalid
@@ -408,13 +452,43 @@ function OnVideoPlayerStateChange() as void
end if
end function
function SeekToEndOfStream()
function SeekToEndOfStream() as void
m.top.UnobserveField("duration")
duration = m.top.duration
' If the stream is less than 30 seconds, it's not worth seeking to the end
if duration > 30
LogInfo("Seeking to end of live stream", duration)
m.top.seek = duration
' If the stream is less than 30 seconds, it's not worth seeking
if duration < 30
return
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 function
@@ -71,36 +71,35 @@ namespace Http
options.continuation = continuation
end if
feeds = InnertubeService.GetSubscriptions(options)
if feeds = invalid
response.Json({
"error": "Failed to get auth feed"
})
result = InnertubeService.GetSubscriptions(options)
if result.error <> invalid
response.Json(result)
response.http_code = 500
return true
end if
if IsAssociativeArray(feeds)
if feeds.error <> invalid
response.Json(feeds)
response.http_code = 500
return true
end if
if not IsArray(result.feeds) or result.feeds.Count() = 0
' Not an error, just no subscriptions
response.Json({
"videos": []
})
return true
end if
result = {
"videos": []
responseBody = {
"videos": ValidArray(result.feeds[0].items)
}
if feeds.Count() > 0
result["videos"] = ValidArray(feeds[0].items)
if feeds[0].DoesExist("continuation")
result["continuation"] = feeds[0].continuation
end if
if result.feeds[0].DoesExist("continuation")
responseBody.continuation = result.feeds[0].continuation
end if
response.Json(responseBody)
if result.DoesExist("cache-control")
response.headers["cache-control"] = result["cache-control"]
end if
response.Json(result)
return true
end function
@@ -144,8 +143,14 @@ namespace Http
options.continuation = continuation
end if
feeds = InnertubeService.GetPlaylists(options)
if feeds = invalid
result = InnertubeService.GetPlaylists(options)
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({
"error": "Failed to get auth playlists"
})
@@ -153,23 +158,12 @@ namespace Http
return true
end if
if IsAssociativeArray(feeds)
if feeds.error <> invalid
response.Json(feeds)
response.http_code = 500
return true
end if
return true
response.Json(result.feeds[0])
if result.DoesExist("cache-control")
response.headers["cache-control"] = result["cache-control"]
end if
if feeds.Count() > 0
response.Json(feeds[0])
return true
end if
response.Json({
"items": []
})
return true
end function
@@ -190,80 +184,41 @@ namespace Http
options = {
"accessToken": accessToken.Mid("Bearer ".Len())
}
continuation = request.query.continuation
if not StringUtils.IsNullOrEmpty(continuation)
hasContinuation = not StringUtils.IsNullOrEmpty(continuation)
if hasContinuation
options.continuation = continuation
end if
feeds = InnertubeService.GetWatchHistory(options)
if feeds = invalid
response.Json({
"error": "Failed to get auth history"
})
response.http_code = 500
return true
end if
if IsAssociativeArray(feeds)
if feeds.error <> invalid
response.Json(feeds)
response.http_code = 500
if not hasContinuation
page = ValidString(request.query.page).ToInt()
if page > 1
LogError("Playlet backend does not use history pagination (use continuation instead)")
response.Json({
"items": []
})
return true
end if
return true
end if
if feeds.Count() > 0
response.Json(feeds[0])
return true
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"
})
result = InnertubeService.GetWatchHistory(options)
if result.error <> invalid
response.Json(result)
response.http_code = 500
return true
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
end function
@@ -317,6 +272,7 @@ namespace Http
end if
response.Json(ValidArray(result.feeds[0].items))
if result.DoesExist("cache-control")
response.headers["cache-control"] = result["cache-control"]
end if
@@ -346,36 +302,27 @@ namespace Http
options.continuation = continuation
end if
feeds = InnertubeService.GetHome(options)
if feeds = invalid
response.Json({
"error": "Failed to get auth home feed"
})
result = InnertubeService.GetHome(options)
if result.error <> invalid
response.Json(result)
response.http_code = 500
return true
end if
if IsAssociativeArray(feeds)
if feeds.error <> invalid
response.Json(feeds)
response.http_code = 500
return true
end if
if not IsArray(result.feeds) or result.feeds.Count() = 0
' Not an error, just no recommended videos, usually when there's no history
response.Json({
"items": []
})
return true
end if
result = {
"items": []
}
response.Json(result.feeds[0])
if feeds.Count() > 0
result["items"] = ValidArray(feeds[0].items)
if feeds[0].DoesExist("continuation")
result["continuation"] = feeds[0].continuation
end if
if result.DoesExist("cache-control")
response.headers["cache-control"] = result["cache-control"]
end if
response.Json(result)
return true
end function
@@ -460,7 +407,7 @@ namespace Http
if not IsArray(result.feeds) or result.feeds.Count() = 0
response.Json({
"error": "Failed to search"
"error": "Failed to search: no results found"
})
response.http_code = 500
return true
@@ -581,9 +528,7 @@ namespace Http
request = context.request
route = request.route
if route.StartsWith("/playlet-invidious-backend/api/v1/auth/history/")
return m.AuthMarkVideoWatched(context)
else if route.StartsWith("/playlet-invidious-backend/api/v1/auth/subscriptions/")
if route.StartsWith("/playlet-invidious-backend/api/v1/auth/subscriptions/")
return m.SubscribeToChannel(context)
end if
@@ -44,6 +44,12 @@ namespace Http
return true
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()
contentNode = InvidiousContent.ToRowCellContentNode(payload, instance)
@@ -79,6 +85,8 @@ namespace Http
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()
+2 -2
View File
@@ -2,8 +2,8 @@ title=PlayletLib
# Do not update version manually, it is auto updated from package.json
major_version=0
minor_version=37
build_version=00000
minor_version=38
build_version=00001
ui_resolutions=hd
uri_resolution_autosub=$$RES$$,480p,720p,1080p
@@ -1,6 +1,6 @@
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
if FindMemberFunction(node, "ObserveFieldScopedEx") <> invalid
' bs:disable-next-line NO_OBSERVE_FIELD_SCOPED_EX
+24
View File
@@ -246,4 +246,28 @@ namespace UrlUtils
}
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
+15 -15
View File
@@ -1,12 +1,12 @@
{
"name": "playlet-web",
"version": "0.37.0",
"version": "0.38.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "playlet-web",
"version": "0.37.0",
"version": "0.38.1",
"devDependencies": {
"@sveltejs/vite-plugin-svelte": "^5.0.3",
"@tailwindcss/typography": "^0.5.16",
@@ -17,11 +17,11 @@
"dotenv": "^16.5.0",
"ip": "^2.0.1",
"postcss": "^8.5.3",
"svelte": "^5.28.2",
"svelte-check": "^4.1.7",
"svelte": "^5.30.1",
"svelte-check": "^4.2.1",
"svelte-preprocess": "^6.0.3",
"tailwindcss": "^3.4.17",
"terser": "^5.39.0",
"terser": "^5.39.2",
"tslib": "^2.8.1",
"typescript": "^5.8.3",
"vite": "^6.3.5",
@@ -4371,9 +4371,9 @@
}
},
"node_modules/svelte": {
"version": "5.28.2",
"resolved": "https://registry.npmjs.org/svelte/-/svelte-5.28.2.tgz",
"integrity": "sha512-FbWBxgWOpQfhKvoGJv/TFwzqb4EhJbwCD17dB0tEpQiw1XyUEKZJtgm4nA4xq3LLsMo7hu5UY/BOFmroAxKTMg==",
"version": "5.30.1",
"resolved": "https://registry.npmjs.org/svelte/-/svelte-5.30.1.tgz",
"integrity": "sha512-QIYtKnJGkubWXtNkrUBKVCvyo9gjcccdbnvXfwsGNhvbeNNdQjRDTa/BiQcJ2kWXbXPQbWKyT7CUu53KIj1rfw==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -4397,9 +4397,9 @@
}
},
"node_modules/svelte-check": {
"version": "4.1.7",
"resolved": "https://registry.npmjs.org/svelte-check/-/svelte-check-4.1.7.tgz",
"integrity": "sha512-1jX4BzXrQJhC/Jt3SqYf6Ntu//vmfc6VWp07JkRfK2nn+22yIblspVUo96gzMkg0Zov8lQicxhxsMzOctwcMQQ==",
"version": "4.2.1",
"resolved": "https://registry.npmjs.org/svelte-check/-/svelte-check-4.2.1.tgz",
"integrity": "sha512-e49SU1RStvQhoipkQ/aonDhHnG3qxHSBtNfBRb9pxVXoa+N7qybAo32KgA9wEb2PCYFNaDg7bZCdhLD1vHpdYA==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -4592,14 +4592,14 @@
}
},
"node_modules/terser": {
"version": "5.39.0",
"resolved": "https://registry.npmjs.org/terser/-/terser-5.39.0.tgz",
"integrity": "sha512-LBAhFyLho16harJoWMg/nZsQYgTrg5jXOn2nCYjRUcZZEdE3qa2zb8QEDRUGVZBW4rlazf2fxkg8tztybTaqWw==",
"version": "5.39.2",
"resolved": "https://registry.npmjs.org/terser/-/terser-5.39.2.tgz",
"integrity": "sha512-yEPUmWve+VA78bI71BW70Dh0TuV4HHd+I5SHOAfS1+QBOmvmCiiffgjR8ryyEd3KIfvPGFqoADt8LdQ6XpXIvg==",
"dev": true,
"license": "BSD-2-Clause",
"dependencies": {
"@jridgewell/source-map": "^0.3.3",
"acorn": "^8.8.2",
"acorn": "^8.14.0",
"commander": "^2.20.0",
"source-map-support": "~0.5.20"
},
+4 -4
View File
@@ -1,6 +1,6 @@
{
"name": "playlet-web",
"version": "0.37.0",
"version": "0.38.1",
"type": "module",
"scripts": {
"dev": "vite",
@@ -18,11 +18,11 @@
"dotenv": "^16.5.0",
"ip": "^2.0.1",
"postcss": "^8.5.3",
"svelte": "^5.28.2",
"svelte-check": "^4.1.7",
"svelte": "^5.30.1",
"svelte-check": "^4.2.1",
"svelte-preprocess": "^6.0.3",
"tailwindcss": "^3.4.17",
"terser": "^5.39.0",
"terser": "^5.39.2",
"tslib": "^2.8.1",
"typescript": "^5.8.3",
"vite": "^6.3.5",
+14
View File
@@ -78,6 +78,13 @@ export class PlayletApi {
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);
}
@@ -99,6 +106,13 @@ export class PlayletApi {
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);
}
@@ -14,6 +14,7 @@
export let viewCount: number | undefined = undefined;
export let isUpcoming: boolean = undefined;
export let premiereTimestamp: number | undefined = undefined;
export let percentDurationWatched: number | undefined = undefined;
export let videoStartAtChecked;
export let videoStartAtTimestamp;
@@ -69,6 +70,7 @@
liveNow,
viewCount,
timestamp,
percentDurationWatched,
};
}
@@ -103,6 +105,7 @@
bind:isUpcoming
bind:premiereTimestamp
bind:invidiousInstance
bind:percentDurationWatched
/>
</div>
<div class="m-4">{title || ""}</div>
@@ -19,6 +19,7 @@
export let lengthText: string | undefined = undefined;
export let liveNow: boolean = undefined;
export let lines: string[] | undefined = undefined;
export let percentDurationWatched: number | undefined = undefined;
// svelte-ignore unused-export-let
export let type: string = undefined;
@@ -207,6 +208,7 @@
bind:lengthText
bind:viewCount
bind:invidiousInstance
bind:percentDurationWatched
/>
<div class="card-body">
<h3 class="card-title text-base line-clamp-2 min-h-12">{title || ""}</h3>
@@ -243,6 +245,7 @@
bind:isUpcoming
bind:premiereTimestamp
bind:viewCount
bind:percentDurationWatched
videoStartAtChecked={false}
videoStartAtTimestamp={0}
/>
@@ -10,6 +10,7 @@
export let viewCount: number | undefined = undefined;
export let isUpcoming: boolean | undefined = undefined;
export let premiereTimestamp: number | undefined = undefined;
export let percentDurationWatched: number | undefined = undefined;
export let invidiousInstance;
@@ -92,4 +93,10 @@
{getFormattedTime(lengthText, lengthSeconds)}
</div>
{/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>
+2 -1
View File
@@ -3,7 +3,8 @@ import { CompilerPlugin, Program, SourceObj } from "brighterscript";
const types = [
{ 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: 'String', interface: 'ifString', type: 'string', defaultValue: '""' },
{ name: 'Array', interface: 'ifArray', type: 'object', defaultValue: '[]' },