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({
title: query_title.not_nil!, # If continuation contents is requested then the query_title has to be passed along.
contents: items,
description_html: "",
browse_endpoint_data: nil,
badges: nil,
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({
title: category.title.empty? ? fallback_title : category.title,
contents: category.contents,
description_html: category.description_html,
browse_endpoint_data: nil,
badges: nil,
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({
title: fallback_title,
contents: items,
description_html: "",
browse_endpoint_data: nil,
badges: nil,
auxiliary_data: auxiliary_data,

View file

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

View file

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

View file