fix tagging

This commit is contained in:
Sayem Chowdhury 2021-03-06 00:21:52 +06:00
parent 9e139d54a0
commit e468369727
3 changed files with 21 additions and 15 deletions

View File

@ -44,8 +44,10 @@ export const writeMetadataFlac = (
flac.setTag('EXPLICIT=' + track.EXPLICIT_LYRICS);
}
if (track.SNG_CONTRIBUTORS) {
if (track.SNG_CONTRIBUTORS && !Array.isArray(track.SNG_CONTRIBUTORS)) {
if (track.SNG_CONTRIBUTORS.main_artist) {
flac.setTag(`COPYRIGHT=${RELEASE_YEAR} ${track.SNG_CONTRIBUTORS.main_artist[0]}`);
}
if (track.SNG_CONTRIBUTORS.publisher) {
flac.setTag('ORGANIZATION=' + track.SNG_CONTRIBUTORS.publisher.join(', '));
}

View File

@ -65,8 +65,10 @@ export const writeMetadataMp3 = (
writer.setFrame('TPOS', track.DISK_NUMBER).setFrame('TRCK', track.TRACK_NUMBER + '/' + album.nb_tracks);
}
if (track.SNG_CONTRIBUTORS) {
if (track.SNG_CONTRIBUTORS && !Array.isArray(track.SNG_CONTRIBUTORS)) {
if (track.SNG_CONTRIBUTORS.main_artist) {
writer.setFrame('TCOP', `${RELEASE_YEAR} ${track.SNG_CONTRIBUTORS.main_artist[0]}`);
}
if (track.SNG_CONTRIBUTORS.publisher) {
writer.setFrame('TPUB', track.SNG_CONTRIBUTORS.publisher.join(', '));
}

View File

@ -44,7 +44,8 @@ interface songType {
SMARTRADIO: string; // 0
SNG_ID: string; // '3135556'
SNG_TITLE: string; // 'Harder, Better, Faster, Stronger'
SNG_CONTRIBUTORS?: {
SNG_CONTRIBUTORS?:
| {
main_artist: string[]; //['Daft Punk']
author?: string[]; // ['Edwin Birdsong', 'Guy-Manuel de Homem-Christo', 'Thomas Bangalter']
composer?: string[];
@ -54,7 +55,8 @@ interface songType {
engineer?: string[];
writer?: string[];
mixer?: string[];
};
}
| [];
STATUS: number; // 3
S_MOD: number; // 0
S_PREMIUM: number; // 0