forked from midou/invidious
Add premiere date to watch page
This commit is contained in:
parent
801dffd571
commit
ef8c9f093c
@ -163,27 +163,28 @@ player.on('waiting', function () {
|
||||
}
|
||||
});
|
||||
|
||||
if (video_data.premiere_timestamp && Math.round(new Date() / 1000) < video_data.premiere_timestamp) {
|
||||
player.getChild('bigPlayButton').hide();
|
||||
}
|
||||
|
||||
if (video_data.params.autoplay) {
|
||||
var bpb = player.getChild('bigPlayButton');
|
||||
bpb.hide();
|
||||
|
||||
if (bpb) {
|
||||
bpb.hide();
|
||||
player.ready(function () {
|
||||
new Promise(function (resolve, reject) {
|
||||
setTimeout(() => resolve(1), 1);
|
||||
}).then(function (result) {
|
||||
var promise = player.play();
|
||||
|
||||
player.ready(function () {
|
||||
new Promise(function (resolve, reject) {
|
||||
setTimeout(() => resolve(1), 1);
|
||||
}).then(function (result) {
|
||||
var promise = player.play();
|
||||
|
||||
if (promise !== undefined) {
|
||||
promise.then(_ => {
|
||||
}).catch(error => {
|
||||
bpb.show();
|
||||
});
|
||||
}
|
||||
});
|
||||
if (promise !== undefined) {
|
||||
promise.then(_ => {
|
||||
}).catch(error => {
|
||||
bpb.show();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (!video_data.params.listen && video_data.params.quality === 'dash') {
|
||||
|
@ -136,6 +136,7 @@
|
||||
"Shared `x`": "شارك منذ `x`",
|
||||
"`x` views": "`x` مشاهدون",
|
||||
"Premieres in `x`": "يعرض فى `x`",
|
||||
"Premieres `x`": "",
|
||||
"Hi! Looks like you have JavaScript turned off. Click here to view comments, keep in mind they may take a bit longer to load.": "اهلا! يبدو ان الجافاسكريبت معطلة. اضغط هنا لعرض التعليقات, ضع فى إعتبارك انها ستأخذ وقت اطول للعرض.",
|
||||
"View YouTube comments": "عرض تعليقات اليوتيوب",
|
||||
"View more comments on Reddit": "عرض المزيد من التعليقات على\\من موقع Reddit",
|
||||
|
@ -136,6 +136,7 @@
|
||||
"Shared `x`": "Geteilt `x`",
|
||||
"`x` views": "`x` Ansichten",
|
||||
"Premieres in `x`": "Premieren in `x`",
|
||||
"Premieres `x`": "",
|
||||
"Hi! Looks like you have JavaScript turned off. Click here to view comments, keep in mind they may take a bit longer to load.": "Hallo! Anscheinend haben Sie JavaScript deaktiviert. Klicken Sie hier um Kommentare anzuzeigen, beachten sie dass es etwas länger dauern kann um sie zu laden.",
|
||||
"View YouTube comments": "YouTube Kommentare anzeigen",
|
||||
"View more comments on Reddit": "Mehr Kommentare auf Reddit anzeigen",
|
||||
|
@ -154,6 +154,7 @@
|
||||
"": "`x` προβολές"
|
||||
},
|
||||
"Premieres in `x`": "Πρώτη προβολή σε `x`",
|
||||
"Premieres `x`": "",
|
||||
"Hi! Looks like you have JavaScript turned off. Click here to view comments, keep in mind they may take a bit longer to load.": "Γεια! Φαίνεται πως έχετε απενεργοποιήσει το JavaScript. Πατήστε εδώ για προβολή σχολίων, αλλά έχετε υπ'όψιν σας πως ίσως φορτώσουν πιο αργά. ",
|
||||
"View YouTube comments": "Προβολή σχολίων από το YouTube",
|
||||
"View more comments on Reddit": "Προβολή περισσότερων σχολίων στο Reddit",
|
||||
|
@ -154,6 +154,7 @@
|
||||
"": "`x` views"
|
||||
},
|
||||
"Premieres in `x`": "Premieres in `x`",
|
||||
"Premieres `x`": "Premieres `x`",
|
||||
"Hi! Looks like you have JavaScript turned off. Click here to view comments, keep in mind they may take a bit longer to load.": "Hi! Looks like you have JavaScript turned off. Click here to view comments, keep in mind they may take a bit longer to load.",
|
||||
"View YouTube comments": "View YouTube comments",
|
||||
"View more comments on Reddit": "View more comments on Reddit",
|
||||
|
@ -136,6 +136,7 @@
|
||||
"Shared `x`": "Konigita `x`",
|
||||
"`x` views": "`x` spektaĵoj",
|
||||
"Premieres in `x`": "Premieras en `x`",
|
||||
"Premieres `x`": "",
|
||||
"Hi! Looks like you have JavaScript turned off. Click here to view comments, keep in mind they may take a bit longer to load.": "Saluton! Ŝajnas, ke vi havas Ĝavoskripton malebligitan. Klaku ĉi tie por vidi komentojn, memoru, ke la ŝargado povus daŭri iom pli.",
|
||||
"View YouTube comments": "Vidi komentojn de YouTube",
|
||||
"View more comments on Reddit": "Vidi pli komentoj en Reddit",
|
||||
|
@ -136,6 +136,7 @@
|
||||
"Shared `x`": "Compartido `x`",
|
||||
"`x` views": "`x` visualizaciones",
|
||||
"Premieres in `x`": "Se estrena en `x`",
|
||||
"Premieres `x`": "",
|
||||
"Hi! Looks like you have JavaScript turned off. Click here to view comments, keep in mind they may take a bit longer to load.": "¡Hola! Parece que tiene JavaScript desactivado. Haga clic aquí para ver los comentarios, pero tenga en cuenta que pueden tardar un poco más en cargarse.",
|
||||
"View YouTube comments": "Ver los comentarios de YouTube",
|
||||
"View more comments on Reddit": "Ver más comentarios en Reddit",
|
||||
|
@ -136,6 +136,7 @@
|
||||
"Shared `x`": "Ajoutée le `x`",
|
||||
"`x` views": "`x` vues",
|
||||
"Premieres in `x`": "Première dans `x`",
|
||||
"Premieres `x`": "",
|
||||
"Hi! Looks like you have JavaScript turned off. Click here to view comments, keep in mind they may take a bit longer to load.": "Il semblerait que JavaScript soit désactivé. Cliquez ici pour voir les commentaires sans. Gardez à l'esprit que le chargement peut prendre plus de temps.",
|
||||
"View YouTube comments": "Voir les commentaires YouTube",
|
||||
"View more comments on Reddit": "Voir plus de commentaires sur Reddit",
|
||||
|
@ -136,6 +136,7 @@
|
||||
"Shared `x`": "Delt `x`",
|
||||
"`x` views": "`x` visninger",
|
||||
"Premieres in `x`": "Premiere om `x`",
|
||||
"Premieres `x`": "",
|
||||
"Hi! Looks like you have JavaScript turned off. Click here to view comments, keep in mind they may take a bit longer to load.": "Hei. Det ser ut til at du har JavaScript avslått. Klikk her for å vise kommentarer, ha i minnet at innlasting tar lengre tid.",
|
||||
"View YouTube comments": "Vis YouTube-kommentarer",
|
||||
"View more comments on Reddit": "Vis flere kommenterer på Reddit",
|
||||
|
@ -136,6 +136,7 @@
|
||||
"Shared `x`": "`x` gedeeld",
|
||||
"`x` views": "`x` weergaven",
|
||||
"Premieres in `x`": "Verschijnt over `x`",
|
||||
"Premieres `x`": "",
|
||||
"Hi! Looks like you have JavaScript turned off. Click here to view comments, keep in mind they may take a bit longer to load.": "Hoi! Het lijkt erop dat je JavaScript hebt uitgeschakeld. Klik hier om de reacties te bekijken. Let op: het laden duurt wat langer.",
|
||||
"View YouTube comments": "YouTube-reacties tonen",
|
||||
"View more comments on Reddit": "Meer reacties bekijken op Reddit",
|
||||
|
@ -136,6 +136,7 @@
|
||||
"Shared `x`": "Udostępniono `x`",
|
||||
"`x` views": "`x` wyświetleń",
|
||||
"Premieres in `x`": "Publikacja za `x`",
|
||||
"Premieres `x`": "",
|
||||
"Hi! Looks like you have JavaScript turned off. Click here to view comments, keep in mind they may take a bit longer to load.": "Cześć! Wygląda na to, że masz wyłączoną obsługę JavaScriptu. Kliknij tutaj, żeby zobaczyć komentarze. Pamiętaj, że wczytywanie może potrwać dłużej.",
|
||||
"View YouTube comments": "Wyświetl komentarze z YouTube",
|
||||
"View more comments on Reddit": "Wyświetl więcej komentarzy na Reddicie",
|
||||
|
@ -136,6 +136,7 @@
|
||||
"Shared `x`": "Опубликовано `x`",
|
||||
"`x` views": "`x` просмотров",
|
||||
"Premieres in `x`": "Премьера через `x`",
|
||||
"Premieres `x`": "",
|
||||
"Hi! Looks like you have JavaScript turned off. Click here to view comments, keep in mind they may take a bit longer to load.": "Похоже, у вас отключён JavaScript. Чтобы увидить комментарии, нажмите сюда, но учтите: они могут загружаться немного медленнее.",
|
||||
"View YouTube comments": "Смотреть комментарии с YouTube",
|
||||
"View more comments on Reddit": "Посмотреть больше комментариев на Reddit",
|
||||
|
@ -136,6 +136,7 @@
|
||||
"Shared `x`": "Розміщено `x`",
|
||||
"`x` views": "`x` переглядів",
|
||||
"Premieres in `x`": "Прем’єра через `x`",
|
||||
"Premieres `x`": "",
|
||||
"Hi! Looks like you have JavaScript turned off. Click here to view comments, keep in mind they may take a bit longer to load.": "Схоже, у вас відключений JavaScript. Щоб побачити коментарі, натисніть сюда, але майте на увазі, що вони можуть завантажуватися трохи довше.",
|
||||
"View YouTube comments": "Переглянути коментарі з YouTube",
|
||||
"View more comments on Reddit": "Переглянути більше коментарів на Reddit",
|
||||
|
@ -519,7 +519,7 @@ get "/watch" do |env|
|
||||
engagement = ((video.dislikes.to_f + video.likes.to_f)/video.views * 100)
|
||||
|
||||
playability_status = video.player_response["playabilityStatus"]?
|
||||
if playability_status && playability_status["status"] == "LIVE_STREAM_OFFLINE"
|
||||
if playability_status && playability_status["status"] == "LIVE_STREAM_OFFLINE" && !video.premiere_timestamp
|
||||
reason = playability_status["reason"]?.try &.as_s
|
||||
end
|
||||
reason ||= ""
|
||||
|
@ -851,8 +851,12 @@ def get_video(id, db, proxies = {} of String => Array({ip: String, port: Int32})
|
||||
if db.query_one?("SELECT EXISTS (SELECT true FROM videos WHERE id = $1)", id, as: Bool) && !region
|
||||
video = db.query_one("SELECT * FROM videos WHERE id = $1", id, as: Video)
|
||||
|
||||
# If record was last updated over 10 minutes ago, refresh (expire param in response lasts for 6 hours)
|
||||
if (refresh && Time.utc - video.updated > 10.minutes) || force_refresh
|
||||
# If record was last updated over 10 minutes ago, or video has since premiered,
|
||||
# refresh (expire param in response lasts for 6 hours)
|
||||
if (refresh &&
|
||||
(Time.utc - video.updated > 10.minutes) ||
|
||||
(video.premiere_timestamp && video.premiere_timestamp.as(Time) < Time.utc)) ||
|
||||
force_refresh
|
||||
begin
|
||||
video = fetch_video(id, proxies, region)
|
||||
video_array = video.to_a
|
||||
|
@ -30,7 +30,8 @@ var video_data = {
|
||||
length_seconds: '<%= video.info["length_seconds"].to_f %>',
|
||||
video_series: <%= video_series.to_json %>,
|
||||
params: <%= params.to_json %>,
|
||||
preferences: <%= preferences.to_json %>
|
||||
preferences: <%= preferences.to_json %>,
|
||||
premiere_timestamp: <%= video.premiere_timestamp.try &.to_unix || "null" %>
|
||||
}
|
||||
</script>
|
||||
|
||||
|
@ -40,7 +40,8 @@ var video_data = {
|
||||
hide_replies_text: '<%= HTML.escape(translate(locale, "Hide replies")) %>',
|
||||
show_replies_text: '<%= HTML.escape(translate(locale, "Show replies")) %>',
|
||||
params: <%= params.to_json %>,
|
||||
preferences: <%= preferences.to_json %>
|
||||
preferences: <%= preferences.to_json %>,
|
||||
premiere_timestamp: <%= video.premiere_timestamp.try &.to_unix || "null" %>
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -72,6 +73,10 @@ var video_data = {
|
||||
<h3>
|
||||
<%= reason %>
|
||||
</h3>
|
||||
<% elsif video.premiere_timestamp %>
|
||||
<h3>
|
||||
<%= translate(locale, "Premieres in `x`", recode_date((video.premiere_timestamp.as(Time) - Time.utc).ago, locale)) %>
|
||||
</h3>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
@ -172,7 +177,11 @@ var video_data = {
|
||||
<%= rendered "components/subscribe_widget" %>
|
||||
|
||||
<p>
|
||||
<b><%= translate(locale, "Shared `x`", video.published.to_s("%B %-d, %Y")) %></b>
|
||||
<% if video.premiere_timestamp %>
|
||||
<b><%= translate(locale, "Premieres `x`", video.premiere_timestamp.not_nil!.to_s("%B %-d, %R UTC")) %></b>
|
||||
<% else %>
|
||||
<b><%= translate(locale, "Shared `x`", video.published.to_s("%B %-d, %Y")) %></b>
|
||||
<% end %>
|
||||
</p>
|
||||
|
||||
<div>
|
||||
|
Loading…
Reference in New Issue
Block a user