From 9205ccc12417bd6797d3900e19f440cf3674d427 Mon Sep 17 00:00:00 2001 From: jonas-w Date: Mon, 7 Feb 2022 02:00:43 +0100 Subject: [PATCH] Removed dummy values and added checks for items.ecr --- src/invidious/channels/channels.cr | 3 --- src/invidious/mixes.cr | 5 +---- src/invidious/playlists.cr | 9 ++------- src/invidious/routes/feeds.cr | 5 ++--- src/invidious/views/components/item.ecr | 6 +++--- 5 files changed, 8 insertions(+), 20 deletions(-) diff --git a/src/invidious/channels/channels.cr b/src/invidious/channels/channels.cr index 9e701043..e0459cc3 100644 --- a/src/invidious/channels/channels.cr +++ b/src/invidious/channels/channels.cr @@ -21,7 +21,6 @@ struct ChannelVideo property live_now : Bool = false property premiere_timestamp : Time? = nil property views : Int64? = nil - property author_verified : Bool #TODO currently a dummy def to_json(locale, json : JSON::Builder) json.object do @@ -219,7 +218,6 @@ def fetch_channel(ucid, pull_all_videos : Bool) live_now: live_now, premiere_timestamp: premiere_timestamp, views: views, - author_verified: false, #TODO dummy for components/item.ecr }) LOGGER.trace("fetch_channel: #{ucid} : video #{video_id} : Updating or inserting video") @@ -257,7 +255,6 @@ def fetch_channel(ucid, pull_all_videos : Bool) live_now: video.live_now, premiere_timestamp: video.premiere_timestamp, views: video.views, - author_verified: false, #TODO dummy for components/item.ecr }) } videos.each do |video| diff --git a/src/invidious/mixes.cr b/src/invidious/mixes.cr index b578e3d9..b3edea27 100644 --- a/src/invidious/mixes.cr +++ b/src/invidious/mixes.cr @@ -8,10 +8,7 @@ struct MixVideo property length_seconds : Int32 property index : Int32 property rdid : String - - def author_verified - false #TODO dummy - end + end struct Mix diff --git a/src/invidious/playlists.cr b/src/invidious/playlists.cr index a17766e3..8383b185 100644 --- a/src/invidious/playlists.cr +++ b/src/invidious/playlists.cr @@ -234,9 +234,6 @@ struct InvidiousPlaylist 0_i64 end - def author_verified - false # TODO dummy for components/item.ecr - end def description_html HTML.escape(self.description) @@ -255,8 +252,7 @@ def create_playlist(title, privacy, user) created: Time.utc, updated: Time.utc, privacy: privacy, - index: [] of Int64, - author_verified: false, # TODO dummy for components/item.ecr + index: [] of Int64 }) Invidious::Database::Playlists.insert(playlist) @@ -274,8 +270,7 @@ def subscribe_playlist(user, playlist) created: Time.utc, updated: playlist.updated, privacy: PlaylistPrivacy::Private, - index: [] of Int64, - author_verified: false, # TODO dummy for components/item.ecr + index: [] of Int64 }) Invidious::Database::Playlists.insert(playlist) diff --git a/src/invidious/routes/feeds.cr b/src/invidious/routes/feeds.cr index 6d1f098f..c26e6da7 100644 --- a/src/invidious/routes/feeds.cr +++ b/src/invidious/routes/feeds.cr @@ -156,7 +156,7 @@ module Invidious::Routes::Feeds response = YT_POOL.client &.get("/feeds/videos.xml?channel_id=#{channel.ucid}") rss = XML.parse_html(response.body) - + print(response) videos = rss.xpath_nodes("//feed/entry").map do |entry| video_id = entry.xpath_node("videoid").not_nil!.content title = entry.xpath_node("title").not_nil!.content @@ -182,7 +182,7 @@ module Invidious::Routes::Feeds paid: false, premium: false, premiere_timestamp: nil, - author_verified: false, #TODO real value + author_verified: false, # ¯\_(ツ)_/¯ }) end @@ -415,7 +415,6 @@ module Invidious::Routes::Feeds live_now: video.live_now, premiere_timestamp: video.premiere_timestamp, views: video.views, - author_verified: false, #TODO dummy for components/item.ecr }) was_insert = Invidious::Database::ChannelVideos.insert(video, with_premiere_timestamp: true) diff --git a/src/invidious/views/components/item.ecr b/src/invidious/views/components/item.ecr index db003146..bc59233f 100644 --- a/src/invidious/views/components/item.ecr +++ b/src/invidious/views/components/item.ecr @@ -30,7 +30,7 @@

<%= HTML.escape(item.title) %>

-

<%= HTML.escape(item.author) %><% if !item.author_verified.nil? && item.author_verified %><% end %>

+

<%= HTML.escape(item.author) %><% if !item.is_a?(InvidiousPlaylist) && !item.author_verified.nil? && item.author_verified %><% end %>

<% when MixVideo %> @@ -45,7 +45,7 @@

<%= HTML.escape(item.title) %>

-

<%= HTML.escape(item.author) %><% if !item.author_verified.nil? && item.author_verified %><% end %>

+

<%= HTML.escape(item.author) %><% if !item.is_a?(MixVideo) && !item.author_verified.nil? && item.author_verified %><% end %>

<% when PlaylistVideo %> @@ -142,7 +142,7 @@
<% endpoint_params = "?v=#{item.id}" %>