From 12b4eb845fe5ad2c4faecbd92607107efec526ef Mon Sep 17 00:00:00 2001 From: cyrahs <105589264+cyrahs@users.noreply.github.com> Date: Thu, 19 Dec 2024 12:58:46 +0800 Subject: [PATCH] fixed some minor bugs (#486) * fix ai crop match logic * bring back manual scrape after refactoring * fix plot scrape in prestige * fix config validation --- config.yml | 1 + javsp/__main__.py | 6 ++++-- javsp/config.py | 1 + javsp/web/prestige.py | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/config.yml b/config.yml index ba84deafb..17547fbff 100644 --- a/config.yml +++ b/config.yml @@ -20,6 +20,7 @@ scanner: # 格式要求:https://docs.pydantic.dev/2.0/usage/types/bytesize/ minimum_size: 232MiB skip_nfo_dir: yes + manual: yes ################################ network: # 设置代理服务器地址,支持 http, socks5/socks5h 代理,比如'http://127.0.0.1:1080' diff --git a/javsp/__main__.py b/javsp/__main__.py index 10d31b264..d1284d704 100644 --- a/javsp/__main__.py +++ b/javsp/__main__.py @@ -402,8 +402,8 @@ def reviewMovieID(all_movies, root): def process_poster(movie: Movie): def should_use_ai_crop_match(label): for r in Cfg().summarizer.cover.crop.on_id_pattern: - re.match(r, label) - return True + if re.match(r, label): + return True return False crop_engine = None if (movie.info.uncensored or @@ -615,6 +615,8 @@ def entry(): recognize_fail = [] error_exit(movie_count, '未找到影片文件') logger.info(f'扫描影片文件:共找到 {movie_count} 部影片') + if Cfg().scanner.manual: + reviewMovieID(recognized, root) RunNormalMode(recognized + recognize_fail) sys.exit(0) diff --git a/javsp/config.py b/javsp/config.py index 5965f4d0d..c491e6621 100644 --- a/javsp/config.py +++ b/javsp/config.py @@ -16,6 +16,7 @@ class Scanner(BaseConfig): ignored_folder_name_pattern: List[str] minimum_size: ByteSize skip_nfo_dir: bool + manual: bool class CrawlerID(str, Enum): airav = 'airav' diff --git a/javsp/web/prestige.py b/javsp/web/prestige.py index f6884c658..4d4f0b0f6 100644 --- a/javsp/web/prestige.py +++ b/javsp/web/prestige.py @@ -51,7 +51,7 @@ def parse_data(movie: MovieInfo): genre_tags = container.xpath("//p[text()='ジャンル:']/following-sibling::div/a") genre = [tag.text.strip() for tag in genre_tags] serial = container.xpath("//p[text()='レーベル:']/following-sibling::div/a/text()")[0].strip() - plot = container.xpath("//h2[text()='商品紹介']/following-sibling::p")[0].text.strip() + plot = container.xpath("//h2[text()='商品紹介']/following-sibling::div/p")[0].text.strip() preview_pics = container.xpath("//h2[text()='サンプル画像']/following-sibling::div/div/picture/source/img/@src") preview_pics = [i.split('?')[0] for i in preview_pics]