Merge pull request #1808 from tenpura-shrimp/showstreamstart

show how long ago stream started
This commit is contained in:
TheFrenchGhosty 2021-02-25 17:53:51 +01:00 committed by GitHub
commit c8cdc50d29
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View file

@ -534,7 +534,8 @@ struct Video
end end
def live_now def live_now
info["videoDetails"]["isLiveContent"]?.try &.as_bool || false info["microformat"]?.try &.["playerMicroformatRenderer"]?
.try &.["liveBroadcastDetails"]?.try &.["isLiveNow"]?.try &.as_bool || false
end end
def is_listed def is_listed

View file

@ -81,6 +81,10 @@
<h3> <h3>
<%= video.premiere_timestamp.try { |t| translate(locale, "Premieres in `x`", recode_date((t - Time.utc).ago, locale)) } %> <%= video.premiere_timestamp.try { |t| translate(locale, "Premieres in `x`", recode_date((t - Time.utc).ago, locale)) } %>
</h3> </h3>
<% elsif video.live_now %>
<h3>
<%= video.premiere_timestamp.try { |t| translate(locale, "Started streaming `x` ago", recode_date((Time.utc - t).ago, locale)) } %>
</h3>
<% end %> <% end %>
</div> </div>