From cbde2e4a81448693f6da41f891b783427e87a917 Mon Sep 17 00:00:00 2001 From: lededev Date: Fri, 8 Apr 2022 12:57:16 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0.nfo=E6=97=B6=E4=BF=9D?= =?UTF-8?q?=E7=95=99=E5=B7=B2=E6=9C=89=E7=9A=84=E7=94=A8=E6=88=B7=E8=87=AA?= =?UTF-8?q?=E5=AE=9A=E4=B9=89=E8=AF=84=E5=88=86=E6=A0=87?= =?UTF-8?q?=E7=AD=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/core.py b/core.py index 3a64c06..6fbb679 100644 --- a/core.py +++ b/core.py @@ -10,6 +10,7 @@ from PIL import Image from io import BytesIO from pathlib import Path from datetime import datetime +from lxml import etree from ADC_function import * from WebCrawler import get_data_from_json @@ -291,6 +292,12 @@ def print_files(path, leak_word, c_word, naming_rule, part, cn_sub, json_data, f print(f"[-]Fatal error! can not make folder '{path}'") sys.exit(0) + old_nfo = None + try: + if os.path.isfile(nfo_path): + old_nfo = etree.parse(nfo_path) + except: + pass # KODI内查看影片信息时找不到number,配置naming_rule=number+'#'+title虽可解决 # 但使得标题太长,放入时常为空的outline内会更适合,软件给outline留出的显示版面也较大 outline = f"{number}#{outline}" @@ -354,11 +361,17 @@ def print_files(path, leak_word, c_word, naming_rule, part, cn_sub, json_data, f print(" " + release + "", file=code) print(" " + release + "", file=code) print(" " + release + "", file=code) + if old_nfo: + try: + xur = old_nfo.xpath('//userrating/text()')[0] + if isinstance(xur, str) and re.match('\d+\.\d+|\d+', xur.strip()): + print(f" {xur.strip()}", file=code) + except: + pass try: f_rating = json_data['用户评分'] uc = json_data['评分人数'] - print(f""" {round(f_rating * 2.0)} - {round(f_rating * 2.0, 1)} + print(f""" {round(f_rating * 2.0, 1)} {round(f_rating * 20.0, 1)}