mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2023-06-08.git
synced 2024-08-15 00:53:38 +00:00
Add premiere date to watch page
This commit is contained in:
parent
801dffd571
commit
ef8c9f093c
17 changed files with 53 additions and 26 deletions
|
@ -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) {
|
if (video_data.params.autoplay) {
|
||||||
var bpb = player.getChild('bigPlayButton');
|
var bpb = player.getChild('bigPlayButton');
|
||||||
|
bpb.hide();
|
||||||
|
|
||||||
if (bpb) {
|
player.ready(function () {
|
||||||
bpb.hide();
|
new Promise(function (resolve, reject) {
|
||||||
|
setTimeout(() => resolve(1), 1);
|
||||||
|
}).then(function (result) {
|
||||||
|
var promise = player.play();
|
||||||
|
|
||||||
player.ready(function () {
|
if (promise !== undefined) {
|
||||||
new Promise(function (resolve, reject) {
|
promise.then(_ => {
|
||||||
setTimeout(() => resolve(1), 1);
|
}).catch(error => {
|
||||||
}).then(function (result) {
|
bpb.show();
|
||||||
var promise = player.play();
|
});
|
||||||
|
}
|
||||||
if (promise !== undefined) {
|
|
||||||
promise.then(_ => {
|
|
||||||
}).catch(error => {
|
|
||||||
bpb.show();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!video_data.params.listen && video_data.params.quality === 'dash') {
|
if (!video_data.params.listen && video_data.params.quality === 'dash') {
|
||||||
|
|
|
@ -136,6 +136,7 @@
|
||||||
"Shared `x`": "شارك منذ `x`",
|
"Shared `x`": "شارك منذ `x`",
|
||||||
"`x` views": "`x` مشاهدون",
|
"`x` views": "`x` مشاهدون",
|
||||||
"Premieres in `x`": "يعرض فى `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.": "اهلا! يبدو ان الجافاسكريبت معطلة. اضغط هنا لعرض التعليقات, ضع فى إعتبارك انها ستأخذ وقت اطول للعرض.",
|
"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": "عرض المزيد من التعليقات على\\من موقع Reddit",
|
"View more comments on Reddit": "عرض المزيد من التعليقات على\\من موقع Reddit",
|
||||||
|
|
|
@ -136,6 +136,7 @@
|
||||||
"Shared `x`": "Geteilt `x`",
|
"Shared `x`": "Geteilt `x`",
|
||||||
"`x` views": "`x` Ansichten",
|
"`x` views": "`x` Ansichten",
|
||||||
"Premieres in `x`": "Premieren in `x`",
|
"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.",
|
"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 YouTube comments": "YouTube Kommentare anzeigen",
|
||||||
"View more comments on Reddit": "Mehr Kommentare auf Reddit anzeigen",
|
"View more comments on Reddit": "Mehr Kommentare auf Reddit anzeigen",
|
||||||
|
@ -315,4 +316,4 @@
|
||||||
"Videos": "Videos",
|
"Videos": "Videos",
|
||||||
"Playlists": "Wiedergabelisten",
|
"Playlists": "Wiedergabelisten",
|
||||||
"Current version: ": "Aktuelle Version: "
|
"Current version: ": "Aktuelle Version: "
|
||||||
}
|
}
|
|
@ -154,6 +154,7 @@
|
||||||
"": "`x` προβολές"
|
"": "`x` προβολές"
|
||||||
},
|
},
|
||||||
"Premieres in `x`": "Πρώτη προβολή σε `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. Πατήστε εδώ για προβολή σχολίων, αλλά έχετε υπ'όψιν σας πως ίσως φορτώσουν πιο αργά. ",
|
"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 YouTube comments": "Προβολή σχολίων από το YouTube",
|
||||||
"View more comments on Reddit": "Προβολή περισσότερων σχολίων στο Reddit",
|
"View more comments on Reddit": "Προβολή περισσότερων σχολίων στο Reddit",
|
||||||
|
|
|
@ -154,6 +154,7 @@
|
||||||
"": "`x` views"
|
"": "`x` views"
|
||||||
},
|
},
|
||||||
"Premieres in `x`": "Premieres in `x`",
|
"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.",
|
"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 YouTube comments": "View YouTube comments",
|
||||||
"View more comments on Reddit": "View more comments on Reddit",
|
"View more comments on Reddit": "View more comments on Reddit",
|
||||||
|
|
|
@ -136,6 +136,7 @@
|
||||||
"Shared `x`": "Konigita `x`",
|
"Shared `x`": "Konigita `x`",
|
||||||
"`x` views": "`x` spektaĵoj",
|
"`x` views": "`x` spektaĵoj",
|
||||||
"Premieres in `x`": "Premieras en `x`",
|
"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.",
|
"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 YouTube comments": "Vidi komentojn de YouTube",
|
||||||
"View more comments on Reddit": "Vidi pli komentoj en Reddit",
|
"View more comments on Reddit": "Vidi pli komentoj en Reddit",
|
||||||
|
@ -315,4 +316,4 @@
|
||||||
"Videos": "Videoj",
|
"Videos": "Videoj",
|
||||||
"Playlists": "Ludlistoj",
|
"Playlists": "Ludlistoj",
|
||||||
"Current version: ": "Nuna versio: "
|
"Current version: ": "Nuna versio: "
|
||||||
}
|
}
|
|
@ -136,6 +136,7 @@
|
||||||
"Shared `x`": "Compartido `x`",
|
"Shared `x`": "Compartido `x`",
|
||||||
"`x` views": "`x` visualizaciones",
|
"`x` views": "`x` visualizaciones",
|
||||||
"Premieres in `x`": "Se estrena en `x`",
|
"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.",
|
"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 YouTube comments": "Ver los comentarios de YouTube",
|
||||||
"View more comments on Reddit": "Ver más comentarios en Reddit",
|
"View more comments on Reddit": "Ver más comentarios en Reddit",
|
||||||
|
|
|
@ -136,6 +136,7 @@
|
||||||
"Shared `x`": "Ajoutée le `x`",
|
"Shared `x`": "Ajoutée le `x`",
|
||||||
"`x` views": "`x` vues",
|
"`x` views": "`x` vues",
|
||||||
"Premieres in `x`": "Première dans `x`",
|
"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.",
|
"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 YouTube comments": "Voir les commentaires YouTube",
|
||||||
"View more comments on Reddit": "Voir plus de commentaires sur Reddit",
|
"View more comments on Reddit": "Voir plus de commentaires sur Reddit",
|
||||||
|
|
|
@ -136,6 +136,7 @@
|
||||||
"Shared `x`": "Delt `x`",
|
"Shared `x`": "Delt `x`",
|
||||||
"`x` views": "`x` visninger",
|
"`x` views": "`x` visninger",
|
||||||
"Premieres in `x`": "Premiere om `x`",
|
"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.",
|
"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 YouTube comments": "Vis YouTube-kommentarer",
|
||||||
"View more comments on Reddit": "Vis flere kommenterer på Reddit",
|
"View more comments on Reddit": "Vis flere kommenterer på Reddit",
|
||||||
|
@ -315,4 +316,4 @@
|
||||||
"Videos": "Videoer",
|
"Videos": "Videoer",
|
||||||
"Playlists": "Spillelister",
|
"Playlists": "Spillelister",
|
||||||
"Current version: ": "Nåværende versjon: "
|
"Current version: ": "Nåværende versjon: "
|
||||||
}
|
}
|
|
@ -136,6 +136,7 @@
|
||||||
"Shared `x`": "`x` gedeeld",
|
"Shared `x`": "`x` gedeeld",
|
||||||
"`x` views": "`x` weergaven",
|
"`x` views": "`x` weergaven",
|
||||||
"Premieres in `x`": "Verschijnt over `x`",
|
"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.",
|
"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 YouTube comments": "YouTube-reacties tonen",
|
||||||
"View more comments on Reddit": "Meer reacties bekijken op Reddit",
|
"View more comments on Reddit": "Meer reacties bekijken op Reddit",
|
||||||
|
@ -315,4 +316,4 @@
|
||||||
"Videos": "Video's",
|
"Videos": "Video's",
|
||||||
"Playlists": "Afspeellijsten",
|
"Playlists": "Afspeellijsten",
|
||||||
"Current version: ": "Huidige versie: "
|
"Current version: ": "Huidige versie: "
|
||||||
}
|
}
|
|
@ -136,6 +136,7 @@
|
||||||
"Shared `x`": "Udostępniono `x`",
|
"Shared `x`": "Udostępniono `x`",
|
||||||
"`x` views": "`x` wyświetleń",
|
"`x` views": "`x` wyświetleń",
|
||||||
"Premieres in `x`": "Publikacja za `x`",
|
"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.",
|
"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 YouTube comments": "Wyświetl komentarze z YouTube",
|
||||||
"View more comments on Reddit": "Wyświetl więcej komentarzy na Reddicie",
|
"View more comments on Reddit": "Wyświetl więcej komentarzy na Reddicie",
|
||||||
|
|
|
@ -136,6 +136,7 @@
|
||||||
"Shared `x`": "Опубликовано `x`",
|
"Shared `x`": "Опубликовано `x`",
|
||||||
"`x` views": "`x` просмотров",
|
"`x` views": "`x` просмотров",
|
||||||
"Premieres in `x`": "Премьера через `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. Чтобы увидить комментарии, нажмите сюда, но учтите: они могут загружаться немного медленнее.",
|
"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 YouTube comments": "Смотреть комментарии с YouTube",
|
||||||
"View more comments on Reddit": "Посмотреть больше комментариев на Reddit",
|
"View more comments on Reddit": "Посмотреть больше комментариев на Reddit",
|
||||||
|
|
|
@ -136,6 +136,7 @@
|
||||||
"Shared `x`": "Розміщено `x`",
|
"Shared `x`": "Розміщено `x`",
|
||||||
"`x` views": "`x` переглядів",
|
"`x` views": "`x` переглядів",
|
||||||
"Premieres in `x`": "Прем’єра через `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. Щоб побачити коментарі, натисніть сюда, але майте на увазі, що вони можуть завантажуватися трохи довше.",
|
"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 YouTube comments": "Переглянути коментарі з YouTube",
|
||||||
"View more comments on Reddit": "Переглянути більше коментарів на Reddit",
|
"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)
|
engagement = ((video.dislikes.to_f + video.likes.to_f)/video.views * 100)
|
||||||
|
|
||||||
playability_status = video.player_response["playabilityStatus"]?
|
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
|
reason = playability_status["reason"]?.try &.as_s
|
||||||
end
|
end
|
||||||
reason ||= ""
|
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
|
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)
|
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 record was last updated over 10 minutes ago, or video has since premiered,
|
||||||
if (refresh && Time.utc - video.updated > 10.minutes) || force_refresh
|
# 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
|
begin
|
||||||
video = fetch_video(id, proxies, region)
|
video = fetch_video(id, proxies, region)
|
||||||
video_array = video.to_a
|
video_array = video.to_a
|
||||||
|
|
|
@ -30,7 +30,8 @@ var video_data = {
|
||||||
length_seconds: '<%= video.info["length_seconds"].to_f %>',
|
length_seconds: '<%= video.info["length_seconds"].to_f %>',
|
||||||
video_series: <%= video_series.to_json %>,
|
video_series: <%= video_series.to_json %>,
|
||||||
params: <%= params.to_json %>,
|
params: <%= params.to_json %>,
|
||||||
preferences: <%= preferences.to_json %>
|
preferences: <%= preferences.to_json %>,
|
||||||
|
premiere_timestamp: <%= video.premiere_timestamp.try &.to_unix || "null" %>
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,8 @@ var video_data = {
|
||||||
hide_replies_text: '<%= HTML.escape(translate(locale, "Hide replies")) %>',
|
hide_replies_text: '<%= HTML.escape(translate(locale, "Hide replies")) %>',
|
||||||
show_replies_text: '<%= HTML.escape(translate(locale, "Show replies")) %>',
|
show_replies_text: '<%= HTML.escape(translate(locale, "Show replies")) %>',
|
||||||
params: <%= params.to_json %>,
|
params: <%= params.to_json %>,
|
||||||
preferences: <%= preferences.to_json %>
|
preferences: <%= preferences.to_json %>,
|
||||||
|
premiere_timestamp: <%= video.premiere_timestamp.try &.to_unix || "null" %>
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -72,6 +73,10 @@ var video_data = {
|
||||||
<h3>
|
<h3>
|
||||||
<%= reason %>
|
<%= reason %>
|
||||||
</h3>
|
</h3>
|
||||||
|
<% elsif video.premiere_timestamp %>
|
||||||
|
<h3>
|
||||||
|
<%= translate(locale, "Premieres in `x`", recode_date((video.premiere_timestamp.as(Time) - Time.utc).ago, locale)) %>
|
||||||
|
</h3>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -172,7 +177,11 @@ var video_data = {
|
||||||
<%= rendered "components/subscribe_widget" %>
|
<%= rendered "components/subscribe_widget" %>
|
||||||
|
|
||||||
<p>
|
<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>
|
</p>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
|
|
Loading…
Reference in a new issue