From dd11620ffaf112dfc80b4150b1d2ce7e508d9cdf Mon Sep 17 00:00:00 2001 From: Neshura Date: Sun, 17 Dec 2023 14:42:22 +0100 Subject: [PATCH] Added description field to jnovel PostInfo struct --- src/jnovel/mod.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/jnovel/mod.rs b/src/jnovel/mod.rs index 616042d..23f9e5b 100644 --- a/src/jnovel/mod.rs +++ b/src/jnovel/mod.rs @@ -149,7 +149,7 @@ impl PartialOrd for PartInfo { #[derive(Debug, Clone)] pub(crate) enum PostInfo { Chapter { part: PartInfo, volume: u8, lemmy_info: LemmyPostInfo }, - Volume { part: PartInfo, lemmy_info: LemmyPostInfo }, + Volume { part: PartInfo, description: String, lemmy_info: LemmyPostInfo }, } impl PostInfo { @@ -166,6 +166,13 @@ impl PostInfo { Volume {lemmy_info: lemmy_info, ..} => lemmy_info.clone() } } + + pub(crate) fn get_description(&self) -> Option { + match self { + _Chapter => None, + Volume {description, ..} => Some(description.clone()) + } + } } impl PartialEq for PostInfo { @@ -286,6 +293,7 @@ pub(crate) async fn check_feed(series_slug: &str, series_has_parts: bool) -> Res let new_post_info = Volume { part: new_part_info, + description: volume.short_description.clone(), lemmy_info: post_details, };