feature:支持编辑专辑艺术家

This commit is contained in:
charlesxie
2023-07-25 16:14:06 +08:00
parent 011635b337
commit cc33cd847a
5 changed files with 25 additions and 5 deletions

View File

@@ -14,6 +14,7 @@ class MusicId3Serializer(serializers.Serializer):
title = serializers.CharField(required=True, allow_null=True, allow_blank=True)
artist = serializers.CharField(required=True, allow_null=True, allow_blank=True)
album = serializers.CharField(required=True, allow_null=True, allow_blank=True)
albumartist = serializers.CharField(required=True, allow_null=True, allow_blank=True)
genre = serializers.CharField(required=True, allow_null=True, allow_blank=True)
year = serializers.CharField(required=True, allow_null=True, allow_blank=True)
lyrics = serializers.CharField(required=True, allow_null=True, allow_blank=True)

View File

@@ -28,6 +28,7 @@ def save_music(f, each, is_raw_thumbnail):
var_dict = {
"title": f["title"].value,
"artist": f["artist"].value,
"albumartist": f["albumartist"].value,
"album": f["album"].value,
"filename": base_filename
}
@@ -46,6 +47,11 @@ def save_music(f, each, is_raw_thumbnail):
f["album"] = ConstantTemplate(each["album"]).resolve_data(var_dict)
else:
f["album"] = each["album"]
if each.get("albumartist", None):
if "${" in each["albumartist"]:
f["albumartist"] = ConstantTemplate(each["albumartist"]).resolve_data(var_dict)
else:
f["albumartist"] = each["albumartist"]
if each.get("genre", None):
f["genre"] = each["genre"]
if each.get("year", None):

View File

@@ -245,7 +245,7 @@ def batch_auto_tag_task(batch, source_list, select_mode):
folder_list = TaskRecord.objects.filter(batch=batch, icon="icon-folder").all()
for folder in folder_list:
data = os.scandir(folder.full_path)
allow_type = ["flac", "mp3", "ape", "wav", "aiff", "wv", "tta", "mp4", "m4a", "ogg", "mpc",
allow_type = ["flac", "mp3", "ape", "wav", "aiff", "wv", "tta", "m4a", "ogg", "mpc",
"opus", "wma", "dsf", "dff"]
bulk_set = []
for entry in data:

View File

@@ -46,7 +46,7 @@ class TaskViewSets(GenericViewSet):
except FileNotFoundError:
return self.failure_response(msg="文件夹不存在")
children_data = []
allow_type = ["flac", "mp3", "ape", "wav", "aiff", "wv", "tta", "mp4", "m4a", "ogg", "mpc",
allow_type = ["flac", "mp3", "ape", "wav", "aiff", "wv", "tta", "m4a", "ogg", "mpc",
"opus", "wma", "dsf", "dff"]
frc_map = {}
file_data = []
@@ -124,6 +124,7 @@ class TaskViewSets(GenericViewSet):
"title": f["title"].value or file_title,
"artist": f["artist"].value,
"album": f["album"].value,
"albumartist": f["albumartist"].value,
"genre": f["genre"].value,
"year": f["year"].value,
"lyrics": f["lyrics"].value,
@@ -153,7 +154,7 @@ class TaskViewSets(GenericViewSet):
if data.get('icon') == 'icon-folder':
file_full_path = f"{full_path}/{data.get('name')}"
data = os.scandir(file_full_path)
allow_type = ["flac", "mp3", "ape", "wav", "aiff", "wv", "tta", "mp4", "m4a", "ogg", "mpc",
allow_type = ["flac", "mp3", "ape", "wav", "aiff", "wv", "tta", "m4a", "ogg", "mpc",
"opus", "wma", "dsf", "dff"]
for index, entry in enumerate(data, 1):
each = entry.name

View File

@@ -82,6 +82,12 @@
<bk-input :clearable="true" v-model="musicInfo.album"></bk-input>
</div>
</div>
<div style="display: flex;margin-bottom: 10px;align-items: center;">
<div class="label1">专辑艺术家</div>
<div style="width: 70%;">
<bk-input :clearable="true" v-model="musicInfo.albumartist"></bk-input>
</div>
</div>
<div style="display: flex;margin-bottom: 10px;align-items: center;">
<div class="label1">风格</div>
<div style="width: 70%;">
@@ -116,7 +122,7 @@
</div>
</div>
<div style="display: flex;margin-top: 10px;">
<div class="label1">保存歌词lrc</div>
<div class="label1">保存歌词文件</div>
<bk-switcher v-model="musicInfo.is_save_lyrics_file"></bk-switcher>
</div>
</div>
@@ -180,6 +186,12 @@
<bk-input :clearable="true" v-model="musicInfoManual.album"></bk-input>
</div>
</div>
<div style="display: flex;margin-bottom: 10px;align-items: center;">
<div class="label1">专辑艺术家</div>
<div style="width: 70%;">
<bk-input :clearable="true" v-model="musicInfoManual.albumartist"></bk-input>
</div>
</div>
<div style="display: flex;margin-bottom: 10px;align-items: center;">
<div class="label1">风格</div>
<div style="width: 70%;">
@@ -214,7 +226,7 @@
</div>
</div>
<div style="display: flex;margin-top: 10px;">
<div class="label1">保存歌词lrc</div>
<div class="label1">保存歌词文件</div>
<bk-switcher v-model="musicInfoManual.is_save_lyrics_file"></bk-switcher>
</div>
</div>