mirror of
https://gitea.pjck.top/Cookies/CookiesChartConverter.git
synced 2025-12-14 12:56:54 +08:00
PRiSM
This commit is contained in:
33
convert.py
33
convert.py
@@ -8,7 +8,7 @@ from acb2mp3 import convert_awb_to_wav, convert_wav_to_mp3
|
||||
from search import search_music_by_id
|
||||
from pv_decode import dat_to_mp4
|
||||
from loguru import logger
|
||||
|
||||
from concurrent.futures import ThreadPoolExecutor, as_completed
|
||||
# 假设你已实现以下函数
|
||||
|
||||
def build_maidata_txt(
|
||||
@@ -136,11 +136,28 @@ def convert_to_simai_folder(result,output_folder):
|
||||
# 示例调用
|
||||
|
||||
if __name__ == "__main__":
|
||||
for i in [110417, 11759, 11792, 11766, 11761, 11795, 11757, 11750, 11751, 111429, 11769, 11756, 11794, 11760, 11758, 11767, 11793, 11745, 11742, 11789, 11780, 11774, 10699, 10493, 11773, 11787, 11786, 11772, 111069, 11775, 11781, 11743, 11788, 11744, 111772, 11808, 10375, 11800, 111365, 110281, 111557, 111363, 111156, 11738, 11736, 10422, 11796, 11791, 11765, 11798, 11753, 110532, 11754, 11737, 11739, 11755, 11799, 11752, 11764, 11790, 11797, 11763, 11741, 11746, 11779, 11770, 11784, 11783, 11777, 11748, 11776, 11782, 11749, 11785, 11771, 11747, 11778, 11740, 111234, 11805, 11802, 111715, 11803, 11804, 11754]:
|
||||
res = search_music_by_id(str(i))
|
||||
if res is None:
|
||||
continue
|
||||
logger.info(res)
|
||||
logger.info("Converting...")
|
||||
convert_to_simai_folder(res,"result")
|
||||
music_ids = [11822]
|
||||
output_folder = "result"
|
||||
max_workers = 6 # 根据 CPU 和硬盘负载合理设置线程数
|
||||
|
||||
with ThreadPoolExecutor(max_workers=max_workers) as executor:
|
||||
futures = {}
|
||||
for mid in music_ids:
|
||||
res = search_music_by_id(str(mid))
|
||||
if res is None:
|
||||
continue
|
||||
logger.info(f"提交任务: {mid}")
|
||||
future = executor.submit(convert_to_simai_folder, res, output_folder)
|
||||
futures[future] = mid
|
||||
|
||||
for future in as_completed(futures):
|
||||
mid = futures[future]
|
||||
try:
|
||||
result = future.result()
|
||||
logger.info(f"{mid} 处理完成")
|
||||
except Exception as e:
|
||||
logger.error(f"{mid} 处理出错: {e}")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user