Compare commits

..
14 Commits
Author SHA1 Message Date
Brahim Hadriche a4c4f3d622 Release v0.23.7 (#391) 2024-05-28 11:49:59 -04:00
Brahim Hadriche 91a62cd3ac Bugfix 2024-05-27 09:38:06 -04:00
Brahim Hadriche 057b1fa1ee [skip ci] Error log 2024-05-27 09:32:14 -04:00
Brahim Hadricheandgithub-action linter 090d96c602 Feature/clock (#388)
* Clock

* Adjust clock work

* Lint fix

* Formatting

---------

Co-authored-by: github-action linter <githubaction@githubaction.com>
2024-05-26 19:01:33 -04:00
Brahim Hadriche 1afd295c7c [skip ci] todo 2024-05-26 09:32:27 -04:00
Brahim Hadriche 0d4c224703 update dependencies (#387) 2024-05-24 22:56:14 -04:00
Brahim Hadriche ca1399c60c Release v0.23.6 (#386) 2024-05-23 13:28:42 -04:00
Brahim Hadriche 1acf1da00d Fix failed to create media player error (#385) 2024-05-23 13:11:35 -04:00
Brahim Hadriche 55c811adb7 Add a setting to clear cache 2024-05-21 17:41:30 -04:00
Brahim Hadriche 0bbb876a84 Adjust font weight 2024-05-21 16:41:39 -04:00
Brahim Hadriche 8b15d1113b Fix a bug where video cast from web app would not play if there's an error dialog on screen 2024-05-21 13:05:40 -04:00
Brahim Hadriche ff35ad61ab [skip ci] update user agent 2024-05-20 14:29:47 -04:00
Brahim Hadriche b8fd099d5c Small tweak 2024-05-20 14:12:49 -04:00
Brahim Hadriche 795435ff4b Fix duplicate bookmarked items bug (#383)
* Fix duplicate bookmarked items bug

* Add a check on task state
2024-05-20 14:00:40 -04:00
48 changed files with 403 additions and 66 deletions

No files matched your search

+26
View File
@@ -5,6 +5,32 @@ 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.23.7] - 2024-05-28
### Added
- A clock to show the time
### Fixed
- Attempt to fix a race condition when closing player
## [0.23.6] - 2024-05-23
### Added
- A dev setting to clear the cache
### Fixed
- A bug where bookmarked channels can be duplicated
- A bug where video cast from web app would not play if there's an error dialog on screen
- failed to create media player error, by waiting for previous video to stop before starting a new one
### Changed
- Font weight to be less bold
## [0.23.5] - 2024-05-19 ## [0.23.5] - 2024-05-19
### Fixed ### Fixed
+1 -1
View File
@@ -2,7 +2,7 @@ openapi: 3.0.0
info: info:
title: Playlet Web API title: Playlet Web API
version: 0.23.5 version: 0.23.7
description: description:
Playlet Web API is a RESTful API for controlling the Playlet app on 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 Roku devices. The API is intended to be used by the Playlet web app, but can
+23 -23
View File
@@ -1,12 +1,12 @@
{ {
"name": "playlet", "name": "playlet",
"version": "0.23.5", "version": "0.23.7",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "playlet", "name": "playlet",
"version": "0.23.5", "version": "0.23.7",
"hasInstallScript": true, "hasInstallScript": true,
"devDependencies": { "devDependencies": {
"@rokucommunity/bslint": "^0.8.21", "@rokucommunity/bslint": "^0.8.21",
@@ -23,7 +23,7 @@
"dotenv": "^16.4.5", "dotenv": "^16.4.5",
"express": "^4.19.2", "express": "^4.19.2",
"fs-extra": "^11.2.0", "fs-extra": "^11.2.0",
"glob": "^10.3.15", "glob": "^10.4.1",
"imap": "^0.8.19", "imap": "^0.8.19",
"ip": "^2.0.1", "ip": "^2.0.1",
"json5": "^2.2.3", "json5": "^2.2.3",
@@ -2456,16 +2456,16 @@
} }
}, },
"node_modules/glob": { "node_modules/glob": {
"version": "10.3.15", "version": "10.4.1",
"resolved": "https://registry.npmjs.org/glob/-/glob-10.3.15.tgz", "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.1.tgz",
"integrity": "sha512-0c6RlJt1TICLyvJYIApxb8GsXoai0KUP7AxKKAtsYXdgJR1mGEUa7DgwShbdk1nly0PYoZj01xd4hzbq3fsjpw==", "integrity": "sha512-2jelhlq3E4ho74ZyVLN03oKdAZVUa6UDZzFLVH1H7dnoax+y9qyaq8zBkfDIggjniU19z0wU18y16jMB2eyVIw==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"foreground-child": "^3.1.0", "foreground-child": "^3.1.0",
"jackspeak": "^2.3.6", "jackspeak": "^3.1.2",
"minimatch": "^9.0.1", "minimatch": "^9.0.4",
"minipass": "^7.0.4", "minipass": "^7.1.2",
"path-scurry": "^1.11.0" "path-scurry": "^1.11.1"
}, },
"bin": { "bin": {
"glob": "dist/esm/bin.mjs" "glob": "dist/esm/bin.mjs"
@@ -2532,9 +2532,9 @@
} }
}, },
"node_modules/glob/node_modules/minimatch": { "node_modules/glob/node_modules/minimatch": {
"version": "9.0.3", "version": "9.0.4",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.4.tgz",
"integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", "integrity": "sha512-KqWh+VchfxcMNRAJjj2tnsSJdNbHsVgnkBhTNrW7AjVo6OvLtxw8zfT9oLw1JSohlFzJ8jCoTgaoXvJ+kHt6fw==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"brace-expansion": "^2.0.1" "brace-expansion": "^2.0.1"
@@ -2999,9 +2999,9 @@
"dev": true "dev": true
}, },
"node_modules/jackspeak": { "node_modules/jackspeak": {
"version": "2.3.6", "version": "3.1.2",
"resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-2.3.6.tgz", "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.1.2.tgz",
"integrity": "sha512-N3yCS/NegsOBokc8GAdM8UcmfsKiSS8cipheD/nivzr700H+nsMOxJjQnvwOcRYVuFkdH0wGUvW2WbXGmrZGbQ==", "integrity": "sha512-kWmLKn2tRtfYMF/BakihVVRzBKOxz4gJMiL2Rj91WnAB5TPZumSH99R/Yf1qE1u4uRimvCSJfm6hnxohXeEXjQ==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@isaacs/cliui": "^8.0.2" "@isaacs/cliui": "^8.0.2"
@@ -3419,9 +3419,9 @@
} }
}, },
"node_modules/minipass": { "node_modules/minipass": {
"version": "7.1.1", "version": "7.1.2",
"resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.1.tgz", "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz",
"integrity": "sha512-UZ7eQ+h8ywIRAW1hIEl2AqdwzJucU/Kp59+8kkZeSvafXhZjul247BvIJjEVFVeON6d7lM46XX1HXCduKAS8VA==", "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==",
"dev": true, "dev": true,
"engines": { "engines": {
"node": ">=16 || 14 >=14.17" "node": ">=16 || 14 >=14.17"
@@ -3900,16 +3900,16 @@
"dev": true "dev": true
}, },
"node_modules/path-scurry": { "node_modules/path-scurry": {
"version": "1.11.0", "version": "1.11.1",
"resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.0.tgz", "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz",
"integrity": "sha512-LNHTaVkzaYaLGlO+0u3rQTz7QrHTFOuKyba9JMTQutkmtNew8dw8wOD7mTU/5fCPZzCWpfW0XnQKzY61P0aTaw==", "integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"lru-cache": "^10.2.0", "lru-cache": "^10.2.0",
"minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0"
}, },
"engines": { "engines": {
"node": ">=16 || 14 >=14.17" "node": ">=16 || 14 >=14.18"
}, },
"funding": { "funding": {
"url": "https://github.com/sponsors/isaacs" "url": "https://github.com/sponsors/isaacs"
+2 -2
View File
@@ -1,6 +1,6 @@
{ {
"name": "playlet", "name": "playlet",
"version": "0.23.5", "version": "0.23.7",
"description": "Unofficial YouTube client for Roku", "description": "Unofficial YouTube client for Roku",
"devDependencies": { "devDependencies": {
"@rokucommunity/bslint": "^0.8.21", "@rokucommunity/bslint": "^0.8.21",
@@ -17,7 +17,7 @@
"dotenv": "^16.4.5", "dotenv": "^16.4.5",
"express": "^4.19.2", "express": "^4.19.2",
"fs-extra": "^11.2.0", "fs-extra": "^11.2.0",
"glob": "^10.3.15", "glob": "^10.4.1",
"imap": "^0.8.19", "imap": "^0.8.19",
"ip": "^2.0.1", "ip": "^2.0.1",
"json5": "^2.2.3", "json5": "^2.2.3",
+2 -2
View File
@@ -1,12 +1,12 @@
{ {
"name": "playlet-app", "name": "playlet-app",
"version": "0.23.5", "version": "0.23.7",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "playlet-app", "name": "playlet-app",
"version": "0.23.5" "version": "0.23.7"
} }
} }
} }
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "playlet-app", "name": "playlet-app",
"version": "0.23.5", "version": "0.23.7",
"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",
@@ -33,7 +33,7 @@ end function
function GetLoadingMessagesFromCache() as object function GetLoadingMessagesFromCache() as object
messagesFile = ReadAsciiFile("cachefs:/loading_messages_v1.json") messagesFile = ReadAsciiFile("cachefs:/loading_messages_v1.json")
if messagesFile = invalid or messagesFile = "" if messagesFile = ""
return invalid return invalid
end if end if
return ParseJson(messagesFile) return ParseJson(messagesFile)
+1 -1
View File
@@ -3,7 +3,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=23 minor_version=23
build_version=00005 build_version=00007
ui_resolutions=hd ui_resolutions=hd
+2 -2
View File
@@ -1,12 +1,12 @@
{ {
"name": "playlet-lib", "name": "playlet-lib",
"version": "0.23.5", "version": "0.23.7",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "playlet-lib", "name": "playlet-lib",
"version": "0.23.5" "version": "0.23.7"
} }
} }
} }
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "playlet-lib", "name": "playlet-lib",
"version": "0.23.5", "version": "0.23.7",
"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",
@@ -34,7 +34,7 @@
</interface> </interface>
<children> <children>
<Font id="normalFont" uri="font:SystemFontFile" size="24" /> <Font id="normalFont" uri="font:SystemFontFile" size="24" />
<Font id="boldFont" uri="font:BoldSystemFontFile" size="24" /> <Font id="boldFont" uri="font:MediumSystemFontFile" size="24" />
<Group id="anchor"> <Group id="anchor">
<Poster <Poster
id="background" id="background"
+62
View File
@@ -0,0 +1,62 @@
import "pkg:/source/utils/Types.bs"
function Init()
m.top.font.size = 18
m.top.horizAlign = "right"
m.top.translation = [1034, 34]
m.top.width = 200
m.dateTime = CreateObject("roDateTime")
Update()
seconds = m.dateTime.GetSeconds()
m.timer = CreateObject("roSGNode", "Timer")
' add 2 seconds delay between real clock time and the displayed time to in case of inaccuracy of the timer
m.timer.duration = 60 - seconds + 2
m.timer.repeat = false
m.timer.ObserveField("fire", FuncName(FirstUpdate))
m.timer.control = "start"
end function
function FirstUpdate()
m.timer.control = "stop"
m.timer.unobserveField("fire")
m.timer.ObserveField("fire", FuncName(Update))
m.timer.duration = 60
m.timer.repeat = true
m.timer.control = "start"
Update()
end function
' format time HH:MM AM/PM
function Update()
m.dateTime.Mark()
m.dateTime.ToLocalTime()
hours = m.dateTime.GetHours()
minutes = m.dateTime.GetMinutes()
if hours >= 12
ampm = "PM"
else
ampm = "AM"
end if
if hours > 12
hours = hours - 12
end if
hoursStr = hours.ToStr()
minutesStr = minutes.ToStr()
if hours < 10
hoursStr = "0" + hoursStr
end if
if minutes < 10
minutesStr = "0" + minutesStr
end if
m.top.text = hoursStr + ":" + minutesStr + " " + ampm
end function
@@ -0,0 +1,2 @@
<component name="Clock" extends="Label">
</component>
@@ -39,7 +39,7 @@
horizAlign="center" horizAlign="center"
width="400" width="400"
translation="[0, 380]"> translation="[0, 380]">
<Font role="font" uri="font:BoldSystemFontFile" size="18" /> <Font role="font" uri="font:MediumSystemFontFile" size="18" />
</Label> </Label>
</StdDlgSideCardArea> </StdDlgSideCardArea>
</children> </children>
@@ -35,6 +35,7 @@
</NavBar> </NavBar>
</AppRoot> </AppRoot>
</Group> </Group>
<Clock />
<VideoContainer id="VideoContainer" /> <VideoContainer id="VideoContainer" />
<Group id="Notifications" /> <Group id="Notifications" />
<VideoQueue id="VideoQueue" /> <VideoQueue id="VideoQueue" />
+1
View File
@@ -52,6 +52,7 @@
</AppRoot> </AppRoot>
</Group> </Group>
<Clock />
<VideoContainer id="VideoContainer" /> <VideoContainer id="VideoContainer" />
<Group id="Notifications" /> <Group id="Notifications" />
@@ -234,5 +234,6 @@ function LoadPlaylistIfNeeded() as void
return return
end if end if
' TODO:P1 use a field instead of function call
m.top.content@.LoadPlaylistPage(m.top.invidious) m.top.content@.LoadPlaylistPage(m.top.invidious)
end function end function
@@ -31,7 +31,7 @@
width="500" width="500"
maxLines="3" maxLines="3"
wrap="true"> wrap="true">
<Font role="font" uri="font:BoldSystemFontFile" size="36" /> <Font role="font" uri="font:MediumSystemFontFile" size="36" />
</Label> </Label>
<Label <Label
id="subtitleLabel" id="subtitleLabel"
@@ -62,7 +62,7 @@
width="200" width="200"
horizAlign="center" horizAlign="center"
translation="[0,210]"> translation="[0,210]">
<Font role="font" uri="font:BoldSystemFontFile" size="26" /> <Font role="font" uri="font:MediumSystemFontFile" size="26" />
</Label> </Label>
<Label <Label
id="ServerLabel" id="ServerLabel"
@@ -19,7 +19,7 @@
</interface> </interface>
<children> <children>
<Font id="normalFont" uri="font:SystemFontFile" size="24" /> <Font id="normalFont" uri="font:SystemFontFile" size="24" />
<Font id="boldFont" uri="font:BoldSystemFontFile" size="26" /> <Font id="boldFont" uri="font:MediumSystemFontFile" size="24" />
<Group translation="[20,50]"> <Group translation="[20,50]">
<Group <Group
@@ -108,7 +108,7 @@
id="WifiNameLabel" id="WifiNameLabel"
color="#4287f5" color="#4287f5"
translation="[0,250]"> translation="[0,250]">
<Font role="font" uri="font:BoldSystemFontFile" size="28" /> <Font role="font" uri="font:MediumSystemFontFile" size="28" />
</Label> </Label>
</LayoutGroup> </LayoutGroup>
</Group> </Group>
@@ -150,7 +150,7 @@
id="LinkCodeLabel" id="LinkCodeLabel"
font="font:LargeBoldSystemFont" font="font:LargeBoldSystemFont"
color="#4287f5"> color="#4287f5">
<Font role="font" uri="font:BoldSystemFontFile" size="48" /> <Font role="font" uri="font:MediumSystemFontFile" size="48" />
</Label> </Label>
</LayoutGroup> </LayoutGroup>
</Group> </Group>
@@ -10,9 +10,9 @@
color="#000000" color="#000000"
opacity="0.5"> opacity="0.5">
</Rectangle> </Rectangle>
<Font id="HeaderFont" uri="font:BoldSystemFontFile" size="18" /> <Font id="HeaderFont" uri="font:MediumSystemFontFile" size="18" />
<Font id="ItemFont" uri="font:SystemFontFile" size="18" /> <Font id="ItemFont" uri="font:SystemFontFile" size="18" />
<Font id="ItemFocusedFont" uri="font:BoldSystemFontFile" size="18" /> <Font id="ItemFocusedFont" uri="font:MediumSystemFontFile" size="18" />
<Rectangle <Rectangle
width="1200" width="1200"
height="543" height="543"
@@ -0,0 +1,27 @@
import "pkg:/components/Dialog/DialogUtils.bs"
import "pkg:/source/utils/CacheUtils.bs"
import "pkg:/source/utils/FocusManagement.bs"
import "pkg:/source/utils/Locale.bs"
function Init()
m.top.focusable = true
m.top.itemSpacings = [8]
m.button = m.top.findNode("Button")
m.button.observeField("buttonSelected", FuncName(OnButtonSelected))
end function
function OnFocusChange() as void
if not m.top.focus
return
end if
NodeSetFocus(m.button, true)
end function
function BindPreference(_preferences as object, _key as string)
' Do nothing
end function
function OnButtonSelected()
CacheUtils.Clear()
DialogUtils.ShowDialog(Tr(Locale.Settings.CacheCleared), Tr(Locale.Generic.Success))
end function
@@ -0,0 +1,19 @@
<component name="ClearCacheControl" extends="LayoutGroup" includes="Focus">
<interface>
<field id="displayText" type="string" alias="Button.text" />
<field id="description" type="string" alias="DescriptionLabel.text" />
<function name="BindPreference" />
</interface>
<children>
<Button
id="Button"
minWidth="340"
showFocusFootprint="true" />
<Label id="DescriptionLabel"
width="450"
color="0xb4b4b4ff"
wrap="true">
<Font role="font" uri="font:SystemFontFile" size="18" />
</Label>
</children>
</component>
@@ -11,7 +11,7 @@
</interface> </interface>
<children> <children>
<Font id="smallestSystemFont" uri="font:SystemFontFile" size="18" /> <Font id="smallestSystemFont" uri="font:SystemFontFile" size="18" />
<Font id="smallestBoldSystemFont" uri="font:BoldSystemFontFile" size="18" /> <Font id="smallestBoldSystemFont" uri="font:MediumSystemFontFile" size="18" />
<LayoutGroup <LayoutGroup
itemSpacings="[24,5,5]"> itemSpacings="[24,5,5]">
@@ -222,13 +222,13 @@ function InitContent() as void
node: m.top node: m.top
feeds: m.top.feeds feeds: m.top.feeds
}, OnVideoRowListContentTaskResult) }, OnVideoRowListContentTaskResult)
m.pendingLoadTasks[task.id] = task m.pendingLoadTasks[task.id] = { task: task }
end function end function
function CancelCurrentTasks() function CancelCurrentTasks()
pendingLoadTasks = m.pendingLoadTasks pendingLoadTasks = m.pendingLoadTasks
for each id in pendingLoadTasks for each id in pendingLoadTasks
task = pendingLoadTasks[id] task = pendingLoadTasks[id].task
task.cancel = true task.cancel = true
end for end for
m.pendingLoadTasks = {} m.pendingLoadTasks = {}
@@ -287,7 +287,16 @@ function GetRowsToLoad() as object
return subContentNodes return subContentNodes
end function end function
function LoadRowContent(contentNode as object) function LoadRowContent(contentNode as object) as void
' Do not spin up multiple tasks for the same content node
for each id in m.pendingLoadTasks
pendingTask = m.pendingLoadTasks[id]
if contentNode.isSameNode(pendingTask.content) and pendingTask.task.state = "run"
LogInfo("Row content already loading:", contentNode.title)
return
end if
end for
LogInfo("Loading row content:", contentNode.title) LogInfo("Loading row content:", contentNode.title)
contentNode.loadState = FeedLoadState.Loading contentNode.loadState = FeedLoadState.Loading
@@ -296,7 +305,7 @@ function LoadRowContent(contentNode as object)
feedContentNode: contentNode feedContentNode: contentNode
invidious: m.invidious invidious: m.invidious
}, OnVideoRowListRowContentTaskResult) }, OnVideoRowListRowContentTaskResult)
m.pendingLoadTasks[task.id] = task m.pendingLoadTasks[task.id] = { task: task, content: contentNode }
end function end function
function OnVideoRowListRowContentTaskResult(output as object) as void function OnVideoRowListRowContentTaskResult(output as object) as void
@@ -115,7 +115,7 @@ namespace SponsorBlock
function OnSponsorBlockTaskResults(output as object) as void function OnSponsorBlockTaskResults(output as object) as void
m.sponsorBlockTask = invalid m.sponsorBlockTask = invalid
if output.cancelled if output.cancelled or m.onCloseCalled = true
return return
end if end if
@@ -48,7 +48,7 @@ function Init()
end if end if
httpAgent = m.top.getHttpAgent() httpAgent = m.top.getHttpAgent()
httpAgent.AddHeader("User-Agent", "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:123.0) Gecko/20100101 Firefox/123.0") httpAgent.AddHeader("User-Agent", "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:126.0) Gecko/20100101 Firefox/126.0")
end function end function
function OnNodeReady() function OnNodeReady()
@@ -114,7 +114,7 @@ end function
function OnVideoContentTaskResults(output as object) as void function OnVideoContentTaskResults(output as object) as void
m.videoContentTask = invalid m.videoContentTask = invalid
if output.cancelled if output.cancelled or m.onCloseCalled = true
return return
end if end if
@@ -155,20 +155,60 @@ function OnVideoContentTaskResults(output as object) as void
end if end if
end if end if
m.top.control = "play" PlayAfterPreviousPlayerHasStopped()
if hasTimestamp and timestamp > 0 if hasTimestamp and timestamp > 0
m.top.seek = content.timestamp m.top.seek = content.timestamp
end if end if
end function end function
function PlayAfterPreviousPlayerHasStopped() as void
previousPlayer = m.top.previousPlayer
m.top.previousPlayer = invalid
if previousPlayer = invalid
m.top.control = "play"
return
end if
previousPlayerState = previousPlayer.state
LogInfo("Previous player state:", previousPlayerState)
if previousPlayerState = "stopping"
previousPlayer.observeFieldScoped("state", FuncName(OnPreviousPlayerState))
return
end if
m.top.control = "play"
end function
function OnPreviousPlayerState(event as object) as void
previousPlayer = event.getRoSGNode()
if m.onCloseCalled = true
previousPlayer.unobserveFieldScoped("state")
return
end if
previousPlayerState = previousPlayer.state
LogInfo("Previous player state change:", previousPlayerState)
if previousPlayerState = "stopped" or previousPlayerState = "error" or previousPlayerState = "finished" or previousPlayerState = "none"
previousPlayer.unobserveFieldScoped("state")
m.top.control = "play"
end if
end function
function OnVideoContentTaskErrorDialogResponse(event as object) function OnVideoContentTaskErrorDialogResponse(event as object)
dialog = event.getRoSGNode() dialog = event.getRoSGNode()
dialog.unobserveFieldScoped("wasClosed") dialog.unobserveFieldScoped("wasClosed")
shouldPlayNext = dialog.actualButtonSelected = 0 shouldPlayNext = dialog.actualButtonSelected = 0
if not shouldPlayNext or not VideoQueueUtils.PlayNext(m.videoQueue, m.invidious, m.preferences) if not shouldPlayNext or not VideoQueueUtils.PlayNext(m.videoQueue, m.invidious, m.preferences)
m.videoQueue.closePlayer = true if m.top.isSameNode(m.videoQueue.player)
m.videoQueue.closePlayer = true
end if
end if end if
Lounge.SendOnStateChange() Lounge.SendOnStateChange()
@@ -183,7 +223,11 @@ function MarkVideoWatched(videoId as string)
end if end if
end function end function
function Close(_unused as dynamic) function OnClose()
m.onCloseCalled = true
m.top.previousPlayer = invalid
if m.videoContentTask <> invalid if m.videoContentTask <> invalid
m.videoContentTask.cancel = true m.videoContentTask.cancel = true
m.videoContentTask = invalid m.videoContentTask = invalid
@@ -203,7 +247,9 @@ function Close(_unused as dynamic)
try try
m.top.control = "stop" m.top.control = "stop"
catch error catch error
DialogUtils.ShowDialog(ErrorUtils.Format(error), Tr(Locale.VideoPlayer.ErrorClosingVideo), true) errorMessage = ErrorUtils.Format(error)
LogError("Error stopping video:", errorMessage)
DialogUtils.ShowDialog(errorMessage, Tr(Locale.VideoPlayer.ErrorClosingVideo), true)
end try end try
m.top.content = invalid m.top.content = invalid
@@ -8,12 +8,13 @@
<field id="invidious" type="node" bind="../../Invidious" /> <field id="invidious" type="node" bind="../../Invidious" />
<field id="webServer" type="node" bind="../../WebServer" /> <field id="webServer" type="node" bind="../../WebServer" />
<field id="loungeService" type="node" bind="../../LoungeService" /> <field id="loungeService" type="node" bind="../../LoungeService" />
<field id="previousPlayer" type="node" />
<field id="minRect" type="rect2D" value="[834,460,426,240]" /> <field id="minRect" type="rect2D" value="[834,460,426,240]" />
<field id="maxRect" type="rect2D" value="[0,0,1280,720]" /> <field id="maxRect" type="rect2D" value="[0,0,1280,720]" />
<field id="chapter" type="string" alias="chapterLabel.text" /> <field id="chapter" type="string" alias="chapterLabel.text" />
<field id="showFullScreenHint" type="boolean" alwaysNotify="true" onChange="OnShowFullScreenHint" /> <field id="showFullScreenHint" type="boolean" alwaysNotify="true" onChange="OnShowFullScreenHint" />
<field id="close" type="boolean" alwaysNotify="true" onChange="OnClose" />
<function name="PlayWithContent" /> <function name="PlayWithContent" />
<function name="Close" />
</interface> </interface>
<children> <children>
<Label id="chapterLabel" width="350" height="25" horizAlign="center" vertAlign="center" font="font:SmallestSystemFont" /> <Label id="chapterLabel" width="350" height="25" horizAlign="center" vertAlign="center" font="font:SmallestSystemFont" />
@@ -59,14 +59,16 @@ function OnVideoContentTaskResults(output as object) as void
end if end if
error = ErrorUtils.Format(error) error = ErrorUtils.Format(error)
LogError(error) LogError(error)
Close(invalid) m.top.close = true
return return
end if end if
m.top.control = "play" m.top.control = "play"
end function end function
function Close(_unused as dynamic) function OnClose()
m.top.previousPlayer = invalid
if m.videoContentTask <> invalid if m.videoContentTask <> invalid
m.videoContentTask.cancel = true m.videoContentTask.cancel = true
m.videoContentTask = invalid m.videoContentTask = invalid
@@ -9,8 +9,9 @@
<interface> <interface>
<field id="videoQueue" type="node" bind="../../VideoQueue" /> <field id="videoQueue" type="node" bind="../../VideoQueue" />
<field id="invidious" type="node" bind="../../Invidious" /> <field id="invidious" type="node" bind="../../Invidious" />
<field id="previousPlayer" type="node" />
<field id="close" type="boolean" alwaysNotify="true" onChange="OnClose" />
<function name="PlayWithContent" /> <function name="PlayWithContent" />
<function name="Close" />
</interface> </interface>
<children> <children>
<SimpleLabel <SimpleLabel
@@ -31,7 +31,6 @@
horizAlign="center" horizAlign="center"
color="0x262626ff" color="0x262626ff"
text="Added to queue"> text="Added to queue">
<Font role="font" uri="font:BoldSystemFontFile" size="22" />
</Label> </Label>
<Label <Label
id="line1Label" id="line1Label"
@@ -88,8 +88,9 @@ function OnClosePlayer() as void
return return
end if end if
player@.Close() player.close = true
m.top.player = invalid m.top.player = invalid
m.previousPlayer = player
m.top.appController@.FocusTopScreen() m.top.appController@.FocusTopScreen()
end function end function
@@ -365,6 +366,7 @@ function CreateVideoPlayer() as object
container = m.top.videoContainer container = m.top.videoContainer
videoPlayer = container.createChild(playerComponent) videoPlayer = container.createChild(playerComponent)
videoPlayer.id = "VideoPlayer" videoPlayer.id = "VideoPlayer"
videoPlayer.previousPlayer = m.previousPlayer
videoPlayer@.BindNode() videoPlayer@.BindNode()
if container.fullscreen if container.fullscreen
@@ -0,0 +1,22 @@
import "pkg:/source/utils/CacheUtils.bs"
namespace Http
class CacheRouter extends HttpRouter
function new()
super()
end function
@delete("/api/cache")
function ClearCache(context as object) as boolean
response = context.response
CacheUtils.Clear()
response.Default(204, "OK")
return true
end function
end class
end namespace
@@ -1,5 +1,6 @@
import "pkg:/components/parts/AutoBind/OnNodeReadyNoOp.bs" import "pkg:/components/parts/AutoBind/OnNodeReadyNoOp.bs"
import "pkg:/components/Web/PlayletWebServer/Middleware/BookmarksRouter.bs" import "pkg:/components/Web/PlayletWebServer/Middleware/BookmarksRouter.bs"
import "pkg:/components/Web/PlayletWebServer/Middleware/CacheRouter.bs"
import "pkg:/components/Web/PlayletWebServer/Middleware/DashRouter.bs" import "pkg:/components/Web/PlayletWebServer/Middleware/DashRouter.bs"
import "pkg:/components/Web/PlayletWebServer/Middleware/DialRouter.bs" import "pkg:/components/Web/PlayletWebServer/Middleware/DialRouter.bs"
import "pkg:/components/Web/PlayletWebServer/Middleware/HomeLayoutRouter.bs" import "pkg:/components/Web/PlayletWebServer/Middleware/HomeLayoutRouter.bs"
@@ -50,6 +51,7 @@ function SetupRoutes(server as object)
server.UseRouter(new Http.SearchHistoryRouter(server)) server.UseRouter(new Http.SearchHistoryRouter(server))
server.UseRouter(new Http.PlayletLibUrlsRouter(server)) server.UseRouter(new Http.PlayletLibUrlsRouter(server))
server.UseRouter(new Http.DialRouter(server)) server.UseRouter(new Http.DialRouter(server))
server.UseRouter(new Http.CacheRouter())
etags = new Http.EtagUtils() etags = new Http.EtagUtils()
server.UseRouter(new Http.HttpStaticFilesRouter("/", "libpkg:/www", etags, { staticFiles: true })) server.UseRouter(new Http.HttpStaticFilesRouter("/", "libpkg:/www", etags, { staticFiles: true }))
+14
View File
@@ -207,6 +207,20 @@
visibility: "web", visibility: "web",
svelteComponent: "PlayletLibVersionControl", svelteComponent: "PlayletLibVersionControl",
}, },
{
displayText: "Clear cache",
key: "dev.clear_cache",
description: "Clear cache from cachefs: and tmp:",
visibility: "web",
svelteComponent: "ClearCacheControl",
},
{
displayText: "Clear cache",
key: "dev.clear_cache",
description: "Clear cache from cachefs: and tmp:",
visibility: "tv",
rokuComponent: "ClearCacheControl",
},
], ],
}, },
] ]
@@ -1256,5 +1256,17 @@
<source>Rating</source> <source>Rating</source>
<translation>Rating</translation> <translation>Rating</translation>
</message> </message>
<message>
<source>Clear cache</source>
<translation>Clear cache</translation>
</message>
<message>
<source>Clear cache from cachefs: and tmp:</source>
<translation>Clear cache from cachefs: and tmp:</translation>
</message>
<message>
<source>Cache cleared.</source>
<translation>Cache cleared.</translation>
</message>
</context> </context>
</TS> </TS>
+1 -1
View File
@@ -3,7 +3,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=23 minor_version=23
build_version=00005 build_version=00007
ui_resolutions=hd ui_resolutions=hd
@@ -739,7 +739,7 @@ namespace HttpClientCache
cacheLocation = GetLocation(request) cacheLocation = GetLocation(request)
cacheText = ReadAsciiFile(cacheLocation) cacheText = ReadAsciiFile(cacheLocation)
if cacheText = invalid if cacheText = ""
return invalid return invalid
end if end if
@@ -0,0 +1,10 @@
import "pkg:/source/AsyncTask/AsyncTask.bs"
import "pkg:/source/AsyncTask/Tasks.bs"
namespace CacheUtils
function Clear()
AsyncTask.Start(Tasks.ClearCacheTask, invalid)
end function
end namespace
@@ -0,0 +1,33 @@
import "pkg:/source/utils/Logging.bs"
@asynctask
function ClearCacheTask() as object
fs = CreateObject("roFileSystem")
if fs = invalid
LogError("Failed to create roFileSystem object")
return invalid
end if
ClearVolume(fs, "tmp:/")
ClearVolume(fs, "cachefs:/")
return invalid
end function
function ClearVolume(fs as object, volume as string)
items = fs.GetDirectoryListing(volume)
for each item in items
fullpath = volume + item
' Skip logs directory
if fullpath = "cachefs:/logs"
continue for
end if
if not fs.Delete(fullpath)
LogError("Failed to delete:", fullpath)
end if
end for
LogInfo("Cleared:", volume)
end function
+3
View File
@@ -283,6 +283,9 @@ namespace Locale
UseDevVideoPlayerDescription = "Enable the dev video player. This is an unfinished video player for testing purposes." UseDevVideoPlayerDescription = "Enable the dev video player. This is an unfinished video player for testing purposes."
PlayletLibraryVersion = "Playlet Library version" PlayletLibraryVersion = "Playlet Library version"
PlayletLibraryVersionDescription = "The version of Playlet Lib to use. These correspond to tagged releases on Github. Releases that do not have a playlet-lib.zip file are disabled." PlayletLibraryVersionDescription = "The version of Playlet Lib to use. These correspond to tagged releases on Github. Releases that do not have a playlet-lib.zip file are disabled."
ClearCache = "Clear cache"
ClearCacheDescription = "Clear cache from cachefs: and tmp:"
CacheCleared = "Cache cleared."
end enum end enum
@locale @locale
+2 -2
View File
@@ -1,12 +1,12 @@
{ {
"name": "playlet-web", "name": "playlet-web",
"version": "0.23.5", "version": "0.23.7",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "playlet-web", "name": "playlet-web",
"version": "0.23.5", "version": "0.23.7",
"devDependencies": { "devDependencies": {
"@sveltejs/vite-plugin-svelte": "^3.1.0", "@sveltejs/vite-plugin-svelte": "^3.1.0",
"@tailwindcss/typography": "^0.5.13", "@tailwindcss/typography": "^0.5.13",
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "playlet-web", "name": "playlet-web",
"version": "0.23.5", "version": "0.23.7",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",
+9
View File
@@ -265,6 +265,15 @@ export class InvidiousApi {
} }
} }
public static clearCache() {
for (let i = localStorage.length - 1; i >= 0; i--) {
const key = localStorage.key(i);
if (key && key.startsWith("v1:")) {
localStorage.removeItem(key);
}
}
}
// TODO:P2 use more appropriate cache storage // TODO:P2 use more appropriate cache storage
private getCache(url: string, cacheSeconds: number) { private getCache(url: string, cacheSeconds: number) {
const cacheKey = this.getCacheKey(url); const cacheKey = this.getCacheKey(url);
+4
View File
@@ -132,6 +132,10 @@ export class PlayletApi {
return await fetch(`${PlayletApi.host()}/api/search-history`, { method: "DELETE" }); return await fetch(`${PlayletApi.host()}/api/search-history`, { method: "DELETE" });
} }
static async clearCache() {
return await fetch(`${PlayletApi.host()}/api/cache`, { method: "DELETE" });
}
static async getBookmarkFeeds() { static async getBookmarkFeeds() {
const response = await fetch(`${PlayletApi.host()}/api/bookmarks/feeds`); const response = await fetch(`${PlayletApi.host()}/api/bookmarks/feeds`);
return await response.json(); return await response.json();
@@ -0,0 +1,27 @@
<script lang="ts">
import { InvidiousApi } from "lib/Api/InvidiousApi";
import { PlayletApi } from "lib/Api/PlayletApi";
import { tr } from "lib/Stores";
import { get } from "svelte/store";
const textSizes = ["text-2xl", "text-lg", "text-base", "text-sm", "text-xs"];
export let displayText: string = "";
// svelte-ignore unused-export-let
export let key: string = "";
export let description: string = "";
export let level: number = 0;
async function clearCache() {
await PlayletApi.clearCache();
InvidiousApi.clearCache();
alert(get(tr)("Cache cleared."));
}
</script>
<div class="m-5">
<div class={textSizes[level]}>{$tr(displayText)}</div>
<div class="text-xs text-gray-500">{@html $tr(description)}</div>
<button class="btn m-1" on:click={clearCache}>{$tr("Clear cache")}</button>
</div>
@@ -7,6 +7,7 @@
import StringControl from "lib/Screens/Settings/SettingControls/StringControl.svelte"; import StringControl from "lib/Screens/Settings/SettingControls/StringControl.svelte";
import NumberControl from "./SettingControls/NumberControl.svelte"; import NumberControl from "./SettingControls/NumberControl.svelte";
import { tr } from "lib/Stores"; import { tr } from "lib/Stores";
import ClearCacheControl from "./SettingControls/ClearCacheControl.svelte";
const textSizes = ["text-2xl", "text-lg", "text-base", "text-sm", "text-xs"]; const textSizes = ["text-2xl", "text-lg", "text-base", "text-sm", "text-xs"];
@@ -30,6 +31,7 @@
const customComponents = { const customComponents = {
ClearSearchHistoryControl, ClearSearchHistoryControl,
ClearCacheControl,
EditHomeScreenControl, EditHomeScreenControl,
PlayletLibVersionControl, PlayletLibVersionControl,
}; };