feat: 优化批量下载工具命名和下载高码率音频
This commit is contained in:
parent
73df9dec48
commit
23882cf85c
@ -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)
|
||||
|
@ -1640,6 +1640,8 @@ class XiaoMusicDevice:
|
||||
"-x",
|
||||
"--audio-format",
|
||||
"mp3",
|
||||
"--audio-quality",
|
||||
"0",
|
||||
"--paths",
|
||||
self.download_path,
|
||||
"-o",
|
||||
|
Loading…
Reference in New Issue
Block a user