Add description_html field to Category

This commit is contained in:
syeopite 2021-05-08 20:07:07 -07:00
parent b906f7a3f8
commit aa8f15f795
No known key found for this signature in database
GPG key ID: 6FA616E5A5294A82
4 changed files with 8 additions and 0 deletions

View file

@ -391,6 +391,7 @@ def fetch_channel_featured_channels(ucid, tab_data, view = nil, shelf_id = nil,
return [Category.new({ return [Category.new({
title: query_title.not_nil!, # If continuation contents is requested then the query_title has to be passed along. title: query_title.not_nil!, # If continuation contents is requested then the query_title has to be passed along.
contents: items, contents: items,
description_html: "",
browse_endpoint_data: nil, browse_endpoint_data: nil,
badges: nil, badges: nil,
auxiliary_data: auxiliary_data, auxiliary_data: auxiliary_data,
@ -435,6 +436,7 @@ def fetch_channel_featured_channels(ucid, tab_data, view = nil, shelf_id = nil,
category_array << Category.new({ category_array << Category.new({
title: category.title.empty? ? fallback_title : category.title, title: category.title.empty? ? fallback_title : category.title,
contents: category.contents, contents: category.contents,
description_html: category.description_html,
browse_endpoint_data: nil, browse_endpoint_data: nil,
badges: nil, badges: nil,
auxiliary_data: category.auxiliary_data, auxiliary_data: category.auxiliary_data,
@ -446,6 +448,7 @@ def fetch_channel_featured_channels(ucid, tab_data, view = nil, shelf_id = nil,
category_array << Category.new({ category_array << Category.new({
title: fallback_title, title: fallback_title,
contents: items, contents: items,
description_html: "",
browse_endpoint_data: nil, browse_endpoint_data: nil,
badges: nil, badges: nil,
auxiliary_data: auxiliary_data, auxiliary_data: auxiliary_data,

View file

@ -258,6 +258,9 @@ private class CategoryParser < ItemParser
badges << {badge["style"].as_s, badge["label"].as_s} badges << {badge["style"].as_s, badge["label"].as_s}
end end
# Category description
description_html = item_contents["subtitle"]?.try { |desc| parse_content(desc) } || ""
# Content parsing # Content parsing
contents = [] of SearchItem contents = [] of SearchItem
@ -280,6 +283,7 @@ private class CategoryParser < ItemParser
Category.new({ Category.new({
title: title, title: title,
contents: contents, contents: contents,
description_html: description_html,
browse_endpoint_data: browse_endpoint_data, browse_endpoint_data: browse_endpoint_data,
badges: badges, badges: badges,
auxiliary_data: auxiliary_data, auxiliary_data: auxiliary_data,

View file

@ -234,6 +234,7 @@ class Category
property title : String property title : String
property contents : Array(SearchItem) property contents : Array(SearchItem)
property browse_endpoint_data : String? property browse_endpoint_data : String?
property description_html : String
property badges : Array(Tuple(String, String))? property badges : Array(Tuple(String, String))?
# Data unique to only specific types of categories. # Data unique to only specific types of categories.

View file