Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: mark premiere videos as unplayable #96

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

SethFalco
Copy link
Contributor

@SethFalco SethFalco commented Jul 4, 2023

Previously, if a channel, search result, or feed, featured a premiered video that was still upcoming, the Invidious add-on would show it like any other video, but would throw errors when trying to play it.

There was no indication in the UI that it's a premiered video.

This PR makes three changes:

  1. If a video is marked isUpcoming in the API, it makes the video unplayable.
  2. If the video has a premiereTimestamp, display that in the subplot instead of the view count and publish date.
  3. Make the UI for date times locale and timezone aware.

Screenshots

A feed that includes a channel with an upcoming video. The subplot text of a upcoming video shows "Premieres: " instead of the view count and publish date. Locale is en-GB and timezone is Europe/London.

image

Same screenshot as above, but with my system timezone locale set to en (probably defaults to en-US) and timezone set to New Zealand.

A channel with an upcoming video. Locale set to en and timezone set to Europe/London.

Information pane is opened while focused on a video.

image

Now that the example video has already past the premiere date, it shows up like any other video and is playable.

Notes

  • You'll see the order between the feed and channel videos differs. On YouTube, a channel will show videos in the same order we do. However, I don't have a YouTube account, so in the feed I don't know if we're showing videos in the same order as the YouTube subscription feed does.
  • I had trouble using __date__ (which afaik delegates to __transform__ internally) because the premiereTimestamp is a conditional attribute. script.module.iapc was throwing exceptions for videos that didn't have it, so I opted to handle transforming it in this plugin.
  • I originally planned to use relative time to display when the video would premiere, but I opted to follow the YouTube interface, which shows absolute time. However, we need to be timezone aware otherwise users will be confused.
    • Either the user lives ahead of UTC, so the video still wouldn't be available even after the time passed.
    • Or the user lives behind UTC, and will wonder how they got late to the party even though they showed up "on time".

References

subplot.append(localizedString(30055))

if self.premiereTimestamp:
subplot.append(localizedString(30063) + self.premiereTimestamp.strftime("%x %X"))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Context:

Directive Meaning Example
%x Locale’s appropriate date representation. 08/16/88 (None); 08/16/1988 (en_US); 16.08.1988 (de_DE)
%X Locale’s appropriate time representation. 21:30:00 (en_US); 21:30:00 (de_DE)

— Excerpt from Python documentation for format codes.

@SethFalco SethFalco changed the title fix: mark premeire videos as unplayable fix: mark premiere videos as unplayable Nov 5, 2023
@lekma
Copy link
Owner

lekma commented Oct 15, 2024

is this still relevant?

@lekma
Copy link
Owner

lekma commented Oct 15, 2024

what happens if you click on an unplayable item that is not a directory?

@SethFalco
Copy link
Contributor Author

is this still relevant?

I still experience this even with the latest version, so it should still be relevant.

It loads for a moment as if it was going to play the video, then does nothing and returns to the menu I was originally on.

what happens if you click on an unplayable item that is not a directory?

At the time I wrote this PR (but I haven't tested this more recently), it does nothing. (No sound, no action, it's as if the click wasn't registered.)


Later I'll rebase this PR and try to record a video with a before vs after. Though atm I'm having some issues with Invidious (even at home on my private self-hosted instance) so we'll see if I'll actually be able to test it. 🤔

@lekma
Copy link
Owner

lekma commented Oct 15, 2024

this is strange because if i click right now on an upcoming stream (v3.2.6) i get an error notification telling me "this live event will begin in 10 hours" could you give me a videoId to test with

by the way no need to rebase the pr ( a lot has changed) i'll introduce this from scratch

@lekma
Copy link
Owner

lekma commented Oct 15, 2024

there was a small bug in v3.2.5 that prevented the errors from the instance to be notified

@lekma
Copy link
Owner

lekma commented Oct 15, 2024

also sorry for not coming back to you earlier (the last two years irl have been...hectic for me)

@SethFalco
Copy link
Contributor Author

this is strange because if i click right now on an upcoming stream (v3.2.6) i get an error notification telling me "this live event will begin in 10 hours" could you give me a videoId to test with

Huh, I'll make sure I actually am on the latest version and try again tonight. Could be I still have the fork with some of my PRs applied.

I'll try to reproduce this somewhere this week if not tonight and come back to you!

also sorry for not coming back to you earlier (the last two years irl have been...hectic for me)

No worries, I get it! There's no rush to these things, and worst case scenario, I can just update the plugin locally, perks of open-source. 👍🏽

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants