1
0
mirror of https://github.com/hanxi/xiaomusic.git synced 2026-04-15 21:03:55 +08:00

feat: 优化批量下载工具命名和下载高码率音频

This commit is contained in:
涵曦
2024-12-12 00:43:30 +08:00
parent 73df9dec48
commit 23882cf85c
2 changed files with 10 additions and 0 deletions

View File

@@ -866,6 +866,8 @@ async def download_playlist(config, url, dirname):
"-x",
"--audio-format",
"mp3",
"--audio-quality",
"0",
"--paths",
config.download_path,
"-o",
@@ -899,6 +901,8 @@ async def download_one_music(config, url, name=""):
"-x",
"--audio-format",
"mp3",
"--audio-quality",
"0",
"--paths",
config.download_path,
"-o",
@@ -947,6 +951,7 @@ def remove_common_prefix(directory):
log.info(f'Common prefix identified: "{common_prefix}"')
pattern = re.compile(r"(\d+)[\t  ]*\1")
for filename in files:
if filename == common_prefix:
continue
@@ -954,6 +959,9 @@ def remove_common_prefix(directory):
if filename.startswith(common_prefix):
# 构造新的文件名
new_filename = filename[len(common_prefix) :]
match = pattern.match(new_filename)
if match:
new_filename = match.group(1) + new_filename[match.end() :]
# 生成完整的文件路径
old_file_path = os.path.join(directory, filename)
new_file_path = os.path.join(directory, new_filename)

View File

@@ -1640,6 +1640,8 @@ class XiaoMusicDevice:
"-x",
"--audio-format",
"mp3",
"--audio-quality",
"0",
"--paths",
self.download_path,
"-o",