Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cc78fb0ec1 | ||
|
|
05f2481f87 | ||
|
|
bdaaf17785 | ||
|
|
a675811488 | ||
|
|
d80240130d | ||
|
|
459a009293 | ||
|
|
cf08c67de5 | ||
|
|
9cd664fdd7 | ||
|
|
ad753deac7 | ||
|
|
3acf733eec | ||
|
|
6c84630cec | ||
|
|
682e0bae7f | ||
|
|
02e206ad22 | ||
|
|
c40428f2d6 | ||
|
|
cb45732965 | ||
|
|
9ccf1efee9 | ||
|
|
5a7ebf95bc | ||
|
|
fef289a201 | ||
|
|
98de5f223e |
No files matched your search
@@ -31,6 +31,6 @@ jobs:
|
|||||||
github_token: ${{ secrets.GH_TOKEN }}
|
github_token: ${{ secrets.GH_TOKEN }}
|
||||||
|
|
||||||
- name: Create unstable release
|
- name: Create unstable release
|
||||||
run: gh release create unstable ./release/playlet.zip ./playlet/src/lib/playlet-lib.zip --notes "This is an automated release." --prerelease --title unstable
|
run: gh release create unstable ./release/playlet.zip ./playlet/src/lib/playlet-lib.zip --notes-file docs/unstable-changelog.md --prerelease --title unstable
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ secrets.GH_TOKEN }}
|
GH_TOKEN: ${{ secrets.GH_TOKEN }}
|
||||||
@@ -5,6 +5,18 @@ All notable changes to this project will be documented in this file.
|
|||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [0.10.1] - 2023-06-28
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Support playing a video from a specific time (cast from phone, drag and drop, open in Invidious)
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- A crash where the saved auth token is not in a valid format
|
||||||
|
- Video duration formatting for long videos
|
||||||
|
- A bug where app would lose focus when playing the next video (0.10.0 regression)
|
||||||
|
|
||||||
## [0.10.0] - 2023-06-25
|
## [0.10.0] - 2023-06-25
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|||||||
@@ -25,14 +25,15 @@ Playlet is an unofficial Youtube client for Roku 📺
|
|||||||
- 🕵️ No Tracking
|
- 🕵️ No Tracking
|
||||||
- 🛡️ Privacy driven (uses Invidious backend)
|
- 🛡️ Privacy driven (uses Invidious backend)
|
||||||
- ⚔️ SponsorBlock integration (skips undesirable sections in videos)
|
- ⚔️ SponsorBlock integration (skips undesirable sections in videos)
|
||||||
- 📱 Cast from phone
|
- 📱 Browse, search, and cast from phone using the web app
|
||||||
- 🔮 Picture-in-picture mode
|
- 🔮 Picture-in-picture mode
|
||||||
- ⚡ Fast! [Check out how we compare with the official Youtube app](https://youtu.be/qmSvA-QQW20)
|
- ⚡ Fast! [Check out how we compare with the official Youtube app](https://youtu.be/qmSvA-QQW20)
|
||||||
|
|
||||||
### Cast from phone
|
### Cast from phone
|
||||||
1. Open settings in Playlet
|
1. Open "Web app" tab in Playlet
|
||||||
1. Scan QR Code with Phone
|
1. Scan QR Code with Phone
|
||||||
1. Enter video ID or video url, and press Play button
|
1. Browse or search videos
|
||||||
|
1. Click the video and choose the "Play on TV" option
|
||||||
|
|
||||||
### Picture-in-picture
|
### Picture-in-picture
|
||||||
- When viewing a video in full screen, press ⬇️ (down) button on your remote to shrink the video
|
- When viewing a video in full screen, press ⬇️ (down) button on your remote to shrink the video
|
||||||
@@ -43,10 +44,17 @@ Playlet is an unofficial Youtube client for Roku 📺
|
|||||||
1. Open settings in Playlet
|
1. Open settings in Playlet
|
||||||
1. Scan QR Code with Phone
|
1. Scan QR Code with Phone
|
||||||
1. Change the Invidious instance
|
1. Change the Invidious instance
|
||||||
|
1. You can also do this from the settings tab
|
||||||
|
|
||||||
## Screenshots
|
## Screenshots
|
||||||
|  |  |  |
|
<a href="./screenshots/README.md">
|
||||||
|----------------------|----------------------|----------------------|
|
|
||||||
|
|  |  |  |
|
||||||
|
|----------------------------------|----------------------------------|----------------------------------|
|
||||||
|
|
||||||
|
</a>
|
||||||
|
|
||||||
|
More under [Screenshots](./screenshots/README.md)
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
### Roku Store (Published app)
|
### Roku Store (Published app)
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
<!-- markdownlint-disable MD036 -->
|
||||||
|
|
||||||
|
# Releasing
|
||||||
|
|
||||||
|
These are mostly the steps when releasing a new version:
|
||||||
|
|
||||||
|
## Playlet lib
|
||||||
|
|
||||||
|
- Create local branch `release/$VERSION` e.g. `release/0.10.0`
|
||||||
|
- Set version in package.json
|
||||||
|
- Update CHANGELOG.md section from `[Unreleased]` to `[$VERSION] - DATE`
|
||||||
|
- `npm run build:release`
|
||||||
|
- This should fail because there are uncommitted changes. This is expected.
|
||||||
|
- Commit changes
|
||||||
|
- Create pull request
|
||||||
|
- Title: `Release v$VERSION`
|
||||||
|
- Comment: `Release $VERSION \nIt should contain everything planned from #6`
|
||||||
|
- Wait for CI and merge
|
||||||
|
- Wait for CI on main branch to create the `unstable` release
|
||||||
|
- Edit `unstable` release
|
||||||
|
- Tag: `v$VERSION`
|
||||||
|
- Title: `v$VERSION`
|
||||||
|
- Body: the content from CHANGELOG.md for this version
|
||||||
|
- Uncheck `Set as a pre-release`
|
||||||
|
- Check `Set as the latest release`
|
||||||
|
- Click `update release`
|
||||||
|
- Update [Roadmap](https://github.com/iBicha/playlet/issues/6)
|
||||||
|
- If current versions says `Planned for $VERSION`, change it to `Released in $VERSION`
|
||||||
|
- Add a `Planned for $VERSION` for the next version
|
||||||
|
|
||||||
|
**The newest Playlet lib is now LIVE**
|
||||||
|
|
||||||
|
## Playlet
|
||||||
|
|
||||||
|
For releasing to the store (when needed), this is done following a Playlet lib release:
|
||||||
|
|
||||||
|
- Switch to main branch and pull changes - **match commit corresponding to the release.**
|
||||||
|
- `npm run build:release`
|
||||||
|
- This should create the signed package under `release/playlet.pkg`
|
||||||
|
- Upload to dashboard, and schedule a release (takes a couple of days)
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
<!-- markdownlint-disable MD041 -->
|
||||||
|
|
||||||
|
This is an automated release. It is generated when new code is pushed to the main branch.
|
||||||
|
|
||||||
|
To test this release:
|
||||||
|
|
||||||
|
- Open Playlet web app in dev mode (`http://ROKU_IP_ADDRESS:8888/index.html?dev=1`)
|
||||||
|
- Go to settings, and scroll down to `Developer settings`
|
||||||
|
- Set `Playlet Library version` to `unstable` and click `Apply`
|
||||||
|
- Restart Playlet
|
||||||
|
- You can verify that you're testing the `unstable` release in the `Info` tab in Playlet or the web app
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "playlet",
|
"name": "playlet",
|
||||||
"version": "0.10.0",
|
"version": "0.10.1",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "playlet",
|
"name": "playlet",
|
||||||
"version": "0.10.0",
|
"version": "0.10.1",
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"bslib": "npm:@rokucommunity/bslib@^0.1.1",
|
"bslib": "npm:@rokucommunity/bslib@^0.1.1",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "playlet",
|
"name": "playlet",
|
||||||
"version": "0.10.0",
|
"version": "0.10.1",
|
||||||
"description": "Unofficial Youtube client for Roku",
|
"description": "Unofficial Youtube client for Roku",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"bslib": "npm:@rokucommunity/bslib@^0.1.1",
|
"bslib": "npm:@rokucommunity/bslib@^0.1.1",
|
||||||
@@ -24,9 +24,6 @@
|
|||||||
"ts-node": "^10.9.1",
|
"ts-node": "^10.9.1",
|
||||||
"typescript": "^5.1.3"
|
"typescript": "^5.1.3"
|
||||||
},
|
},
|
||||||
"engines": {
|
|
||||||
"node": "<19.0.0"
|
|
||||||
},
|
|
||||||
"ropm": {
|
"ropm": {
|
||||||
"rootDir": "playlet-lib/src",
|
"rootDir": "playlet-lib/src",
|
||||||
"noprefix": [
|
"noprefix": [
|
||||||
|
|||||||
@@ -113,8 +113,11 @@ function OnWebServerLogin()
|
|||||||
m.homeGridScreen.refresh = true
|
m.homeGridScreen.refresh = true
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function OnWebServerCommand()
|
function OnWebServerCommand() as void
|
||||||
if m.serverTask.command.StartsWith("play:")
|
if m.serverTask.command = invalid or m.serverTask.command.command = invalid
|
||||||
|
return
|
||||||
|
end if
|
||||||
|
if m.serverTask.command.command = "play"
|
||||||
sender = m.videoContainer.sender ?? m.currentFocued
|
sender = m.videoContainer.sender ?? m.currentFocued
|
||||||
if m.videoContainer.fullscreen
|
if m.videoContainer.fullscreen
|
||||||
dialog = m.top.getScene().dialog
|
dialog = m.top.getScene().dialog
|
||||||
@@ -122,7 +125,7 @@ function OnWebServerCommand()
|
|||||||
dialog.close = true
|
dialog.close = true
|
||||||
end if
|
end if
|
||||||
end if
|
end if
|
||||||
PlayVideo(m.serverTask.command.Mid(5), { sender: sender })
|
PlayVideo(m.serverTask.command.videoId, { sender: sender, timestamp: m.serverTask.command.timestamp })
|
||||||
end if
|
end if
|
||||||
end function
|
end function
|
||||||
|
|
||||||
@@ -146,5 +149,5 @@ function PlayVideoFromArgs(args as object) as void
|
|||||||
end if
|
end if
|
||||||
|
|
||||||
sender = m.videoContainer.sender ?? m.currentFocued
|
sender = m.videoContainer.sender ?? m.currentFocued
|
||||||
PlayVideo(args.contentId, { sender: sender })
|
PlayVideo(args.contentId, { sender: sender, timestamp: args.timestamp })
|
||||||
end function
|
end function
|
||||||
@@ -7,11 +7,16 @@ import "pkg:/components/VideoPlayer/MarkVideoWatchedTask.bs"
|
|||||||
function PlayVideo(videoId as string, args = invalid as object)
|
function PlayVideo(videoId as string, args = invalid as object)
|
||||||
sender = args?.sender
|
sender = args?.sender
|
||||||
metadata = args?.metadata
|
metadata = args?.metadata
|
||||||
|
timestamp = args?.timestamp
|
||||||
|
|
||||||
if metadata <> invalid and GetInterface(metadata, "ifSGNodeField") <> invalid
|
if metadata <> invalid and GetInterface(metadata, "ifSGNodeField") <> invalid
|
||||||
metadata = args.metadata.getFields()
|
metadata = args.metadata.getFields()
|
||||||
end if
|
end if
|
||||||
|
|
||||||
|
if timestamp = invalid
|
||||||
|
timestamp = 0
|
||||||
|
end if
|
||||||
|
|
||||||
width = 1280
|
width = 1280
|
||||||
height = 720
|
height = 720
|
||||||
translation = [0.0, 0.0]
|
translation = [0.0, 0.0]
|
||||||
@@ -21,14 +26,18 @@ function PlayVideo(videoId as string, args = invalid as object)
|
|||||||
height = videoContainer.videoPlayer.height
|
height = videoContainer.videoPlayer.height
|
||||||
translation = videoContainer.videoPlayer.translation
|
translation = videoContainer.videoPlayer.translation
|
||||||
end if
|
end if
|
||||||
|
previousSender = videoContainer.sender
|
||||||
CloseVideo(false)
|
CloseVideo(false)
|
||||||
if sender <> invalid
|
if sender <> invalid
|
||||||
videoContainer.sender = sender
|
videoContainer.sender = sender
|
||||||
|
else
|
||||||
|
videoContainer.sender = previousSender
|
||||||
end if
|
end if
|
||||||
videoContainer.videoPlayer = videoContainer.createChild("VideoPlayer")
|
videoContainer.videoPlayer = videoContainer.createChild("VideoPlayer")
|
||||||
videoContainer.insertChild(videoContainer.videoPlayer, 0)
|
videoContainer.insertChild(videoContainer.videoPlayer, 0)
|
||||||
videoContainer.videoPlayer.id = "VideoPlayer"
|
videoContainer.videoPlayer.id = "VideoPlayer"
|
||||||
videoContainer.videoPlayer.metadata = metadata
|
videoContainer.videoPlayer.metadata = metadata
|
||||||
|
videoContainer.videoPlayer.timestamp = timestamp
|
||||||
videoContainer.videoPlayer.videoId = videoId
|
videoContainer.videoPlayer.videoId = videoId
|
||||||
videoContainer.videoPlayer.width = width
|
videoContainer.videoPlayer.width = width
|
||||||
videoContainer.videoPlayer.height = height
|
videoContainer.videoPlayer.height = height
|
||||||
|
|||||||
@@ -286,8 +286,11 @@ function OnVideoPlayerStateChange() as void
|
|||||||
|
|
||||||
' If we successfully played the video, then any error that comes later is not due to a 403 (FORBIDDEN).
|
' If we successfully played the video, then any error that comes later is not due to a 403 (FORBIDDEN).
|
||||||
' This is to reduce false positives, as we do not want retry another link if the first link is working fine.
|
' This is to reduce false positives, as we do not want retry another link if the first link is working fine.
|
||||||
if state = "playing"
|
if state = "playing" and not m.videoPlayingSuccess
|
||||||
m.videoPlayingSuccess = true
|
m.videoPlayingSuccess = true
|
||||||
|
if m.top.timestamp <> 0
|
||||||
|
m.top.seek = m.top.timestamp
|
||||||
|
end if
|
||||||
end if
|
end if
|
||||||
|
|
||||||
if state = "error"
|
if state = "error"
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
<field id="chapter" type="string" alias="chapterLabel.text" />
|
<field id="chapter" type="string" alias="chapterLabel.text" />
|
||||||
<field id="videoId" type="string" />
|
<field id="videoId" type="string" />
|
||||||
<field id="metadata" type="assocarray" />
|
<field id="metadata" type="assocarray" />
|
||||||
|
<field id="timestamp" type="integer" />
|
||||||
</interface>
|
</interface>
|
||||||
<children>
|
<children>
|
||||||
<Label
|
<Label
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ function OnContentSet() as void
|
|||||||
else
|
else
|
||||||
m.top.FindNode("liveRect").visible = false
|
m.top.FindNode("liveRect").visible = false
|
||||||
if content.lengthSeconds <> invalid and content.lengthSeconds <> 0
|
if content.lengthSeconds <> invalid and content.lengthSeconds <> 0
|
||||||
m.top.FindNode("durationLabel").text = TimeUtils.GetFormattedTime(content.lengthSeconds)
|
SetDurationText(TimeUtils.GetFormattedTime(content.lengthSeconds))
|
||||||
m.top.FindNode("durationRect").visible = true
|
m.top.FindNode("durationRect").visible = true
|
||||||
else
|
else
|
||||||
m.top.FindNode("durationRect").visible = false
|
m.top.FindNode("durationRect").visible = false
|
||||||
@@ -42,6 +42,18 @@ function OnContentSet() as void
|
|||||||
|
|
||||||
end function
|
end function
|
||||||
|
|
||||||
|
function SetDurationText(text as string)
|
||||||
|
label = m.top.FindNode("durationLabel")
|
||||||
|
rect = m.top.FindNode("durationRect")
|
||||||
|
rectParent = rect.getParent()
|
||||||
|
|
||||||
|
label.text = text
|
||||||
|
size = label.localBoundingRect()
|
||||||
|
|
||||||
|
rect.width = size.width + 16
|
||||||
|
rect.translation = [rectParent.width - rect.width, 162]
|
||||||
|
end function
|
||||||
|
|
||||||
function OnThumbnailLoadFailed() as void
|
function OnThumbnailLoadFailed() as void
|
||||||
if m.thumbnail.loadStatus <> "failed"
|
if m.thumbnail.loadStatus <> "failed"
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -17,18 +17,18 @@
|
|||||||
<Rectangle
|
<Rectangle
|
||||||
id="durationRect"
|
id="durationRect"
|
||||||
width="60"
|
width="60"
|
||||||
height="25"
|
height="26"
|
||||||
color="0x000000"
|
color="0x000000"
|
||||||
opacity="0.8"
|
opacity="0.8"
|
||||||
translation="[290, 162]"
|
translation="[290, 162]"
|
||||||
>
|
>
|
||||||
<Label
|
<Label
|
||||||
width="60"
|
height="26"
|
||||||
height="25"
|
|
||||||
id="durationLabel"
|
id="durationLabel"
|
||||||
horizAlign="center"
|
horizAlign="center"
|
||||||
vertAlign="center"
|
vertAlign="center"
|
||||||
font="font:SmallestSystemFont"
|
font="font:SmallestSystemFont"
|
||||||
|
translation="[8, 0]"
|
||||||
/>
|
/>
|
||||||
</Rectangle>
|
</Rectangle>
|
||||||
<Rectangle
|
<Rectangle
|
||||||
|
|||||||
@@ -23,8 +23,7 @@ namespace Http
|
|||||||
response.Default(204, "OK")
|
response.Default(204, "OK")
|
||||||
return true
|
return true
|
||||||
else if payload.command = "play"
|
else if payload.command = "play"
|
||||||
videoId = payload.videoId
|
server.task.top.command = payload
|
||||||
server.task.top.command = `play:${videoId}`
|
|
||||||
response.Default(204, "OK")
|
response.Default(204, "OK")
|
||||||
return true
|
return true
|
||||||
else if payload.command = "set-playlet-lib-urls"
|
else if payload.command = "set-playlet-lib-urls"
|
||||||
|
|||||||
@@ -3,6 +3,6 @@
|
|||||||
<component name="WebServerTask" extends="Task">
|
<component name="WebServerTask" extends="Task">
|
||||||
<interface>
|
<interface>
|
||||||
<field id="login" type="boolean" alwaysNotify="true" />
|
<field id="login" type="boolean" alwaysNotify="true" />
|
||||||
<field id="command" type="string" alwaysNotify="true" />
|
<field id="command" type="assocarray" alwaysNotify="true" />
|
||||||
</interface>
|
</interface>
|
||||||
</component>
|
</component>
|
||||||
@@ -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=10
|
minor_version=10
|
||||||
build_version=00000
|
build_version=00001
|
||||||
|
|
||||||
sg_component_libs_provided=PlayletLib
|
sg_component_libs_provided=PlayletLib
|
||||||
hidden=1
|
hidden=1
|
||||||
|
|||||||
@@ -157,6 +157,8 @@ class InvidiousService
|
|||||||
|
|
||||||
' Public Invidious instances fail a lot randomly, even with valid tokens
|
' Public Invidious instances fail a lot randomly, even with valid tokens
|
||||||
' For that reason, it's better to make sure the token actually expired by date
|
' For that reason, it's better to make sure the token actually expired by date
|
||||||
|
' TODO: this happens because instance owners do not set hmac_key https://github.com/iv-org/invidious/issues/3854
|
||||||
|
' Once hmac_key is enforced, this check can be removed.
|
||||||
function IsTokenMaybeExpired() as dynamic
|
function IsTokenMaybeExpired() as dynamic
|
||||||
authToken = InvidiousSettings.GetAuthToken()
|
authToken = InvidiousSettings.GetAuthToken()
|
||||||
if authToken = invalid
|
if authToken = invalid
|
||||||
|
|||||||
@@ -39,7 +39,12 @@ namespace InvidiousSettings
|
|||||||
if tokenPayload = invalid
|
if tokenPayload = invalid
|
||||||
return invalid
|
return invalid
|
||||||
end if
|
end if
|
||||||
return ParseJson(tokenPayload)
|
authData = ParseJson(tokenPayload)
|
||||||
|
if authData = invalid or authData.instance = invalid or authData.token = invalid
|
||||||
|
RegistryUtils.Delete(RegistryUtils.INVIDIOUS_TOKEN)
|
||||||
|
return invalid
|
||||||
|
end if
|
||||||
|
return authData
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function GetBackupInstances() as object
|
function GetBackupInstances() as object
|
||||||
|
|||||||
@@ -1,17 +1,32 @@
|
|||||||
import "pkg:/source/utils/Types.bs"
|
import "pkg:/source/utils/Types.bs"
|
||||||
|
|
||||||
namespace TimeUtils
|
namespace TimeUtils
|
||||||
' Helper function convert seconds to mm:ss format
|
' Helper function convert seconds to [hh:]mm:ss format
|
||||||
' getTime(138) returns 2:18
|
' getTime(138) returns 2:18
|
||||||
function GetFormattedTime(length as integer) as string
|
function GetFormattedTime(length as integer) as string
|
||||||
minutes = (length \ 60).ToStr()
|
hours = length \ 3600
|
||||||
|
minutes = (length \ 60) mod 60
|
||||||
seconds = length mod 60
|
seconds = length mod 60
|
||||||
|
|
||||||
if seconds < 10
|
if seconds < 10
|
||||||
seconds = "0" + seconds.ToStr()
|
seconds = "0" + seconds.ToStr()
|
||||||
else
|
else
|
||||||
seconds = seconds.ToStr()
|
seconds = seconds.ToStr()
|
||||||
end if
|
end if
|
||||||
return minutes + ":" + seconds
|
|
||||||
|
if minutes < 10 and hours > 0
|
||||||
|
minutes = "0" + minutes.ToStr()
|
||||||
|
else
|
||||||
|
minutes = minutes.ToStr()
|
||||||
|
end if
|
||||||
|
|
||||||
|
formattedTime = minutes + ":" + seconds
|
||||||
|
|
||||||
|
if hours > 0
|
||||||
|
formattedTime = hours.ToStr() + ":" + formattedTime
|
||||||
|
end if
|
||||||
|
|
||||||
|
return formattedTime
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function GetFormattedTimeLeft(unixTimestamp as integer) as string
|
function GetFormattedTimeLeft(unixTimestamp as integer) as string
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "playlet-web",
|
"name": "playlet-web",
|
||||||
"version": "0.10.0",
|
"version": "0.10.1",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "playlet-web",
|
"name": "playlet-web",
|
||||||
"version": "0.10.0",
|
"version": "0.10.1",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@sveltejs/vite-plugin-svelte": "^2.4.2",
|
"@sveltejs/vite-plugin-svelte": "^2.4.2",
|
||||||
"@tailwindcss/typography": "^0.5.9",
|
"@tailwindcss/typography": "^0.5.9",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "playlet-web",
|
"name": "playlet-web",
|
||||||
"version": "0.10.0",
|
"version": "0.10.1",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
|
|||||||
@@ -3,12 +3,16 @@
|
|||||||
import { PlayletApi } from "./PlayletApi";
|
import { PlayletApi } from "./PlayletApi";
|
||||||
import { playletStateStore } from "./Stores";
|
import { playletStateStore } from "./Stores";
|
||||||
import { InvidiousApi } from "./InvidiousApi";
|
import { InvidiousApi } from "./InvidiousApi";
|
||||||
|
import VideoStartAt from "./VideoStartAt.svelte";
|
||||||
|
|
||||||
let modal;
|
let modal;
|
||||||
let isDragging;
|
let isDragging;
|
||||||
let isLoading;
|
let isLoading;
|
||||||
let dragEndTimeout;
|
let dragEndTimeout;
|
||||||
|
|
||||||
|
let videoStartAtChecked;
|
||||||
|
let videoStartAtTimestamp;
|
||||||
|
|
||||||
let videoMetadata;
|
let videoMetadata;
|
||||||
|
|
||||||
let tvName = "Roku TV";
|
let tvName = "Roku TV";
|
||||||
@@ -43,10 +47,10 @@
|
|||||||
let dataString = await new Promise((resolve) =>
|
let dataString = await new Promise((resolve) =>
|
||||||
item.getAsString(resolve)
|
item.getAsString(resolve)
|
||||||
);
|
);
|
||||||
if (IsValidHttpUrl(dataString)) {
|
if (isValidHttpUrl(dataString)) {
|
||||||
const videoId = GetVideoId(dataString);
|
const videoInfo = parseYouTubeUrl(dataString);
|
||||||
if (videoId) {
|
if (videoInfo.videoId) {
|
||||||
searchForVideoById(videoId);
|
searchForVideoById(videoInfo.videoId, videoInfo.timestamp);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -54,10 +58,14 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function searchForVideoById(videoId) {
|
async function searchForVideoById(videoId, timestamp) {
|
||||||
try {
|
try {
|
||||||
isLoading = true;
|
isLoading = true;
|
||||||
videoMetadata = await invidiousApi.getVideoMetadata(videoId);
|
videoMetadata = await invidiousApi.getVideoMetadata(videoId);
|
||||||
|
videoStartAtChecked = timestamp !== undefined;
|
||||||
|
if (videoStartAtChecked) {
|
||||||
|
videoStartAtTimestamp = timestamp;
|
||||||
|
}
|
||||||
modal.showModal();
|
modal.showModal();
|
||||||
} finally {
|
} finally {
|
||||||
isLoading = false;
|
isLoading = false;
|
||||||
@@ -74,7 +82,7 @@
|
|||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
function IsValidHttpUrl(string) {
|
function isValidHttpUrl(string) {
|
||||||
let url;
|
let url;
|
||||||
try {
|
try {
|
||||||
url = new URL(string);
|
url = new URL(string);
|
||||||
@@ -84,7 +92,16 @@
|
|||||||
return url.protocol === "http:" || url.protocol === "https:";
|
return url.protocol === "http:" || url.protocol === "https:";
|
||||||
}
|
}
|
||||||
|
|
||||||
function GetVideoId(url) {
|
function parseYouTubeUrl(url) {
|
||||||
|
const urlSearchParams = new URLSearchParams(new URL(url).search);
|
||||||
|
|
||||||
|
function getTimestamp() {
|
||||||
|
const timestamp = urlSearchParams.get("t");
|
||||||
|
if (timestamp) {
|
||||||
|
return timestamp.endsWith("s") ? timestamp.slice(0, -1) : timestamp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Share/Short url
|
// Share/Short url
|
||||||
// TODO: use regex, and support timestamped videos
|
// TODO: use regex, and support timestamped videos
|
||||||
const YoutubeUrls = [
|
const YoutubeUrls = [
|
||||||
@@ -100,33 +117,52 @@
|
|||||||
for (var i in YoutubeUrls) {
|
for (var i in YoutubeUrls) {
|
||||||
let youtubeUrl = YoutubeUrls[i];
|
let youtubeUrl = YoutubeUrls[i];
|
||||||
if (url.startsWith(youtubeUrl)) {
|
if (url.startsWith(youtubeUrl)) {
|
||||||
url = url.replace(youtubeUrl, "");
|
let videoId = url.replace(youtubeUrl, "");
|
||||||
if (url.includes("?")) {
|
if (videoId.includes("?")) {
|
||||||
url = url.substring(0, url.indexOf("?"));
|
videoId = videoId.substring(0, videoId.indexOf("?"));
|
||||||
}
|
}
|
||||||
return url;
|
const result: any = {
|
||||||
|
videoId,
|
||||||
|
};
|
||||||
|
|
||||||
|
const timestamp = getTimestamp();
|
||||||
|
if (timestamp) {
|
||||||
|
result.timestamp = timestamp;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// regular url
|
// regular url
|
||||||
url = new URL(url);
|
const result: any = {
|
||||||
const urlSearchParams = new URLSearchParams(url.search);
|
videoId: urlSearchParams.get("v"),
|
||||||
return urlSearchParams.get("v");
|
};
|
||||||
|
|
||||||
|
const timestamp = getTimestamp();
|
||||||
|
if (timestamp) {
|
||||||
|
result.timestamp = timestamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function playVideoOnTv() {
|
async function playVideoOnTv() {
|
||||||
await PlayletApi.playVideo(videoMetadata?.videoId);
|
await PlayletApi.playVideo(videoMetadata?.videoId, videoStartAtTimestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
function openInvidiousInNewTab() {
|
function openInvidiousInNewTab() {
|
||||||
window.open(`${invidiousInstance}/watch?v=${videoMetadata?.videoId}`);
|
let url = `${invidiousInstance}/watch?v=${videoMetadata?.videoId}`;
|
||||||
|
if (videoStartAtChecked && videoStartAtTimestamp) {
|
||||||
|
url += `&t=${videoStartAtTimestamp}`;
|
||||||
|
}
|
||||||
|
window.open(url);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
class="{isDragging || isLoading
|
class="{isDragging || isLoading
|
||||||
? ''
|
? ''
|
||||||
: 'hidden'} absolute w-full h-full bg-base-100/80 z-50 flex justify-center items-center"
|
: 'hidden'} fixed w-full h-full bg-base-100/80 z-50 flex justify-center items-center"
|
||||||
>
|
>
|
||||||
{#if isDragging}
|
{#if isDragging}
|
||||||
<div class="text-2xl font-bold">Drop a Youtube link here</div>
|
<div class="text-2xl font-bold">Drop a Youtube link here</div>
|
||||||
@@ -139,6 +175,11 @@
|
|||||||
<form method="dialog" class="modal-box bg-base-100">
|
<form method="dialog" class="modal-box bg-base-100">
|
||||||
<h3 class="text-lg m-5">{videoMetadata?.title}</h3>
|
<h3 class="text-lg m-5">{videoMetadata?.title}</h3>
|
||||||
<div class="flex flex-col">
|
<div class="flex flex-col">
|
||||||
|
<VideoStartAt
|
||||||
|
bind:checked={videoStartAtChecked}
|
||||||
|
bind:timestamp={videoStartAtTimestamp}
|
||||||
|
lengthSeconds={videoMetadata?.lengthSeconds}
|
||||||
|
/>
|
||||||
<button class="btn m-2" on:click={playVideoOnTv}>Play on {tvName}</button>
|
<button class="btn m-2" on:click={playVideoOnTv}>Play on {tvName}</button>
|
||||||
<button class="btn m-2" on:click={openInvidiousInNewTab}
|
<button class="btn m-2" on:click={openInvidiousInNewTab}
|
||||||
>Open in Invidious</button
|
>Open in Invidious</button
|
||||||
|
|||||||
@@ -43,11 +43,15 @@ export class PlayletApi {
|
|||||||
return await PlayletApi.postJson(`${PlayletApi.host()}/api/command`, { command: "logout" });
|
return await PlayletApi.postJson(`${PlayletApi.host()}/api/command`, { command: "logout" });
|
||||||
}
|
}
|
||||||
|
|
||||||
static async playVideo(videoId) {
|
static async playVideo(videoId, timestamp) {
|
||||||
if (!videoId) {
|
if (!videoId) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
return await PlayletApi.postJson(`${PlayletApi.host()}/api/command`, { command: "play", videoId: videoId });
|
const payload = { command: "play", videoId: videoId };
|
||||||
|
if (timestamp !== undefined) {
|
||||||
|
payload["timestamp"] = timestamp;
|
||||||
|
}
|
||||||
|
return await PlayletApi.postJson(`${PlayletApi.host()}/api/command`, payload);
|
||||||
}
|
}
|
||||||
|
|
||||||
static async getSearchHistory() {
|
static async getSearchHistory() {
|
||||||
|
|||||||
@@ -18,6 +18,8 @@
|
|||||||
|
|
||||||
// svelte-ignore unused-export-let
|
// svelte-ignore unused-export-let
|
||||||
export let defaultValue: any = undefined;
|
export let defaultValue: any = undefined;
|
||||||
|
// svelte-ignore unused-export-let
|
||||||
|
export let rokuComponent: any = undefined;
|
||||||
|
|
||||||
const customComponents = {
|
const customComponents = {
|
||||||
ClearSearchHistoryControl
|
ClearSearchHistoryControl
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { PlayletApi } from "./PlayletApi";
|
import { PlayletApi } from "./PlayletApi";
|
||||||
import { playletStateStore } from "./Stores";
|
import { playletStateStore } from "./Stores";
|
||||||
|
import VideoStartAt from "./VideoStartAt.svelte";
|
||||||
|
|
||||||
export let title: string | undefined = undefined;
|
export let title: string | undefined = undefined;
|
||||||
export let videoId: string | undefined = undefined;
|
export let videoId: string | undefined = undefined;
|
||||||
@@ -39,6 +40,8 @@
|
|||||||
let modal;
|
let modal;
|
||||||
let tvName = "Roku TV";
|
let tvName = "Roku TV";
|
||||||
let invidiousInstance;
|
let invidiousInstance;
|
||||||
|
let videoStartAtChecked;
|
||||||
|
let videoStartAtTimestamp;
|
||||||
|
|
||||||
playletStateStore.subscribe((value) => {
|
playletStateStore.subscribe((value) => {
|
||||||
tvName = value?.device?.friendly_name ?? "Roku TV";
|
tvName = value?.device?.friendly_name ?? "Roku TV";
|
||||||
@@ -49,14 +52,14 @@
|
|||||||
if (isUpcoming) {
|
if (isUpcoming) {
|
||||||
return `Premeres in ${getFormattedTimeLeft(premiereTimestamp)}`;
|
return `Premeres in ${getFormattedTimeLeft(premiereTimestamp)}`;
|
||||||
}
|
}
|
||||||
const pubText = publishedText || '';
|
const pubText = publishedText || "";
|
||||||
const viewCountText = formatViewCount(viewCount);
|
const viewCountText = formatViewCount(viewCount);
|
||||||
|
|
||||||
if (pubText === '' && viewCountText === '') {
|
if (pubText === "" && viewCountText === "") {
|
||||||
return '';
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
return `${pubText} • ${viewCountText}`;
|
return `${pubText} • ${viewCountText}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getFormattedTimeLeft(unixTimestamp) {
|
function getFormattedTimeLeft(unixTimestamp) {
|
||||||
@@ -148,10 +151,21 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getFormattedTime(length) {
|
function getFormattedTime(length) {
|
||||||
const minutes = Math.floor(length / 60).toString();
|
const hours = Math.floor(length / 3600);
|
||||||
const seconds = (length % 60);
|
const minutes = Math.floor((length / 60) % 60);
|
||||||
|
const seconds = length % 60;
|
||||||
|
|
||||||
const secondsString = seconds < 10 ? `0${seconds}` : seconds.toString();
|
const secondsString = seconds < 10 ? `0${seconds}` : seconds.toString();
|
||||||
return minutes + ":" + secondsString;
|
const minutesString =
|
||||||
|
minutes < 10 && hours > 0 ? `0${minutes}` : minutes.toString();
|
||||||
|
|
||||||
|
let formattedTime = minutesString + ":" + secondsString;
|
||||||
|
|
||||||
|
if (hours > 0) {
|
||||||
|
formattedTime = hours.toString() + ":" + formattedTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
return formattedTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
function isVideoLive() {
|
function isVideoLive() {
|
||||||
@@ -162,24 +176,41 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function playVideoOnTv() {
|
async function playVideoOnTv() {
|
||||||
await PlayletApi.playVideo(videoId);
|
await PlayletApi.playVideo(videoId, videoStartAtTimestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
function openInvidiousInNewTab() {
|
function openInvidiousInNewTab() {
|
||||||
window.open(`${invidiousInstance}/watch?v=${videoId}`)
|
let url = `${invidiousInstance}/watch?v=${videoId}`;
|
||||||
|
if (videoStartAtChecked && videoStartAtTimestamp) {
|
||||||
|
url += `&t=${videoStartAtTimestamp}`;
|
||||||
|
}
|
||||||
|
window.open(url);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<button class="w-80 p-2" on:click="{modal.showModal()}">
|
<button class="w-80 p-2" on:click={modal.showModal()}>
|
||||||
<div class="card card-compact bg-base-100 shadow-xl border border-neutral">
|
<div class="card card-compact bg-base-100 shadow-xl border border-neutral">
|
||||||
<figure class="relative">
|
<figure class="relative">
|
||||||
<img class="w-full rounded-box" loading="lazy" width="320" height="180" src={getThumbnailUrl()} alt={title} />
|
<img
|
||||||
|
class="w-full rounded-box"
|
||||||
|
loading="lazy"
|
||||||
|
width="320"
|
||||||
|
height="180"
|
||||||
|
src={getThumbnailUrl()}
|
||||||
|
alt={title}
|
||||||
|
/>
|
||||||
{#if isVideoLive()}
|
{#if isVideoLive()}
|
||||||
<div class="absolute bottom-2 right-0 bg-red-500 text-white text-sm rounded-sm font-bold pt-1 pb-1 pr-2 pl-2">LIVE</div>
|
<div
|
||||||
{:else}
|
class="absolute bottom-2 right-0 bg-red-500 text-white text-sm rounded-sm font-bold pt-1 pb-1 pr-2 pl-2"
|
||||||
{#if lengthSeconds}
|
>
|
||||||
<div class="absolute bottom-2 right-0 bg-black/70 text-white text-sm rounded-sm pt-1 pb-1 pr-2 pl-2">{getFormattedTime(lengthSeconds)}</div>
|
LIVE
|
||||||
{/if}
|
</div>
|
||||||
|
{:else if lengthSeconds}
|
||||||
|
<div
|
||||||
|
class="absolute bottom-2 right-0 bg-black/70 text-white text-sm rounded-sm pt-1 pb-1 pr-2 pl-2"
|
||||||
|
>
|
||||||
|
{getFormattedTime(lengthSeconds)}
|
||||||
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</figure>
|
</figure>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
@@ -194,12 +225,19 @@
|
|||||||
<form method="dialog" class="modal-box bg-base-100">
|
<form method="dialog" class="modal-box bg-base-100">
|
||||||
<h3 class="text-lg m-5">{title}</h3>
|
<h3 class="text-lg m-5">{title}</h3>
|
||||||
<div class="flex flex-col">
|
<div class="flex flex-col">
|
||||||
|
<VideoStartAt
|
||||||
|
bind:checked={videoStartAtChecked}
|
||||||
|
bind:timestamp={videoStartAtTimestamp}
|
||||||
|
{lengthSeconds}
|
||||||
|
/>
|
||||||
<button class="btn m-2" on:click={playVideoOnTv}>Play on {tvName}</button>
|
<button class="btn m-2" on:click={playVideoOnTv}>Play on {tvName}</button>
|
||||||
<button class="btn m-2" on:click={openInvidiousInNewTab}>Open in Invidious</button>
|
<button class="btn m-2" on:click={openInvidiousInNewTab}
|
||||||
|
>Open in Invidious</button
|
||||||
|
>
|
||||||
<button class="btn m-2">Cancel</button>
|
<button class="btn m-2">Cancel</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
<form method="dialog" class="modal-backdrop">
|
<form method="dialog" class="modal-backdrop">
|
||||||
<button>close</button>
|
<button>close</button>
|
||||||
</form>
|
</form>
|
||||||
</dialog>
|
</dialog>
|
||||||
@@ -0,0 +1,83 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
export let checked = false;
|
||||||
|
export let lengthSeconds = undefined;
|
||||||
|
export let timestamp = 0;
|
||||||
|
|
||||||
|
let textInputElemet;
|
||||||
|
let timestampText = "";
|
||||||
|
let timestampRange = 0;
|
||||||
|
|
||||||
|
$: {
|
||||||
|
if (document.activeElement !== textInputElemet) {
|
||||||
|
timestampText = getTimeStampText(timestamp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$: timestampRange = timestamp !== undefined ? timestamp : 0;
|
||||||
|
|
||||||
|
function getTimeStamp(timestampText) {
|
||||||
|
if (timestampText === "") {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
const match = /^(\d{1,3}):(\d{1,2})$/.exec(timestampText);
|
||||||
|
if (match) {
|
||||||
|
const minutes = parseInt(match[1]);
|
||||||
|
const seconds = parseInt(match[2]);
|
||||||
|
if (seconds < 60) {
|
||||||
|
return minutes * 60 + seconds;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getTimeStampText(timestamp) {
|
||||||
|
if (timestamp === undefined) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
const minutes = Math.floor(timestamp / 60);
|
||||||
|
const remainingSeconds = timestamp % 60;
|
||||||
|
|
||||||
|
const formattedMinutes = String(minutes);
|
||||||
|
const formattedSeconds = String(remainingSeconds).padStart(2, "0");
|
||||||
|
|
||||||
|
return `${formattedMinutes}:${formattedSeconds}`;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="form-control">
|
||||||
|
<div class="flex flex-row items-center">
|
||||||
|
<label class="label justify-start cursor-pointer">
|
||||||
|
<input type="checkbox" bind:checked class="checkbox" />
|
||||||
|
<span class="label-text m-2">Start at</span>
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
bind:this={textInputElemet}
|
||||||
|
disabled={!checked}
|
||||||
|
class="input w-24"
|
||||||
|
placeholder="0:00"
|
||||||
|
bind:value={timestampText}
|
||||||
|
on:input={(e) => {
|
||||||
|
timestamp = getTimeStamp(e.currentTarget.value);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
{#if checked}
|
||||||
|
{#if timestamp !== undefined}
|
||||||
|
<span class="label-text m-2">({timestamp}s)</span>
|
||||||
|
{:else}
|
||||||
|
<span class="label-text m-2 text-error">(Invalid time)</span>
|
||||||
|
{/if}
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
{#if lengthSeconds && checked}
|
||||||
|
<input
|
||||||
|
type="range"
|
||||||
|
min="0"
|
||||||
|
max={lengthSeconds}
|
||||||
|
bind:value={timestampRange}
|
||||||
|
on:input={(e) => {
|
||||||
|
// @ts-ignore
|
||||||
|
timestamp = e.currentTarget.value;
|
||||||
|
}}
|
||||||
|
class="range range-xs range-primary"
|
||||||
|
/>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
@@ -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=10
|
minor_version=10
|
||||||
build_version=00000
|
build_version=00001
|
||||||
|
|
||||||
## Channel Assets
|
## Channel Assets
|
||||||
### Main Menu Icons / Channel Poster Artwork
|
### Main Menu Icons / Channel Poster Artwork
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 146 KiB |
|
Before Width: | Height: | Size: 82 KiB |
|
Before Width: | Height: | Size: 48 KiB |
@@ -0,0 +1,15 @@
|
|||||||
|
## Screenshots
|
||||||
|
### Home
|
||||||
|

|
||||||
|
### Search
|
||||||
|

|
||||||
|
### Settings
|
||||||
|

|
||||||
|
### Link to web app
|
||||||
|

|
||||||
|
### App info
|
||||||
|

|
||||||
|
|
||||||
|
### Web app
|
||||||
|
|  |  |  |
|
||||||
|
|----------------------------------|----------------------------------|----------------------------------|
|
||||||
|
After Width: | Height: | Size: 83 KiB |
|
After Width: | Height: | Size: 80 KiB |
|
After Width: | Height: | Size: 30 KiB |
|
After Width: | Height: | Size: 52 KiB |
|
After Width: | Height: | Size: 43 KiB |
|
After Width: | Height: | Size: 358 KiB |
|
After Width: | Height: | Size: 362 KiB |
|
After Width: | Height: | Size: 99 KiB |