From 38c8f5deff1b5fadc15dabf424a68dda4016852f Mon Sep 17 00:00:00 2001 From: shenjack <3695888@qq.com> Date: Fri, 30 Aug 2024 18:17:31 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A8=8D=E5=BE=AE=E6=94=B9=E8=BF=9B=E4=B8=80?= =?UTF-8?q?=E4=B8=8B=EF=BC=88=EF=BC=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sr_download/sql/.gitignore | 1 + sr_download/sql/xml_parse.py | 12 +++++------- 2 files changed, 6 insertions(+), 7 deletions(-) create mode 100644 sr_download/sql/.gitignore diff --git a/sr_download/sql/.gitignore b/sr_download/sql/.gitignore new file mode 100644 index 0000000..cd3d225 --- /dev/null +++ b/sr_download/sql/.gitignore @@ -0,0 +1 @@ +logs \ No newline at end of file diff --git a/sr_download/sql/xml_parse.py b/sr_download/sql/xml_parse.py index 83febd5..a13b3f8 100644 --- a/sr_download/sql/xml_parse.py +++ b/sr_download/sql/xml_parse.py @@ -27,13 +27,10 @@ def parse_part_types(xml_file): tree = ET.parse(xml_file) root = tree.getroot() - # 定义命名空间 - namespace = {'ns': 'http://shenjack.top:81/files/DR/xsd/partlist.xsd'} - part_dict = {} # 遍历所有 PartType 元素 - for part in root.findall('ns:PartType', namespace): + for part in root.findall('PartType'): part_id = part.get('id') part_mass = float(part.get('mass')) # type: ignore part_dict[part_id] = part_mass * 500 # 缩放因子 @@ -48,6 +45,7 @@ WITH data AS ( WHERE "save_type" = 'ship' AND full_data.xml_tested AND save_id >= 1200000 + ORDER BY save_id ASC LIMIT {limit} OFFSET {offset} ), parts_data AS ( @@ -79,11 +77,11 @@ def main(): db = get_db() db_cur = db.cursor() - offset = 51500 - limit = 500 + offset = 0 + limit = 100 target_mass = 775150 - delta = 100 + delta = 10000 start_time = time.time()