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 live_now : Bool = false
property premiere_timestamp : Time? = nil property premiere_timestamp : Time? = nil
property views : Int64? = nil property views : Int64? = nil
property author_verified : Bool #TODO currently a dummy
def to_json(locale, json : JSON::Builder) def to_json(locale, json : JSON::Builder)
json.object do json.object do
@ -219,7 +218,6 @@ def fetch_channel(ucid, pull_all_videos : Bool)
live_now: live_now, live_now: live_now,
premiere_timestamp: premiere_timestamp, premiere_timestamp: premiere_timestamp,
views: views, views: views,
author_verified: false, #TODO dummy for components/item.ecr
}) })
LOGGER.trace("fetch_channel: #{ucid} : video #{video_id} : Updating or inserting video") 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, live_now: video.live_now,
premiere_timestamp: video.premiere_timestamp, premiere_timestamp: video.premiere_timestamp,
views: video.views, views: video.views,
author_verified: false, #TODO dummy for components/item.ecr
}) } }) }
videos.each do |video| videos.each do |video|

View File

@ -8,10 +8,7 @@ struct MixVideo
property length_seconds : Int32 property length_seconds : Int32
property index : Int32 property index : Int32
property rdid : String property rdid : String
def author_verified
false #TODO dummy
end
end end
struct Mix struct Mix

View File

@ -234,9 +234,6 @@ struct InvidiousPlaylist
0_i64 0_i64
end end
def author_verified
false # TODO dummy for components/item.ecr
end
def description_html def description_html
HTML.escape(self.description) HTML.escape(self.description)
@ -255,8 +252,7 @@ def create_playlist(title, privacy, user)
created: Time.utc, created: Time.utc,
updated: Time.utc, updated: Time.utc,
privacy: privacy, privacy: privacy,
index: [] of Int64, index: [] of Int64
author_verified: false, # TODO dummy for components/item.ecr
}) })
Invidious::Database::Playlists.insert(playlist) Invidious::Database::Playlists.insert(playlist)
@ -274,8 +270,7 @@ def subscribe_playlist(user, playlist)
created: Time.utc, created: Time.utc,
updated: playlist.updated, updated: playlist.updated,
privacy: PlaylistPrivacy::Private, privacy: PlaylistPrivacy::Private,
index: [] of Int64, index: [] of Int64
author_verified: false, # TODO dummy for components/item.ecr
}) })
Invidious::Database::Playlists.insert(playlist) 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}") response = YT_POOL.client &.get("/feeds/videos.xml?channel_id=#{channel.ucid}")
rss = XML.parse_html(response.body) rss = XML.parse_html(response.body)
print(response)
videos = rss.xpath_nodes("//feed/entry").map do |entry| videos = rss.xpath_nodes("//feed/entry").map do |entry|
video_id = entry.xpath_node("videoid").not_nil!.content video_id = entry.xpath_node("videoid").not_nil!.content
title = entry.xpath_node("title").not_nil!.content title = entry.xpath_node("title").not_nil!.content
@ -182,7 +182,7 @@ module Invidious::Routes::Feeds
paid: false, paid: false,
premium: false, premium: false,
premiere_timestamp: nil, premiere_timestamp: nil,
author_verified: false, #TODO real value author_verified: false, # ¯\_(ツ)_/¯
}) })
end end
@ -415,7 +415,6 @@ module Invidious::Routes::Feeds
live_now: video.live_now, live_now: video.live_now,
premiere_timestamp: video.premiere_timestamp, premiere_timestamp: video.premiere_timestamp,
views: video.views, views: video.views,
author_verified: false, #TODO dummy for components/item.ecr
}) })
was_insert = Invidious::Database::ChannelVideos.insert(video, with_premiere_timestamp: true) 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> <p dir="auto"><%= HTML.escape(item.title) %></p>
</a> </a>
<a href="/channel/<%= item.ucid %>"> <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> </a>
<% when MixVideo %> <% when MixVideo %>
<a href="/watch?v=<%= item.id %>&list=<%= item.rdid %>"> <a href="/watch?v=<%= item.id %>&list=<%= item.rdid %>">
@ -45,7 +45,7 @@
<p dir="auto"><%= HTML.escape(item.title) %></p> <p dir="auto"><%= HTML.escape(item.title) %></p>
</a> </a>
<a href="/channel/<%= item.ucid %>"> <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> </a>
<% when PlaylistVideo %> <% when PlaylistVideo %>
<a style="width:100%" href="/watch?v=<%= item.id %>&list=<%= item.plid %>&index=<%= item.index %>"> <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="video-card-row flexible">
<div class="flex-left"><a href="/channel/<%= item.ucid %>"> <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> </a></div>
<% endpoint_params = "?v=#{item.id}" %> <% endpoint_params = "?v=#{item.id}" %>