bugfix for #34
This commit is contained in:
parent
e1513eda63
commit
922f31b718
|
@ -92,6 +92,7 @@ form >>> input {
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { split_regex } from '@/decrypt/utils';
|
||||||
import Ruby from './Ruby';
|
import Ruby from './Ruby';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@ -167,10 +168,10 @@ export default {
|
||||||
this.$emit('ok', {
|
this.$emit('ok', {
|
||||||
picture: this.imgFile.blob,
|
picture: this.imgFile.blob,
|
||||||
title: this.title,
|
title: this.title,
|
||||||
artist: this.artist,
|
artist: this.artist.split(split_regex),
|
||||||
album: this.album,
|
album: this.album,
|
||||||
albumartist: this.albumartist,
|
albumartist: this.albumartist,
|
||||||
genre: this.genre,
|
genre: this.genre.split(split_regex),
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
<el-button circle icon="el-icon-video-play" type="success" @click="handlePlay(scope.$index, scope.row)">
|
<el-button circle icon="el-icon-video-play" type="success" @click="handlePlay(scope.$index, scope.row)">
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button circle icon="el-icon-download" @click="handleDownload(scope.row)"></el-button>
|
<el-button circle icon="el-icon-download" @click="handleDownload(scope.row)"></el-button>
|
||||||
<el-button circle icon="el-icon-edit" @click="handleEdit(scope.row)"></el-button>
|
<el-button circle icon="el-icon-edit" @click="handleEdit(scope.$index, scope.row)"></el-button>
|
||||||
<el-button circle icon="el-icon-delete" type="danger" @click="handleDelete(scope.$index, scope.row)">
|
<el-button circle icon="el-icon-delete" type="danger" @click="handleDelete(scope.$index, scope.row)">
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
|
@ -56,8 +56,8 @@ export default {
|
||||||
handleDownload(row) {
|
handleDownload(row) {
|
||||||
this.$emit('download', row);
|
this.$emit('download', row);
|
||||||
},
|
},
|
||||||
handleEdit(row) {
|
handleEdit(index, row) {
|
||||||
this.$emit('edit', row);
|
this.$emit('edit', index, row);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -14,10 +14,10 @@
|
||||||
:show="showEditDialog"
|
:show="showEditDialog"
|
||||||
:picture="editing_data.picture"
|
:picture="editing_data.picture"
|
||||||
:title="editing_data.title"
|
:title="editing_data.title"
|
||||||
:artist="editing_data.artist"
|
:artist="joinedArtist"
|
||||||
:album="editing_data.album"
|
:album="editing_data.album"
|
||||||
:albumartist="editing_data.albumartist"
|
:albumartist="editing_data.albumartist"
|
||||||
:genre="editing_data.genre"
|
:genre="joinedGenre"
|
||||||
@cancel="showEditDialog = false"
|
@cancel="showEditDialog = false"
|
||||||
@ok="handleEdit"
|
@ok="handleEdit"
|
||||||
></edit-dialog>
|
></edit-dialog>
|
||||||
|
@ -78,7 +78,19 @@ export default {
|
||||||
return {
|
return {
|
||||||
showConfigDialog: false,
|
showConfigDialog: false,
|
||||||
showEditDialog: false,
|
showEditDialog: false,
|
||||||
editing_data: { picture: '', title: '', artist: '', album: '', albumartist: '', genre: '' },
|
editing_data: {
|
||||||
|
picture: '',
|
||||||
|
title: '',
|
||||||
|
artist: [''],
|
||||||
|
album: '',
|
||||||
|
albumartist: '',
|
||||||
|
genre: [''],
|
||||||
|
ext: '',
|
||||||
|
blob: Blob,
|
||||||
|
index: 0
|
||||||
|
},
|
||||||
|
joinedArtist: "",
|
||||||
|
joinedGenre: "",
|
||||||
tableData: [],
|
tableData: [],
|
||||||
playing_url: '',
|
playing_url: '',
|
||||||
playing_auto: false,
|
playing_auto: false,
|
||||||
|
@ -160,7 +172,11 @@ export default {
|
||||||
}
|
}
|
||||||
this.editing_data.title = data.title;
|
this.editing_data.title = data.title;
|
||||||
this.editing_data.artist = data.artist;
|
this.editing_data.artist = data.artist;
|
||||||
|
this.joinedArtist = data.artist.join();
|
||||||
this.editing_data.album = data.album;
|
this.editing_data.album = data.album;
|
||||||
|
this.editing_data.albumartist = data.albumartist;
|
||||||
|
this.editing_data.genre = data.genre;
|
||||||
|
this.joinedGenre = data.genre.join();
|
||||||
let writeSuccess = true;
|
let writeSuccess = true;
|
||||||
let notifyMsg = '成功修改 ' + this.editing_data.title;
|
let notifyMsg = '成功修改 ' + this.editing_data.title;
|
||||||
try {
|
try {
|
||||||
|
@ -175,10 +191,10 @@ export default {
|
||||||
const newMeta = {
|
const newMeta = {
|
||||||
picture: imageInfo?.buffer,
|
picture: imageInfo?.buffer,
|
||||||
title: data.title,
|
title: data.title,
|
||||||
artists: data.artist.split(split_regex),
|
artists: data.artist,
|
||||||
album: data.album,
|
album: data.album,
|
||||||
albumartist: data.albumartist,
|
albumartist: data.albumartist,
|
||||||
genre: data.genre.split(split_regex),
|
genre: data.genre,
|
||||||
};
|
};
|
||||||
const buffer = Buffer.from(await this.editing_data.blob.arrayBuffer());
|
const buffer = Buffer.from(await this.editing_data.blob.arrayBuffer());
|
||||||
const mime = AudioMimeType[this.editing_data.ext] || AudioMimeType.mp3;
|
const mime = AudioMimeType[this.editing_data.ext] || AudioMimeType.mp3;
|
||||||
|
@ -195,6 +211,9 @@ export default {
|
||||||
notifyMsg = '修改' + this.editing_data.title + '未能完成。在写入新的元数据时发生错误:' + e;
|
notifyMsg = '修改' + this.editing_data.title + '未能完成。在写入新的元数据时发生错误:' + e;
|
||||||
}
|
}
|
||||||
this.editing_data.file = URL.createObjectURL(this.editing_data.blob);
|
this.editing_data.file = URL.createObjectURL(this.editing_data.blob);
|
||||||
|
let dataIndex = this.editing_data.index;
|
||||||
|
delete this.editing_data.index;
|
||||||
|
this.tableData.splice(dataIndex, 1, this.editing_data)
|
||||||
if (writeSuccess === true) {
|
if (writeSuccess === true) {
|
||||||
this.$notify.success({
|
this.$notify.success({
|
||||||
title: '修改成功',
|
title: '修改成功',
|
||||||
|
@ -216,14 +235,14 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
async editFile(data) {
|
async editFile(index, data) {
|
||||||
this.editing_data.picture = data.picture;
|
this.editing_data = data;
|
||||||
this.editing_data.title = data.title
|
|
||||||
this.editing_data.artist = data.artist.join()
|
|
||||||
this.editing_data.album = data.album
|
|
||||||
const musicMeta = await metaParseBlob(data.blob);
|
const musicMeta = await metaParseBlob(data.blob);
|
||||||
this.editing_data.albumartist = musicMeta.common.albumartist || '';
|
this.editing_data.albumartist = musicMeta.common.albumartist || '';
|
||||||
this.editing_data.genre = musicMeta.common.genre?.join() || '';
|
this.editing_data.genre = musicMeta.common.genre || [''];
|
||||||
|
this.joinedArtist = this.editing_data.artist.join();
|
||||||
|
this.joinedGenre = this.editing_data.genre.join();
|
||||||
|
this.editing_data.index = index;
|
||||||
this.showEditDialog = true;
|
this.showEditDialog = true;
|
||||||
},
|
},
|
||||||
async saveFile(data) {
|
async saveFile(data) {
|
||||||
|
|
Loading…
Reference in New Issue