diff --git a/locales/en-US.json b/locales/en-US.json index 06d095dc..e206bc0e 100644 --- a/locales/en-US.json +++ b/locales/en-US.json @@ -174,6 +174,7 @@ "Delete playlist `x`?": "Delete playlist `x`?", "Delete playlist": "Delete playlist", "Create playlist": "Create playlist", + "Create compilation": "Create compilation", "Title": "Title", "Playlist privacy": "Playlist privacy", "Editing playlist `x`": "Editing playlist `x`", @@ -413,6 +414,7 @@ "Audio mode": "Audio mode", "Video mode": "Video mode", "Playlists": "Playlists", + "Compilations": "Compilations", "search_filters_title": "Filters", "search_filters_date_label": "Upload date", "search_filters_date_option_none": "Any date", @@ -469,6 +471,7 @@ "download_subtitles": "Subtitles - `x` (.vtt)", "user_created_playlists": "`x` created playlists", "user_saved_playlists": "`x` saved playlists", + "user_created_compilations": "`x` created compilations", "Video unavailable": "Video unavailable", "preferences_save_player_pos_label": "Save playback position: ", "crash_page_you_found_a_bug": "It looks like you found a bug in Invidious!", diff --git a/src/invidious/compilations.cr b/src/invidious/compilations.cr index b048fb84..42e9aaf5 100644 --- a/src/invidious/compilations.cr +++ b/src/invidious/compilations.cr @@ -240,9 +240,9 @@ struct InvidiousCompilation end def create_compilation(title, privacy, user) - plid = "IVPL#{Random::Secure.urlsafe_base64(24)[0, 31]}" + compid = "IVPL#{Random::Secure.urlsafe_base64(24)[0, 31]}" - playlist = InvidiousCompilation.new({ + compilation = InvidiousCompilation.new({ title: title.byte_slice(0, 150), id: compid, author: user.email, diff --git a/src/invidious/database/compilations.cr b/src/invidious/database/compilations.cr index ff727e99..76e45641 100644 --- a/src/invidious/database/compilations.cr +++ b/src/invidious/database/compilations.cr @@ -166,6 +166,8 @@ end module Invidious::Database::CompilationVideos extend self + private alias VideoIndex = Int64 | Array(Int64) + # ------------------- # Insert / Delete # ------------------- diff --git a/src/invidious/views/components/item.ecr b/src/invidious/views/components/item.ecr index c29ec47b..867e2e8f 100644 --- a/src/invidious/views/components/item.ecr +++ b/src/invidious/views/components/item.ecr @@ -1,6 +1,6 @@ <%- thin_mode = env.get("preferences").as(Preferences).thin_mode - item_watched = !item.is_a?(SearchChannel | SearchHashtag | SearchPlaylist | InvidiousPlaylist | Category) && env.get?("user").try &.as(User).watched.index(item.id) != nil + item_watched = !item.is_a?(SearchChannel | SearchHashtag | SearchPlaylist | InvidiousPlaylist | InvidiousCompilation | Category) && env.get?("user").try &.as(User).watched.index(item.id) != nil author_verified = item.responds_to?(:author_verified) && item.author_verified -%> @@ -53,7 +53,7 @@
<%= translate_count(locale, "generic_channels_count", item.channel_count, NumberFormatting::Separator) %>
<%- end -%> - <% when SearchPlaylist, InvidiousPlaylist %> + <% when SearchPlaylist, InvidiousPlaylist, InvidiousCompilation %> <%- if item.id.starts_with? "RD" link_url = "/mix?list=#{item.id}&continuation=#{URI.parse(item.thumbnail || "/vi/-----------").request_target.split("/")[2]}" @@ -87,6 +87,11 @@ + <% when CompilationVideo %> + + <% if !env.get("preferences").as(Preferences).thin_mode %> + <% end %> + <% when Category %> <% else %> <%- diff --git a/src/invidious/views/feeds/compilations.ecr b/src/invidious/views/feeds/compilations.ecr index 096a5090..a7280e30 100644 --- a/src/invidious/views/feeds/compilations.ecr +++ b/src/invidious/views/feeds/compilations.ecr @@ -2,4 +2,28 @@