modify scripts
This commit is contained in:
@ -195,7 +195,7 @@ def generate_union_table(mysql_conn):
|
|||||||
key_str = parse_union_key(row["release_date"], row["studio_name"], row["whisper_code"])
|
key_str = parse_union_key(row["release_date"], row["studio_name"], row["whisper_code"])
|
||||||
if key_str not in dict_whisper_data:
|
if key_str not in dict_whisper_data:
|
||||||
dict_whisper_data[key_str] = set()
|
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. 内存中进行双边匹配
|
# 4. 内存中进行双边匹配
|
||||||
result = []
|
result = []
|
||||||
@ -210,6 +210,8 @@ def generate_union_table(mysql_conn):
|
|||||||
if w['release_date'] and w['studio_name']:
|
if w['release_date'] and w['studio_name']:
|
||||||
# 对name进行去空格,去特殊字符处理
|
# 对name进行去空格,去特殊字符处理
|
||||||
key_str = parse_union_key(w['release_date'], w['studio_name'], w['whisper_code'])
|
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':
|
if w['release_date'] == '2012-08-31' and w['studio_name'] == 'HEYZO':
|
||||||
print(f"whisper data: {w}")
|
print(f"whisper data: {w}")
|
||||||
print(f'key_str: {key_str}')
|
print(f'key_str: {key_str}')
|
||||||
@ -217,7 +219,7 @@ def generate_union_table(mysql_conn):
|
|||||||
set_idx = dict_stash_data[key_str]
|
set_idx = dict_stash_data[key_str]
|
||||||
for idx in set_idx:
|
for idx in set_idx:
|
||||||
print(f"stash data: {stash_data[idx]}")
|
print(f"stash data: {stash_data[idx]}")
|
||||||
|
'''
|
||||||
if key_str in dict_stash_data:
|
if key_str in dict_stash_data:
|
||||||
set_idx = dict_stash_data[key_str]
|
set_idx = dict_stash_data[key_str]
|
||||||
for idx in set_idx:
|
for idx in set_idx:
|
||||||
@ -229,6 +231,8 @@ def generate_union_table(mysql_conn):
|
|||||||
if not matched:
|
if not matched:
|
||||||
# 否则匹配第一个未匹配过的
|
# 否则匹配第一个未匹配过的
|
||||||
for idx in set_idx:
|
for idx in set_idx:
|
||||||
|
if stash_data[idx]['code'].lower() in whisper_codes:
|
||||||
|
continue
|
||||||
if not stash_data[idx].get('matched', False):
|
if not stash_data[idx].get('matched', False):
|
||||||
s = stash_data[idx]
|
s = stash_data[idx]
|
||||||
stash_data[idx]['matched'] = True
|
stash_data[idx]['matched'] = True
|
||||||
|
|||||||
Reference in New Issue
Block a user