mirror of
https://gitlab.com/RemixDev/deemix-js.git
synced 2024-12-28 02:16:08 +00:00
Replaced id3-tagger with custom one to fix tagging issues
This commit is contained in:
parent
02072f7c3c
commit
6706f6b039
|
@ -5,22 +5,22 @@ const fs = require('fs')
|
|||
function tagID3(path, track, save){
|
||||
const songBuffer = fs.readFileSync(path)
|
||||
const tag = new ID3Writer(songBuffer)
|
||||
if (save.useNullSeparator) tag.separator = String.fromCharCode(0)
|
||||
tag.separateWithNull = String.fromCharCode(0)
|
||||
|
||||
if (save.title) tag.setFrame('TIT2', track.title)
|
||||
|
||||
if (save.artist && track.artists.length){
|
||||
if (save.multiArtistSeparator == "default"){
|
||||
tag.setArrayFrame('TPE1', track.artists)
|
||||
tag.setFrame('TPE1', track.artists)
|
||||
}else{
|
||||
if (save.multiArtistSeparator == "nothing"){
|
||||
tag.setArrayFrame('TPE1', [track.mainArtist.name])
|
||||
tag.setFrame('TPE1', [track.mainArtist.name])
|
||||
} else {
|
||||
tag.setArrayFrame('TPE1', [track.artistsString])
|
||||
tag.setFrame('TPE1', [track.artistsString])
|
||||
}
|
||||
// Tag ARTISTS is added to keep the multiartist support when using a non standard tagging method
|
||||
// https://picard-docs.musicbrainz.org/en/appendices/tag_mapping.html#artists
|
||||
tag.setArrayFrame('TXXX', {
|
||||
tag.setFrame('TXXX', {
|
||||
description: 'ARTISTS',
|
||||
value: track.artists
|
||||
})
|
||||
|
@ -31,9 +31,9 @@ function tagID3(path, track, save){
|
|||
|
||||
if (save.albumArtist && track.album.artists.length){
|
||||
if (save.singleAlbumArtist && track.album.mainArtist.save){
|
||||
tag.setArrayFrame('TPE2', [track.album.mainArtist.name])
|
||||
tag.setFrame('TPE2', [track.album.mainArtist.name])
|
||||
} else {
|
||||
tag.setArrayFrame('TPE2', track.album.artists)
|
||||
tag.setFrame('TPE2', track.album.artists)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ function tagID3(path, track, save){
|
|||
tag.setFrame('TPOS', discNumber)
|
||||
}
|
||||
|
||||
if (save.genre) tag.setArrayFrame('TCON', track.album.genre)
|
||||
if (save.genre) tag.setFrame('TCON', track.album.genre)
|
||||
if (save.year) tag.setFrame('TYER', track.date.year)
|
||||
|
||||
// Referencing ID3 standard
|
||||
|
@ -78,15 +78,12 @@ function tagID3(path, track, save){
|
|||
language: 'XXX'
|
||||
})
|
||||
|
||||
// TODO: Uncomment when implemented in lib
|
||||
/*
|
||||
if (save.syncedLyrics && track.lyrics.syncID3) tag.setFrame('SYLT', {
|
||||
text: track.lyrics.syncID3,
|
||||
type: 1,
|
||||
timestampFormat: 2,
|
||||
useUnicodeEncoding: true
|
||||
})
|
||||
*/
|
||||
|
||||
let involvedPeople = []
|
||||
Object.keys(track.contributors).forEach(role => {
|
||||
|
@ -98,12 +95,11 @@ function tagID3(path, track, save){
|
|||
tag.setFrame('TCOM', track.contributors.composer)
|
||||
}
|
||||
})
|
||||
// TODO: Uncomment when implemented in lib
|
||||
// if (involvedPeople.length && save.involvedPeople) tag.setFrame('IPLS', involvedPeople)
|
||||
if (involvedPeople.length && save.involvedPeople) tag.setFrame('IPLS', involvedPeople)
|
||||
|
||||
if (save.copyright) tag.setFrame('TCOP', track.copyright)
|
||||
if (save.savePlaylistAsCompilation && track.playlist || track.album.recordType == "compile")
|
||||
tag._setIntegerFrame('TCMP', 1) // tag.setFrame('TCMP', 1)
|
||||
tag.setFrame('TCMP', '1')
|
||||
|
||||
if (save.source){
|
||||
tag.setFrame('TXXX', {
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -10,7 +10,6 @@
|
|||
"license": "GPL-3.0-or-later",
|
||||
"dependencies": {
|
||||
"async": "^3.2.0",
|
||||
"browser-id3-writer": "^4.4.0",
|
||||
"crypto": "^1.0.1",
|
||||
"deezer-js": "^0.0.8",
|
||||
"got": "^11.8.2",
|
||||
|
|
|
@ -202,11 +202,6 @@ brace-expansion@^1.1.7:
|
|||
balanced-match "^1.0.0"
|
||||
concat-map "0.0.1"
|
||||
|
||||
browser-id3-writer@^4.4.0:
|
||||
version "4.4.0"
|
||||
resolved "https://registry.npmjs.org/browser-id3-writer/-/browser-id3-writer-4.4.0.tgz"
|
||||
integrity sha512-8xce9wo4VoKNR4udEGOAf8vndYxhToqQS+1wyrjdYVPQKRc4Wm6xwGG6XrKYgax28y5AvrbCkqK6t1RplPN2Ew==
|
||||
|
||||
cacheable-lookup@^5.0.3:
|
||||
version "5.0.4"
|
||||
resolved "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-5.0.4.tgz"
|
||||
|
|
Loading…
Reference in a new issue