Skip to content

Commit

Permalink
Merge pull request #28 from nichuanfang/dev
Browse files Browse the repository at this point in the history
在破解ncm有可能直接生成mp3文件 这种情况需要直接放入dist目录
  • Loading branch information
nichuanfang authored May 24, 2024
2 parents c97dd78 + 03edab6 commit f1d2978
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion mk/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,12 @@ def handle_unblock_music(unhandled_audio_paths,parent_dir,dist_path):
subprocess.run(um_command, shell=True)
# 删除原文件
os.unlink(path)
flac2alac(os.path.join(temp_path,audio_name.rsplit('.',1)[0]+'.flac'),dist_path)
# 判断生成的是什么格式的文件
if os.path.exists(os.path.join(temp_path,audio_name.rsplit('.',1)[0]+'.flac')):
# 生成的是flac文件
flac2alac(os.path.join(temp_path,audio_name.rsplit('.',1)[0]+'.flac'),dist_path)
elif os.path.exists(os.path.join(temp_path,audio_name.rsplit('.',1)[0]+'.mp3')):
shutil.move(os.path.join(temp_path,audio_name.rsplit('.',1)[0]+'.mp3'),os.path.join(dist_path,audio_name.rsplit('.',1)[0]+'.mp3'))
except subprocess.CalledProcessError as e:
print(e)
elif audio_name.endswith('flac'):
Expand Down

0 comments on commit f1d2978

Please sign in to comment.