From c740d5e0a099c5f074ce98bade0a25ddd57abbad Mon Sep 17 00:00:00 2001 From: Brahim Hadriche Date: Thu, 19 Oct 2023 19:16:27 -0400 Subject: [PATCH] Bookmarks (#153) * Empty bookmarks screen * Bookmarks object * Long press support * Lint fix * Context menu v1 * A working context menu * Basic bookmarks in context menu * Use a root content node for bookmarks * context menu animation * small tweak * move logger around, adjust animation * Lint fix * Restore logger fix * Cache channel info * Bookmarks v1 * Added comment * Adjust "popular" feed error handling * Progress with bookmarks * Add todo * add todo * handle roDateTime logging * logger adjustment * Use yaml for api and layout * rename requestData to feedSource * Restructure things * Lint fix * remove comment * introduce feedSource id * small cleanup * playlist context menu * Context menu for the channel view * changelog --------- Co-authored-by: github-action linter --- CHANGELOG.md | 16 + docs/README.md | 4 +- docs/models.md | 48 +++ .../BootstrapScene/BootstrapScene.xml | 2 +- playlet-app/src/source/Main.bs | 4 +- .../src/components/ChannelView/ChannelView.bs | 62 ++-- .../components/ChannelView/ChannelView.xml | 3 +- .../ContentNode/BookmarkContentNode.xml | 5 + .../ContentNode/ChannelContentNode.xml | 3 +- .../ContextMenuItemContentNode.xml | 7 + .../ContentNode/FeedContentNode.xml | 6 +- .../ContentNode/PlaylistContentNode.xml | 3 + .../ContentNode/VideoContentNode.xml | 3 + .../src/components/ContextMenu/ContextMenu.bs | 171 +++++++++ .../components/ContextMenu/ContextMenu.xml | 70 ++++ .../components/ContextMenu/ContextMenuRow.bs | 29 ++ .../components/ContextMenu/ContextMenuRow.xml | 19 + .../ContextMenu/ContextMenuUtils.bs | 76 ++++ playlet-lib/src/components/EcpArgs.bs | 1 + playlet-lib/src/components/Logger/Logger.bs | 15 +- playlet-lib/src/components/Logger/Logger.xml | 2 +- playlet-lib/src/components/MainScene.bs | 3 - .../src/components/MainScene.transpiled.brs | 2 - .../src/components/MainScene.transpiled.xml | 11 +- playlet-lib/src/components/MainScene.xml | 17 +- .../src/components/NavBar/IconButton.bs | 4 +- playlet-lib/src/components/NavBar/NavBar.bs | 6 +- playlet-lib/src/components/NavBar/NavBar.xml | 2 +- .../src/components/NavBar/NavBarItem.xml | 1 - .../src/components/Navigation/LongPress.bs | 39 +++ .../components/PlaylistView/PlaylistView.bs | 101 +++++- .../components/PlaylistView/PlaylistView.xml | 7 +- .../BookmarksScreen/BookmarksScreen.bs | 101 ++++++ .../BookmarksScreen/BookmarksScreen.xml | 38 ++ .../Screens/HomeScreen/HomeScreen.bs | 10 +- .../Screens/HomeScreen/HomeScreen.xml | 8 +- .../Screens/SearchScreen/SearchScreen.bs | 19 +- .../Screens/SearchScreen/SearchScreen.xml | 4 +- .../Screens/SettingsScreen/SettingsScreen.bs | 1 + .../Services/Bookmarks/Bookmarks.bs | 326 ++++++++++++++++++ .../Services/Bookmarks/Bookmarks.xml | 20 ++ .../Services/Invidious/Invidious.bs | 2 +- .../Services/Invidious/InvidiousService.bs | 122 +++++-- .../Invidious/InvidiousToContentNode.bs | 2 + .../src/components/VideoFeed/VideoRowList.bs | 154 +++++++-- .../src/components/VideoFeed/VideoRowList.xml | 10 +- .../VideoFeed/VideoRowListContentTask.bs | 16 +- .../VideoFeed/VideoRowListRowContentTask.bs | 210 +++++++---- .../Middleware/InvidiousRouter.bs | 2 +- .../ContextMenuProvider.part.xml | 7 + .../src/config/default_home_layout.json5 | 64 ---- .../src/config/default_home_layout.yaml | 74 ++++ .../src/config/invidious_video_api.json5 | 195 ----------- .../src/config/invidious_video_api.yaml | 195 +++++++++++ playlet-lib/src/images/icons/star.png | Bin 0 -> 1236 bytes playlet-lib/src/source/utils/ErrorUtils.bs | 2 +- playlet-lib/src/source/utils/Logging.bs | 26 +- playlet-lib/src/source/utils/RegistryUtils.bs | 1 + playlet-web/src/App.svelte | 9 +- playlet-web/src/lib/Api/InvidiousApi.ts | 25 +- playlet-web/src/lib/Api/PlayletApi.ts | 4 +- .../src/lib/Screens/Home/ScreenHomeRow.svelte | 6 +- playlet-web/src/lib/Screens/HomeScreen.svelte | 4 +- 63 files changed, 1889 insertions(+), 510 deletions(-) create mode 100644 docs/models.md create mode 100644 playlet-lib/src/components/ContentNode/BookmarkContentNode.xml create mode 100644 playlet-lib/src/components/ContentNode/ContextMenuItemContentNode.xml create mode 100644 playlet-lib/src/components/ContextMenu/ContextMenu.bs create mode 100644 playlet-lib/src/components/ContextMenu/ContextMenu.xml create mode 100644 playlet-lib/src/components/ContextMenu/ContextMenuRow.bs create mode 100644 playlet-lib/src/components/ContextMenu/ContextMenuRow.xml create mode 100644 playlet-lib/src/components/ContextMenu/ContextMenuUtils.bs create mode 100644 playlet-lib/src/components/Navigation/LongPress.bs create mode 100644 playlet-lib/src/components/Screens/BookmarksScreen/BookmarksScreen.bs create mode 100644 playlet-lib/src/components/Screens/BookmarksScreen/BookmarksScreen.xml create mode 100644 playlet-lib/src/components/Services/Bookmarks/Bookmarks.bs create mode 100644 playlet-lib/src/components/Services/Bookmarks/Bookmarks.xml create mode 100644 playlet-lib/src/components/parts/ContextMenuProvider/ContextMenuProvider.part.xml delete mode 100644 playlet-lib/src/config/default_home_layout.json5 create mode 100644 playlet-lib/src/config/default_home_layout.yaml delete mode 100644 playlet-lib/src/config/invidious_video_api.json5 create mode 100644 playlet-lib/src/config/invidious_video_api.yaml create mode 100644 playlet-lib/src/images/icons/star.png diff --git a/CHANGELOG.md b/CHANGELOG.md index 1945f007..f8cd2dc1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +- Bookmarks: different items can now be bookmarked, and be found in the `Bookmarks` screen. + Things that can be bookmarked: + - A video + - A channel + - A playlist + - Subscriptions + - Trending + - Popular + - Playlists + - Search results + - Channel tabs (latest videos, live streams, playlists, shorts, podcasts, related channels) +- Context menu: press and hold `OK` to show a context menu to: + - Play/queue a video or a playlist + - Open the channel of a playlist or of a video + - Manage bookmarks - Local DASH manifest generation - This adds support for multi languages audio tracks - Also adds thumbnails/preview in trick play mode @@ -17,6 +32,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Layout in channel view so that the upload time and view count of videos is visible +- A few things in the logger ### Changed diff --git a/docs/README.md b/docs/README.md index 6a3cf257..becc3286 100644 --- a/docs/README.md +++ b/docs/README.md @@ -210,13 +210,13 @@ Additionally, the web server exposes the settings under `/api/preferences`, whic When Playlet starts, it shows a video feed on the screen. Subscription, Trending videos, and so on. -The layout is defined under [playlet-lib/src/config/default_home_layout.json5](/playlet-lib/src/config/default_home_layout.json5). +The layout is defined under [playlet-lib/src/config/default_home_layout.yaml](/playlet-lib/src/config/default_home_layout.yaml). This could allow users to define custom layouts, so they can see what they find relevant in the home page. This can include Subscription, Trending, Popular videos, Search per keywords, or Playlists. Additionally each feed has information on how it is fetched. For now, only Invidious can be data source, but other systems should be configured in the same way. -Invidious API definitions are defined under [playlet-lib/src/config/invidious_video_api.json5](/playlet-lib/src/config/invidious_video_api.json5), and Playlet parses these at runtime and make the right API calls to fetch the data. +Invidious API definitions are defined under [playlet-lib/src/config/invidious_video_api.yaml](/playlet-lib/src/config/invidious_video_api.yaml), and Playlet parses these at runtime and make the right API calls to fetch the data. Finally, this layout system is what allows both the BrightScript app and the Web app to display the same homepage. diff --git a/docs/models.md b/docs/models.md new file mode 100644 index 00000000..cedb6b2c --- /dev/null +++ b/docs/models.md @@ -0,0 +1,48 @@ + + +# Models + +ApiEndpoint: + +- id +- url +- queryParams +- pathParams +- cacheSeconds +- paginationType +- authenticated +- responseHandler + +FeedSource: + +- id +- title +- apiType: string ("Invidious") +- endpoint: ApiEndpoint +- pathParams +- queryParams +- state: + - paginationtype (Runtime field) + - page (Runtime field) + - continuation (Runtime field) + - queryParams.page (Runtime field) + - queryParams.continuation (Runtime field) + +Feed/FeedContentNode: + +- Title +- feedSources: FeedSource[] +- feedSourceIndex (Runtime field) + +RowListLayout + +- Feed[] + +Bookmarks + +- BookmarkGroup[] + +BookmarkGroup + +- title +- feedSources: FeedSource[] diff --git a/playlet-app/src/components/BootstrapScene/BootstrapScene.xml b/playlet-app/src/components/BootstrapScene/BootstrapScene.xml index b062dfeb..04a32c73 100644 --- a/playlet-app/src/components/BootstrapScene/BootstrapScene.xml +++ b/playlet-app/src/components/BootstrapScene/BootstrapScene.xml @@ -4,7 +4,7 @@ - +
- {#each $homeLayoutFileStore as homeLayoutItem} - + {#each $homeLayoutFileStore as feed} + {/each}