From 657b6c98188d0a3de7239a4ef33ccd3b6f1d3f3f Mon Sep 17 00:00:00 2001 From: Brahim Hadriche Date: Mon, 16 Dec 2024 17:42:59 -0500 Subject: [PATCH 1/2] Fix error when opening a mix --- CHANGELOG.md | 4 ++++ .../components/ContentNode/PlaylistContentTask.bs | 15 ++++++++++++++- .../src/components/PlaylistView/PlaylistView.bs | 9 +++++++-- .../Services/Invidious/InvidiousToContentNode.bs | 5 +++++ .../VideoFeed/VideoRowCell/PlaylistRowCell.bs | 7 ++++++- .../VideoFeed/VideoRowCell/PlaylistRowCell.xml | 1 + 6 files changed, 37 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ea4ebcc0..90d81f43 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Compression (gzip) to static web app files. Reduces app size significantly +### Fixed + +- Error when opening a mix + ## [0.33.0] - 2024-12-14 ### Added diff --git a/playlet-lib/src/components/ContentNode/PlaylistContentTask.bs b/playlet-lib/src/components/ContentNode/PlaylistContentTask.bs index 4225bd8e..8b49e5ac 100644 --- a/playlet-lib/src/components/ContentNode/PlaylistContentTask.bs +++ b/playlet-lib/src/components/ContentNode/PlaylistContentTask.bs @@ -35,10 +35,23 @@ function PlaylistContentTask(input as object) as object } end if + ' TODO:P2 To remove after https://github.com/iv-org/invidious/pull/5116 + if IsString(metadata["mixId"]) and IsArray(metadata["videos"]) + videos = metadata["videos"] + for i = 0 to videos.Count() - 1 + thumbnails = videos[i].videoThumbnails + if thumbnails.Count() = 1 and IsArray(thumbnails[0]) + videos[i].videoThumbnails = thumbnails[0] + end if + end for + end if + InvidiousContent.ToPlaylistContentNode(contentNode, metadata, instance) childCount = contentNode.getChildCount() - if metadata.videos.Count() = 0 or childCount >= metadata.videoCount + videoCount = ValidInt(metadata.videoCount) + + if metadata.videos.Count() = 0 or childCount >= videoCount contentNode.loadState = FeedLoadState.Loaded return { success: true diff --git a/playlet-lib/src/components/PlaylistView/PlaylistView.bs b/playlet-lib/src/components/PlaylistView/PlaylistView.bs index 3405578b..b4c308b0 100644 --- a/playlet-lib/src/components/PlaylistView/PlaylistView.bs +++ b/playlet-lib/src/components/PlaylistView/PlaylistView.bs @@ -42,8 +42,13 @@ function OnContentSet() as void end if m.titleLabel.text = content.title - ' NOTE: "_author" not "author". See PlaylistContentNode.xml for explanation. - m.subtitleLabel.text = `${content._author} • ${content.videoCountText} • ${content.viewCountText}` + ' Starts with RD means a mix, not a playlist + if content.playlistId.StartsWith("RD") + m.subtitleLabel.text = "" + else + ' NOTE: "_author" not "author". See PlaylistContentNode.xml for explanation. + m.subtitleLabel.text = `${content._author} • ${content.videoCountText} • ${content.viewCountText}` + end if m.updatedLabel.text = content.updatedText m.descriptionLabel.text = content.description diff --git a/playlet-lib/src/components/Services/Invidious/InvidiousToContentNode.bs b/playlet-lib/src/components/Services/Invidious/InvidiousToContentNode.bs index 87454213..f88a6af0 100644 --- a/playlet-lib/src/components/Services/Invidious/InvidiousToContentNode.bs +++ b/playlet-lib/src/components/Services/Invidious/InvidiousToContentNode.bs @@ -239,6 +239,11 @@ namespace InvidiousContent end function function PlaylistSetThumbnail(node as object, nodeField as string, playlistItem as object, instance as dynamic, quality = "medium" as string) as void + currentThumbnail = node[nodeField] + if currentThumbnail <> "" and currentThumbnail <> "pkg:/images/thumbnail-missing.jpg" + return + end if + thumbnail = "" if IsString(playlistItem.playlistThumbnail) thumbnailUrl = playlistItem.playlistThumbnail diff --git a/playlet-lib/src/components/VideoFeed/VideoRowCell/PlaylistRowCell.bs b/playlet-lib/src/components/VideoFeed/VideoRowCell/PlaylistRowCell.bs index af71ca8e..0069ba86 100644 --- a/playlet-lib/src/components/VideoFeed/VideoRowCell/PlaylistRowCell.bs +++ b/playlet-lib/src/components/VideoFeed/VideoRowCell/PlaylistRowCell.bs @@ -19,7 +19,12 @@ function OnContentSet() as void m.top.thumbnailUri = content.thumbnail - SetVideoCount(content.videoCountText) + if content.videoCount = -1 + m.top.videoCountLabelVisible = false + else + m.top.videoCountLabelVisible = true + SetVideoCount(content.videoCountText) + end if end function function SetVideoCount(videoCountText as string) as void diff --git a/playlet-lib/src/components/VideoFeed/VideoRowCell/PlaylistRowCell.xml b/playlet-lib/src/components/VideoFeed/VideoRowCell/PlaylistRowCell.xml index 440634fb..f8e92a6f 100644 --- a/playlet-lib/src/components/VideoFeed/VideoRowCell/PlaylistRowCell.xml +++ b/playlet-lib/src/components/VideoFeed/VideoRowCell/PlaylistRowCell.xml @@ -7,6 +7,7 @@ + Date: Mon, 16 Dec 2024 18:20:19 -0500 Subject: [PATCH 2/2] UI to clarify how to enable `Control by mobile apps` in the web app --- CHANGELOG.md | 1 + .../src/lib/Screens/RemoteControlScreen.svelte | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 90d81f43..50ba6f65 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Compression (gzip) to static web app files. Reduces app size significantly +- UI to clarify how to enable `Control by mobile apps` in the web app ### Fixed diff --git a/playlet-web/src/lib/Screens/RemoteControlScreen.svelte b/playlet-web/src/lib/Screens/RemoteControlScreen.svelte index e733c17f..d0ddcaed 100644 --- a/playlet-web/src/lib/Screens/RemoteControlScreen.svelte +++ b/playlet-web/src/lib/Screens/RemoteControlScreen.svelte @@ -100,6 +100,19 @@ ); } } + + function showRemoteNotWorkingDialog() { + // show dialog with instructions + let content = `If the remote control is not working, please check your device settings. Go to: +- Settings +- System +- Advanced System Settings +- Control by mobile apps +- Network access +And set it to "Enabled".`; + + alert(content); + }
@@ -144,5 +157,9 @@
+