Skip to content
This repository was archived by the owner on Nov 8, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 21 additions & 4 deletions lib/invidious/objects/videos.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
__all__ = ["Video", "Videos"]


from datetime import datetime

from iapc.tools import localizedString, ListItem, buildUrl

from .base import Url, Thumbnails, Item, Items
Expand Down Expand Up @@ -50,6 +52,15 @@ class Video(Item):
def liveNow(self):
return self.get("liveNow", False)

@property
def premiereTimestamp(self):
timestamp = self.get("premiereTimestamp", None)

if not timestamp:
return None

return datetime.fromtimestamp(timestamp)

@property
def label(self):
if self.liveNow:
Expand All @@ -65,10 +76,15 @@ def infos(self):
@property
def subplot(self):
subplot = [localizedString(30053)]
if hasattr(self, "viewCount"):
subplot.append(localizedString(30054))
if hasattr(self, "published"):
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.

else:
if hasattr(self, "viewCount"):
subplot.append(localizedString(30054))
if hasattr(self, "published"):
subplot.append(localizedString(30055) + self.published.strftime("%x %X"))

return "\n".join(subplot)

@property
Expand All @@ -88,6 +104,7 @@ def makeItem(self, path):
return ListItem(
self.label,
path,
isPlayable=not self.isUpcoming,
infoLabels={
"video": dict(self.infos, title=self.title, plot=self.plot)
},
Expand Down
8 changes: 6 additions & 2 deletions resources/language/resource.language.de_de/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ msgid "Views: {0.viewCount}"
msgstr "Aufrufe: {0.viewCount}"

msgctxt "#30055"
msgid "Published: {0.published}"
msgstr "Veröffentlicht: {0.published}"
msgid "Published: "
msgstr "Veröffentlicht: "

#msgctxt "#30056"
#msgid "{0.title}\n\nChannel: {0.author}"
Expand Down Expand Up @@ -160,6 +160,10 @@ msgctxt "#30062"
msgid "New search"
msgstr "Neue Suche"

msgctxt "#30063"
msgid "Premieres: "
msgstr ""

msgctxt "#30099"
msgid "More..."
msgstr "Mehr..."
Expand Down
6 changes: 5 additions & 1 deletion resources/language/resource.language.en_gb/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ msgid "Views: {0.viewCount}"
msgstr ""

msgctxt "#30055"
msgid "Published: {0.published}"
msgid "Published: "
msgstr ""

#msgctxt "#30056"
Expand Down Expand Up @@ -160,6 +160,10 @@ msgctxt "#30062"
msgid "New search"
msgstr ""

msgctxt "#30063"
msgid "Premieres: "
msgstr ""

msgctxt "#30099"
msgid "More..."
msgstr ""
Expand Down
8 changes: 6 additions & 2 deletions resources/language/resource.language.es_es/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ msgid "Views: {0.viewCount}"
msgstr "Reproducciones: {0.viewCount}"

msgctxt "#30055"
msgid "Published: {0.published}"
msgstr "Publicado: {0.published}"
msgid "Published: "
msgstr "Publicado: "

#msgctxt "#30056"
#msgid "{0.title}\n\nChannel: {0.author}"
Expand Down Expand Up @@ -160,6 +160,10 @@ msgctxt "#30062"
msgid "New search"
msgstr "Nueva búsqueda"

msgctxt "#30063"
msgid "Premieres: "
msgstr ""

msgctxt "#30099"
msgid "More..."
msgstr "Más..."
Expand Down
8 changes: 6 additions & 2 deletions resources/language/resource.language.fr_fr/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ msgid "Views: {0.viewCount}"
msgstr "Vues: {0.viewCount}"

msgctxt "#30055"
msgid "Published: {0.published}"
msgstr "Publiée le: {0.published}"
msgid "Published: "
msgstr "Publiée le: "

#msgctxt "#30056"
#msgid "{0.title}\n\nChannel: {0.author}"
Expand Down Expand Up @@ -160,6 +160,10 @@ msgctxt "#30062"
msgid "New search"
msgstr "Nouvelle recherche"

msgctxt "#30063"
msgid "Premieres: "
msgstr ""

msgctxt "#30099"
msgid "More..."
msgstr "Suivant..."
Expand Down