diff --git a/assets/css/default.css b/assets/css/default.css index 9828513a..504329cd 100644 --- a/assets/css/default.css +++ b/assets/css/default.css @@ -761,8 +761,16 @@ h1, h2, h3, h4, h5, p, } div.compilation-video-panel { - display: block; - margin-left: auto; - margin-right: auto; - color: #d9d9d9; + padding: 28.125%; + position: relative; + box-sizing: border-box; } + +img.compilation-video-panel { + position: absolute; + width: 100%; + height: 100%; + left: 0; + top: 0; + object-fit: cover; +} \ No newline at end of file diff --git a/src/invidious/routing.cr b/src/invidious/routing.cr index d64ccceb..ac01694d 100644 --- a/src/invidious/routing.cr +++ b/src/invidious/routing.cr @@ -86,6 +86,7 @@ module Invidious::Routing get "/create_compilation", Routes::Compilations, :new post "/create_compilation", Routes::Compilations, :create post "/compilation_ajax", Routes::Compilations, :compilation_ajax + get "/add_compilation_items", Routes::Compilations, :add_compilation_items_page end def register_iv_playlist_routes diff --git a/src/invidious/search/query.cr b/src/invidious/search/query.cr index e38845d9..de64388e 100644 --- a/src/invidious/search/query.cr +++ b/src/invidious/search/query.cr @@ -8,6 +8,7 @@ module Invidious::Search # Types specific to Invidious Subscriptions # Search user subscriptions Playlist # "Add playlist item" search + Compilation # "Add compilation item" search end getter type : Type = Type::Regular @@ -75,6 +76,12 @@ module Invidious::Search # @filters, _, @query, _ = Filters.from_legacy_filters(@raw_query) # + when .compilation? + # In "add compilation item" mode, filters are parsed from the query + # string itself (legacy), and the channel is ignored. + # + @filters, _, @query, _ = Filters.from_legacy_filters(@raw_query) + # when .subscriptions?, .regular? if params["sp"]? # Parse the `sp` URL parameter (youtube compatibility) @@ -112,7 +119,7 @@ module Invidious::Search return items if self.empty_raw_query? case @type - when .regular?, .playlist? + when .regular?, .playlist?, .compilation? items = Processors.regular(self) # when .channel? diff --git a/src/invidious/views/compilation.ecr b/src/invidious/views/compilation.ecr index 741f6770..6bcd7d0f 100644 --- a/src/invidious/views/compilation.ecr +++ b/src/invidious/views/compilation.ecr @@ -6,3 +6,99 @@ <% end %> +
<%= HTML.escape(item.author) %><% if !item.is_a?(InvidiousCompilation) && !item.is_a?(InvidiousPlaylist) && !item.author_verified.nil? && item.author_verified %> <% end %>
<% when CompilationVideo %> - +<%= translate(locale, "LIVE") %>
+ <% elsif item.length_seconds != 0 %> +<%= recode_length_seconds(item.length_seconds) %>
+ <% end %> + + <% if item_watched %> + + + <% end %> +<%= HTML.escape(item.title) %>
+ + +<%= translate(locale, "Premieres in `x`", recode_date((item.premiere_timestamp.as(Time) - Time.utc).ago, locale)) %>
+ <% elsif Time.utc - item.published > 1.minute %> +<%= translate(locale, "Shared `x` ago", recode_date(item.published, locale)) %>
+ <% end %> +<%= translate_count(locale, "generic_views_count", item.views || 0, NumberFormatting::Short) %>
+