Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5c0bc3c82c | ||
|
|
d99151ff21 | ||
|
|
6e84809923 | ||
|
|
e993ac3b59 | ||
|
|
d301b3fff7 | ||
|
|
f452bf23de | ||
|
|
38a054a46a | ||
|
|
f60d8b6caf | ||
|
|
6c29993437 | ||
|
|
52fc935598 | ||
|
|
ae82ad4b28 | ||
|
|
b7fe0feb94 | ||
|
|
0cd9758538 | ||
|
|
a1f2e4de52 | ||
|
|
503370f4d7 | ||
|
|
8acb7c64de | ||
|
|
50858c150f |
No files matched your search
@@ -52,18 +52,18 @@ jobs:
|
||||
- name: Run Analysis on Playlet App
|
||||
run: ./sca-cmd/bin/sca-cmd ./release/playlet.zip --exit error
|
||||
|
||||
- name: Delete unstable release
|
||||
- name: Delete Canary release
|
||||
uses: dev-drprasad/delete-tag-and-release@v1.0
|
||||
with:
|
||||
tag_name: unstable
|
||||
tag_name: canary
|
||||
github_token: ${{ secrets.GH_TOKEN }}
|
||||
|
||||
- name: Extract changelog
|
||||
run: |
|
||||
latest_release=$(awk 'BEGIN { RS="## \\[" } NR==2 { print "## ["$0 }' CHANGELOG.md)
|
||||
echo -e "\n$latest_release" >> docs/unstable-changelog.md
|
||||
echo -e "\n$latest_release" >> docs/canary-changelog.md
|
||||
|
||||
- name: Create unstable release
|
||||
run: gh release create unstable ./release/playlet.zip ./release/playlet-lib.zip --notes-file docs/unstable-changelog.md --prerelease --title unstable
|
||||
- name: Create Canary release
|
||||
run: gh release create canary ./release/playlet.zip ./release/playlet-lib.zip --notes-file docs/canary-changelog.md --prerelease --title Canary
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GH_TOKEN }}
|
||||
@@ -5,6 +5,19 @@ 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.12.0] - 2023-09-17
|
||||
|
||||
### Added
|
||||
|
||||
- A field to indicate when a playlist was last updated
|
||||
- Voice search in search page
|
||||
- Basic support for channels (open channel, see latest videos)
|
||||
- Search filters (Upload date, type, duration, features, and sort by)
|
||||
|
||||
### Changed
|
||||
|
||||
- Renamed `Unstable` releases to `Canary`
|
||||
|
||||
## [0.11.0] - 2023-09-10
|
||||
|
||||
This version went through a major refactor, which resulted in a different arcitecture of the app to support new features, the rewrite of many pieces, as well as new features.
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<img alt="Current Release" src="https://img.shields.io/github/release/iBicha/playlet.svg"/>
|
||||
<img alt="Total Downloads" src="https://img.shields.io/github/downloads/iBicha/playlet/latest/playlet-lib.zip.svg"/>
|
||||
</a>
|
||||
<a href="https://github.com/iBicha/playlet">
|
||||
<a href="/LICENSE">
|
||||
<img alt="AGPL-3.0 license" src="https://img.shields.io/github/license/iBicha/playlet.svg"/>
|
||||
</a>
|
||||
<a href="https://channelstore.roku.com/en-ca/details/840aec36f51bfe6d96cf6db9055a372a/playlet">
|
||||
@@ -56,7 +56,7 @@ More under [Screenshots](./docs/screenshots/README.md)
|
||||
### Picture-in-picture
|
||||
|
||||
- When viewing a video in full screen, press ⬇️ (down) button on your remote to shrink the video
|
||||
- You can browser or search for videos while you watch
|
||||
- You can browse or search for videos while you watch
|
||||
- To restore currently playing video to full screen, press the ✳️ (options) button
|
||||
|
||||
### Customize Invidious instance
|
||||
|
||||
@@ -19,12 +19,11 @@ This document contains various kinds of information related to Playlet developme
|
||||
- [Debug endpoints](#debug-endpoints)
|
||||
- [Releases from Github](#releases-from-github)
|
||||
- [Dev library hosted by VS Code Extension](#dev-library-hosted-by-vs-code-extension)
|
||||
- [AsyncAwait Task Generator](#asyncawait-task-generator)
|
||||
- [Feature flags](#feature-flags)
|
||||
- [User preferences](#user-preferences)
|
||||
- [Home page layout](#home-page-layout)
|
||||
- [Playlet Web App](#playlet-web-app)
|
||||
- [Testing](#testing)
|
||||
- [Playlet Web App](#playlet-web-app)
|
||||
- [Svelte development](#svelte-development)
|
||||
- [Tailwind/Daisy UI](#tailwinddaisy-ui)
|
||||
- [API calls (proxy authenticated)](#api-calls-proxy-authenticated)
|
||||
@@ -291,7 +290,7 @@ The developer settings are only visible through the web app. They are found at t
|
||||
|
||||
For now, it allows you to point to a different Github release other than the default `latest`.
|
||||
|
||||
This is mostly useful to QA the `unstable` release in a "production" setting before making it available to all users as the official "latest" version. Consider the `unstable` version a [Canary release](https://en.wikipedia.org/wiki/Feature_toggle#Canary_release)
|
||||
This is mostly useful to QA the `canary` release (see [Canary release](https://en.wikipedia.org/wiki/Feature_toggle#Canary_release)) in a "production" setting before making it available to all users as the official "latest" version.
|
||||
|
||||
#### In case of a softlock
|
||||
|
||||
@@ -307,8 +306,8 @@ This will remove the custom lib, and revert to using default (latest release fro
|
||||
|
||||
On pull requests, a Github action will run `lint:fix` and `format:fix` and push changes to the PR branch, to keep things tidy.
|
||||
|
||||
When merged to main branch, a Github action will build Playlet, run static analysis using Roku's [Static Channel Analysis tool](https://devtools.web.roku.com/#static-channel-analysis-tool), and release a new version tagged `unstable`, with the build artifacts attached, and changelog included.
|
||||
When merged to main branch, a Github action will build Playlet, run static analysis using Roku's [Static Channel Analysis tool](https://devtools.web.roku.com/#static-channel-analysis-tool), and release a new version tagged `canary`, with the build artifacts attached, and changelog included.
|
||||
|
||||
Existing `unstable` release will be removed before creating a new one.
|
||||
Existing `canary` release will be removed before creating a new one.
|
||||
|
||||
This makes [Releasing](./RELEASING.md) simpler.
|
||||
@@ -3,10 +3,10 @@
|
||||
# Releasing
|
||||
|
||||
The release process for Playlet is very simple, since most of the work is automated.
|
||||
The automation makes `unstable` releases.
|
||||
The automation makes `canary` releases.
|
||||
|
||||
```makefile
|
||||
unstable release + QA = stable version
|
||||
canary release + QA = stable version
|
||||
```
|
||||
|
||||
These are mostly the steps when releasing a new version:
|
||||
@@ -23,12 +23,12 @@ These are mostly the steps when releasing a new version:
|
||||
- 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
|
||||
- Wait for CI on main branch to create the `canary` release
|
||||
- Edit `canary` release
|
||||
- Tag: `v$VERSION`
|
||||
- Title: `v$VERSION`
|
||||
- Body: the content from CHANGELOG.md for this version
|
||||
- This should be already included, just remove the notes about testing the unstable release
|
||||
- This should be already included, just remove the notes about testing the canary release
|
||||
- Uncheck `Set as a pre-release`
|
||||
- Check `Set as the latest release`
|
||||
- Click `update release`
|
||||
|
||||
@@ -6,6 +6,6 @@ To test this release:
|
||||
|
||||
- Open Playlet web app in a browser (`http://ROKU_IP_ADDRESS:8888/index.html`)
|
||||
- Go to settings, and scroll down to `Developer settings`
|
||||
- Set `Playlet Library version` to `unstable` and click `Apply`
|
||||
- Set `Playlet Library version` to `canary` 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
|
||||
- You can verify that you're testing the `canary` release in the `Info` tab in Playlet or the web app
|
||||
@@ -2,7 +2,7 @@ openapi: 3.0.0
|
||||
|
||||
info:
|
||||
title: Playlet Web API
|
||||
version: 0.11.0
|
||||
version: 0.12.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,21 @@
|
||||
# Playlet Brighterscript Plugins
|
||||
|
||||
<!-- markdownlint-disable MD024 -->
|
||||
- [Json5/Yaml support](#json5yaml-support)
|
||||
- [Manifest editing](#manifest-editing)
|
||||
- [Validation](#validation)
|
||||
- [Includes](#includes)
|
||||
- [@oninit](#oninit)
|
||||
- [Bindings](#bindings)
|
||||
- [Async Task Generator](#async-task-generator)
|
||||
- [Tracking transpilied files](#tracking-transpilied-files)
|
||||
|
||||
Playlet implements a few [Brighterscript Plugins](https://github.com/rokucommunity/brighterscript/blob/master/docs/plugins.md). The plugins inject themselves in the compilation process, allowing the modification of bs scripts, xml components, and even assets or the app manifest. Let's start with a simple one:
|
||||
|
||||
<!-- markdownlint-disable MD024 -->
|
||||
|
||||
## Json5/Yaml support
|
||||
|
||||
**[Source](tools/bs-plugins/json-yaml-plugin.ts)**
|
||||
**[Source](/tools/bs-plugins/json-yaml-plugin.ts)**
|
||||
|
||||
This plugin allows us to include `jsonc`, `json5` and `yaml` files into the app as static assets. They are an alternative to plain `json`, which for instance, does not support comments. Additionally, this plugin minifies the `json` files.
|
||||
|
||||
@@ -20,7 +29,7 @@ At the end of the build, the plugin scans for certain files (`jsonc`, `json`, `j
|
||||
|
||||
## Manifest editing
|
||||
|
||||
**[Source](tools/bs-plugins/manifest-edit-plugin.ts)**
|
||||
**[Source](/tools/bs-plugins/manifest-edit-plugin.ts)**
|
||||
|
||||
This plugin allows us to make modifications to the app manifest dynamically, mostly based on compiler flags.
|
||||
|
||||
@@ -38,7 +47,7 @@ We simply read the content of the original manifest, and modify it before the co
|
||||
|
||||
## Validation
|
||||
|
||||
**[Source](tools/bs-plugins/validation-plugin.ts)**
|
||||
**[Source](/tools/bs-plugins/validation-plugin.ts)**
|
||||
|
||||
This plugin allows us to add custom diagnostic errors messages to source code, to prevent using certain patterns of functions.
|
||||
|
||||
@@ -86,7 +95,7 @@ node.ObserveField("someField", "OnSomeFieldChanged")
|
||||
|
||||
## Includes
|
||||
|
||||
**[Source](tools/bs-plugins/component-includes-plugin.ts)**
|
||||
**[Source](/tools/bs-plugins/component-includes-plugin.ts)**
|
||||
|
||||
This plugin allows us "include" different pieces of a component, enabling [Composition over inheritance](https://en.wikipedia.org/wiki/Composition_over_inheritance)
|
||||
|
||||
@@ -98,7 +107,7 @@ Consider a "behaviour" that we want in multiple components. For example:
|
||||
<!-- Beep.xml -->
|
||||
<component name="Beep" extends="Node">
|
||||
<interface>
|
||||
<field id="beep" type="boolean" alwaysNotify="true" onChange="OnBeepSet" />
|
||||
<field id="beepNow" type="boolean" alwaysNotify="true" onChange="OnBeepSet" />
|
||||
</interface>
|
||||
<script type="text/brightscript" uri="pkg:/path/to/Beep.bs" />
|
||||
</component>
|
||||
@@ -161,7 +170,7 @@ A couple of more details:
|
||||
|
||||
## @oninit
|
||||
|
||||
**[Source](tools/bs-plugins/oninit-plugin.ts)**
|
||||
**[Source](/tools/bs-plugins/oninit-plugin.ts)**
|
||||
|
||||
`@oninit` is an annotation that can be added to functions, and then these functions will be called in the `Init()` function of the component it is in.
|
||||
|
||||
@@ -214,7 +223,7 @@ Important implementation details:
|
||||
|
||||
## Bindings
|
||||
|
||||
**[Source](tools/bs-plugins/bindings-plugin.ts)**
|
||||
**[Source](/tools/bs-plugins/bindings-plugin.ts)**
|
||||
|
||||
This plugin allows us to "bind" different node references together. It's a simple form of dependency injection to manage dependencies between nodes.
|
||||
|
||||
@@ -409,7 +418,7 @@ calling `BindNode` will trigger all the binding steps just for this node. But it
|
||||
|
||||
## Async Task Generator
|
||||
|
||||
**[Source](tools/bs-plugins/asynctask-plugin.ts)**
|
||||
**[Source](/tools/bs-plugins/asynctask-plugin.ts)**
|
||||
|
||||
This plugin generates `Task` components a scripts that makes it simpler to call a function in a background thread, and get the result in a callback function.
|
||||
|
||||
@@ -456,7 +465,7 @@ Although very useful, this pattern might not be the best for long running tasks
|
||||
|
||||
## Tracking transpilied files
|
||||
|
||||
**[Source](tools/bs-plugins/track-transpiled-plugin.ts)**
|
||||
**[Source](/tools/bs-plugins/track-transpiled-plugin.ts)**
|
||||
|
||||
By now, you realize we make a lot of transformations to the source code through many plugins. As a sanity check, this plugin allows us to keep track of the transpiled files, so we can be sure that the output is what we expect.
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "playlet",
|
||||
"version": "0.11.0",
|
||||
"version": "0.12.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "playlet",
|
||||
"version": "0.11.0",
|
||||
"version": "0.12.0",
|
||||
"hasInstallScript": true,
|
||||
"devDependencies": {
|
||||
"@rokucommunity/bslint": "^0.8.9",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "playlet",
|
||||
"version": "0.11.0",
|
||||
"version": "0.12.0",
|
||||
"description": "Unofficial Youtube client for Roku",
|
||||
"devDependencies": {
|
||||
"@rokucommunity/bslint": "^0.8.9",
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "playlet-app",
|
||||
"version": "0.11.0",
|
||||
"version": "0.12.0",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "playlet-app",
|
||||
"version": "0.11.0",
|
||||
"version": "0.12.0",
|
||||
"hasInstallScript": true,
|
||||
"dependencies": {
|
||||
"bslib": "npm:@rokucommunity/bslib@^0.1.1"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "playlet-app",
|
||||
"version": "0.11.0",
|
||||
"version": "0.12.0",
|
||||
"description": "Unofficial Youtube client for Roku",
|
||||
"dependencies": {
|
||||
"bslib": "npm:@rokucommunity/bslib@^0.1.1"
|
||||
|
||||
@@ -2,7 +2,7 @@ title=Playlet
|
||||
|
||||
# Do not update version manually, it is auto updated from package.json
|
||||
major_version=0
|
||||
minor_version=11
|
||||
minor_version=12
|
||||
build_version=00000
|
||||
|
||||
ui_resolutions=hd
|
||||
@@ -23,6 +23,8 @@ splash_screen_sd=pkg:/images/splash-screen_sd.jpg
|
||||
splash_color=#242424
|
||||
splash_min_time=0
|
||||
|
||||
confirm_partner_button=1
|
||||
|
||||
supports_input_launch=1
|
||||
|
||||
playlet_lib_remote_url=https://github.com/iBicha/playlet/releases/latest/download/playlet-lib.zip
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "playlet-lib",
|
||||
"version": "0.11.0",
|
||||
"version": "0.12.0",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "playlet-lib",
|
||||
"version": "0.11.0",
|
||||
"version": "0.12.0",
|
||||
"hasInstallScript": true,
|
||||
"dependencies": {
|
||||
"bslib": "npm:@rokucommunity/bslib@^0.1.1",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "playlet-lib",
|
||||
"version": "0.11.0",
|
||||
"version": "0.12.0",
|
||||
"description": "Unofficial Youtube client for Roku",
|
||||
"dependencies": {
|
||||
"bslib": "npm:@rokucommunity/bslib@^0.1.1",
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace ChannelUtils
|
||||
function Open(contentNode as object)
|
||||
channelView = CreateObject("roSGNode", "ChannelView")
|
||||
m.appController@.PushScreen(channelView)
|
||||
channelView@.BindNode(invalid)
|
||||
channelView.content = contentNode
|
||||
end function
|
||||
end namespace
|
||||
@@ -0,0 +1,77 @@
|
||||
import "pkg:/source/roku_modules/log/LogMixin.brs"
|
||||
import "pkg:/source/utils/FocusManagement.bs"
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
import "pkg:/source/utils/StringUtils.bs"
|
||||
|
||||
function Init()
|
||||
m.log = new log.Logger("ChannelView")
|
||||
|
||||
m.banner = m.top.findNode("banner")
|
||||
m.thumbnail = m.top.findNode("thumbnail")
|
||||
m.authorLabel = m.top.findNode("authorLabel")
|
||||
m.rowList = m.top.FindNode("rowList")
|
||||
|
||||
m.banner.ObserveField("loadStatus", FuncName(OnBannerLoadStatus))
|
||||
end function
|
||||
|
||||
function OnNodeready()
|
||||
m.rowList@.BindNode(invalid)
|
||||
end function
|
||||
|
||||
function OnFocusChange() as void
|
||||
if not m.top.focus
|
||||
return
|
||||
end if
|
||||
|
||||
NodeSetFocus(m.rowList, true)
|
||||
end function
|
||||
|
||||
function OnContentSet() as void
|
||||
content = m.top.content
|
||||
if content = invalid
|
||||
return
|
||||
end if
|
||||
|
||||
' NOTE: "_author" not "author". See PlaylistContentNode.xml for explanation.
|
||||
m.authorLabel.text = content._author
|
||||
' TODO:P1 handle case where there's no banner - a big portion of the screen is blank
|
||||
m.banner.uri = content.banner
|
||||
if StringUtils.IsNullOrEmpty(content.thumbnail)
|
||||
m.thumbnail.uri = ""
|
||||
else
|
||||
if m.thumbnail.uri <> content.thumbnail or m.thumbnail.loadStatus = "failed"
|
||||
m.thumbnail.loadingBitmapUri = m.thumbnail.uri
|
||||
m.thumbnail.uri = content.thumbnail
|
||||
end if
|
||||
end if
|
||||
|
||||
m.rowList.content = content
|
||||
|
||||
content@.LoadChannel(m.invidious)
|
||||
end function
|
||||
|
||||
function OnkeyEvent(key as string, press as boolean) as boolean
|
||||
if press = false
|
||||
return false
|
||||
end if
|
||||
|
||||
if key = "back"
|
||||
Close()
|
||||
return true
|
||||
end if
|
||||
return false
|
||||
end function
|
||||
|
||||
function Close()
|
||||
m.appController@.PopScreen(invalid)
|
||||
end function
|
||||
|
||||
function OnBannerLoadStatus() as void
|
||||
status = m.banner.loadStatus
|
||||
if status <> "ready"
|
||||
return
|
||||
end if
|
||||
|
||||
aspect = m.banner.bitmapWidth / m.banner.bitmapHeight
|
||||
m.banner.height = m.banner.width / aspect
|
||||
end function
|
||||
@@ -0,0 +1,54 @@
|
||||
<component name="ChannelView" extends="Group" includes="AutoBind,Focus">
|
||||
<interface>
|
||||
<field id="content" type="node" onChange="OnContentSet" />
|
||||
<field id="appController" type="node" bind="/AppController" />
|
||||
<field id="invidious" type="node" bind="/Invidious" />
|
||||
</interface>
|
||||
<children>
|
||||
<Rectangle
|
||||
width="1280"
|
||||
height="720"
|
||||
color="0x242424">
|
||||
</Rectangle>
|
||||
|
||||
<Poster
|
||||
id="banner"
|
||||
translation="[0,0]"
|
||||
width="1280" />
|
||||
|
||||
<Poster
|
||||
translation="[115,180]"
|
||||
width="104"
|
||||
height="104"
|
||||
uri="pkg:/images/circle-mask-500.png">
|
||||
|
||||
<CirclePoster
|
||||
id="thumbnail"
|
||||
width="100"
|
||||
height="100"
|
||||
translation="[2,2]" />
|
||||
</Poster>
|
||||
|
||||
<Label
|
||||
id="authorLabel"
|
||||
translation="[228,226]"
|
||||
font="font:MediumBoldSystemFont" />
|
||||
|
||||
<VideoRowList
|
||||
itemComponentName="RowCell"
|
||||
id="rowList"
|
||||
focusable="false"
|
||||
translation="[0,320]"
|
||||
numRows="1"
|
||||
rowitemSize="[[350,196]]"
|
||||
rowItemSpacing="[[25,0]]"
|
||||
itemSize="[1280,326]"
|
||||
itemSpacing="[0,65]"
|
||||
rowLabelOffset="[[115,20]]"
|
||||
focusXOffset="[115]"
|
||||
showRowLabel="[true]"
|
||||
rowFocusAnimationStyle="floatingfocus"
|
||||
variableWidthItems="true"
|
||||
focusBitmapUri="pkg:/images/focus_grid.9.png" />
|
||||
</children>
|
||||
</component>
|
||||
@@ -0,0 +1,24 @@
|
||||
function Init()
|
||||
m.top.poster = m.top.findNode("Poster")
|
||||
m.top.maskGroup = m.top.findNode("MaskGroup")
|
||||
end function
|
||||
|
||||
function UpdateMaskSize()
|
||||
width = m.top.poster.width
|
||||
height = m.top.poster.height
|
||||
|
||||
maskSize = [width * GetScaleFactor(), height * GetScaleFactor()]
|
||||
m.top.maskGroup.maskSize = maskSize
|
||||
end function
|
||||
|
||||
' MaskGroup component do not scale with with UI resolution
|
||||
function GetScaleFactor() as float
|
||||
if m.scaleFactor <> invalid
|
||||
return m.scaleFactor
|
||||
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
|
||||
end function
|
||||
@@ -0,0 +1,23 @@
|
||||
<component name="CirclePoster" extends="Group">
|
||||
<interface>
|
||||
<field id="poster" type="node" />
|
||||
<field id="maskGroup" type="node" />
|
||||
|
||||
<field id="width" type="integer" alias="Poster.width" onChange="UpdateMaskSize" />
|
||||
<field id="height" type="integer" alias="Poster.height" onChange="UpdateMaskSize" />
|
||||
<field id="uri" type="uri" alias="Poster.uri" />
|
||||
<field id="loadingBitmapUri" type="uri" alias="Poster.loadingBitmapUri" />
|
||||
<field id="failedBitmapUri" type="uri" alias="Poster.failedBitmapUri" />
|
||||
<field id="loadStatus" type="string" alias="Poster.loadStatus" />
|
||||
|
||||
<field id="maskUri" type="uri" value="pkg:/images/circle-mask-500.png" alias="MaskGroup.maskuri" />
|
||||
</interface>
|
||||
<children>
|
||||
<MaskGroup
|
||||
id="MaskGroup"
|
||||
maskuri="pkg:/images/circle-mask-500.png">
|
||||
<Poster
|
||||
id="Poster" />
|
||||
</MaskGroup>
|
||||
</children>
|
||||
</component>
|
||||
@@ -0,0 +1,48 @@
|
||||
import "pkg:/source/asyncTask/asyncTask.bs"
|
||||
import "pkg:/components/ContentNode/ChannelContentTask.bs"
|
||||
import "pkg:/source/utils/ErrorUtils.bs"
|
||||
import "pkg:/components/Dialog/DialogUtils.bs"
|
||||
|
||||
function Init()
|
||||
m.top.latestVideos = m.top.findNode("latestVideos")
|
||||
end function
|
||||
|
||||
function LoadChannel(invidiousNode as object) as void
|
||||
if m.contentTask <> invalid
|
||||
m.contentTask.cancel = true
|
||||
end if
|
||||
|
||||
loadState = m.top.loadState
|
||||
if loadState = FeedLoadState.Loading or loadState = FeedLoadState.Loaded
|
||||
return
|
||||
end if
|
||||
|
||||
m.top.loadState = FeedLoadState.Loading
|
||||
m.contentTask = StartAsyncTask(ChannelContentTask, {
|
||||
content: m.top,
|
||||
invidious: invidiousNode
|
||||
}, OnChannelContentTaskResult)
|
||||
end function
|
||||
|
||||
function OnChannelContentTaskResult(output as object) as void
|
||||
m.contentTask = invalid
|
||||
|
||||
if output.cancelled
|
||||
return
|
||||
end if
|
||||
|
||||
if not output.success or not output.result.success
|
||||
' output.error for unhandled exception
|
||||
error = output.error
|
||||
if error = invalid
|
||||
' output.result.error for network errors
|
||||
error = output.result.error
|
||||
end if
|
||||
error = ErrorUtils.Format(error)
|
||||
m.log.error(error)
|
||||
playlistId = output.task.input.content.playlistId
|
||||
message = `Failed to load playlist ${playlistId}\n${error}`
|
||||
DialogUtils.ShowDialog(message, "Playlist load fail", true)
|
||||
return
|
||||
end if
|
||||
end function
|
||||
@@ -1,7 +1,28 @@
|
||||
<component name="ChannelContentNode" extends="ContentNode">
|
||||
<interface>
|
||||
<field id="type" type="string" value="channel" />
|
||||
<field id="loadState" type="string" />
|
||||
<function name="LoadChannel" />
|
||||
|
||||
<field id="HDItemWidth" type="float" value="200" />
|
||||
<!-- NOTE: "_author" not "author". See PlaylistContentNode.xml for explanation -->
|
||||
<field id="_author" type="string" />
|
||||
<field id="authorId" type="string" />
|
||||
<field id="description" type="string" />
|
||||
<field id="subCount" type="integer" />
|
||||
<field id="subCountText" type="string" />
|
||||
<field id="videoCount" type="integer" />
|
||||
<field id="videoCountText" type="string" />
|
||||
<field id="thumbnail" type="string" />
|
||||
<field id="banner" type="string" />
|
||||
|
||||
<field id="latestVideos" type="node" />
|
||||
|
||||
<field id="HDItemWidth" type="float" value="196" />
|
||||
</interface>
|
||||
|
||||
<children>
|
||||
<ContentNode id="latestVideos" title="Latest Videos">
|
||||
|
||||
</ContentNode>
|
||||
</children>
|
||||
</component>
|
||||
@@ -0,0 +1,40 @@
|
||||
import "pkg:/components/Services/Invidious/InvidiousService.bs"
|
||||
import "pkg:/components/Services/Invidious/InvidiousToContentNode.bs"
|
||||
|
||||
@asynctask
|
||||
function ChannelContentTask(input as object) as object
|
||||
contentNode = input.content
|
||||
invidiousNode = input.invidious
|
||||
|
||||
if m.top.cancel
|
||||
contentNode.loadState = FeedLoadState.None
|
||||
return invalid
|
||||
end if
|
||||
|
||||
service = new Invidious.InvidiousService(invidiousNode)
|
||||
response = service.GetChannel(contentNode.authorId, m.top.cancellation)
|
||||
|
||||
if m.top.cancel
|
||||
contentNode.loadState = FeedLoadState.None
|
||||
return invalid
|
||||
end if
|
||||
|
||||
metadata = response.Json()
|
||||
|
||||
if not response.IsSuccess() or metadata = invalid
|
||||
contentNode.loadState = FeedLoadState.Error
|
||||
return {
|
||||
success: false,
|
||||
error: response.ErrorMessage()
|
||||
}
|
||||
end if
|
||||
|
||||
instance = service.GetInstance()
|
||||
InvidiousContent.ToChannelContentNode(contentNode, metadata, instance)
|
||||
|
||||
contentNode.loadState = FeedLoadState.Loaded
|
||||
|
||||
return {
|
||||
success: true
|
||||
}
|
||||
end function
|
||||
@@ -29,5 +29,7 @@
|
||||
<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>
|
||||
@@ -61,9 +61,6 @@
|
||||
invidious="bind:../Invidious"
|
||||
preferences="bind:../Preferences"
|
||||
playQueue="bind:../PlayQueue" />
|
||||
|
||||
<!-- Inherits from WebServer
|
||||
<WebSocketServer id="WebSocketServer" webserver="ref:../WebServer" /> -->
|
||||
</AppController>
|
||||
</children>
|
||||
</component>
|
||||
@@ -9,7 +9,6 @@ import "pkg:/components/VideoFeed/FeedLoadState.bs"
|
||||
import "pkg:/source/utils/ErrorUtils.bs"
|
||||
import "pkg:/components/Dialog/DialogUtils.bs"
|
||||
|
||||
' TODO:P2 use already loaded thumbnail, and crossfade to highres version (using same Poster)
|
||||
function Init()
|
||||
m.log = new log.Logger("PlaylistView")
|
||||
|
||||
@@ -17,6 +16,7 @@ function Init()
|
||||
m.backgroundSmall = m.top.findNode("backgroundSmall")
|
||||
m.titleLabel = m.top.findNode("titleLabel")
|
||||
m.subtitleLabel = m.top.findNode("subtitleLabel")
|
||||
m.updatedLabel = m.top.findNode("updatedLabel")
|
||||
m.descriptionLabel = m.top.findNode("descriptionLabel")
|
||||
m.list = m.top.findNode("list")
|
||||
end function
|
||||
@@ -43,9 +43,11 @@ function OnContentSet() as void
|
||||
m.titleLabel.text = content.title
|
||||
' NOTE: "_author" not "author". See PlaylistContentNode.xml for explanation.
|
||||
m.subtitleLabel.text = `${content._author} • ${content.videoCountText} • ${content.viewCountText}`
|
||||
m.updatedLabel.text = content.updatedText
|
||||
m.descriptionLabel.text = content.description
|
||||
|
||||
' TODO:P2 cross fade
|
||||
' We use two Posters to cross fade from the low res thumbnail to the high res thumbnail.
|
||||
' We can't use a single Poster because we're using the blendColor. There's no loadingBitmapBlendColor.
|
||||
m.backgroundSmall.uri = content.thumbnail
|
||||
m.background.uri = content.thumbnailBackground
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
height="720"
|
||||
blendColor="0x323232">
|
||||
<LayoutGroup
|
||||
itemSpacings="[5,20]"
|
||||
itemSpacings="[5,5,20]"
|
||||
translation="[65,90]">
|
||||
<Label
|
||||
id="titleLabel"
|
||||
@@ -35,6 +35,10 @@
|
||||
id="subtitleLabel"
|
||||
width="500"
|
||||
font="font:SmallestBoldSystemFont" />
|
||||
<Label
|
||||
id="updatedLabel"
|
||||
width="500"
|
||||
font="font:SmallestSystemFont" />
|
||||
<Label
|
||||
id="descriptionLabel"
|
||||
width="500"
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
focusXOffset="[115]"
|
||||
showRowLabel="[true]"
|
||||
rowFocusAnimationStyle="floatingfocus"
|
||||
variableWidthItems="true"
|
||||
focusBitmapUri="pkg:/images/focus_grid.9.png"
|
||||
/>
|
||||
</children>
|
||||
|
||||
@@ -0,0 +1,273 @@
|
||||
import "pkg:/components/Navigation/Navigation.bs"
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
import "pkg:/source/roku_modules/log/LogMixin.brs"
|
||||
import "pkg:/source/utils/ArrayUtils.bs"
|
||||
|
||||
function Init()
|
||||
options = {
|
||||
date: [{
|
||||
title: "Any date",
|
||||
value: ""
|
||||
}, {
|
||||
title: "Last hour",
|
||||
value: "hour"
|
||||
}, {
|
||||
title: "Today",
|
||||
value: "today"
|
||||
}, {
|
||||
title: "This week",
|
||||
value: "week"
|
||||
}, {
|
||||
title: "This month",
|
||||
value: "month"
|
||||
}, {
|
||||
title: "This year",
|
||||
value: "year"
|
||||
}],
|
||||
type: [{
|
||||
title: "Any type",
|
||||
value: ""
|
||||
}, {
|
||||
title: "Video",
|
||||
value: "video"
|
||||
}, {
|
||||
title: "Playlist",
|
||||
value: "playlist"
|
||||
}, {
|
||||
title: "Channel",
|
||||
value: "channel"
|
||||
}, {
|
||||
title: "Movie",
|
||||
value: "movie"
|
||||
}, {
|
||||
title: "Show",
|
||||
value: "show"
|
||||
}],
|
||||
duration: [{
|
||||
title: "Any duration",
|
||||
value: ""
|
||||
}, {
|
||||
title: "Under 4 minutes",
|
||||
value: "short"
|
||||
}, {
|
||||
title: "4 - 20 minutes",
|
||||
value: "medium"
|
||||
}, {
|
||||
title: "Over 20 minutes",
|
||||
value: "long"
|
||||
}],
|
||||
features: [{
|
||||
title: "Live",
|
||||
value: "live"
|
||||
}, {
|
||||
title: "4K",
|
||||
value: "4k"
|
||||
}, {
|
||||
title: "HD",
|
||||
value: "hd"
|
||||
}, {
|
||||
title: "Subtitles/CC",
|
||||
value: "subtitles"
|
||||
}, {
|
||||
title: "Creative Commons",
|
||||
value: "creative_commons"
|
||||
}, {
|
||||
title: "360°",
|
||||
value: "360"
|
||||
}, {
|
||||
title: "VR180",
|
||||
value: "vr180"
|
||||
}, {
|
||||
title: "3D",
|
||||
value: "3d"
|
||||
}, {
|
||||
title: "HDR",
|
||||
value: "hdr"
|
||||
}, {
|
||||
title: "Purchased",
|
||||
value: "purchased"
|
||||
}, {
|
||||
title: "Location",
|
||||
value: "location"
|
||||
}],
|
||||
sort_by: [{
|
||||
title: "Relevance",
|
||||
value: ""
|
||||
}, {
|
||||
title: "Upload date",
|
||||
value: "upload_date"
|
||||
}, {
|
||||
title: "View count",
|
||||
value: "view_count"
|
||||
}, {
|
||||
title: "Rating",
|
||||
value: "rating"
|
||||
}]
|
||||
}
|
||||
|
||||
m.controls = {
|
||||
date: m.top.findNode("UploadDateList"),
|
||||
type: m.top.findNode("TypeList"),
|
||||
duration: m.top.findNode("DurationList"),
|
||||
features: m.top.findNode("FeaturesList"),
|
||||
sort_by: m.top.findNode("SortByList")
|
||||
}
|
||||
|
||||
for each filterKey in m.controls
|
||||
control = m.controls[filterKey]
|
||||
control.addFields({ filterKey: filterKey })
|
||||
end for
|
||||
|
||||
m.contentNodes = {
|
||||
date: m.controls.date.content,
|
||||
type: m.controls.type.content,
|
||||
duration: m.controls.duration.content,
|
||||
features: m.controls.features.content,
|
||||
sort_by: m.controls.sort_by.content
|
||||
}
|
||||
|
||||
PopulateLists(m.contentNodes, options)
|
||||
|
||||
navigationNodes = [m.controls.date, m.controls.type, m.controls.duration, m.controls.features, m.controls.sort_by]
|
||||
for i = 0 to navigationNodes.count() - 2
|
||||
SetNavigation(navigationNodes[i], "right", navigationNodes[i + 1])
|
||||
end for
|
||||
for i = 1 to navigationNodes.count() - 1
|
||||
SetNavigation(navigationNodes[i], "left", navigationNodes[i - 1])
|
||||
end for
|
||||
end function
|
||||
|
||||
function PopulateLists(contentNodes as object, options as object)
|
||||
for each key in options
|
||||
contentNode = contentNodes[key]
|
||||
list = options[key]
|
||||
for each item in list
|
||||
node = CreateObject("roSGNode", "ContentNode")
|
||||
node.title = item.title
|
||||
node.addFields({ value: item.value })
|
||||
contentNode.appendChild(node)
|
||||
end for
|
||||
end for
|
||||
end function
|
||||
|
||||
function OnNodeReady()
|
||||
m.log = new log.Logger("SearchFilters")
|
||||
|
||||
RefreshUI()
|
||||
|
||||
m.controls.date.ObserveField("checkedItem", FuncName(OnListChecked))
|
||||
m.controls.type.ObserveField("checkedItem", FuncName(OnListChecked))
|
||||
m.controls.duration.ObserveField("checkedItem", FuncName(OnListChecked))
|
||||
m.controls.features.ObserveField("checkedState", FuncName(OnListChecked))
|
||||
m.controls.sort_by.ObserveField("checkedItem", FuncName(OnListChecked))
|
||||
end function
|
||||
|
||||
function RefreshUI()
|
||||
filters = m.searchScreen.filters
|
||||
for each key in filters
|
||||
control = m.controls[key]
|
||||
value = filters[key]
|
||||
if IsString(value)
|
||||
SetCheckedItem(control, value)
|
||||
else if IsArray(value)
|
||||
SetCheckedItemArray(control, value)
|
||||
end if
|
||||
end for
|
||||
end function
|
||||
|
||||
function SetCheckedItem(control as object, value as string) as void
|
||||
content = control.content
|
||||
childCount = content.getChildCount()
|
||||
for i = 0 to childCount - 1
|
||||
child = content.getChild(i)
|
||||
if child.value = value
|
||||
control.checkedItem = i
|
||||
return
|
||||
end if
|
||||
end for
|
||||
end function
|
||||
|
||||
function SetCheckedItemArray(control as object, values as object) as void
|
||||
content = control.content
|
||||
childCount = content.getChildCount()
|
||||
checkedState = []
|
||||
for i = 0 to childCount - 1
|
||||
child = content.getChild(i)
|
||||
value = child.value
|
||||
checkedState.push(ArrayUtils.IndexOfString(values, value) >= 0)
|
||||
end for
|
||||
control.checkedState = checkedState
|
||||
end function
|
||||
|
||||
function OnFocusChange() as void
|
||||
if not m.top.focus
|
||||
return
|
||||
end if
|
||||
|
||||
NodeSetFocus(m.controls.date, true)
|
||||
end function
|
||||
|
||||
function OnListChecked(event as object)
|
||||
control = event.getRoSGNode()
|
||||
filterKey = control.filterKey
|
||||
|
||||
state = m.searchScreen.filters
|
||||
if IsString(state[filterKey])
|
||||
SetFilterString(control)
|
||||
else if IsArray(state[filterKey])
|
||||
SetFilterArray(control)
|
||||
end if
|
||||
end function
|
||||
|
||||
function SetFilterString(control as object) as void
|
||||
content = control.content
|
||||
selectedNode = content.getChild(control.checkedItem)
|
||||
value = selectedNode.value
|
||||
|
||||
filterKey = control.filterKey
|
||||
state = m.searchScreen.filters
|
||||
state[filterKey] = value
|
||||
m.searchScreen.filters = state
|
||||
end function
|
||||
|
||||
function SetFilterArray(control as object) as void
|
||||
content = control.content
|
||||
checkedState = control.checkedState
|
||||
|
||||
values = []
|
||||
for i = 0 to checkedState.count() - 1
|
||||
if checkedState[i]
|
||||
node = content.getChild(i)
|
||||
values.push(node.value)
|
||||
end if
|
||||
end for
|
||||
|
||||
filterKey = control.filterKey
|
||||
state = m.searchScreen.filters
|
||||
state[filterKey] = values
|
||||
m.searchScreen.filters = state
|
||||
end function
|
||||
|
||||
function OnkeyEvent(key as string, press as boolean) as boolean
|
||||
navigation = NavigationKeyHandler(key, press)
|
||||
if navigation.handled
|
||||
m.currentNavigtionNode = navigation.node
|
||||
return true
|
||||
end if
|
||||
|
||||
if key = "options" and press
|
||||
' A pass-through to the app controller, so it can toggle picture-in-picture
|
||||
return false
|
||||
end if
|
||||
|
||||
if key = "back" and press
|
||||
Close()
|
||||
return true
|
||||
end if
|
||||
|
||||
return true
|
||||
end function
|
||||
|
||||
function Close()
|
||||
m.appController@.PopScreen(invalid)
|
||||
end function
|
||||
@@ -0,0 +1,124 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<component name="SearchFilters" extends="Group" includes="AutoBind,Focus">
|
||||
<interface>
|
||||
<field id="searchScreen" type="node" />
|
||||
<field id="appController" type="node" bind="/AppController" />
|
||||
</interface>
|
||||
<children>
|
||||
<Rectangle
|
||||
width="1280"
|
||||
height="720"
|
||||
color="#000000"
|
||||
opacity="0.5">
|
||||
</Rectangle>
|
||||
<Font id="HeaderFont" uri="font:BoldSystemFontFile" size="18" />
|
||||
<Font id="ItemFont" uri="font:SystemFontFile" size="18" />
|
||||
<Font id="ItemFocusedFont" uri="font:BoldSystemFontFile" size="18" />
|
||||
<Rectangle
|
||||
width="1116"
|
||||
height="543"
|
||||
translation="[82,84]"
|
||||
color="#242424">
|
||||
|
||||
<LayoutGroup
|
||||
layoutDirection="horiz"
|
||||
translation="[35,20]">
|
||||
<LayoutGroup horizAlignment="center" itemSpacings="[10,10]">
|
||||
<Label
|
||||
text="Upload date"
|
||||
font="dictionary:HeaderFont"
|
||||
horizAlign="center"
|
||||
width="188" />
|
||||
<Rectangle
|
||||
width="170"
|
||||
height="1" />
|
||||
<RadioButtonList
|
||||
id="UploadDateList"
|
||||
vertFocusAnimationStyle="floatingFocus"
|
||||
font="dictionary:ItemFont"
|
||||
focusedFont="dictionary:ItemFocusedFont"
|
||||
itemSize="[140,42]">
|
||||
<ContentNode role="content" />
|
||||
</RadioButtonList>
|
||||
</LayoutGroup>
|
||||
|
||||
<LayoutGroup horizAlignment="center" itemSpacings="[10,10]">
|
||||
<Label
|
||||
text="Type"
|
||||
font="dictionary:HeaderFont"
|
||||
horizAlign="center"
|
||||
width="168" />
|
||||
<Rectangle
|
||||
width="150"
|
||||
height="1" />
|
||||
<RadioButtonList
|
||||
id="TypeList"
|
||||
vertFocusAnimationStyle="floatingFocus"
|
||||
font="dictionary:ItemFont"
|
||||
focusedFont="dictionary:ItemFocusedFont"
|
||||
itemSize="[120,42]">
|
||||
<ContentNode role="content" />
|
||||
</RadioButtonList>
|
||||
</LayoutGroup>
|
||||
|
||||
<LayoutGroup horizAlignment="center" itemSpacings="[10,10]">
|
||||
<Label
|
||||
text="Duration"
|
||||
font="dictionary:HeaderFont"
|
||||
horizAlign="center"
|
||||
width="238" />
|
||||
<Rectangle
|
||||
width="220"
|
||||
height="1" />
|
||||
<RadioButtonList
|
||||
id="DurationList"
|
||||
vertFocusAnimationStyle="floatingFocus"
|
||||
font="dictionary:ItemFont"
|
||||
focusedFont="dictionary:ItemFocusedFont"
|
||||
itemSize="[190,42]">
|
||||
<ContentNode role="content" />
|
||||
</RadioButtonList>
|
||||
</LayoutGroup>
|
||||
|
||||
<LayoutGroup horizAlignment="center" itemSpacings="[10,10]">
|
||||
<Label
|
||||
text="Features"
|
||||
font="dictionary:HeaderFont"
|
||||
horizAlign="center"
|
||||
width="258" />
|
||||
<Rectangle
|
||||
width="240"
|
||||
height="1" />
|
||||
<CheckList
|
||||
id="FeaturesList"
|
||||
vertFocusAnimationStyle="floatingFocus"
|
||||
font="dictionary:ItemFont"
|
||||
focusedFont="dictionary:ItemFocusedFont"
|
||||
itemSize="[210,42]">
|
||||
<ContentNode role="content" />
|
||||
</CheckList>
|
||||
</LayoutGroup>
|
||||
|
||||
<LayoutGroup horizAlignment="center" itemSpacings="[10,10]">
|
||||
<Label
|
||||
text="Sort by"
|
||||
font="dictionary:HeaderFont"
|
||||
horizAlign="center"
|
||||
width="198" />
|
||||
<Rectangle
|
||||
width="180"
|
||||
height="1" />
|
||||
<RadioButtonList
|
||||
id="SortByList"
|
||||
vertFocusAnimationStyle="floatingFocus"
|
||||
font="dictionary:ItemFont"
|
||||
focusedFont="dictionary:ItemFocusedFont"
|
||||
itemSize="[150,42]">
|
||||
<ContentNode role="content" />
|
||||
</RadioButtonList>
|
||||
</LayoutGroup>
|
||||
</LayoutGroup>
|
||||
</Rectangle>
|
||||
</children>
|
||||
</component>
|
||||
@@ -14,6 +14,21 @@ function Init()
|
||||
m.scrollAnimation = m.top.FindNode("scrollAnimation")
|
||||
m.scrollAnimationInterpolator = m.top.FindNode("scrollAnimationInterpolator")
|
||||
m.suggestions = m.top.FindNode("suggestions")
|
||||
m.filtersButton = m.top.FindNode("filtersButton")
|
||||
|
||||
textEditBox = m.keyboard.textEditBox
|
||||
textEditBox.voiceEntryType = "generic"
|
||||
textEditBox.voiceEnabled = true
|
||||
|
||||
m.top.filters = {
|
||||
date: "",
|
||||
type: "",
|
||||
duration: "",
|
||||
features: [],
|
||||
sort_by: ""
|
||||
}
|
||||
|
||||
m.top.ObserveField("filters", FuncName(OnFiltersChange))
|
||||
end function
|
||||
|
||||
function OnNodeReady()
|
||||
@@ -23,6 +38,8 @@ function OnNodeReady()
|
||||
m.keyboard.ObserveField("text", FuncName(OnTextChange))
|
||||
m.suggestions.ObserveField("buttonFocused", FuncName(OnSearchButtonFocused))
|
||||
m.suggestions.ObserveField("buttonSelected", FuncName(OnSearchButtonSelected))
|
||||
m.filtersButton.ObserveField("buttonSelected", FuncName(OnFiltersButtonSelected))
|
||||
|
||||
m.top.ObserveField("visible", FuncName(OnVisibilityChange))
|
||||
m.rowlist.ObserveFieldScoped("onError", FuncName(OnSearchError))
|
||||
|
||||
@@ -30,12 +47,17 @@ function OnNodeReady()
|
||||
ScrollUp()
|
||||
end function)
|
||||
SetNavigation(m.suggestions, "right", m.keyboard)
|
||||
SetNavigation(m.filtersButton, "right", m.keyboard)
|
||||
SetNavigation(m.keyboard, "left", m.suggestions)
|
||||
SetNavigation(m.suggestions, "left", m.navBar)
|
||||
SetNavigation(m.filtersButton, "left", m.navBar)
|
||||
SetNavigation(m.keyboard, "left", m.navBar)
|
||||
SetNavigation(m.rowList, "left", m.navBar, function()
|
||||
ScrollUp()
|
||||
end function)
|
||||
SetNavigation(m.filtersButton, "down", m.suggestions)
|
||||
SetNavigation(m.filtersButton, "down", m.keyboard)
|
||||
|
||||
SetNavigation(invalid, "down", m.rowList, function()
|
||||
ScrollDown()
|
||||
end function)
|
||||
@@ -43,6 +65,9 @@ function OnNodeReady()
|
||||
ScrollUp()
|
||||
end function)
|
||||
|
||||
SetNavigation(m.suggestions, "up", m.filtersButton)
|
||||
SetNavigation(m.keyboard, "up", m.filtersButton)
|
||||
|
||||
m.currentNavigtionNode = m.suggestions
|
||||
' Trigger suggestions
|
||||
OnTextChange()
|
||||
@@ -119,6 +144,13 @@ function OnSearchSuggestionsTaskResults(output as object) as void
|
||||
m.suggestions.focusable = m.suggestions.buttons.Count() > 0
|
||||
end function
|
||||
|
||||
function OnFiltersButtonSelected()
|
||||
searchFilters = CreateObject("roSGNode", "SearchFilters")
|
||||
m.appController@.PushScreen(searchFilters)
|
||||
searchFilters.searchScreen = m.top
|
||||
searchFilters@.BindNode(invalid)
|
||||
end function
|
||||
|
||||
function OnSearchButtonSelected()
|
||||
selected = m.suggestions.buttonSelected
|
||||
text = m.suggestions.buttons[selected]
|
||||
@@ -145,19 +177,56 @@ function OnSearchButtonFocused() as void
|
||||
m.keyboard.text = text
|
||||
end function
|
||||
|
||||
function OnFiltersChange()
|
||||
filterCount = 0
|
||||
filters = m.top.filters
|
||||
for each filter in filters
|
||||
value = filters[filter]
|
||||
if IsString(value) and value.len() > 0
|
||||
filterCount++
|
||||
else if IsArray(value) and value.Count() > 0
|
||||
filterCount += value.Count()
|
||||
end if
|
||||
end for
|
||||
if filterCount > 0
|
||||
m.filtersButton.text = `Filters (${filterCount})`
|
||||
else
|
||||
m.filtersButton.text = "Filters"
|
||||
end if
|
||||
end function
|
||||
|
||||
function Search(text as string)
|
||||
m.rowlist.UnobserveFieldScoped("someContentReady")
|
||||
' TODO:P1 someContentReady only fires if there are search results.
|
||||
' The case where search results are empty is not handled.
|
||||
m.rowlist.ObserveFieldScoped("someContentReady", FuncName(OnSearchContentReady))
|
||||
ShowLoadingScreen()
|
||||
|
||||
m.rowList.contentData = [{
|
||||
requestData = {
|
||||
title: `Search - ${text}`,
|
||||
apiType: "Invidious",
|
||||
endpoint: "search",
|
||||
queryParams: {
|
||||
q: text
|
||||
}
|
||||
}]
|
||||
}
|
||||
|
||||
filters = m.top.filters
|
||||
for each filter in filters
|
||||
value = filters[filter]
|
||||
if IsString(value) and value.len() > 0
|
||||
requestData.queryParams[filter] = value
|
||||
else if IsArray(value) and value.Count() > 0
|
||||
' TODO:P1 this is http client implementation details leaking
|
||||
' We need a declarative way to set array types
|
||||
requestData.queryParams[filter] = {
|
||||
value: value,
|
||||
__arrayType: HttpClient.QueryParamArrayType.CommaSeparated
|
||||
}
|
||||
end if
|
||||
end for
|
||||
|
||||
m.rowList.contentData = [requestData]
|
||||
end function
|
||||
|
||||
function OnSearchContentReady() as void
|
||||
|
||||
@@ -4,10 +4,23 @@
|
||||
<interface>
|
||||
<field id="navBar" type="node" bind="/NavBar" />
|
||||
<field id="invidious" type="node" bind="/Invidious" />
|
||||
<field id="appController" type="node" bind="/AppController" />
|
||||
<field id="filters" type="assocarray" />
|
||||
</interface>
|
||||
<children>
|
||||
<Group id="container">
|
||||
<MiniKeyboard
|
||||
<Button
|
||||
id="filtersButton"
|
||||
translation="[160,40]"
|
||||
minWidth="0"
|
||||
height="48"
|
||||
showFocusFootprint="true"
|
||||
iconUri="pkg:/images/icons/filters-white.png"
|
||||
focusedIconUri="pkg:/images/icons/filters-black.png"
|
||||
text="Filters">
|
||||
</Button>
|
||||
|
||||
<DynamicMiniKeyboard
|
||||
id="keyboard"
|
||||
translation="[730,110]"
|
||||
/>
|
||||
|
||||
@@ -16,6 +16,7 @@ namespace Invidious
|
||||
|
||||
const VIDEOS_ENDPOINT = "/api/v1/videos"
|
||||
const PLAYLISTS_ENDPOINT = "/api/v1/playlists"
|
||||
const CHANNELS_ENDPOINT = "/api/v1/channels"
|
||||
const HISTORY_ENDPOINT = "/api/v1/auth/history"
|
||||
|
||||
const SEARCH_SUGGEST_ENDPOINT = "/api/v1/search/suggestions"
|
||||
@@ -136,6 +137,17 @@ namespace Invidious
|
||||
return request.Await()
|
||||
end function
|
||||
|
||||
function GetChannel(authorId as string, cancellation = invalid as object) as object
|
||||
instance = m.GetInstance()
|
||||
url = `${instance}${Invidious.CHANNELS_ENDPOINT}/${authorId}`
|
||||
|
||||
request = HttpClient.Get(url)
|
||||
request.QueryParams(m.DefaultQueryParams())
|
||||
request.Cancellation(cancellation)
|
||||
|
||||
return request.Await()
|
||||
end function
|
||||
|
||||
function GetVideoStreamUrl(videoId as string) as string
|
||||
instance = m.GetInstance()
|
||||
return `${instance}/latest_version?id=${videoId}`
|
||||
|
||||
@@ -21,8 +21,7 @@ namespace InvidiousContent
|
||||
else if item.type = "playlist"
|
||||
return ToPlaylistContentNode(invalid, item, instance)
|
||||
else if item.type = "channel"
|
||||
return invalid
|
||||
' return ToChannelContentNode(item, instance)
|
||||
return ToChannelContentNode(invalid, item, instance)
|
||||
else
|
||||
return invalid
|
||||
end if
|
||||
@@ -67,9 +66,11 @@ namespace InvidiousContent
|
||||
SetIfExists(node, "playlistId", item, "playlistId")
|
||||
SetIfExists(node, "title", item, "title")
|
||||
SetIfExists(node, "videoCount", item, "videoCount")
|
||||
node.videoCountText = PlaylistGetVideoCountText(item)
|
||||
node.videoCountText = GetVideoCountText(item)
|
||||
SetIfExists(node, "viewCount", item, "viewCount")
|
||||
node.viewCountText = PlaylistGetViewCountText(item)
|
||||
SetIfExists(node, "updated", item, "updated")
|
||||
node.updatedText = PlaylistGetUpdatedText(item)
|
||||
|
||||
if item.videos <> invalid
|
||||
childCount = node.getChildCount()
|
||||
@@ -97,10 +98,40 @@ namespace InvidiousContent
|
||||
return node
|
||||
end function
|
||||
|
||||
function ToChannelContentNode(item as object, instance as dynamic) as object
|
||||
node = CreateObject("roSGNode", "ChannelContentNode")
|
||||
function ToChannelContentNode(node as object, item as object, instance as dynamic) as object
|
||||
if node = invalid
|
||||
node = CreateObject("roSGNode", "ChannelContentNode")
|
||||
node.loadState = FeedLoadState.None
|
||||
end if
|
||||
node.type = "channel"
|
||||
|
||||
' NOTE: "_author" not "author". See PlaylistContentNode.xml for explanation.
|
||||
SetIfExists(node, "_author", item, "author")
|
||||
SetIfExists(node, "authorId", item, "authorId")
|
||||
SetIfExists(node, "description", item, "description")
|
||||
SetIfExists(node, "subCount", item, "subCount")
|
||||
node.subCountText = GetChannelSubCountText(item)
|
||||
SetIfExists(node, "videoCount", item, "videoCount")
|
||||
node.videoCountText = GetVideoCountText(item)
|
||||
node.thumbnail = GetChannelThumbnail(item.authorThumbnails)
|
||||
node.banner = GetChannelBanner(item.authorBanners)
|
||||
|
||||
if item.latestVideos <> invalid
|
||||
newNodes = []
|
||||
|
||||
for each video in item.latestVideos
|
||||
video.type = "video"
|
||||
videoNode = ToVideoContentNode(invalid, video, instance)
|
||||
if videoNode <> invalid
|
||||
newNodes.push(videoNode)
|
||||
end if
|
||||
end for
|
||||
|
||||
if newNodes.Count() > 0
|
||||
node.latestVideos.appendChildren(newNodes)
|
||||
end if
|
||||
end if
|
||||
|
||||
return node
|
||||
end function
|
||||
|
||||
@@ -199,13 +230,74 @@ namespace InvidiousContent
|
||||
node[nodeField] = thumbnail
|
||||
end function
|
||||
|
||||
function PlaylistGetVideoCountText(playlistItem as object) as string
|
||||
videoCount = ValidInt(playlistItem.videoCount)
|
||||
function GetChannelThumbnail(authorThumbnails as object) as string
|
||||
if authorThumbnails = invalid or authorThumbnails.Count() = 0
|
||||
return ""
|
||||
end if
|
||||
url = authorThumbnails[authorThumbnails.Count() - 1].url
|
||||
if url.startsWith("//")
|
||||
url = "https:" + url
|
||||
end if
|
||||
return url
|
||||
end function
|
||||
|
||||
function GetChannelBanner(authorBanners as object) as string
|
||||
if authorBanners = invalid or authorBanners.Count() = 0
|
||||
return ""
|
||||
end if
|
||||
return authorBanners[authorBanners.Count() - 1].url
|
||||
end function
|
||||
|
||||
function GetVideoCountText(item as object) as string
|
||||
videoCount = ValidInt(item.videoCount)
|
||||
return videoCount = 1 ? "1 video" : `${videoCount} videos`
|
||||
end function
|
||||
|
||||
function GetChannelSubCountText(channel as object) as string
|
||||
subCount = ValidInt(channel.subCount)
|
||||
return subCount = 1 ? "1 subscriber" : `${subCount} subscribers`
|
||||
end function
|
||||
|
||||
function PlaylistGetViewCountText(playlistItem as object) as string
|
||||
return VideoGetViewCountText(playlistItem)
|
||||
end function
|
||||
|
||||
function PlaylistGetUpdatedText(playlistItem as object) as string
|
||||
updated = playlistItem.updated
|
||||
if not IsInt(updated)
|
||||
return ""
|
||||
end if
|
||||
span = TimeUtils.Now().AsSeconds() - updated
|
||||
if span < 1
|
||||
return ""
|
||||
end if
|
||||
|
||||
count = ""
|
||||
total_days = span \ 86400
|
||||
if total_days > 365
|
||||
years = total_days \ 365
|
||||
count = years > 1 ? `${years} years` : "1 year"
|
||||
else if total_days > 30
|
||||
months = total_days \ 30
|
||||
count = months > 1 ? `${months} months` : "1 month"
|
||||
else if total_days > 7
|
||||
weeks = total_days \ 7
|
||||
count = weeks > 1 ? `${weeks} weeks` : "1 week"
|
||||
else if total_days > 1
|
||||
count = `${total_days} days`
|
||||
else if span > 3600
|
||||
hours = span \ 3600
|
||||
count = hours > 1 ? `${hours} hours` : "1 hour"
|
||||
else if span > 60
|
||||
minutes = span \ 60
|
||||
count = minutes > 1 ? `${minutes} minutes` : "1 minute"
|
||||
else
|
||||
count = span > 1 ? `${span} seconds` : "1 second"
|
||||
end if
|
||||
|
||||
if StringUtils.IsNullOrEmpty(count)
|
||||
return ""
|
||||
end if
|
||||
return `Updated ${count} ago`
|
||||
end function
|
||||
end namespace
|
||||
@@ -13,44 +13,9 @@ function OnContentSet() as void
|
||||
return
|
||||
end if
|
||||
|
||||
m.authorLabel.text = content.author
|
||||
SetSubCount(content.subCount)
|
||||
|
||||
m.thumbnail.uri = GetThumbnailUrl(content.authorThumbnails)
|
||||
|
||||
SetVideoCount(content.videoCount)
|
||||
end function
|
||||
|
||||
function SetSubCount(subCount as integer)
|
||||
subCountText = ""
|
||||
if subCount = 1
|
||||
subCountText = "1 subscriber"
|
||||
else
|
||||
subCountText = `${subCount} subscribers`
|
||||
end if
|
||||
|
||||
m.subCountLabel.text = subCountText
|
||||
end function
|
||||
|
||||
|
||||
function SetVideoCount(videoCount as integer)
|
||||
videoCountText = ""
|
||||
if videoCount = 1
|
||||
videoCountText = "1 video"
|
||||
else
|
||||
videoCountText = `${videoCount} videos`
|
||||
end if
|
||||
|
||||
m.videoCountLabel.text = videoCountText
|
||||
end function
|
||||
|
||||
function GetThumbnailUrl(videoThumbnails as object) as string
|
||||
if videoThumbnails = invalid or videoThumbnails.Count() = 0
|
||||
return ""
|
||||
end if
|
||||
url = videoThumbnails[videoThumbnails.Count() - 1].url
|
||||
if url.startsWith("//")
|
||||
url = "https:" + url
|
||||
end if
|
||||
return url
|
||||
' NOTE: "_author" not "author". See PlaylistContentNode.xml for explanation.
|
||||
m.authorLabel.text = content._author
|
||||
m.subCountLabel.text = content.subCountText
|
||||
m.videoCountLabel.text = content.videoCountText
|
||||
m.thumbnail.uri = content.thumbnail
|
||||
end function
|
||||
@@ -8,27 +8,26 @@
|
||||
<children>
|
||||
<LayoutGroup
|
||||
itemSpacings="[24,5,5]">
|
||||
<Poster
|
||||
|
||||
<CirclePoster
|
||||
id="thumbnail"
|
||||
loadDisplayMode="scaleToZoom"
|
||||
width="200"
|
||||
height="196">
|
||||
</Poster>
|
||||
width="196"
|
||||
height="196" />
|
||||
|
||||
<Label
|
||||
id="authorLabel"
|
||||
width="200"
|
||||
width="196"
|
||||
font="font:SmallestBoldSystemFont"
|
||||
maxLines="2"
|
||||
wrap="true" />
|
||||
<Label
|
||||
id="subCountLabel"
|
||||
width="200"
|
||||
width="196"
|
||||
height="25"
|
||||
font="font:SmallestSystemFont" />
|
||||
<Label
|
||||
id="videoCountLabel"
|
||||
width="200"
|
||||
width="196"
|
||||
height="25"
|
||||
font="font:SmallestSystemFont" />
|
||||
</LayoutGroup>
|
||||
|
||||
@@ -3,6 +3,7 @@ import "pkg:/source/utils/Types.bs"
|
||||
function Init()
|
||||
m.titleLabel = m.top.FindNode("titleLabel")
|
||||
m.authorLabel = m.top.FindNode("authorLabel")
|
||||
m.updatedLabel = m.top.FindNode("updatedLabel")
|
||||
m.videoCountRect = m.top.FindNode("videoCountRect")
|
||||
m.videoCountLabel = m.top.FindNode("videoCountLabel")
|
||||
m.thumbnail = m.top.FindNode("thumbnail")
|
||||
@@ -19,6 +20,7 @@ function OnContentSet() as void
|
||||
m.titleLabel.text = content.title
|
||||
' NOTE: "_author" not "author". See PlaylistContentNode.xml for explanation.
|
||||
m.authorLabel.text = content._author
|
||||
m.updatedLabel.text = content.updatedText
|
||||
|
||||
m.thumbnail.uri = content.thumbnail
|
||||
|
||||
|
||||
@@ -7,30 +7,26 @@
|
||||
</interface>
|
||||
<children>
|
||||
<LayoutGroup
|
||||
itemSpacings="[24,5]"
|
||||
>
|
||||
itemSpacings="[24,5,5]">
|
||||
<Poster
|
||||
id="thumbnail"
|
||||
loadDisplayMode="scaleToZoom"
|
||||
width="350"
|
||||
height="196"
|
||||
>
|
||||
height="196">
|
||||
<Rectangle
|
||||
id="videoCountRect"
|
||||
width="60"
|
||||
height="26"
|
||||
color="0x000000"
|
||||
opacity="0.8"
|
||||
translation="[290, 162]"
|
||||
>
|
||||
translation="[290, 162]">
|
||||
<Label
|
||||
height="26"
|
||||
id="videoCountLabel"
|
||||
horizAlign="center"
|
||||
vertAlign="center"
|
||||
font="font:SmallestSystemFont"
|
||||
translation="[8, 0]"
|
||||
/>
|
||||
translation="[8, 0]" />
|
||||
</Rectangle>
|
||||
</Poster>
|
||||
|
||||
@@ -39,14 +35,17 @@
|
||||
width="350"
|
||||
font="font:SmallestBoldSystemFont"
|
||||
maxLines="2"
|
||||
wrap="true"
|
||||
/>
|
||||
wrap="true" />
|
||||
<Label
|
||||
id="authorLabel"
|
||||
width="350"
|
||||
height="25"
|
||||
font="font:SmallestSystemFont"
|
||||
/>
|
||||
font="font:SmallestSystemFont" />
|
||||
<Label
|
||||
id="updatedLabel"
|
||||
width="350"
|
||||
height="25"
|
||||
font="font:SmallestSystemFont" />
|
||||
</LayoutGroup>
|
||||
</children>
|
||||
</component>
|
||||
@@ -7,6 +7,7 @@ import "pkg:/source/utils/ErrorUtils.bs"
|
||||
import "pkg:/components/Dialog/DialogUtils.bs"
|
||||
import "pkg:/components/VideoPlayer/VideoUtils.bs"
|
||||
import "pkg:/components/PlaylistView/PlaylistUtils.bs"
|
||||
import "pkg:/components/ChannelView/ChannelUtils.bs"
|
||||
|
||||
function Init()
|
||||
m.pendingLoadTasks = {}
|
||||
@@ -78,6 +79,7 @@ function OnRowItemSelected(event as object)
|
||||
else if rowItem.type = "channel"
|
||||
authorId = rowItem.authorId
|
||||
m.log.info("Open channel: " + authorId)
|
||||
ChannelUtils.Open(rowItem)
|
||||
else if rowItem.type = "action"
|
||||
if rowItem.action = "LoginDialog"
|
||||
dialog = CreateObject("roSGNode", "LoginDialog")
|
||||
|
||||
@@ -84,7 +84,7 @@
|
||||
required: false,
|
||||
type: ["video", "playlist", "channel", "all"],
|
||||
arrayType: "comma-separated",
|
||||
default: ["video", "playlist"],
|
||||
default: ["video", "playlist", "channel"],
|
||||
},
|
||||
features: {
|
||||
required: false,
|
||||
|
||||
|
After Width: | Height: | Size: 9.6 KiB |
|
After Width: | Height: | Size: 316 B |
|
After Width: | Height: | Size: 321 B |
@@ -0,0 +1,3 @@
|
||||
<svg enable-background="new 0 0 24 24" height="24" viewBox="0 0 24 24" width="24" focusable="false" style="pointer-events: none; display: block; width: 100%; height: 100%;">
|
||||
<path fill="#000000" d="M15 17h6v1h-6v-1zm-4 0H3v1h8v2h1v-5h-1v2zm3-9h1V3h-1v2H3v1h11v2zm4-3v1h3V5h-3zM6 14h1V9H6v2H3v1h3v2zm4-2h11v-1H10v1z"></path>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 334 B |
@@ -0,0 +1,3 @@
|
||||
<svg enable-background="new 0 0 24 24" height="24" viewBox="0 0 24 24" width="24" focusable="false" style="pointer-events: none; display: block; width: 100%; height: 100%;">
|
||||
<path fill="#FFFFFF" d="M15 17h6v1h-6v-1zm-4 0H3v1h8v2h1v-5h-1v2zm3-9h1V3h-1v2H3v1h11v2zm4-3v1h3V5h-3zM6 14h1V9H6v2H3v1h3v2zm4-2h11v-1H10v1z"></path>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 334 B |
|
Before Width: | Height: | Size: 330 B After Width: | Height: | Size: 330 B |
|
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB |
|
Before Width: | Height: | Size: 1021 B After Width: | Height: | Size: 1021 B |
|
Before Width: | Height: | Size: 542 B After Width: | Height: | Size: 542 B |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
@@ -2,7 +2,7 @@ title=PlayletLib
|
||||
|
||||
# Do not update version manually, it is auto updated from package.json
|
||||
major_version=0
|
||||
minor_version=11
|
||||
minor_version=12
|
||||
build_version=00000
|
||||
|
||||
ui_resolutions=hd
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "playlet-web",
|
||||
"version": "0.11.0",
|
||||
"version": "0.12.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "playlet-web",
|
||||
"version": "0.11.0",
|
||||
"version": "0.12.0",
|
||||
"devDependencies": {
|
||||
"@sveltejs/vite-plugin-svelte": "^2.4.5",
|
||||
"@tailwindcss/typography": "^0.5.10",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "playlet-web",
|
||||
"version": "0.11.0",
|
||||
"version": "0.12.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -21,9 +21,9 @@
|
||||
if (
|
||||
value?.app?.lib_url_type === "custom" &&
|
||||
value?.app?.lib_url ===
|
||||
"https://github.com/iBicha/playlet/releases/download/unstable/playlet-lib.zip"
|
||||
"https://github.com/iBicha/playlet/releases/download/canary/playlet-lib.zip"
|
||||
) {
|
||||
version += "-unstable";
|
||||
version += "-canary";
|
||||
}
|
||||
loggedIn = value?.invidious?.logged_in;
|
||||
auth_url = value?.invidious?.auth_url;
|
||||
|
||||
@@ -48,7 +48,7 @@ const logoOutput = {
|
||||
},
|
||||
};
|
||||
|
||||
const iconsInput = './playlet-app/src/images/vector/icons';
|
||||
const iconsInput = './playlet-lib/src/images/vector/icons';
|
||||
const iconsOutput = './playlet-lib/src/images/icons';
|
||||
|
||||
(async () => {
|
||||
|
||||
@@ -16,6 +16,7 @@ function getArgumentParser() {
|
||||
|
||||
parser.add_argument('--browser', { help: 'Use cookies from browser' });
|
||||
parser.add_argument('--invidious', { help: 'Invidious instance to sync to' });
|
||||
parser.add_argument('--invidious-token-file', { help: 'Invidious auth token. If provided, manual authorization will be skipped' });
|
||||
parser.add_argument('--output-file', { help: 'Write profile to Invidious JSON compatible file' });
|
||||
parser.add_argument('--playlist-limit', { help: 'Maximum playlist video count', type: 'int', default: 500 });
|
||||
|
||||
@@ -272,11 +273,13 @@ async function deleteAccessToken(invidiousInstance, token) {
|
||||
(async () => {
|
||||
let invidiousInstance = undefined
|
||||
let token = undefined;
|
||||
let unregisterToken = false;
|
||||
try {
|
||||
const parser = getArgumentParser()
|
||||
const args = parser.parse_args()
|
||||
|
||||
invidiousInstance = args.invidious
|
||||
invidiousTokenFile = args.invidious_token_file
|
||||
browser = args.browser
|
||||
outputFile = args.output_file
|
||||
playlistLimit = args.playlist_limit
|
||||
@@ -317,18 +320,22 @@ async function deleteAccessToken(invidiousInstance, token) {
|
||||
}
|
||||
}
|
||||
|
||||
token = await getAccessToken(invidiousInstance)
|
||||
if (!invidiousTokenFile) {
|
||||
token = await getAccessToken(invidiousInstance)
|
||||
unregisterToken = true;
|
||||
} else {
|
||||
token = fs.readFileSync(invidiousTokenFile, 'utf8');
|
||||
}
|
||||
|
||||
await deletePlaylists(invidiousInstance, token, playlistsToDelete)
|
||||
await importInvidiousProfile(invidiousInstance, token, profile);
|
||||
}
|
||||
|
||||
}
|
||||
catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
finally {
|
||||
if (token) {
|
||||
if (token && unregisterToken) {
|
||||
console.log("Deleting token")
|
||||
await deleteAccessToken(invidiousInstance, token)
|
||||
}
|
||||
|
||||