From 274c187e18386893d5cd9ef6dca70850f4c36498 Mon Sep 17 00:00:00 2001 From: sophon Date: Thu, 25 Dec 2025 16:11:30 +0800 Subject: [PATCH] modify scripts --- src/tools/sync_db.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/tools/sync_db.py b/src/tools/sync_db.py index 1271db5..fb32b82 100644 --- a/src/tools/sync_db.py +++ b/src/tools/sync_db.py @@ -195,7 +195,7 @@ def generate_union_table(mysql_conn): key_str = parse_union_key(row["release_date"], row["studio_name"], row["whisper_code"]) if key_str not in dict_whisper_data: dict_whisper_data[key_str] = set() - dict_whisper_data[key_str].add(idx) + dict_whisper_data[key_str].add(row['whisper_code'].lower() if row['whisper_code'] else "") # 4. 内存中进行双边匹配 result = [] @@ -210,6 +210,8 @@ def generate_union_table(mysql_conn): if w['release_date'] and w['studio_name']: # 对name进行去空格,去特殊字符处理 key_str = parse_union_key(w['release_date'], w['studio_name'], w['whisper_code']) + whisper_codes = dict_whisper_data.get(key_str, set()) + ''' if w['release_date'] == '2012-08-31' and w['studio_name'] == 'HEYZO': print(f"whisper data: {w}") print(f'key_str: {key_str}') @@ -217,7 +219,7 @@ def generate_union_table(mysql_conn): set_idx = dict_stash_data[key_str] for idx in set_idx: print(f"stash data: {stash_data[idx]}") - + ''' if key_str in dict_stash_data: set_idx = dict_stash_data[key_str] for idx in set_idx: @@ -229,6 +231,8 @@ def generate_union_table(mysql_conn): if not matched: # 否则匹配第一个未匹配过的 for idx in set_idx: + if stash_data[idx]['code'].lower() in whisper_codes: + continue if not stash_data[idx].get('matched', False): s = stash_data[idx] stash_data[idx]['matched'] = True