Update to 0.19.5 and include optional thumbnail

This commit is contained in:
Neshura 2024-07-15 22:15:19 +02:00
parent 7dcc7bfee2
commit 2ecfe88cb9
Signed by: Neshura
GPG key ID: 4E2D47B1374C297D
5 changed files with 378 additions and 109 deletions
src/fetchers

View file

@ -4,7 +4,6 @@ use serde_derive::{Deserialize, Serialize};
use std::collections::HashMap;
use std::ops::Sub;
use async_trait::async_trait;
use url::Url;
use crate::fetchers::{FetcherTrait};
use crate::lemmy::{PartInfo, PostInfo, PostInfoInner, PostType};
use systemd_journal_logger::connected_to_journal;
@ -201,7 +200,8 @@ impl FetcherTrait for JNovelFetcher {
);
let post_details = PostInfoInner {
title: volume.title.clone(),
url: Url::parse(&post_url).unwrap(),
url: post_url.clone(),
thumbnail: Some(volume.cover.thumbnail.clone())
};
let new_post_info = PostInfo {
@ -293,10 +293,13 @@ async fn get_latest_prepub(volume_slug: &str) -> Option<PostInfoInner> {
continue;
}
let thumbnail = prepub_part.cover.as_ref().map(|cover| cover.thumbnail.clone());
let post_url = format!("{}/read/{}", jnc_base_url!(), prepub_part.slug);
post_details = Some(PostInfoInner {
title: prepub_part.title.clone(),
url: Url::parse(&post_url).unwrap(),
url: post_url.clone(),
thumbnail
});
}