mirror of
https://github.com/lifegpc/pixiv_downloader.git
synced 2026-07-08 01:32:41 +08:00
Update OptHelper, current only an instance in whole programs
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
use crate::author_name_filter::AuthorFiler;
|
||||
use crate::gettext;
|
||||
use crate::opthelper::OptHelper;
|
||||
use crate::opthelper::get_helper;
|
||||
use crate::pixiv_link::ToPixivID;
|
||||
use crate::pixiv_link::PixivID;
|
||||
use json::JsonValue;
|
||||
@@ -16,11 +16,10 @@ pub struct PixivData {
|
||||
/// The author
|
||||
pub author: Option<String>,
|
||||
pub description: Option<String>,
|
||||
helper: OptHelper,
|
||||
}
|
||||
|
||||
impl PixivData {
|
||||
pub fn new<T: ToPixivID>(id: T, helper: OptHelper) -> Option<Self> {
|
||||
pub fn new<T: ToPixivID>(id: T) -> Option<Self> {
|
||||
let i = id.to_pixiv_id();
|
||||
if i.is_none() {
|
||||
return None;
|
||||
@@ -30,7 +29,6 @@ impl PixivData {
|
||||
title: None,
|
||||
author: None,
|
||||
description: None,
|
||||
helper: helper,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -59,7 +57,7 @@ impl PixivData {
|
||||
let author = value["userName"].as_str();
|
||||
if author.is_some() {
|
||||
let au = author.unwrap();
|
||||
match self.helper.author_name_filters() {
|
||||
match get_helper().author_name_filters() {
|
||||
Some(l) => { self.author = Some(l.filter(au)) }
|
||||
None => { self.author = Some(String::from(author.unwrap())); }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user