mirror of
https://github.com/lifegpc/pixiv_downloader.git
synced 2026-07-08 01:32:41 +08:00
add support to output description information
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
use crate::data::data::PixivData;
|
||||
use crate::gettext;
|
||||
use crate::parser::description::parse_description;
|
||||
use crate::pixiv_link::PixivID;
|
||||
use crate::pixiv_link::ToPixivID;
|
||||
use json::JsonValue;
|
||||
@@ -91,6 +92,13 @@ impl From<&PixivData> for JSONDataFile {
|
||||
if p.author.is_some() {
|
||||
f.add("author", p.author.as_ref().unwrap()).unwrap();
|
||||
}
|
||||
if p.description.is_some() {
|
||||
f.add("description", p.description.as_ref().unwrap()).unwrap();
|
||||
let pd = parse_description(p.description.as_ref().unwrap());
|
||||
if pd.is_some() {
|
||||
f.add("parsed_description", pd.unwrap()).unwrap();
|
||||
}
|
||||
}
|
||||
f
|
||||
}
|
||||
}
|
||||
@@ -121,3 +129,9 @@ impl ToJson for &String {
|
||||
Some(JsonValue::String((*self).to_string()))
|
||||
}
|
||||
}
|
||||
|
||||
impl ToJson for String {
|
||||
fn to_json(&self) -> Option<JsonValue> {
|
||||
Some(JsonValue::String(self.to_string()))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user