Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9201b8dfe0 | ||
|
|
cf17fed02e | ||
|
|
f8d202be56 | ||
|
|
af091fe8f7 | ||
|
|
d89b1c519d | ||
|
|
dca3e42c79 | ||
|
|
2f72c6471a | ||
|
|
413e73c1c0 | ||
|
|
2a57cc99c7 | ||
|
|
d65f930247 | ||
|
|
ed632a7a62 | ||
|
|
89ea45ed54 | ||
|
|
d7e5732fde | ||
|
|
9f5a605e8f | ||
|
|
45da0880ba | ||
|
|
9e47d4d42e | ||
|
|
3312bbc56e | ||
|
|
e1cda5cc5c | ||
|
|
af0ddf68c5 | ||
|
|
3559a3fff6 | ||
|
|
e0709452be | ||
|
|
9bbf8dd038 | ||
|
|
64d655fca9 | ||
|
|
ecb738ab1f | ||
|
|
c14fa7a1d3 |
No files matched your search
@@ -0,0 +1,36 @@
|
||||
name: Update Dependencies
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 0 * * 6"
|
||||
workflow_dispatch: {}
|
||||
|
||||
jobs:
|
||||
update_deps:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Use Node.js 18.x
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 18.x
|
||||
cache: "npm"
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Update dependencies
|
||||
run: npm run update-deps
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Create Pull Request
|
||||
uses: peter-evans/create-pull-request@v5
|
||||
with:
|
||||
commit-message: "update dependencies"
|
||||
branch: shore/update-deps
|
||||
title: "[shore] update dependencies"
|
||||
body: "Weekly pull request to update dependencies."
|
||||
@@ -5,6 +5,25 @@ 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/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [0.17.0] - 2023-11-17
|
||||
|
||||
### Added
|
||||
|
||||
- Playlet logo in web app is clickable, and launches app if not already on
|
||||
- Remote control in web app
|
||||
- Clickable buttons and keyboard support
|
||||
|
||||
## [0.16.0] - 2023-11-13
|
||||
|
||||
### Added
|
||||
|
||||
- User interface for the Queue: Press and hold `Options (*)` to show the queue
|
||||
|
||||
### Fixed
|
||||
|
||||
- Crash when video player has no content
|
||||
- Execution timeout on cirlce posters
|
||||
|
||||
## [0.15.1] - 2023-11-10
|
||||
|
||||
### Added
|
||||
|
||||
@@ -62,9 +62,12 @@ More under [Screenshots](./docs/screenshots/README.md)
|
||||
### Customize Invidious instance
|
||||
|
||||
1. Open settings in Playlet
|
||||
1. Scan QR Code with Phone
|
||||
1. Change the Invidious instance
|
||||
1. You can also do this from the settings tab
|
||||
1. Select Invidious -> Instance
|
||||
1. Set a custom instance, or choose a public one hosted by volunteers (from https://api.invidious.io/)
|
||||
1. Optionally, Select `Test instance` to make sure it works
|
||||
1. Hit save
|
||||
|
||||
> ℹ️ **Note**: If you are logged in when you change the instance, you will remain logged in to the old instance. In this case, Playlet will use the old instance to retrieve your subscriptions and your playlists, but will use the new instance for everything else. After switching to a new instance, you can log out and log in again to use your profile on the new instance.
|
||||
|
||||
## Development
|
||||
|
||||
|
||||
@@ -143,7 +143,7 @@ That's pretty much it.
|
||||
There are a few reasons we made this separation:
|
||||
|
||||
- Playlet relies on [Invidious](https://github.com/iv-org/invidious). Invidious tries to keep up with Youtube making changes to their platform, but sometimes, a breaking change happens that requires Playlet to react quickly. Releasing through the Roku Channel store can take days, or a week. During this time, Playlet would be not functional, and that's not acceptable.
|
||||
- The ability to roll back: Sometimes an app breaking bug gets released. Allowing users to choose a seperate version is a flexible way to keep things working. Although right now rollbacks are behind a - hidden by default - developer menu, the reasoning still stands.
|
||||
- The ability to roll back: Sometimes an app breaking bug gets released. Allowing users to choose a seperate version is a flexible way to keep things working. For example, it's possible to choose a different verrsion from the developer settings in the web app.
|
||||
- It is simply easier to release: Releasing Playlet Lib on Github, and everyone receives the latest version immediately, is very conveninct and less of a hassle, than going through the Roku Channel store.
|
||||
- I've had instances where I was trying to pass the certfication for Playlet to publish it. One of the criterias is to pass a some automated tests. But the tests were failing because their system could not connect to their Roku test devices (connection keeps timing out). My only option was to keep trying over and over until it worked.
|
||||
- It might sound that Playlet Lib is just a workaround for the Roku Channel release process. But phrased differently, Roku Channel release process is not good enough of what we need for Playlet.
|
||||
|
||||
@@ -2,7 +2,7 @@ openapi: 3.0.0
|
||||
|
||||
info:
|
||||
title: Playlet Web API
|
||||
version: 0.15.1
|
||||
version: 0.17.0
|
||||
description:
|
||||
Playlet Web API is a RESTful API for controlling the Playlet app on
|
||||
Roku devices. The API is intended to be used by the Playlet web app, but can
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "playlet",
|
||||
"version": "0.15.1",
|
||||
"version": "0.17.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "playlet",
|
||||
"version": "0.15.1",
|
||||
"version": "0.17.0",
|
||||
"hasInstallScript": true,
|
||||
"devDependencies": {
|
||||
"@rokucommunity/bslint": "^0.8.12",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "playlet",
|
||||
"version": "0.15.1",
|
||||
"version": "0.17.0",
|
||||
"description": "Unofficial Youtube client for Roku",
|
||||
"devDependencies": {
|
||||
"@rokucommunity/bslint": "^0.8.12",
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "playlet-app",
|
||||
"version": "0.15.1",
|
||||
"version": "0.17.0",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "playlet-app",
|
||||
"version": "0.15.1"
|
||||
"version": "0.17.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "playlet-app",
|
||||
"version": "0.15.1",
|
||||
"version": "0.17.0",
|
||||
"description": "Unofficial Youtube client for Roku",
|
||||
"scripts": {
|
||||
"prebuild": "rm -rf build/playlet-app",
|
||||
|
||||
@@ -2,8 +2,8 @@ title=Playlet
|
||||
|
||||
# Do not update version manually, it is auto updated from package.json
|
||||
major_version=0
|
||||
minor_version=15
|
||||
build_version=00001
|
||||
minor_version=17
|
||||
build_version=00000
|
||||
|
||||
ui_resolutions=hd
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
' Playlet (App to play videos from an Invidious server on Roku TVs)
|
||||
' Copyright (C) 2022 Brahim Hadriche
|
||||
' Copyright (C) 2023 Brahim Hadriche
|
||||
|
||||
' This program is free software: you can redistribute it and/or modify
|
||||
' it under the terms of the GNU Affero General Public License as published by
|
||||
@@ -28,16 +28,16 @@ function Main(args as object) as void
|
||||
scene.ObserveField("exitChannel", port)
|
||||
scene.launchArgs = args
|
||||
|
||||
' These vars are needed to pass certification.
|
||||
' The actual work is done in Playlet Lib
|
||||
' bs:disable-next-line LINT1005
|
||||
contentId = args.contentId
|
||||
' bs:disable-next-line LINT1005
|
||||
mediaType = args.mediaType
|
||||
|
||||
' Do not signal app launch complete here, we're doing it over at Playlet Lib
|
||||
' This is needed to pass cetification
|
||||
if false
|
||||
' These vars are needed to pass certification.
|
||||
' The actual work is done in Playlet Lib
|
||||
' bs:disable-next-line LINT1005
|
||||
contentId = args.contentId
|
||||
' bs:disable-next-line LINT1005
|
||||
mediaType = args.mediaType
|
||||
|
||||
' Do not signal app launch complete here, we're doing it over at Playlet Lib
|
||||
' This is needed to pass cetification
|
||||
scene.signalBeacon("AppLaunchComplete")
|
||||
end if
|
||||
|
||||
@@ -85,10 +85,3 @@ function Main(args as object) as void
|
||||
end while
|
||||
|
||||
end function
|
||||
|
||||
function ClearPlayletLibUrlsIfNeeded(launchArgs as object) as void
|
||||
if launchArgs = invalid or launchArgs.clearPlayletLibUrls = invalid
|
||||
return
|
||||
end if
|
||||
DeleteRegistryKey("playlet_lib_urls", "Playlet")
|
||||
end function
|
||||
@@ -20,3 +20,10 @@ function GetPlayletLibUrlsFromRegistry() as object
|
||||
urls = ParseJson(urlsJson)
|
||||
return urls
|
||||
end function
|
||||
|
||||
function ClearPlayletLibUrlsIfNeeded(launchArgs as object) as void
|
||||
if launchArgs = invalid or launchArgs.clearPlayletLibUrls = invalid
|
||||
return
|
||||
end if
|
||||
DeleteRegistryKey("playlet_lib_urls", "Playlet")
|
||||
end function
|
||||
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "playlet-lib",
|
||||
"version": "0.15.1",
|
||||
"version": "0.17.0",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "playlet-lib",
|
||||
"version": "0.15.1"
|
||||
"version": "0.17.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "playlet-lib",
|
||||
"version": "0.15.1",
|
||||
"version": "0.17.0",
|
||||
"description": "Unofficial Youtube client for Roku",
|
||||
"scripts": {
|
||||
"prebuild": "rm -rf build/playlet-lib",
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import "pkg:/components/Dialog/DialogUtils.bs"
|
||||
import "pkg:/components/Navigation/LongPress.bs"
|
||||
import "pkg:/components/PlayQueue/PlayQueueViewUtils.bs"
|
||||
import "pkg:/components/VideoPlayer/VideoUtils.bs"
|
||||
import "pkg:/source/utils/FocusManagement.bs"
|
||||
import "pkg:/source/utils/Logging.bs"
|
||||
@@ -10,6 +12,7 @@ function Init()
|
||||
end function
|
||||
|
||||
function OnNodeReady()
|
||||
InitializeLongPress(["options"])
|
||||
NodeSetFocus(m.top.root, true)
|
||||
end function
|
||||
|
||||
@@ -78,15 +81,26 @@ function GetRootScreen(screenName as string) as object
|
||||
end function
|
||||
|
||||
function onKeyEvent(key as string, press as boolean) as boolean
|
||||
if not press
|
||||
return false
|
||||
if LongPressHandler(key, press)
|
||||
return true
|
||||
end if
|
||||
if key = "options"
|
||||
|
||||
if key = OPTIONS_LONG_PRESS_KEY and press
|
||||
LogInfo("Opening PlayQueueView")
|
||||
PlayQueueViewUtils.Open(m.top.playQueue, m.top)
|
||||
return true
|
||||
end if
|
||||
|
||||
if key = "options" and not press
|
||||
if VideoUtils.ToggleVideoPictureInPicture()
|
||||
return true
|
||||
end if
|
||||
end if
|
||||
|
||||
if not press
|
||||
return false
|
||||
end if
|
||||
|
||||
if key = "play"
|
||||
if VideoUtils.TogglePause()
|
||||
return true
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
<interface>
|
||||
<field id="root" type="node" />
|
||||
<field id="stack" type="node" />
|
||||
<field id="playQueue" type="node" />
|
||||
<function name="PushScreen" />
|
||||
<function name="PopScreen" />
|
||||
<function name="FocusTopScreen" />
|
||||
|
||||
@@ -7,17 +7,27 @@ function UpdateMaskSize()
|
||||
width = m.top.width
|
||||
height = m.top.height
|
||||
|
||||
m.top.maskSize = [width * GetScaleFactor(), height * GetScaleFactor()]
|
||||
m.top.maskSize = [width * GetUIScaleFactor(), height * GetUIScaleFactor()]
|
||||
end function
|
||||
|
||||
' MaskGroup component do not scale with with UI resolution
|
||||
function GetScaleFactor() as float
|
||||
if m.scaleFactor <> invalid
|
||||
return m.scaleFactor
|
||||
function GetUIScaleFactor() as float
|
||||
if m.uiScaleFactor <> invalid
|
||||
return m.uiScaleFactor
|
||||
end if
|
||||
|
||||
if m.global.uiScaleFactor <> invalid
|
||||
return m.global.uiScaleFactor
|
||||
end if
|
||||
|
||||
deviceInfo = CreateObject("roDeviceInfo")
|
||||
uiResolutionWidth = deviceInfo.GetUIResolution().width
|
||||
' divide by 1280 because we have ui_resolutions=hd in manifest
|
||||
m.scaleFactor = uiResolutionWidth / 1280
|
||||
return m.scaleFactor
|
||||
m.uiScaleFactor = uiResolutionWidth / 1280
|
||||
|
||||
if not m.global.hasField("uiScaleFactor")
|
||||
m.global.addField("uiScaleFactor", "float", false)
|
||||
end if
|
||||
m.global.uiScaleFactor = m.uiScaleFactor
|
||||
return m.uiScaleFactor
|
||||
end function
|
||||
@@ -1,23 +1,23 @@
|
||||
<component name="ChannelContentNode" extends="ContentNode">
|
||||
<interface>
|
||||
<function name="LoadChannel" />
|
||||
|
||||
<field id="type" type="string" value="channel" />
|
||||
<field id="loadState" type="string" />
|
||||
<function name="LoadChannel" />
|
||||
<!-- index in a feed -->
|
||||
<field id="feedSourcesIndex" type="integer" value="-1" />
|
||||
<field id="HDItemWidth" type="float" value="196" />
|
||||
<!-- NOTE: "_author" not "author". See PlaylistContentNode.xml for explanation -->
|
||||
<field id="_author" type="string" />
|
||||
<field id="authorId" type="string" />
|
||||
<field id="banner" type="string" />
|
||||
<field id="channelHandle" type="string" />
|
||||
<field id="description" type="string" />
|
||||
<field id="subCount" type="integer" />
|
||||
<field id="subCountText" type="string" />
|
||||
<field id="tabs" type="array" />
|
||||
<field id="thumbnail" type="string" />
|
||||
<field id="videoCount" type="integer" />
|
||||
<field id="videoCountText" type="string" />
|
||||
<field id="thumbnail" type="string" />
|
||||
<field id="banner" type="string" />
|
||||
<field id="tabs" type="array" />
|
||||
|
||||
<field id="HDItemWidth" type="float" value="196" />
|
||||
</interface>
|
||||
</component>
|
||||
@@ -4,9 +4,7 @@
|
||||
<field id="loadState" type="string" />
|
||||
<!-- index in a feed -->
|
||||
<field id="feedSourcesIndex" type="integer" value="-1" />
|
||||
<!--
|
||||
TODO:P0 see if the existance of the field "title" has anything to do with it
|
||||
|
||||
<!--
|
||||
For some strange reason, the "author" field can only be set once.
|
||||
If you try to set it again, it will not be updated, with type mismatch warning:
|
||||
|
||||
@@ -24,17 +22,19 @@
|
||||
Although we use the field "author" in other components, this is the only place where we modify it after
|
||||
we set it for the first time (because a saved Playlist belongs to the Invidious user at first, but then
|
||||
we can query it's original owner)
|
||||
|
||||
The issue happens on PlaylistContentNode and ChannelContentNode, but not VideoContentNode.
|
||||
-->
|
||||
<field id="_author" type="string" />
|
||||
<field id="authorId" type="string" />
|
||||
<field id="playlistId" type="string" />
|
||||
<field id="thumbnail" type="uri" />
|
||||
<field id="thumbnailBackground" type="uri" />
|
||||
<field id="updated" type="integer" />
|
||||
<field id="updatedText" type="string" />
|
||||
<field id="videoCount" type="integer" value="-1" />
|
||||
<field id="videoCountText" type="string" />
|
||||
<field id="viewCount" type="integer" />
|
||||
<field id="viewCountText" type="string" />
|
||||
<field id="updated" type="integer" />
|
||||
<field id="updatedText" type="string" />
|
||||
</interface>
|
||||
</component>
|
||||
@@ -1,14 +1,13 @@
|
||||
<component name="VideoContentNode" extends="ContentNode">
|
||||
<interface>
|
||||
<field id="type" type="string" value="video" />
|
||||
|
||||
<field id="author" type="string" />
|
||||
<field id="authorId" type="string" />
|
||||
<field id="hlsUrl" type="uri" />
|
||||
<!-- index in a playlist -->
|
||||
<field id="index" type="integer" value="-1" />
|
||||
<!-- index in a feed -->
|
||||
<field id="feedSourcesIndex" type="integer" value="-1" />
|
||||
|
||||
<field id="author" type="string" />
|
||||
<field id="authorId" type="string" />
|
||||
<field id="isUpcoming" type="boolean" />
|
||||
<field id="lengthSeconds" type="integer" />
|
||||
<field id="lengthText" type="string" />
|
||||
|
||||
@@ -2,7 +2,10 @@
|
||||
<children>
|
||||
<!-- Logger should remain the first child, to make sure it is initialized first in the scene -->
|
||||
<Logger id="Logger" />
|
||||
<AppController id="AppController" root="bind:./AppRoot" stack="bind:./Stack">
|
||||
<AppController id="AppController"
|
||||
root="bind:./AppRoot"
|
||||
stack="bind:./Stack"
|
||||
playQueue="bind:./PlayQueue">
|
||||
<Group id="Stack">
|
||||
<AppRoot id="AppRoot">
|
||||
<NavBar id="NavBar" focusIndex="1" appController="bind:/AppController">
|
||||
|
||||
@@ -7,7 +7,8 @@ function InitializeBindings()
|
||||
childProps: {
|
||||
"AppController": {
|
||||
"root": "./AppRoot",
|
||||
"stack": "./Stack"
|
||||
"stack": "./Stack",
|
||||
"playQueue": "./PlayQueue"
|
||||
},
|
||||
"NavBar": {
|
||||
"appController": "/AppController"
|
||||
|
||||
@@ -1,41 +1,79 @@
|
||||
const LONG_PRESS_KEY = "OK_LONG_PRESS"
|
||||
const OK_LONG_PRESS_KEY = "OK_LONG_PRESS"
|
||||
const OPTIONS_LONG_PRESS_KEY = "OPTIONS_LONG_PRESS"
|
||||
|
||||
function InitializeLongPress(keys as object, duration = 1.0 as float)
|
||||
longPressKeyMap = {
|
||||
"OK": OK_LONG_PRESS_KEY,
|
||||
"options": OPTIONS_LONG_PRESS_KEY
|
||||
}
|
||||
m._longPressKeyMap = {}
|
||||
for each key in keys
|
||||
m._longPressKeyMap[key] = longPressKeyMap[key]
|
||||
end for
|
||||
|
||||
#if DEBUG
|
||||
' This is for testing long press using the VSCode extension.
|
||||
' Using the keyboard:
|
||||
' - press K to simulate an "OK" long press on the remote.
|
||||
' - press O to simulate an "options" long press on the remote.
|
||||
simulatedLongPressKeyMap = {
|
||||
"OK": "Lit_k",
|
||||
"options": "Lit_o"
|
||||
}
|
||||
|
||||
m._simulatedLongPressKeyMap = {}
|
||||
for each key in keys
|
||||
m._simulatedLongPressKeyMap[simulatedLongPressKeyMap[key]] = key
|
||||
end for
|
||||
#end if
|
||||
|
||||
function InitializeLongPressTimer(duration = 1.0 as float)
|
||||
m._longPressTimer = CreateObject("roSGNode", "Timer")
|
||||
m._longPressTimer.duration = duration
|
||||
m._longPressFired = false
|
||||
m._pressState = {}
|
||||
|
||||
m._longPressTimer.ObserveField("fire", FuncName(LongPressTimerFired))
|
||||
end function
|
||||
|
||||
function LongPressHandler(key as string, press as boolean) as boolean
|
||||
#if DEBUG
|
||||
if key = "Lit_l"
|
||||
LogInfo("Simulating long press using key:", key, "press:", press)
|
||||
if m._simulatedLongPressKeyMap.DoesExist(key)
|
||||
subtype = m.top.subtype()
|
||||
simulatedKey = m._simulatedLongPressKeyMap[key]
|
||||
LogInfo(`[${subtype}] Simulating`, simulatedKey, "long press using key:", key, "press:", press)
|
||||
longPressKey = m._longPressKeyMap[simulatedKey]
|
||||
m._longPressFired = true
|
||||
return OnkeyEvent(LONG_PRESS_KEY, press)
|
||||
return OnkeyEvent(longPressKey, press)
|
||||
end if
|
||||
#end if
|
||||
if key = "OK" and press
|
||||
|
||||
isLongPressKey = m._longPressKeyMap.DoesExist(key)
|
||||
if not isLongPressKey
|
||||
return false
|
||||
end if
|
||||
|
||||
if press
|
||||
m._longPressTimer.control = "stop"
|
||||
m._longPressTimer.control = "start"
|
||||
m._longPressFired = false
|
||||
m._okPressed = true
|
||||
m._longPressKey = key
|
||||
m._pressState[key] = true
|
||||
return true
|
||||
end if
|
||||
|
||||
if key = "OK" and not press
|
||||
if not press
|
||||
m._longPressTimer.control = "stop"
|
||||
if m._longPressFired = true
|
||||
m._longPressFired = false
|
||||
m._okPressed = false
|
||||
m._pressState[key] = false
|
||||
return true
|
||||
end if
|
||||
' This case is for handling a dialog: The dialog will be dismissed with the OK down event,
|
||||
' and we would trigger the action with the OK up event. The action should only happen if
|
||||
' we detected both down and up events.
|
||||
wasOkPressed = m._okPressed
|
||||
m._okPressed = false
|
||||
if wasOkPressed <> true
|
||||
wasPressed = m._pressState[key]
|
||||
m._pressState[key] = false
|
||||
if wasPressed <> true
|
||||
return true
|
||||
end if
|
||||
end if
|
||||
@@ -43,7 +81,11 @@ function LongPressHandler(key as string, press as boolean) as boolean
|
||||
return false
|
||||
end function
|
||||
|
||||
function LongPressTimerFired()
|
||||
function LongPressTimerFired() as void
|
||||
m._longPressFired = true
|
||||
OnkeyEvent(LONG_PRESS_KEY, true)
|
||||
if StringUtils.IsNullOrEmpty(m._longPressKey) or not m._longPressKeyMap.DoesExist(m._longPressKey)
|
||||
return
|
||||
end if
|
||||
|
||||
OnkeyEvent(m._longPressKeyMap[m._longPressKey], true)
|
||||
end function
|
||||
@@ -0,0 +1,5 @@
|
||||
<component name="ContentNodeReference" extends="ContentNode">
|
||||
<interface>
|
||||
<field id="refNode" type="node" />
|
||||
</interface>
|
||||
</component>
|
||||
@@ -0,0 +1,41 @@
|
||||
' NodeByRef: these functions provides the ability to "wrap" a node in
|
||||
' another node, so it can be passed by reference. This is useful for
|
||||
' when a node is required to be a child of multiple nodes at once,
|
||||
' which is not possible.
|
||||
' Instead, the node is wrapped, passed around, and unwrapped when needed.
|
||||
import "pkg:/source/utils/StringUtils.bs"
|
||||
|
||||
namespace NodeByRef
|
||||
|
||||
function Wrap(node as object) as object
|
||||
if node = invalid
|
||||
return invalid
|
||||
end if
|
||||
|
||||
if node.refNode <> invalid
|
||||
return node
|
||||
end if
|
||||
|
||||
ref = CreateObject("roSGNode", "ContentNodeReference")
|
||||
ref.refNode = node
|
||||
if not StringUtils.IsNullOrEmpty(node.id)
|
||||
ref.id = node.id + "-ref"
|
||||
end if
|
||||
return ref
|
||||
end function
|
||||
|
||||
function Unwrap(node as object) as object
|
||||
if node = invalid
|
||||
return invalid
|
||||
end if
|
||||
|
||||
loopGuard = 0
|
||||
while node.refNode <> invalid and loopGuard < 10
|
||||
node = node.refNode
|
||||
loopGuard += 1
|
||||
end while
|
||||
|
||||
return node
|
||||
end function
|
||||
|
||||
end namespace
|
||||
@@ -1,3 +1,4 @@
|
||||
import "pkg:/components/NodeByRef/NodeByRef.bs"
|
||||
import "pkg:/source/utils/StringUtils.bs"
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
|
||||
@@ -14,6 +15,7 @@ end function
|
||||
|
||||
function OnContentSet() as void
|
||||
content = m.top.content
|
||||
content = NodeByRef.Unwrap(content)
|
||||
if content = invalid
|
||||
return
|
||||
end if
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<children>
|
||||
<Poster
|
||||
width="500"
|
||||
height="126"
|
||||
height="144"
|
||||
opacity="0.9"
|
||||
uri="pkg:/images/white.9.png">
|
||||
|
||||
@@ -40,6 +40,12 @@
|
||||
color="0x262626ff"
|
||||
wrap="true" />
|
||||
</LayoutGroup>
|
||||
<Label
|
||||
width="480"
|
||||
font="font:SmallestSystemFont"
|
||||
color="0x262626ff"
|
||||
text="Press and hold Options (*) to open the queue"
|
||||
translation="[10,120]" />
|
||||
</Poster>
|
||||
<Animation
|
||||
id="translationAnimation"
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import "pkg:/components/Dialog/DialogUtils.bs"
|
||||
import "pkg:/components/NodeByRef/NodeByRef.bs"
|
||||
import "pkg:/components/PlaylistView/PlaylistContentTask.bs"
|
||||
import "pkg:/components/PlayQueue/Notifications/PlayQueueNotificationUtils.bs"
|
||||
import "pkg:/components/VideoFeed/FeedLoadState.bs"
|
||||
@@ -9,53 +10,74 @@ import "pkg:/source/utils/ErrorUtils.bs"
|
||||
import "pkg:/source/utils/Logging.bs"
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
|
||||
' TODO:P1 prevent adding duplicates of the same video/playlist
|
||||
function Init()
|
||||
m.pendingLoadTasks = {}
|
||||
' TODO:P1 prevent adding duplicates of the same video/playlist
|
||||
m.queue = CreateObject("roArray", 0, true)
|
||||
m.content = m.top.findNode("Content")
|
||||
m.top.content = m.content
|
||||
m.content.addField("index", "integer", false)
|
||||
m.content.index = m.top.index
|
||||
end function
|
||||
|
||||
function Play(node as object, playlistIndex as integer)
|
||||
m.top.index += 1
|
||||
m.top.playlistIndex = playlistIndex
|
||||
|
||||
if m.top.index >= m.queue.Count()
|
||||
m.queue.push(node)
|
||||
m.top.index = m.queue.Count() - 1
|
||||
node = WrapWithIndexField(node)
|
||||
if m.top.index >= m.content.getChildCount()
|
||||
m.content.appendChild(node)
|
||||
m.top.index = m.content.getChildCount() - 1
|
||||
else
|
||||
ArrayUtils.Insert(m.queue, node, m.top.index)
|
||||
m.content.insertChild(node, m.top.index)
|
||||
end if
|
||||
|
||||
PlayItemAtCurrentIndex()
|
||||
end function
|
||||
|
||||
function AddToQueue(node as object)
|
||||
m.queue.push(node)
|
||||
node = WrapWithIndexField(node)
|
||||
m.content.appendChild(node)
|
||||
queueNotifications = m.top.preferences["misc.queue_notifications"]
|
||||
if queueNotifications
|
||||
PlayQueue.ShowNotifcation(m.top.notifications, node)
|
||||
end if
|
||||
end function
|
||||
|
||||
' TODO:P1 better model of the queue (Now playing, etc)
|
||||
function WrapWithIndexField(node as object) as object
|
||||
node = NodeByRef.Wrap(node)
|
||||
if not node.hasField("index")
|
||||
node.addField("index", "integer", false)
|
||||
end if
|
||||
node.index = m.top.index
|
||||
return node
|
||||
end function
|
||||
|
||||
' TODO:P0 better model of the queue (Now playing, etc)
|
||||
function GetQueue(unused as dynamic) as object
|
||||
queueNodes = m.content.getChildren(-1, 0)
|
||||
items = []
|
||||
for each item in m.queue
|
||||
if item.type = "video"
|
||||
for each node in queueNodes
|
||||
node = NodeByRef.Unwrap(node)
|
||||
if node = invalid
|
||||
continue for
|
||||
end if
|
||||
|
||||
nodeType = node.type
|
||||
if nodeType = "video"
|
||||
items.push({
|
||||
type: item.type,
|
||||
videoId: item.videoId,
|
||||
title: item.title,
|
||||
author: item.author,
|
||||
thumbnail: item.thumbnail
|
||||
type: nodeType,
|
||||
videoId: node.videoId,
|
||||
title: node.title,
|
||||
author: node.author,
|
||||
thumbnail: node.thumbnail
|
||||
})
|
||||
else if item.type = "playlist"
|
||||
else if node.type = "playlist"
|
||||
items.push({
|
||||
type: item.type,
|
||||
playlistId: item.playlistId,
|
||||
title: item.title,
|
||||
thumbnail: item.thumbnail,
|
||||
videoCountText: item.videoCountText
|
||||
type: nodeType,
|
||||
playlistId: node.playlistId,
|
||||
title: node.title,
|
||||
thumbnail: node.thumbnail,
|
||||
videoCountText: node.videoCountText
|
||||
})
|
||||
end if
|
||||
end for
|
||||
@@ -68,21 +90,24 @@ function GetQueue(unused as dynamic) as object
|
||||
end function
|
||||
|
||||
function Clear(unused as dynamic)
|
||||
m.queue.Clear()
|
||||
m.content.removeChildrenIndex(m.content.getChildCount(), 0)
|
||||
m.top.index = -1
|
||||
m.top.playlistIndex = -1
|
||||
end function
|
||||
|
||||
function PlayNextItem(unused as dynamic) as boolean
|
||||
if m.queue.Count() = 0
|
||||
childCount = m.content.getChildCount()
|
||||
if childCount = 0
|
||||
return false
|
||||
end if
|
||||
|
||||
if m.top.index <> -1
|
||||
if m.top.index >= m.queue.Count()
|
||||
index = m.top.index
|
||||
if index <> -1
|
||||
if index >= childCount
|
||||
return false
|
||||
end if
|
||||
node = m.queue[m.top.index]
|
||||
node = m.content.getChild(index)
|
||||
node = NodeByRef.Unwrap(node)
|
||||
if node.type = "playlist"
|
||||
m.top.playlistIndex += 1
|
||||
if PlayPlaylistAtCurrentIndex(node)
|
||||
@@ -93,15 +118,22 @@ function PlayNextItem(unused as dynamic) as boolean
|
||||
|
||||
m.top.index += 1
|
||||
m.top.playlistIndex = -1
|
||||
if m.top.index >= m.queue.Count()
|
||||
if m.top.index >= childCount
|
||||
return false
|
||||
end if
|
||||
|
||||
return PlayItemAtCurrentIndex()
|
||||
end function
|
||||
|
||||
function PlayItemAtIndex(index as integer) as boolean
|
||||
m.top.index = index
|
||||
m.top.playlistIndex = -1
|
||||
return PlayItemAtCurrentIndex()
|
||||
end function
|
||||
|
||||
function PlayItemAtCurrentIndex() as boolean
|
||||
node = m.queue[m.top.index]
|
||||
node = m.content.getChild(m.top.index)
|
||||
node = NodeByRef.Unwrap(node)
|
||||
if node = invalid
|
||||
return false
|
||||
end if
|
||||
@@ -118,17 +150,18 @@ function PlayItemAtCurrentIndex() as boolean
|
||||
end function
|
||||
|
||||
function PlayPlaylistAtCurrentIndex(playlist as object) as boolean
|
||||
playlist = NodeByRef.Unwrap(playlist)
|
||||
if playlist.videoCount < 0
|
||||
LoadPlaylist(playlist)
|
||||
return true
|
||||
end if
|
||||
index = m.top.playlistIndex
|
||||
if index < 0 or index >= playlist.videoCount
|
||||
playlistIndex = m.top.playlistIndex
|
||||
if playlistIndex < 0 or playlistIndex >= playlist.videoCount
|
||||
return false
|
||||
end if
|
||||
|
||||
if index < playlist.getChildCount()
|
||||
child = playlist.getChild(index)
|
||||
if playlistIndex < playlist.getChildCount()
|
||||
child = playlist.getChild(playlistIndex)
|
||||
VideoUtils.PlayVideo(child)
|
||||
return true
|
||||
end if
|
||||
@@ -177,3 +210,12 @@ function OnPlaylistContentTaskResult(output as object) as void
|
||||
|
||||
PlayPlaylistAtCurrentIndex(playlist)
|
||||
end function
|
||||
|
||||
function OnIndexChange()
|
||||
index = m.top.index
|
||||
m.content.index = index
|
||||
children = m.top.content.getChildren(-1, 0)
|
||||
for each child in children
|
||||
child.index = index
|
||||
end for
|
||||
end function
|
||||
@@ -1,7 +1,7 @@
|
||||
<component name="PlayQueue" extends="Node">
|
||||
<interface>
|
||||
<field id="queue" type="array" />
|
||||
<field id="index" type="integer" value="-1" />
|
||||
<field id="content" type="node" />
|
||||
<field id="index" type="integer" value="-1" onChange="OnIndexChange" />
|
||||
<field id="playlistIndex" type="integer" value="-1" />
|
||||
<field id="invidious" type="node" />
|
||||
<field id="notifications" type="node" />
|
||||
@@ -11,5 +11,9 @@
|
||||
<function name="GetQueue" />
|
||||
<function name="Clear" />
|
||||
<function name="PlayNextItem" />
|
||||
<function name="PlayItemAtIndex" />
|
||||
</interface>
|
||||
<children>
|
||||
<ContentNode id="Content" />
|
||||
</children>
|
||||
</component>
|
||||
@@ -0,0 +1,83 @@
|
||||
import "pkg:/components/Navigation/Navigation.bs"
|
||||
import "pkg:/source/utils/FocusManagement.bs"
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
|
||||
function Init()
|
||||
m.queueList = m.top.findNode("queueList")
|
||||
m.queueLabel = m.top.findNode("queueLabel")
|
||||
m.clearButton = m.top.findNode("clearButton")
|
||||
m.showAnimation = m.top.findNode("showAnimation")
|
||||
|
||||
m.clearButton.ObserveField("buttonSelected", FuncName(OnClearButtonSelected))
|
||||
m.queueList.ObserveField("itemSelected", FuncName(OnItemSelected))
|
||||
|
||||
SetNavigation(m.queueList, "up", m.clearButton)
|
||||
SetNavigation(m.clearButton, "down", m.queueList)
|
||||
end function
|
||||
|
||||
function Show(unsued as dynamic)
|
||||
m.showAnimation.control = "start"
|
||||
end function
|
||||
|
||||
function OnFocusChange() as void
|
||||
if not m.top.focus
|
||||
return
|
||||
end if
|
||||
NodeSetFocus(m.queueList, true)
|
||||
end function
|
||||
|
||||
function OnContentSet() as void
|
||||
content = m.top.content
|
||||
if content = invalid
|
||||
return
|
||||
end if
|
||||
|
||||
if not content.isSameNode(m.queueList.content)
|
||||
m.queueList.content = content
|
||||
end if
|
||||
|
||||
index = content.index
|
||||
if IsInt(index) and index <> -1
|
||||
m.queueLabel.text = `Queue (${index + 1}/${content.getChildCount()})`
|
||||
else
|
||||
m.queueLabel.text = `Queue (${content.getChildCount()})`
|
||||
end if
|
||||
end function
|
||||
|
||||
function OnkeyEvent(key as string, press as boolean) as boolean
|
||||
if NavigationKeyHandler(key, press).handled
|
||||
return true
|
||||
end if
|
||||
|
||||
if press = false
|
||||
return false
|
||||
end if
|
||||
|
||||
if key = "back"
|
||||
Close()
|
||||
return true
|
||||
end if
|
||||
return false
|
||||
end function
|
||||
|
||||
function Close()
|
||||
m.top.appController@.PopScreen(invalid)
|
||||
end function
|
||||
|
||||
function OnClearButtonSelected()
|
||||
m.top.playQueue@.Clear(invalid)
|
||||
end function
|
||||
|
||||
function OnItemSelected() as void
|
||||
content = m.queueList.content
|
||||
if content = invalid
|
||||
return
|
||||
end if
|
||||
|
||||
index = m.queueList.itemSelected
|
||||
if index < 0 or index >= content.getChildCount()
|
||||
return
|
||||
end if
|
||||
|
||||
m.top.playQueue@.PlayItemAtIndex(index)
|
||||
end function
|
||||
@@ -0,0 +1,64 @@
|
||||
<component name="PlayQueueView" extends="Group" includes="Focus">
|
||||
<interface>
|
||||
<field id="content" type="node" onChange="OnContentSet" />
|
||||
<field id="jumpToItem" type="integer" alias="queueList.jumpToItem" />
|
||||
<field id="playQueue" type="node" />
|
||||
<field id="appController" type="node" />
|
||||
<function name="Show" />
|
||||
</interface>
|
||||
|
||||
<children>
|
||||
<Rectangle
|
||||
id="background"
|
||||
width="1280"
|
||||
height="720"
|
||||
color="#000000"
|
||||
opacity="0" />
|
||||
<Rectangle
|
||||
id="container"
|
||||
width="470"
|
||||
height="720"
|
||||
translation="[-470,0]"
|
||||
color="0x242424">
|
||||
<Label
|
||||
id="queueLabel"
|
||||
width="270"
|
||||
height="52"
|
||||
text="Queue"
|
||||
vertAlign="center"
|
||||
font="font:MediumBoldSystemFont"
|
||||
translation="[20,20]" />
|
||||
<Button
|
||||
id="clearButton"
|
||||
minWidth="150"
|
||||
height="52"
|
||||
text="Clear"
|
||||
showFocusFootprint="true"
|
||||
translation="[295,15]" />
|
||||
<MarkupGrid
|
||||
id="queueList"
|
||||
itemComponentName="PlayQueueViewCell"
|
||||
itemSize="[432,90]"
|
||||
itemSpacing="[0,15]"
|
||||
numColumns="1"
|
||||
numRows="6"
|
||||
vertFocusAnimationStyle="floatingFocus"
|
||||
translation="[20,90]" />
|
||||
</Rectangle>
|
||||
|
||||
<Animation id="showAnimation"
|
||||
duration="0.3"
|
||||
optional="true">
|
||||
<FloatFieldInterpolator
|
||||
id="fadeInterpolator"
|
||||
key="[0.0, 0.5, 1.0]"
|
||||
keyValue="[0.0, 0.4, 0.8]"
|
||||
fieldToInterp="background.opacity" />
|
||||
<Vector2DFieldInterpolator
|
||||
id="translationInterpolator"
|
||||
key="[0.0, 0.5, 1.0]"
|
||||
keyValue="[[-470,0], [-235,0], [0,0]]"
|
||||
fieldToInterp="container.translation" />
|
||||
</Animation>
|
||||
</children>
|
||||
</component>
|
||||
@@ -0,0 +1,75 @@
|
||||
import "pkg:/components/NodeByRef/NodeByRef.bs"
|
||||
import "pkg:/source/utils/Logging.bs"
|
||||
import "pkg:/source/utils/TimeUtils.bs"
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
|
||||
function Init()
|
||||
m.durationRect = m.top.FindNode("durationRect")
|
||||
m.durationLabel = m.top.FindNode("durationLabel")
|
||||
end function
|
||||
|
||||
function OnContentSet() as void
|
||||
content = m.top.itemContent
|
||||
content = NodeByRef.Unwrap(content)
|
||||
if content = invalid
|
||||
return
|
||||
end if
|
||||
|
||||
m.top.title = content.title
|
||||
m.top.thumbnailUri = content.thumbnail
|
||||
|
||||
contentType = ValidString(content.type)
|
||||
if contentType = "video" and ValidInt(content.lengthSeconds) <> 0
|
||||
SetDurationText(content.lengthText)
|
||||
m.top.durationRectVisible = true
|
||||
else if contentType = "playlist" and not StringUtils.IsNullOrEmpty(content.videoCountText)
|
||||
SetDurationText(content.videoCountText)
|
||||
m.top.durationRectVisible = true
|
||||
else
|
||||
m.top.durationRectVisible = false
|
||||
end if
|
||||
|
||||
SetHighlight()
|
||||
end function
|
||||
|
||||
function SetDurationText(text as string) as void
|
||||
m.top.duration = text
|
||||
|
||||
label = m.durationLabel
|
||||
rect = m.durationRect
|
||||
|
||||
if label = invalid or rect = invalid
|
||||
return
|
||||
end if
|
||||
|
||||
rectParent = rect.getParent()
|
||||
size = label.localBoundingRect()
|
||||
|
||||
rect.width = size.width + 16
|
||||
rect.translation = [rectParent.width - rect.width, rect.translation[1]]
|
||||
end function
|
||||
|
||||
function SetHighlight() as void
|
||||
content = m.top.itemContent
|
||||
|
||||
playQueueContent = content.getParent()
|
||||
if playQueueContent = invalid
|
||||
return
|
||||
end if
|
||||
|
||||
playQueue = playQueueContent.getParent()
|
||||
if playQueue = invalid
|
||||
return
|
||||
end if
|
||||
|
||||
playQueueIndex = playQueue.index
|
||||
index = m.top.index
|
||||
|
||||
if playQueueIndex = index
|
||||
m.top.thumbnailBlendColor = "#FFFFFFFF"
|
||||
m.top.highlightUri = "pkg:/images/focus_grid.9.png"
|
||||
else
|
||||
m.top.thumbnailBlendColor = "#606060FF"
|
||||
m.top.highlightUri = ""
|
||||
end if
|
||||
end function
|
||||
@@ -0,0 +1,50 @@
|
||||
<component name="PlayQueueViewCell" extends="Group">
|
||||
<interface>
|
||||
<field id="itemContent" type="node" onChange="OnContentSet" />
|
||||
<field id="index" type="integer" />
|
||||
<field id="title" type="string" alias="titleLabel.text" />
|
||||
<field id="thumbnailUri" type="uri" alias="thumbnailPoster.uri" />
|
||||
<field id="thumbnailBlendColor" type="color" alias="thumbnailPoster.blendColor" />
|
||||
<field id="highlightUri" type="uri" alias="highlightPoster.uri" />
|
||||
<field id="duration" type="string" alias="durationLabel.text" />
|
||||
<field id="durationRectVisible" type="boolean" alias="durationRect.visible" />
|
||||
</interface>
|
||||
<children>
|
||||
<Poster
|
||||
id="thumbnailPoster"
|
||||
loadDisplayMode="scaleToZoom"
|
||||
width="160"
|
||||
height="90"
|
||||
failedBitmapUri="pkg:/images/thumbnail-missing.jpg"
|
||||
translation="[2,2]">
|
||||
<Rectangle
|
||||
id="durationRect"
|
||||
width="60"
|
||||
height="26"
|
||||
color="0x000000"
|
||||
opacity="0.8"
|
||||
translation="[100, 58]">
|
||||
<Label
|
||||
height="26"
|
||||
id="durationLabel"
|
||||
horizAlign="center"
|
||||
vertAlign="center"
|
||||
font="font:SmallestSystemFont"
|
||||
translation="[8, 0]" />
|
||||
</Rectangle>
|
||||
</Poster>
|
||||
<Poster
|
||||
id="highlightPoster"
|
||||
blendColor="0xFF0000"
|
||||
width="164"
|
||||
height="94" />
|
||||
|
||||
<Label
|
||||
id="titleLabel"
|
||||
width="260"
|
||||
font="font:SmallestBoldSystemFont"
|
||||
maxLines="3"
|
||||
wrap="true"
|
||||
translation="[172,2]" />
|
||||
</children>
|
||||
</component>
|
||||
@@ -0,0 +1,23 @@
|
||||
import "pkg:/components/Services/Invidious/InvidiousToContentNode.bs"
|
||||
|
||||
namespace PlayQueueViewUtils
|
||||
|
||||
function Open(playQueue as object, appController as object) as object
|
||||
playQueueView = CreateObject("roSGNode", "PlayQueueView")
|
||||
playQueueView.appController = appController
|
||||
playQueueView.playQueue = playQueue
|
||||
appController@.PushScreen(playQueueView)
|
||||
|
||||
content = playQueue.content
|
||||
index = playQueue.index
|
||||
|
||||
playQueueView.content = content
|
||||
if index > -1 and index < content.GetChildCount()
|
||||
playQueueView.jumpToItem = index
|
||||
end if
|
||||
|
||||
playQueueView@.Show(invalid)
|
||||
return playQueueView
|
||||
end function
|
||||
|
||||
end namespace
|
||||
@@ -24,7 +24,7 @@ end function
|
||||
|
||||
function OnNodeReady()
|
||||
m.list.ObserveField("itemFocused", FuncName(OnItemFocused))
|
||||
InitializeLongPressTimer()
|
||||
InitializeLongPress(["OK"])
|
||||
end function
|
||||
|
||||
function OnFocusChange() as void
|
||||
@@ -53,7 +53,9 @@ function OnContentSet() as void
|
||||
m.background.uri = content.thumbnailBackground
|
||||
|
||||
itemFocused = m.list.itemFocused
|
||||
m.list.content = content
|
||||
if not content.isSameNode(m.list.content)
|
||||
m.list.content = content
|
||||
end if
|
||||
if itemFocused > -1 and content.getChildCount() > itemFocused
|
||||
m.list.jumpToItem = itemFocused
|
||||
end if
|
||||
@@ -65,7 +67,7 @@ function OnkeyEvent(key as string, press as boolean) as boolean
|
||||
return true
|
||||
end if
|
||||
|
||||
if key = LONG_PRESS_KEY and press
|
||||
if key = OK_LONG_PRESS_KEY and press
|
||||
OnItemLongPressed(m.list.itemFocused)
|
||||
return true
|
||||
end if
|
||||
|
||||
@@ -39,5 +39,5 @@ function SetDurationText(text as string) as void
|
||||
size = label.localBoundingRect()
|
||||
|
||||
rect.width = size.width + 16
|
||||
rect.translation = [rectParent.width - rect.width, 72]
|
||||
rect.translation = [rectParent.width - rect.width, rect.translation[1]]
|
||||
end function
|
||||
@@ -35,7 +35,6 @@ namespace InvidiousContent
|
||||
|
||||
SetIfExists(node, "author", item, "author")
|
||||
SetIfExists(node, "authorId", item, "authorId")
|
||||
SetIfExists(node, "hlsUrl", item, "hlsUrl")
|
||||
SetIfExists(node, "lengthSeconds", item, "lengthSeconds")
|
||||
node.lengthText = TimeUtils.GetFormattedTime(item.lengthSeconds)
|
||||
node.liveNow = VideoIsLive(item)
|
||||
|
||||
@@ -37,5 +37,5 @@ function SetVideoCount(videoCountText as string)
|
||||
size = label.localBoundingRect()
|
||||
|
||||
rect.width = size.width + 16
|
||||
rect.translation = [rectParent.width - rect.width, 162]
|
||||
rect.translation = [rectParent.width - rect.width, rect.translation[1]]
|
||||
end function
|
||||
@@ -71,6 +71,6 @@ function SetDurationText(text as string)
|
||||
size = label.localBoundingRect()
|
||||
|
||||
rect.width = size.width + 16
|
||||
rect.translation = [rectParent.width - rect.width, 162]
|
||||
rect.translation = [rectParent.width - rect.width, rect.translation[1]]
|
||||
end function
|
||||
|
||||
@@ -25,7 +25,7 @@ function OnNodeReady()
|
||||
|
||||
' TODO:P1 Reload when subscriptions change
|
||||
DisposableObserveFieldScoped(m.invidious, "authToken", FuncName(OnAuthTokenChange))
|
||||
InitializeLongPressTimer()
|
||||
InitializeLongPress(["OK"])
|
||||
end function
|
||||
|
||||
function OnFocusedChildChange() as void
|
||||
@@ -301,7 +301,7 @@ function OnkeyEvent(key as string, press as boolean) as boolean
|
||||
return true
|
||||
end if
|
||||
|
||||
if key = LONG_PRESS_KEY and press
|
||||
if key = OK_LONG_PRESS_KEY and press
|
||||
OnRowItemLongPressed(m.top.rowItemFocused)
|
||||
return true
|
||||
end if
|
||||
|
||||
@@ -154,15 +154,26 @@ function VideoRowListRowContentTask(input as object) as object
|
||||
end function
|
||||
|
||||
function RemovePlaceHolderItems(contentNode as object)
|
||||
childCount = contentNode.getChildCount()
|
||||
removeIndex = childCount
|
||||
removeCount = 0
|
||||
|
||||
index = childCount - 1
|
||||
isLoading = true
|
||||
while isLoading and contentNode.getChildCount() > 0
|
||||
lastIndex = contentNode.getChildCount() - 1
|
||||
child = contentNode.getChild(lastIndex)
|
||||
isLoading = IsString(child.type) and child.type = "loading"
|
||||
if isLoading = true
|
||||
contentNode.removeChildIndex(lastIndex)
|
||||
while isLoading and index >= 0
|
||||
child = contentNode.getChild(index)
|
||||
isLoading = ValidString(child.type) = "loading"
|
||||
if not isLoading
|
||||
exit while
|
||||
end if
|
||||
removeCount += 1
|
||||
removeIndex -= 1
|
||||
index -= 1
|
||||
end while
|
||||
|
||||
if removeCount > 0
|
||||
contentNode.removeChildrenIndex(removeCount, removeIndex)
|
||||
end if
|
||||
end function
|
||||
|
||||
function HandleFeedLoadErrorDialog(error as object, rowList as object) as void
|
||||
|
||||
@@ -4,6 +4,8 @@ function Init()
|
||||
' We keep in memory the last videos we watched, to avoid a loop
|
||||
' Sometimes recommended videos point to each other, and we're stuck watching
|
||||
' The same 2 videos over and over again
|
||||
|
||||
' TODO:P1 get rid of `watchedVideos` and use the PlayQueue instead
|
||||
m.watchedVideos = new RingBuffer(100)
|
||||
end function
|
||||
|
||||
|
||||
@@ -185,8 +185,18 @@ function OnVideoPlayerStateChange() as void
|
||||
end if
|
||||
|
||||
if state = "finished"
|
||||
if content = invalid
|
||||
m.container@.watchedVideosClear(invalid)
|
||||
VideoUtils.CloseVideo()
|
||||
end if
|
||||
|
||||
metadata = content.metadata
|
||||
if metadata <> invalid and not PlayNext(metadata.recommendedVideos)
|
||||
if metadata = invalid
|
||||
m.container@.watchedVideosClear(invalid)
|
||||
VideoUtils.CloseVideo()
|
||||
end if
|
||||
|
||||
if not PlayNext(metadata.recommendedVideos)
|
||||
m.container@.watchedVideosClear(invalid)
|
||||
VideoUtils.CloseVideo()
|
||||
end if
|
||||
@@ -221,6 +231,7 @@ function PlayNext(recommendedVideos as object) as boolean
|
||||
return PlayNextRecommendedVideo(recommendedVideos)
|
||||
end function
|
||||
|
||||
' TODO:P2 move this to the play queue
|
||||
function PlayNextRecommendedVideo(recommendedVideos as object) as boolean
|
||||
if m.preferences["playback.autoplay"] <> true
|
||||
return false
|
||||
@@ -240,8 +251,9 @@ function PlayNextRecommendedVideo(recommendedVideos as object) as boolean
|
||||
end if
|
||||
if not m.container@.watchedVideosContain(videoId)
|
||||
LogInfo(`Playing next recommended video (${videoId})`)
|
||||
node = InvidiousContent.ToVideoContentNode(invalid, metadata, invalid)
|
||||
VideoUtils.PlayVideo(node)
|
||||
instance = m.invidious@.GetCurrentInstance(invalid)
|
||||
node = InvidiousContent.ToVideoContentNode(invalid, metadata, instance)
|
||||
m.playQueue@.Play(node, -1)
|
||||
return true
|
||||
end if
|
||||
end for
|
||||
|
||||
@@ -2,8 +2,8 @@ title=PlayletLib
|
||||
|
||||
# Do not update version manually, it is auto updated from package.json
|
||||
major_version=0
|
||||
minor_version=15
|
||||
build_version=00001
|
||||
minor_version=17
|
||||
build_version=00000
|
||||
|
||||
ui_resolutions=hd
|
||||
|
||||
|
||||
@@ -284,18 +284,19 @@ namespace HttpClient
|
||||
end function
|
||||
|
||||
function Await() as HttpResponse
|
||||
tryCount = m._tryCount
|
||||
triesLeft = m._tryCount
|
||||
response = invalid
|
||||
|
||||
response = m.AwaitInternal()
|
||||
if response.IsSuccess() or response.TimedOut() or response.IsCancelled() or response.StatusCode() < 500
|
||||
return response
|
||||
end if
|
||||
tryCount -= 1
|
||||
triesLeft -= 1
|
||||
|
||||
while tryCount > 0
|
||||
while triesLeft > 0
|
||||
backoffMs = 1000 + Rnd(2000)
|
||||
LogInfo("Request failed ID:", m.urlTransfer.GetIdentity(), "ErrorMessage:", response.ErrorMessage(), `\nRetrying:`, m._tryCount - tryCount, "in", backoffMs, "ms")
|
||||
tryNumber = m._tryCount - triesLeft + 1
|
||||
LogInfo("Request failed ID:", m.urlTransfer.GetIdentity(), "ErrorMessage:", response.ErrorMessage(), `\nRetrying: (`, tryNumber, "/", m._tryCount, ") in", backoffMs, "ms")
|
||||
|
||||
m.urlTransfer = invalid
|
||||
m._cache = invalid
|
||||
@@ -307,7 +308,7 @@ namespace HttpClient
|
||||
if response.IsSuccess() or response.TimedOut() or response.IsCancelled() or response.StatusCode() < 500
|
||||
return response
|
||||
end if
|
||||
tryCount -= 1
|
||||
triesLeft -= 1
|
||||
end while
|
||||
|
||||
return response
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "playlet-web",
|
||||
"version": "0.15.1",
|
||||
"version": "0.17.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "playlet-web",
|
||||
"version": "0.15.1",
|
||||
"version": "0.17.0",
|
||||
"devDependencies": {
|
||||
"@sveltejs/vite-plugin-svelte": "^2.4.6",
|
||||
"@tailwindcss/typography": "^0.5.10",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "playlet-web",
|
||||
"version": "0.15.1",
|
||||
"version": "0.17.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
import InfoScreen from "lib/Screens/InfoScreen.svelte";
|
||||
import LinkDragDrop from "lib/LinkDragDrop.svelte";
|
||||
import BookmarksScreen from "lib/Screens/BookmarksScreen.svelte";
|
||||
import RemoteControlScreen from "lib/Screens/RemoteControlScreen.svelte";
|
||||
|
||||
onMount(async () => {
|
||||
PlayletApi.getState().then((value) => {
|
||||
@@ -71,6 +72,8 @@
|
||||
|
||||
<SettingsScreen visibility={currentScreen == "settings"} />
|
||||
|
||||
<RemoteControlScreen visibility={currentScreen == "remote"} />
|
||||
|
||||
<InfoScreen visibility={currentScreen == "info"} />
|
||||
</div>
|
||||
<BottomNavigation />
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
<svg
|
||||
width="24px"
|
||||
height="24px"
|
||||
viewBox="0 0 24 24"
|
||||
version="1.1"
|
||||
id="svg27"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<g class="fill-current">
|
||||
<path
|
||||
d="M 17.101562 0 L 6.898438 0 C 5.722656 0 4.765625 0.957031 4.765625 2.132812 L 4.765625 21.867188 C 4.765625 23.042969 5.722656 24 6.898438 24 L 17.101562 24 C 18.277344 24 19.234375 23.042969 19.234375 21.867188 L 19.234375 2.132812 C 19.234375 0.957031 18.277344 0 17.101562 0 Z M 17.8125 21.867188 C 17.8125 22.257812 17.492188 22.578125 17.101562 22.578125 L 6.898438 22.578125 C 6.507812 22.578125 6.1875 22.257812 6.1875 21.867188 L 6.1875 2.132812 C 6.1875 1.742188 6.507812 1.421875 6.898438 1.421875 L 17.101562 1.421875 C 17.492188 1.421875 17.8125 1.742188 17.8125 2.132812 Z M 17.8125 21.867188 "
|
||||
/>
|
||||
<path
|
||||
d="M 10.375 13.164062 L 8.863281 13.164062 C 8.472656 13.164062 8.152344 13.484375 8.152344 13.875 C 8.152344 14.269531 8.472656 14.585938 8.863281 14.585938 L 10.375 14.585938 C 10.769531 14.585938 11.085938 14.269531 11.085938 13.875 C 11.085938 13.484375 10.769531 13.164062 10.375 13.164062 Z M 10.375 13.164062 "
|
||||
/>
|
||||
<path
|
||||
d="M 10.375 16.105469 L 8.863281 16.105469 C 8.472656 16.105469 8.152344 16.425781 8.152344 16.816406 C 8.152344 17.210938 8.472656 17.527344 8.863281 17.527344 L 10.375 17.527344 C 10.769531 17.527344 11.085938 17.210938 11.085938 16.816406 C 11.085938 16.425781 10.769531 16.105469 10.375 16.105469 Z M 10.375 16.105469 "
|
||||
/>
|
||||
<path
|
||||
d="M 10.375 19.046875 L 8.863281 19.046875 C 8.472656 19.046875 8.152344 19.367188 8.152344 19.757812 C 8.152344 20.152344 8.472656 20.46875 8.863281 20.46875 L 10.375 20.46875 C 10.769531 20.46875 11.085938 20.152344 11.085938 19.757812 C 11.085938 19.367188 10.769531 19.046875 10.375 19.046875 Z M 10.375 19.046875 "
|
||||
/>
|
||||
<path
|
||||
d="M 15.136719 13.164062 L 13.625 13.164062 C 13.230469 13.164062 12.914062 13.484375 12.914062 13.875 C 12.914062 14.269531 13.230469 14.585938 13.625 14.585938 L 15.136719 14.585938 C 15.527344 14.585938 15.847656 14.269531 15.847656 13.875 C 15.847656 13.484375 15.527344 13.164062 15.136719 13.164062 Z M 15.136719 13.164062 "
|
||||
/>
|
||||
<path
|
||||
d="M 15.136719 16.105469 L 13.625 16.105469 C 13.230469 16.105469 12.914062 16.425781 12.914062 16.816406 C 12.914062 17.210938 13.230469 17.527344 13.625 17.527344 L 15.136719 17.527344 C 15.527344 17.527344 15.847656 17.210938 15.847656 16.816406 C 15.847656 16.425781 15.527344 16.105469 15.136719 16.105469 Z M 15.136719 16.105469 "
|
||||
/>
|
||||
<path
|
||||
d="M 15.136719 19.046875 L 13.625 19.046875 C 13.230469 19.046875 12.914062 19.367188 12.914062 19.757812 C 12.914062 20.152344 13.230469 20.46875 13.625 20.46875 L 15.136719 20.46875 C 15.527344 20.46875 15.847656 20.152344 15.847656 19.757812 C 15.847656 19.367188 15.527344 19.046875 15.136719 19.046875 Z M 15.136719 19.046875 "
|
||||
/>
|
||||
<path
|
||||
d="M 11.246094 6.660156 C 10.929688 6.660156 10.675781 6.914062 10.675781 7.226562 C 10.675781 7.542969 10.929688 7.796875 11.246094 7.796875 L 12.753906 7.796875 C 13.070312 7.796875 13.324219 7.542969 13.324219 7.226562 C 13.324219 6.914062 13.070312 6.660156 12.753906 6.660156 Z M 11.246094 6.660156 "
|
||||
/>
|
||||
<path
|
||||
d="M 10.914062 5.3125 C 11.0625 5.3125 11.207031 5.257812 11.316406 5.148438 L 12.027344 4.4375 L 12.683594 5.089844 C 12.902344 5.3125 13.265625 5.3125 13.488281 5.089844 C 13.710938 4.867188 13.710938 4.507812 13.488281 4.285156 L 12.496094 3.296875 C 12.238281 3.039062 11.816406 3.039062 11.558594 3.296875 L 10.511719 4.34375 C 10.289062 4.5625 10.289062 4.925781 10.511719 5.148438 C 10.625 5.257812 10.769531 5.3125 10.914062 5.3125 Z M 10.914062 5.3125 "
|
||||
/>
|
||||
<path
|
||||
d="M 13.488281 9.308594 C 13.265625 9.085938 12.902344 9.085938 12.683594 9.308594 L 11.972656 10.019531 L 11.316406 9.363281 C 11.097656 9.140625 10.734375 9.140625 10.511719 9.363281 C 10.292969 9.585938 10.292969 9.945312 10.511719 10.167969 L 11.503906 11.160156 C 11.632812 11.289062 11.800781 11.351562 11.972656 11.351562 C 12.140625 11.351562 12.3125 11.289062 12.441406 11.160156 L 13.488281 10.113281 C 13.710938 9.890625 13.710938 9.53125 13.488281 9.308594 Z M 13.488281 9.308594 "
|
||||
/>
|
||||
<path
|
||||
d="M 14.886719 5.742188 C 14.664062 5.519531 14.304688 5.519531 14.082031 5.742188 C 13.859375 5.960938 13.859375 6.324219 14.082031 6.546875 L 14.792969 7.253906 L 14.136719 7.910156 C 13.914062 8.132812 13.914062 8.492188 14.136719 8.714844 C 14.25 8.824219 14.394531 8.882812 14.539062 8.882812 C 14.683594 8.882812 14.832031 8.824219 14.941406 8.714844 L 15.929688 7.726562 C 16.191406 7.464844 16.191406 7.046875 15.929688 6.785156 Z M 14.886719 5.742188 "
|
||||
/>
|
||||
<path
|
||||
d="M 9.515625 8.882812 C 9.664062 8.882812 9.808594 8.824219 9.917969 8.714844 C 10.140625 8.492188 10.140625 8.132812 9.917969 7.910156 L 9.207031 7.199219 L 9.863281 6.546875 C 10.085938 6.324219 10.085938 5.964844 9.863281 5.742188 C 9.640625 5.519531 9.28125 5.519531 9.058594 5.742188 L 8.070312 6.730469 C 7.808594 6.988281 7.808594 7.410156 8.070312 7.667969 L 9.113281 8.714844 C 9.226562 8.824219 9.371094 8.882812 9.515625 8.882812 Z M 9.515625 8.882812 "
|
||||
/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 5.1 KiB |
@@ -0,0 +1,18 @@
|
||||
<svg
|
||||
name="arrow-back"
|
||||
class="ret-icon arrow-back remote-arrow-back"
|
||||
width="14px"
|
||||
height="14px"
|
||||
viewBox="0 0 17 14"
|
||||
><g
|
||||
><g fill="#FFF" transform="translate(-183 -616)"
|
||||
><g transform="translate(111 553)"
|
||||
><g transform="translate(15 49)"
|
||||
><path
|
||||
d="M72.115 19.39l.025.006H61.433l3.366-3.374a.876.876 0 00.255-.622.874.874 0 00-.255-.62l-.524-.524a.868.868 0 00-.618-.256.868.868 0 00-.618.255l-5.77 5.77a.867.867 0 00-.255.619c0 .235.09.456.255.62l5.77 5.77a.868.868 0 00.618.255c.234 0 .454-.09.618-.255l.524-.524a.867.867 0 00.255-.618.84.84 0 00-.255-.606l-3.404-3.392h10.732a.907.907 0 00.887-.898v-.74c0-.483-.417-.866-.9-.866z"
|
||||
/></g
|
||||
></g
|
||||
></g
|
||||
></g
|
||||
>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 744 B |
@@ -0,0 +1,12 @@
|
||||
<svg
|
||||
name="arrow_down"
|
||||
class="ret-icon arrow_down remote-arrow-down"
|
||||
width="14px"
|
||||
height="14px"
|
||||
viewBox="0 0 18 12"
|
||||
><polygon
|
||||
fill="#FFF"
|
||||
transform="translate(-68.000000, -1097.000000) translate(68.000000, 1097.000000) translate(9.000000, 5.928571) rotate(90.000000) translate(-9.000000, -5.928571) "
|
||||
points="5.58223573 -3.07142857 3.5 -0.969991371 10.3355285 5.92857143 3.5 12.8252596 5.58223573 14.9285714 14.5 5.92857143"
|
||||
/></svg
|
||||
>
|
||||
|
After Width: | Height: | Size: 461 B |
@@ -0,0 +1,12 @@
|
||||
<svg
|
||||
name="arrow_left"
|
||||
class="ret-icon arrow_left remote-arrow-down"
|
||||
width="14px"
|
||||
height="14px"
|
||||
viewBox="0 0 13 18"
|
||||
><polygon
|
||||
fill="#FFF"
|
||||
transform="translate(-426.000000, -1322.000000) translate(427.000000, 1322.000000) translate(5.500000, 9.000000) scale(-1, 1) translate(-5.500000, -9.000000) "
|
||||
points="2.08223573 0 0 2.1014372 6.83552854 9 0 15.8966882 2.08223573 18 11 9"
|
||||
/></svg
|
||||
>
|
||||
|
After Width: | Height: | Size: 413 B |
@@ -0,0 +1,12 @@
|
||||
<svg
|
||||
name="arrow_right"
|
||||
class="ret-icon arrow_right remote-arrow-down"
|
||||
width="14px"
|
||||
height="14px"
|
||||
viewBox="0 0 13 18"
|
||||
><polygon
|
||||
fill="#FFF"
|
||||
points="2.08223573 0 0 2.1014372 6.83552854 9 0 15.8966882 2.08223573 18 11 9"
|
||||
transform="translate(-360.000000, -809.000000) translate(361.000000, 809.000000)"
|
||||
/></svg
|
||||
>
|
||||
|
After Width: | Height: | Size: 337 B |
@@ -0,0 +1,12 @@
|
||||
<svg
|
||||
name="arrow_up"
|
||||
class="ret-icon arrow_up remote-arrow-down"
|
||||
width="14px"
|
||||
height="14px"
|
||||
viewBox="0 0 18 12"
|
||||
><polygon
|
||||
fill="#FFF"
|
||||
transform="translate(-423.000000, -1139.000000) translate(423.000000, 1139.000000) translate(9.000000, 6.071429) scale(1, -1) rotate(90.000000) translate(-9.000000, -6.071429) "
|
||||
points="5.58223573 -2.92857143 3.5 -0.827134228 10.3355285 6.07142857 3.5 12.9681168 5.58223573 15.0714286 14.5 6.07142857"
|
||||
/></svg
|
||||
>
|
||||
|
After Width: | Height: | Size: 472 B |
@@ -0,0 +1,16 @@
|
||||
<svg name="fast-forward-left" width="14px" height="14px" viewBox="0 0 21 15"
|
||||
><g
|
||||
><g fill="#FFF" transform="translate(-158 -886)"
|
||||
><g transform="translate(111 553)"
|
||||
><g transform="translate(15 49)"
|
||||
><g transform="translate(0 270)"
|
||||
><path
|
||||
d="M51.919 20.73l-9.474-6.666a.35.35 0 00-.552.287v6.237l-9.272-6.52a.352.352 0 00-.553.287V27.68a.351.351 0 00.553.287l9.272-6.52v6.237a.351.351 0 00.552.287l9.474-6.667a.35.35 0 000-.573z"
|
||||
transform="matrix(-1 0 0 1 84.136 0)"
|
||||
/></g
|
||||
></g
|
||||
></g
|
||||
></g
|
||||
></g
|
||||
></svg
|
||||
>
|
||||
|
After Width: | Height: | Size: 614 B |
@@ -0,0 +1,15 @@
|
||||
<svg name="fast-forward-right" width="14px" height="14px" viewBox="0 0 21 15"
|
||||
><g
|
||||
><g fill="#FFF" transform="translate(-344 -886)"
|
||||
><g transform="translate(111 553)"
|
||||
><g transform="translate(15 49)"
|
||||
><g transform="translate(185.1 270)"
|
||||
><path
|
||||
d="M53.449 20.73l-9.474-6.666a.35.35 0 00-.553.287v6.237l-9.272-6.52a.352.352 0 00-.552.287V27.68a.351.351 0 00.552.287l9.272-6.52v6.237a.351.351 0 00.553.287l9.474-6.667a.35.35 0 000-.573z"
|
||||
/></g
|
||||
></g
|
||||
></g
|
||||
></g
|
||||
></g
|
||||
></svg
|
||||
>
|
||||
|
After Width: | Height: | Size: 567 B |
@@ -0,0 +1,20 @@
|
||||
<svg
|
||||
name="home"
|
||||
class="ret-icon home remote-home"
|
||||
width="14px"
|
||||
height="14px"
|
||||
viewBox="0 0 16 14"
|
||||
><g
|
||||
><g fill="#FFF" transform="translate(-323 -615)"
|
||||
><g transform="translate(111 553)"
|
||||
><g transform="translate(15 49)"
|
||||
><g transform="translate(139.972)"
|
||||
><path
|
||||
d="M59.0141643 27L64.013762 27 64.013762 23 66.0141643 23 66.0141643 27 71.0143655 27 71.0143655 21 73.0141643 21 65.0143655 13 57.0141643 21 59.0141643 21z"
|
||||
/></g
|
||||
></g
|
||||
></g
|
||||
></g
|
||||
></g
|
||||
></svg
|
||||
>
|
||||
|
After Width: | Height: | Size: 562 B |
@@ -0,0 +1,15 @@
|
||||
<svg name="repeat" width="15px" height="15px" viewBox="0 0 16 17" version="1.1">
|
||||
<g transform="matrix(-1,0,0,1,16.794,0)">
|
||||
<g fill="#FFF" transform="translate(-183,-830)" id="g10">
|
||||
<g transform="translate(111,553)" id="g8">
|
||||
<g transform="translate(15,49)" id="g6">
|
||||
<g transform="translate(0,216)" id="g4">
|
||||
<path
|
||||
d="m 57.887742,20.527863 c -0.01443,-4.135974 3.340802,-7.511707 7.475774,-7.52614 4.134976,-0.01444 7.513698,3.337791 7.528138,7.473764 10e-4,0.274999 -0.01404,0.552055 -0.04411,0.828162 l 1.211993,-0.0042 c 0.156,-4.77e-4 0.298335,0.09496 0.358829,0.236747 a 0.393,0.393 0 0 1 -0.08553,0.423301 l -2.653708,2.667279 a 0.385,0.385 0 0 1 -0.545994,0.0019 L 68.45488,21.98201 a 0.392,0.392 0 0 1 -0.08548,-0.424706 0.392,0.392 0 0 1 0.356171,-0.239241 l 1.34499,-0.0047 a 4.757,4.757 0 0 0 -4.69745,-5.563635 4.759,4.759 0 0 0 -4.735383,4.768557 c 0.0091,2.619984 2.150567,4.742521 4.768552,4.733384 0.212996,-6.83e-4 0.387608,0.172645 0.388357,0.387644 l 0.0069,1.972989 c 7.66e-4,0.213998 -0.172644,0.388607 -0.385644,0.38935 -4.134973,0.01444 -7.513706,-3.340793 -7.528134,-7.473769 z"
|
||||
/>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.2 KiB |
@@ -0,0 +1 @@
|
||||
<span class="font-semibold text-sm select-none">OK</span>
|
||||
@@ -0,0 +1,15 @@
|
||||
<svg name="asterisc" width="14px" height="14px" viewBox="0 0 16 17"
|
||||
><g
|
||||
><g fill="#FFF" transform="translate(-323 -830)"
|
||||
><g transform="translate(111 553)"
|
||||
><g transform="translate(15 49)"
|
||||
><g transform="translate(139.972 216)"
|
||||
><path
|
||||
d="M72.132 17.016c0 .738-.864 1.46-2.59 2.166-1.743.707-2.63 1.123-2.661 1.248-.032.173.8.55 2.496 1.13 1.68.597 2.52 1.327 2.52 2.19 0 .22-.048.448-.142.683-.267.707-.683 1.06-1.248 1.06-.33 0-.726-.134-1.19-.4-.462-.267-1.016-.66-1.66-1.178-1.145-.957-1.789-1.381-1.93-1.271-.063.047-.094.164-.094.353 0 .157.07.69.211 1.601.142.926.212 1.64.212 2.143 0 1.444-.51 2.19-1.53 2.237-1.1.016-1.649-.714-1.649-2.19 0-.251.02-.557.06-.918.039-.361.097-.77.176-1.225.173-.957.259-1.523.259-1.695 0-.22-.055-.37-.165-.448-.173-.125-.761.306-1.766 1.295-1.115 1.1-2.033 1.649-2.755 1.649-.361 0-.707-.118-1.036-.353-.346-.267-.518-.55-.518-.848 0-.644.832-1.42 2.496-2.331 1.648-.91 2.457-1.452 2.425-1.625-.015-.283-.824-.683-2.425-1.201s-2.402-1.209-2.402-2.072c0-.267.086-.589.259-.966.204-.518.542-.777 1.013-.777.627 0 1.593.55 2.896 1.649 1.224 1.004 1.915 1.452 2.072 1.342a.67.67 0 00.094-.377c0-.204-.11-.816-.33-1.837a33.535 33.535 0 01-.223-1.318 6.849 6.849 0 01-.082-.966c0-1.177.502-1.766 1.507-1.766.957 0 1.436.644 1.436 1.93 0 .44-.07 1.092-.212 1.955-.141.848-.212 1.413-.212 1.696 0 .392.094.62.283.683.188.063.855-.408 2.001-1.413 1.146-1.02 2.057-1.53 2.732-1.53.408 0 .793.18 1.154.54.345.346.518.73.518 1.155z"
|
||||
/></g
|
||||
></g
|
||||
></g
|
||||
></g
|
||||
></g
|
||||
></svg
|
||||
>
|
||||
|
After Width: | Height: | Size: 1.6 KiB |
@@ -0,0 +1,15 @@
|
||||
<svg name="play" width="14px" height="14px" viewBox="0 0 11 14"
|
||||
><g
|
||||
><g fill="#FFF" transform="translate(-258 -886)"
|
||||
><g transform="translate(111 553)"
|
||||
><g transform="translate(15 49)"
|
||||
><g transform="translate(92.55 270)"
|
||||
><path
|
||||
d="M50.278 20.725L40.61 14.06a.335.335 0 00-.523.274v13.334a.334.334 0 00.523.274l9.667-6.667a.333.333 0 000-.549z"
|
||||
/></g
|
||||
></g
|
||||
></g
|
||||
></g
|
||||
></g
|
||||
></svg
|
||||
>
|
||||
|
After Width: | Height: | Size: 478 B |
@@ -0,0 +1,13 @@
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="22"
|
||||
height="22"
|
||||
fill="currentColor"
|
||||
class="bi bi-power"
|
||||
viewBox="0 0 16 16"
|
||||
>
|
||||
<path d="M7.5 1v7h1V1h-1z" />
|
||||
<path
|
||||
d="M3 8.812a4.999 4.999 0 0 1 2.578-4.375l-.485-.874A6 6 0 1 0 11 3.616l-.501.865A5 5 0 1 1 3 8.812z"
|
||||
/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 295 B |
@@ -0,0 +1,12 @@
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="22"
|
||||
height="22"
|
||||
fill="currentColor"
|
||||
class="bi bi-volume-down-fill"
|
||||
viewBox="0 0 16 16"
|
||||
>
|
||||
<path
|
||||
d="M9 4a.5.5 0 0 0-.812-.39L5.825 5.5H3.5A.5.5 0 0 0 3 6v4a.5.5 0 0 0 .5.5h2.325l2.363 1.89A.5.5 0 0 0 9 12V4zm3.025 4a4.486 4.486 0 0 1-1.318 3.182L10 10.475A3.489 3.489 0 0 0 11.025 8 3.49 3.49 0 0 0 10 5.525l.707-.707A4.486 4.486 0 0 1 12.025 8z"
|
||||
/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 422 B |
@@ -0,0 +1,12 @@
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="22"
|
||||
height="22"
|
||||
fill="currentColor"
|
||||
class="bi bi-volume-mute-fill"
|
||||
viewBox="0 0 16 16"
|
||||
>
|
||||
<path
|
||||
d="M6.717 3.55A.5.5 0 0 1 7 4v8a.5.5 0 0 1-.812.39L3.825 10.5H1.5A.5.5 0 0 1 1 10V6a.5.5 0 0 1 .5-.5h2.325l2.363-1.89a.5.5 0 0 1 .529-.06zm7.137 2.096a.5.5 0 0 1 0 .708L12.207 8l1.647 1.646a.5.5 0 0 1-.708.708L11.5 8.707l-1.646 1.647a.5.5 0 0 1-.708-.708L10.793 8 9.146 6.354a.5.5 0 1 1 .708-.708L11.5 7.293l1.646-1.647a.5.5 0 0 1 .708 0z"
|
||||
/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 512 B |
@@ -0,0 +1,18 @@
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="22"
|
||||
height="22"
|
||||
fill="currentColor"
|
||||
class="bi bi-volume-up-fill"
|
||||
viewBox="0 0 16 16"
|
||||
>
|
||||
<path
|
||||
d="M11.536 14.01A8.473 8.473 0 0 0 14.026 8a8.473 8.473 0 0 0-2.49-6.01l-.708.707A7.476 7.476 0 0 1 13.025 8c0 2.071-.84 3.946-2.197 5.303l.708.707z"
|
||||
/>
|
||||
<path
|
||||
d="M10.121 12.596A6.48 6.48 0 0 0 12.025 8a6.48 6.48 0 0 0-1.904-4.596l-.707.707A5.483 5.483 0 0 1 11.025 8a5.483 5.483 0 0 1-1.61 3.89l.706.706z"
|
||||
/>
|
||||
<path
|
||||
d="M8.707 11.182A4.486 4.486 0 0 0 10.025 8a4.486 4.486 0 0 0-1.318-3.182L8 5.525A3.489 3.489 0 0 1 9.025 8 3.49 3.49 0 0 1 8 10.475l.707.707zM6.717 3.55A.5.5 0 0 1 7 4v8a.5.5 0 0 1-.812.39L3.825 10.5H1.5A.5.5 0 0 1 1 10V6a.5.5 0 0 1 .5-.5h2.325l2.363-1.89a.5.5 0 0 1 .529-.06z"
|
||||
/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 780 B |
@@ -0,0 +1,33 @@
|
||||
import { getIp } from "./Host";
|
||||
|
||||
export class ExternalControlProtocol {
|
||||
static async launchApp(appId) {
|
||||
console.log("Launching app", appId)
|
||||
return fetch(`http://${getIp()}:8060/launch/${appId}`, {
|
||||
method: 'POST',
|
||||
body: '',
|
||||
})
|
||||
}
|
||||
static async pressKey(key) {
|
||||
return fetch(`http://${getIp()}:8060/keypress/${key}`, {
|
||||
method: 'POST',
|
||||
body: '',
|
||||
})
|
||||
}
|
||||
|
||||
static async pressKeyUp(key) {
|
||||
console.log("Pressing key up", key)
|
||||
return fetch(`http://${getIp()}:8060/keyup/${key}`, {
|
||||
method: 'POST',
|
||||
body: '',
|
||||
})
|
||||
}
|
||||
|
||||
static async pressKeyDown(key) {
|
||||
console.log("Pressing key down", key)
|
||||
return fetch(`http://${getIp()}:8060/keydown/${key}`, {
|
||||
method: 'POST',
|
||||
body: '',
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -3,4 +3,9 @@ function getHost() {
|
||||
return urlSearchParams.get('host') ?? window.location.host
|
||||
}
|
||||
|
||||
export { getHost }
|
||||
function getIp() {
|
||||
const host = getHost()
|
||||
return host.split(':')[0]
|
||||
}
|
||||
|
||||
export { getHost, getIp }
|
||||
@@ -4,6 +4,7 @@
|
||||
import SearchIcon from "../assets/search-icon.svg.svelte";
|
||||
import SettingsIcon from "../assets/settings-icon.svg.svelte";
|
||||
import BookmarksIcon from "../assets/star-icon.svg.svelte";
|
||||
import RemoteIcon from "../assets/remote-control.svg.svelte";
|
||||
|
||||
import { appStateStore } from "lib/Stores";
|
||||
import type { AppState } from "lib/Types";
|
||||
@@ -55,6 +56,14 @@
|
||||
<SettingsIcon />
|
||||
</div>
|
||||
</button>
|
||||
<button
|
||||
on:click={() => setScreen("remote")}
|
||||
class={$appStateStore.screen === "remote" ? "active" : ""}
|
||||
>
|
||||
<div class="h-6">
|
||||
<RemoteIcon />
|
||||
</div>
|
||||
</button>
|
||||
<button
|
||||
on:click={() => setScreen("info")}
|
||||
class={$appStateStore.screen === "info" ? "active" : ""}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
import playletLogoLight from "assets/logo-light.svg";
|
||||
import UserIcon from "assets/user.svg.svelte";
|
||||
import { PlayletApi } from "lib/Api/PlayletApi";
|
||||
import { ExternalControlProtocol } from "lib/Api/ExternalControlProtocol";
|
||||
import { appThemeStore, playletStateStore } from "lib/Stores";
|
||||
import ThemeSelect from "lib/ThemeToggle.svelte";
|
||||
|
||||
@@ -12,10 +13,14 @@
|
||||
let currentInstance;
|
||||
let loggedInInstance;
|
||||
let username;
|
||||
let appId = "693751";
|
||||
|
||||
playletStateStore.subscribe((value) => {
|
||||
version = value?.app?.lib_version ?? "";
|
||||
if (value?.app?.id === "dev") {
|
||||
if (value?.app?.id) {
|
||||
appId = value?.app?.id;
|
||||
}
|
||||
if (appId === "dev") {
|
||||
version += "-dev";
|
||||
}
|
||||
if (
|
||||
@@ -49,11 +54,13 @@
|
||||
|
||||
<div class="navbar bg-base-100 sticky top-0 z-40">
|
||||
<div class="flex-1">
|
||||
<img
|
||||
src={$appThemeStore === "dark" ? playletLogoDark : playletLogoLight}
|
||||
class="h-8"
|
||||
alt="Playlet Logo"
|
||||
/>
|
||||
<button on:click={() => ExternalControlProtocol.launchApp(appId)}>
|
||||
<img
|
||||
src={$appThemeStore === "dark" ? playletLogoDark : playletLogoLight}
|
||||
class="h-8"
|
||||
alt="Playlet Logo"
|
||||
/>
|
||||
</button>
|
||||
<h4 class="label brightness-75">{version}</h4>
|
||||
</div>
|
||||
<div class="flex-none">
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
<script lang="ts">
|
||||
import { ExternalControlProtocol } from "lib/Api/ExternalControlProtocol";
|
||||
import { onDestroy, onMount } from "svelte";
|
||||
|
||||
export let key: string;
|
||||
export let icon;
|
||||
export let small: boolean = false;
|
||||
|
||||
let button;
|
||||
|
||||
onMount(() => {
|
||||
const isTouchDevice = "ontouchstart" in document.documentElement;
|
||||
if (isTouchDevice) {
|
||||
button.addEventListener("touchstart", pressKeyDown);
|
||||
button.addEventListener("touchend", pressKeyUp);
|
||||
button.addEventListener("touchcancel", onMouseLeave);
|
||||
} else {
|
||||
button.addEventListener("mousedown", pressKeyDown);
|
||||
button.addEventListener("mouseup", pressKeyUp);
|
||||
button.addEventListener("mouseleave", onMouseLeave);
|
||||
}
|
||||
});
|
||||
|
||||
onDestroy(() => {
|
||||
const isTouchDevice = "ontouchstart" in document.documentElement;
|
||||
if (isTouchDevice) {
|
||||
button.removeEventListener("touchstart", pressKeyDown);
|
||||
button.removeEventListener("touchend", pressKeyUp);
|
||||
button.removeEventListener("touchcancel", onMouseLeave);
|
||||
} else {
|
||||
button.removeEventListener("mousedown", pressKeyDown);
|
||||
button.removeEventListener("mouseup", pressKeyUp);
|
||||
button.removeEventListener("mouseleave", onMouseLeave);
|
||||
}
|
||||
});
|
||||
|
||||
let isDown = false;
|
||||
function pressKeyDown() {
|
||||
isDown = true;
|
||||
ExternalControlProtocol.pressKeyDown(key);
|
||||
}
|
||||
|
||||
function pressKeyUp() {
|
||||
isDown = false;
|
||||
ExternalControlProtocol.pressKeyUp(key);
|
||||
}
|
||||
|
||||
function onMouseLeave() {
|
||||
if (isDown) {
|
||||
pressKeyUp();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<button
|
||||
bind:this={button}
|
||||
class="{small
|
||||
? 'w-16'
|
||||
: 'w-24'} h-11 btn-primary rounded-full flex items-center justify-center"
|
||||
>
|
||||
<svelte:component this={icon} />
|
||||
</button>
|
||||
@@ -0,0 +1,151 @@
|
||||
<script lang="ts">
|
||||
import { ExternalControlProtocol } from "lib/Api/ExternalControlProtocol";
|
||||
|
||||
import HomeIcon from "assets/remote-control/home.svg.svelte";
|
||||
import ArrowBackIcon from "assets/remote-control/arrow-back.svg.svelte";
|
||||
import ArrowUpIcon from "assets/remote-control/arrow-up.svg.svelte";
|
||||
import ArrowDownIcon from "assets/remote-control/arrow-down.svg.svelte";
|
||||
import ArrowLeftIcon from "assets/remote-control/arrow-left.svg.svelte";
|
||||
import ArrowRightIcon from "assets/remote-control/arrow-right.svg.svelte";
|
||||
import OkIcon from "assets/remote-control/ok.svelte";
|
||||
import InstantReplayIcon from "assets/remote-control/instant-replay.svg.svelte";
|
||||
import OptionsIcon from "assets/remote-control/options.svg.svelte";
|
||||
import FastForwardIcon from "assets/remote-control/fast-forward.svg.svelte";
|
||||
import FastBackwardIcon from "assets/remote-control/fast-backward.svg.svelte";
|
||||
import PlayIcon from "assets/remote-control/play.svg.svelte";
|
||||
import VolumeDownIcon from "assets/remote-control/volume-down.svg.svelte";
|
||||
import VolumeMuteIcon from "assets/remote-control/volume-mute.svg.svelte";
|
||||
import VolumeUpIcon from "assets/remote-control/volume-up.svg.svelte";
|
||||
import PowerIcon from "assets/remote-control/power.svg.svelte";
|
||||
|
||||
import RemoteButton from "./RemoteControl/RemoteButton.svelte";
|
||||
import { onDestroy, onMount } from "svelte";
|
||||
|
||||
export let visibility: boolean;
|
||||
let screen;
|
||||
|
||||
const BUTTONS = {
|
||||
home: "Home",
|
||||
rev: "Rev",
|
||||
fwd: "Fwd",
|
||||
play: "Play",
|
||||
select: "Select",
|
||||
left: "Left",
|
||||
right: "Right",
|
||||
down: "Down",
|
||||
up: "Up",
|
||||
back: "Back",
|
||||
instantReplay: "InstantReplay",
|
||||
info: "Info",
|
||||
backspace: "Backspace",
|
||||
search: "Search",
|
||||
enter: "Enter",
|
||||
volumeDown: "VolumeDown",
|
||||
volumeMute: "VolumeMute",
|
||||
volumeUp: "VolumeUp",
|
||||
powerOff: "PowerOff",
|
||||
};
|
||||
|
||||
const KEYBOARD_BUTTONS = {
|
||||
ArrowRight: BUTTONS.right,
|
||||
ArrowLeft: BUTTONS.left,
|
||||
ArrowUp: BUTTONS.up,
|
||||
ArrowDown: BUTTONS.down,
|
||||
Enter: BUTTONS.select,
|
||||
Backspace: BUTTONS.backspace,
|
||||
Escape: BUTTONS.back,
|
||||
"*": BUTTONS.info,
|
||||
};
|
||||
|
||||
onMount(() => {
|
||||
screen.addEventListener("keydown", onKeyDown);
|
||||
screen.addEventListener("keyup", onKeyUp);
|
||||
// TODO:P1 support navigator.mediaSession
|
||||
// media buttons, such as play/pause, next, and previous track.
|
||||
// metadata, like title, artist, album, artwork
|
||||
});
|
||||
|
||||
onDestroy(() => {
|
||||
screen.removeEventListener("keydown", onKeyDown);
|
||||
screen.removeEventListener("keyup", onKeyUp);
|
||||
});
|
||||
|
||||
function onKeyDown(event) {
|
||||
if (!visibility) {
|
||||
return;
|
||||
}
|
||||
event.preventDefault();
|
||||
if (event.repeat) {
|
||||
return;
|
||||
}
|
||||
if (event.key in KEYBOARD_BUTTONS) {
|
||||
ExternalControlProtocol.pressKeyDown(KEYBOARD_BUTTONS[event.key]);
|
||||
} else {
|
||||
ExternalControlProtocol.pressKeyDown(
|
||||
"Lit_" + encodeURIComponent(event.key)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function onKeyUp(event) {
|
||||
if (!visibility) {
|
||||
return;
|
||||
}
|
||||
event.preventDefault();
|
||||
if (event.repeat) {
|
||||
return;
|
||||
}
|
||||
if (event.key in KEYBOARD_BUTTONS) {
|
||||
ExternalControlProtocol.pressKeyUp(KEYBOARD_BUTTONS[event.key]);
|
||||
} else {
|
||||
ExternalControlProtocol.pressKeyUp(
|
||||
"Lit_" + encodeURIComponent(event.key)
|
||||
);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<div bind:this={screen} tabindex="-1" class={visibility ? "" : "hidden"}>
|
||||
<div class="flex flex-col items-center justify-center p-6">
|
||||
<div class="flex space-x-2 m-2">
|
||||
<button
|
||||
on:click={() => {
|
||||
ExternalControlProtocol.pressKey(BUTTONS.powerOff);
|
||||
}}
|
||||
class="btn-primary rounded-full flex items-center justify-center bg-red-600 hover:bg-red-400 w-12 h-12 text-white"
|
||||
>
|
||||
<PowerIcon />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="flex space-x-2 m-2">
|
||||
<RemoteButton key={BUTTONS.back} icon={ArrowBackIcon} />
|
||||
<RemoteButton key={BUTTONS.home} icon={HomeIcon} />
|
||||
</div>
|
||||
<div class="flex space-x-2 m-2">
|
||||
<RemoteButton key={BUTTONS.up} icon={ArrowUpIcon} small />
|
||||
</div>
|
||||
<div class="flex space-x-2 m-2">
|
||||
<RemoteButton key={BUTTONS.left} icon={ArrowLeftIcon} small />
|
||||
<RemoteButton key={BUTTONS.select} icon={OkIcon} small />
|
||||
<RemoteButton key={BUTTONS.right} icon={ArrowRightIcon} small />
|
||||
</div>
|
||||
<div class="flex space-x-2 m-2">
|
||||
<RemoteButton key={BUTTONS.down} icon={ArrowDownIcon} small />
|
||||
</div>
|
||||
<div class="flex space-x-2 m-2">
|
||||
<RemoteButton key={BUTTONS.instantReplay} icon={InstantReplayIcon} />
|
||||
<RemoteButton key={BUTTONS.info} icon={OptionsIcon} />
|
||||
</div>
|
||||
<div class="flex space-x-2 m-2">
|
||||
<RemoteButton key={BUTTONS.rev} icon={FastBackwardIcon} small />
|
||||
<RemoteButton key={BUTTONS.play} icon={PlayIcon} small />
|
||||
<RemoteButton key={BUTTONS.fwd} icon={FastForwardIcon} small />
|
||||
</div>
|
||||
<div class="flex space-x-2 m-2">
|
||||
<RemoteButton key={BUTTONS.volumeMute} icon={VolumeMuteIcon} small />
|
||||
<RemoteButton key={BUTTONS.volumeDown} icon={VolumeDownIcon} small />
|
||||
<RemoteButton key={BUTTONS.volumeUp} icon={VolumeUpIcon} small />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,5 +1,5 @@
|
||||
export type AppState = {
|
||||
screen: "search" | "home" | "bookmarks" | "settings" | "info"
|
||||
screen: "search" | "home" | "bookmarks" | "settings" | "info" | "remote"
|
||||
}
|
||||
|
||||
export type PlayletState = {
|
||||
|
||||