refactor(pixiv): keep the artwork type as the API's string

TypeModel's Illust and Manga variants existed only so serde would accept
those values -- both call sites ask a single question (is this ugoira?), so
the field is a String and the check is a comparison. Same for a type the API
adds later: it no longer fails the whole parse.
This commit is contained in:
2026-09-21 17:19:26 +08:00
parent 7dd0e8f2d6
commit 7a61077d80
3 changed files with 8 additions and 15 deletions
+2 -2
View File
@@ -1,4 +1,4 @@
use super::model::{IllustrationModel, TypeModel};
use super::model::IllustrationModel;
use crate::media::Media;
use crate::site::{FetchError, Fetched, PixivError, Site, SiteFuture};
use html_escape::{encode_double_quoted_attribute, encode_text};
@@ -225,7 +225,7 @@ impl Illustration {
tags.insert(0, "AI".to_string());
}
let mut media = vec![];
if matches!(&model.r#type, TypeModel::Ugoira) {
if model.r#type == "ugoira" {
// No static images for ugoira; the fetch path encodes an MP4 via
// ffmpeg and appends it as a Video item (api.rs). This fallback
// keeps media empty when encoding fails or ffmpeg is missing.