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
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.

None yet

1 participant