mirror of
https://github.com/d-fi/d-fi-core.git
synced 2025-07-27 07:34:42 +02:00
update spec
This commit is contained in:
parent
70d2645d5e
commit
a31c59e193
@ -9,7 +9,7 @@ export const writeMetadataMp3 = (
|
|||||||
cover?: Buffer | null,
|
cover?: Buffer | null,
|
||||||
): Buffer => {
|
): Buffer => {
|
||||||
const writer = new id3Writer(buffer);
|
const writer = new id3Writer(buffer);
|
||||||
const RELEASE_YEAR = album ? album.release_date.split('-')[0] : null;
|
const RELEASE_DATES = album && album.release_date.split('-');
|
||||||
|
|
||||||
writer
|
writer
|
||||||
.setFrame('TIT2', track.SNG_TITLE)
|
.setFrame('TIT2', track.SNG_TITLE)
|
||||||
@ -28,10 +28,11 @@ export const writeMetadataMp3 = (
|
|||||||
album.genres.data.map((g) => g.name),
|
album.genres.data.map((g) => g.name),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
if (RELEASE_DATES) {
|
||||||
|
writer.setFrame('TYER', RELEASE_DATES[0]).setFrame('TDAT', RELEASE_DATES[2] + RELEASE_DATES[1]);
|
||||||
|
}
|
||||||
writer
|
writer
|
||||||
.setFrame('TPE2', album.artist.name)
|
.setFrame('TPE2', album.artist.name)
|
||||||
.setFrame('TYER', RELEASE_YEAR)
|
|
||||||
.setFrame('TDAT', album.release_date)
|
|
||||||
.setFrame('TXXX', {
|
.setFrame('TXXX', {
|
||||||
description: 'RELEASETYPE',
|
description: 'RELEASETYPE',
|
||||||
value: album.record_type,
|
value: album.record_type,
|
||||||
@ -75,7 +76,7 @@ export const writeMetadataMp3 = (
|
|||||||
|
|
||||||
if (track.SNG_CONTRIBUTORS && !Array.isArray(track.SNG_CONTRIBUTORS)) {
|
if (track.SNG_CONTRIBUTORS && !Array.isArray(track.SNG_CONTRIBUTORS)) {
|
||||||
if (track.SNG_CONTRIBUTORS.main_artist) {
|
if (track.SNG_CONTRIBUTORS.main_artist) {
|
||||||
writer.setFrame('TCOP', `${RELEASE_YEAR ? RELEASE_YEAR + ' ' : ''}${track.SNG_CONTRIBUTORS.main_artist[0]}`);
|
writer.setFrame('TCOP', `${RELEASE_DATES ? RELEASE_DATES[0] + ' ' : ''}${track.SNG_CONTRIBUTORS.main_artist[0]}`);
|
||||||
}
|
}
|
||||||
if (track.SNG_CONTRIBUTORS.publisher) {
|
if (track.SNG_CONTRIBUTORS.publisher) {
|
||||||
writer.setFrame('TPUB', track.SNG_CONTRIBUTORS.publisher.join(', '));
|
writer.setFrame('TPUB', track.SNG_CONTRIBUTORS.publisher.join(', '));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user