From dd79d85cca893e94645630fb8d69af5cf65e1d02 Mon Sep 17 00:00:00 2001 From: Brahim Hadriche Date: Wed, 25 Oct 2023 20:51:36 -0400 Subject: [PATCH] Fix "upcoming" videos --- .../components/Services/Invidious/InvidiousToContentNode.bs | 6 +++--- playlet-web/src/lib/LinkDragDrop.svelte | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/playlet-lib/src/components/Services/Invidious/InvidiousToContentNode.bs b/playlet-lib/src/components/Services/Invidious/InvidiousToContentNode.bs index c7210a79..863ab56c 100644 --- a/playlet-lib/src/components/Services/Invidious/InvidiousToContentNode.bs +++ b/playlet-lib/src/components/Services/Invidious/InvidiousToContentNode.bs @@ -36,7 +36,6 @@ namespace InvidiousContent SetIfExists(node, "author", item, "author") SetIfExists(node, "authorId", item, "authorId") SetIfExists(node, "hlsUrl", item, "hlsUrl") - SetIfExists(node, "isUpcoming", item, "isUpcoming") SetIfExists(node, "lengthSeconds", item, "lengthSeconds") node.lengthText = TimeUtils.GetFormattedTime(item.lengthSeconds) node.liveNow = VideoIsLive(item) @@ -159,11 +158,12 @@ namespace InvidiousContent end function function VideoIsUpcoming(videoItem as object) as boolean - return videoItem.isUpcoming = true + return videoItem.isUpcoming = true and ValidInt(videoItem.premiereTimestamp) <> 0 end function function VideoSetPremiereTimestampText(node as object, videoItem as object) - if VideoIsUpcoming(videoItem) and videoItem.premiereTimestamp <> invalid + if VideoIsUpcoming(videoItem) + node.isUpcoming = true node.premiereTimestampText = `Premeres in ${TimeUtils.GetFormattedTimeLeft(videoItem.premiereTimestamp)}` end if end function diff --git a/playlet-web/src/lib/LinkDragDrop.svelte b/playlet-web/src/lib/LinkDragDrop.svelte index 66318f34..7fae2c63 100644 --- a/playlet-web/src/lib/LinkDragDrop.svelte +++ b/playlet-web/src/lib/LinkDragDrop.svelte @@ -54,6 +54,8 @@ searchForVideoById(videoInfo.videoId, videoInfo.timestamp); return; } else { + // TODO:P2 make a HEAD request and check for a redirect, then + // resolve the redirect url. const urlInfo: any = await invidiousApi.resolveUrl(dataString); if (urlInfo && urlInfo.pageType === "WEB_PAGE_TYPE_CHANNEL") { searchForChannelById(urlInfo.ucid);