Major improvements

This commit is contained in:
techmetx11 2023-01-22 00:12:04 +01:00
parent fe5b81f2c3
commit caf9520c86
No known key found for this signature in database
GPG Key ID: 20E0C88A0E7E5AF2
5 changed files with 55 additions and 49 deletions

View File

@ -491,30 +491,27 @@ hr {
/* Description Expansion Styling*/ /* Description Expansion Styling*/
#descexpansionbutton, #descexpansionbutton,
#musicdescexpansionbutton { #music-desc-expansion {
display: none display: none;
} }
#descexpansionbutton ~ div, #descexpansionbutton ~ div {
#musicdescexpansionbutton ~ div {
overflow: hidden; overflow: hidden;
height: 8.3em; height: 8.3em;
} }
#descexpansionbutton:checked ~ div, #descexpansionbutton:checked ~ div {
#musicdescexpansionbutton:checked ~ div {
overflow: unset; overflow: unset;
height: 100%; height: 100%;
} }
#descexpansionbutton ~ label, #descexpansionbutton ~ label {
#musicdescexpansionbutton ~ label {
order: 1; order: 1;
margin-top: 20px; margin-top: 20px;
} }
label[for="descexpansionbutton"]:hover, label[for="descexpansionbutton"]:hover,
label[for="musicdescexpansionbutton"]:hover { label[for="music-desc-expansion"]:hover {
cursor: pointer; cursor: pointer;
} }
@ -527,8 +524,7 @@ h5,
p, p,
#descriptionWrapper, #descriptionWrapper,
#description-box, #description-box,
#music-description-box, #music-description-box {
#musicDescriptionWrapper {
unicode-bidi: plaintext; unicode-bidi: plaintext;
text-align: start; text-align: start;
} }
@ -538,12 +534,27 @@ p,
white-space: pre-wrap; white-space: pre-wrap;
} }
#musicDescriptionWrapper { #music-description-box {
max-width: 600px; display: none;
} }
#music-description-title { #music-desc-expansion:checked ~ #music-description-box {
margin-bottom: 0px; display: block;
}
#music-desc-expansion ~ label > h3 > .ion-ios-arrow-up,
#music-desc-expansion:checked ~ label > h3 > .ion-ios-arrow-down {
display: none;
}
#music-desc-expansion:checked ~ label > h3 > .ion-ios-arrow-up,
#music-desc-expansion ~ label > h3 > .ion-ios-arrow-down {
display: inline;
}
/* Select all the music items except the first one */
.music-item + .music-item {
border-top: 1px solid #ffffff;
} }
/* Center the "invidious" logo on the search page */ /* Center the "invidious" logo on the search page */

View File

@ -188,6 +188,7 @@
"Engagement: ": "Engagement: ", "Engagement: ": "Engagement: ",
"Whitelisted regions: ": "Whitelisted regions: ", "Whitelisted regions: ": "Whitelisted regions: ",
"Blacklisted regions: ": "Blacklisted regions: ", "Blacklisted regions: ": "Blacklisted regions: ",
"Music in this video": "Music in this video",
"Artist: ": "Artist: ", "Artist: ": "Artist: ",
"Album: ": "Album: ", "Album: ": "Album: ",
"Shared `x`": "Shared `x`", "Shared `x`": "Shared `x`",

View File

@ -248,12 +248,9 @@ struct Video
end end
def music : Array(VideoMusic) def music : Array(VideoMusic)
music_list = Array(VideoMusic).new info["music"].as_a.map { |music_json|
VideoMusic.new(music_json["album"].as_s, music_json["artist"].as_s, music_json["license"].as_s)
info["music"].as_a.each do |music_json| }
music_list << VideoMusic.new(music_json["album"].as_s, music_json["artist"].as_s, music_json["license"].as_s)
end
return music_list
end end
# Macros defining getters/setters for various types of data # Macros defining getters/setters for various types of data

View File

@ -312,13 +312,18 @@ def parse_video_info(video_id : String, player_response : Hash(String, JSON::Any
# Music section # Music section
music_list = [] of VideoMusic music_list = [] of VideoMusic
music_desclist = player_response.dig?("engagementPanels", 1, "engagementPanelSectionListRenderer", "content", "structuredDescriptionContentRenderer", "items", 2, "videoDescriptionMusicSectionRenderer", "carouselLockups").try &.as_a music_desclist = player_response.dig?(
music_desclist.try &.each do |music_desc| "engagementPanels", 1, "engagementPanelSectionListRenderer",
"content", "structuredDescriptionContentRenderer", "items", 2,
"videoDescriptionMusicSectionRenderer", "carouselLockups"
)
music_desclist.try &.as_a.each do |music_desc|
artist = nil artist = nil
album = nil album = nil
music_license = nil music_license = nil
music_desc.dig?("carouselLockupRenderer", "infoRows").try &.as_a.try &.each do |desc| music_desc.dig?("carouselLockupRenderer", "infoRows").try &.as_a.each do |desc|
desc_title = extract_text(desc.dig?("infoRowRenderer", "title")) desc_title = extract_text(desc.dig?("infoRowRenderer", "title"))
if desc_title == "ARTIST" if desc_title == "ARTIST"
artist = extract_text(desc.dig?("infoRowRenderer", "defaultMetadata")) artist = extract_text(desc.dig?("infoRowRenderer", "defaultMetadata"))
@ -328,8 +333,7 @@ def parse_video_info(video_id : String, player_response : Hash(String, JSON::Any
music_license = extract_text(desc.dig?("infoRowRenderer", "expandedMetadata")) music_license = extract_text(desc.dig?("infoRowRenderer", "expandedMetadata"))
end end
end end
music = VideoMusic.new(album.to_s, artist.to_s, music_license.to_s) music_list << VideoMusic.new(album.to_s, artist.to_s, music_license.to_s)
music_list << music
end end
# Author infos # Author infos

View File

@ -34,13 +34,11 @@
we're going to need to do it here in order to allow for translations. we're going to need to do it here in order to allow for translations.
--> -->
<style> <style>
#descexpansionbutton ~ label > a::after, #descexpansionbutton ~ label > a::after {
#musicdescexpansionbutton ~ label > a::after {
content: "<%= translate(locale, "Show more") %>" content: "<%= translate(locale, "Show more") %>"
} }
#descexpansionbutton:checked ~ label > a::after, #descexpansionbutton:checked ~ label > a::after {
#musicdescexpansionbutton:checked ~ label > a::after {
content: "<%= translate(locale, "Show less") %>" content: "<%= translate(locale, "Show less") %>"
} }
</style> </style>
@ -238,27 +236,22 @@ we're going to need to do it here in order to allow for translations.
<hr> <hr>
<% if !video.music.empty? %> <% if !video.music.empty? %>
<h3 id="music-description-title"><%= translate(locale, "Music") %></h3> <input id="music-desc-expansion" type="checkbox"/>
<label for="music-desc-expansion">
<h3 id="music-description-title">
<%= translate(locale, "Music in this video") %>
<span class="icon ion-ios-arrow-up"></span>
<span class="icon ion-ios-arrow-down"></span>
</h3>
</label>
<div id="music-description-box"> <div id="music-description-box">
<% if video.music.size == 1 %> <% video.music.each do |music| %>
<div id="musicDescriptionWrapper"> <div class="music-item">
<p id="music-artist"><%= translate(locale, "Artist: ") %><%= video.music[0].artist %></p> <p id="music-artist"><%= translate(locale, "Artist: ") %><%= music.artist %></p>
<p id="music-album"><%= translate(locale, "Album: ") %><%= video.music[0].album %></p> <p id="music-album"><%= translate(locale, "Album: ") %><%= music.album %></p>
<p id="music-license"><%= translate(locale, "License: ") %><%= video.music[0].license %></p> <p id="music-license"><%= translate(locale, "License: ") %><%= music.license %></p>
</div> </div>
<% else %>
<input id="musicdescexpansionbutton" type="checkbox"/>
<div id="musicDescriptionWrapper">
<% video.music.each do |music| %>
<p id="music-artist"><%= translate(locale, "Artist: ") %><%= music.artist %></p>
<p id="music-album"><%= translate(locale, "Album: ") %><%= music.album %></p>
<p id="music-license"><%= translate(locale, "License: ") %><%= music.license %></p>
<hr>
<% end %>
</div>
<label for="musicdescexpansionbutton">
<a></a>
</label>
<% end %> <% end %>
</div> </div>
<hr> <hr>