Removed dummy values and added checks for items.ecr

This commit is contained in:
jonas-w 2022-02-07 02:00:43 +01:00
parent 00df3e2c40
commit 9205ccc124
5 changed files with 8 additions and 20 deletions

View file

@ -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|

View file

@ -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

View file

@ -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)

View file

@ -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)

View file

@ -30,7 +30,7 @@
<p dir="auto"><%= HTML.escape(item.title) %></p>
</a>
<a href="/channel/<%= item.ucid %>">
<p dir="auto"><b><%= HTML.escape(item.author) %><% if !item.author_verified.nil? && item.author_verified %><i class="icon ion ion-md-checkmark-circle"></i><% end %></b></p>
<p dir="auto"><b><%= HTML.escape(item.author) %><% if !item.is_a?(InvidiousPlaylist) && !item.author_verified.nil? && item.author_verified %><i class="icon ion ion-md-checkmark-circle"></i><% end %></b></p>
</a>
<% when MixVideo %>
<a href="/watch?v=<%= item.id %>&list=<%= item.rdid %>">
@ -45,7 +45,7 @@
<p dir="auto"><%= HTML.escape(item.title) %></p>
</a>
<a href="/channel/<%= item.ucid %>">
<p dir="auto"><b><%= HTML.escape(item.author) %><% if !item.author_verified.nil? && item.author_verified %><i class="icon ion ion-md-checkmark-circle"></i><% end %></b></p>
<p dir="auto"><b><%= HTML.escape(item.author) %><% if !item.is_a?(MixVideo) && !item.author_verified.nil? && item.author_verified %><i class="icon ion ion-md-checkmark-circle"></i><% end %></b></p>
</a>
<% when PlaylistVideo %>
<a style="width:100%" href="/watch?v=<%= item.id %>&list=<%= item.plid %>&index=<%= item.index %>">
@ -142,7 +142,7 @@
<div class="video-card-row flexible">
<div class="flex-left"><a href="/channel/<%= item.ucid %>">
<p class="channel-name" dir="auto"><%= HTML.escape(item.author) %><% if !item.author_verified.nil? && item.author_verified %><i class="icon ion ion-md-checkmark-circle"></i><% end %></p>
<p class="channel-name" dir="auto"><%= HTML.escape(item.author) %><% if !item.is_a?(ChannelVideo) && !item.author_verified.nil? && item.author_verified %><i class="icon ion ion-md-checkmark-circle"></i><% end %></p>
</a></div>
<% endpoint_params = "?v=#{item.id}" %>