feature:修复自动刮削报错停止的问题

This commit is contained in:
charlesxie
2023-09-07 09:38:49 +08:00
parent 4e36df26fd
commit 37f4d39e5e
3 changed files with 18 additions and 3 deletions

View File

@@ -23,6 +23,7 @@ DFF等音频格式。
- version: 1.2.4 支持繁体匹配,新增消息中心展示自动刮削不匹配的数据
- version: 1.2.5 支持保存专辑封面文件,支持自定义上传专辑封面
- version: 1.2.6 简单适配H5端,支持手机端访问
- version: latest 支持wma,wmv格式, 修复自动刮削报错停止的问题
# 🦀 Show Project
DEMO 地址账号密码为:admin/admin

View File

@@ -245,6 +245,7 @@ def clear_music():
def batch_auto_tag_task(batch, source_list, select_mode):
"""
自动刮削任务
source_list: ["migu", "qmusic", "netease"]
"""
folder_list = TaskRecord.objects.filter(batch=batch, icon="icon-folder").all()
@@ -270,7 +271,12 @@ def batch_auto_tag_task(batch, source_list, select_mode):
is_match = False
for resource in source_list:
print("开始匹配", resource)
is_match = match_song(resource, task.full_path, select_mode)
try:
is_match = match_song(resource, task.full_path, select_mode)
except Exception as e:
print(e)
is_match = False
break
if is_match:
task.state = "success"
task.save()
@@ -297,6 +303,7 @@ def batch_auto_tag_task(batch, source_list, select_mode):
def tidy_folder_task(music_path_list, tidy_config):
"""整理文件夹任务"""
root_path = tidy_config.get("root_path")
first_dir = tidy_config.get("first_dir")
second_dir = tidy_config.get("second_dir")

View File

@@ -30,9 +30,16 @@ def walk_file(file_path, endfix=".py"):
if os.path.isdir(file_path):
for current_path, sub_folders, files_name in os.walk(file_path):
base_name = os.path.basename(current_path)
if base_name in ["migrations"]:
if base_name in ["migrations", "compose", "lib", "media", "requirements", "static", "templates", "tests",
"web", "translators"]:
continue
if "/web/" in current_path:
continue
if "/static/" in current_path:
continue
for file in files_name:
if file == "manage.py":
continue
if file.endswith(endfix):
file_path = os.path.join(current_path, file)
yield file_path
@@ -136,7 +143,7 @@ def run_work(file_list):
if __name__ == '__main__':
encode_dir = "/Users/macbookair/coding/music-tag-web/component/translators/"
encode_dir = "/Users/macbookair/coding/music-tag-web/"
fileSet = walk_file(encode_dir)
# 切分任务
extensions = split_list(list(fileSet), NB_COMPILE_JOBS)