mirror of
https://gitlab.com/RemixDev/deemix-js.git
synced 2024-12-29 10:56:18 +00:00
Add POPM for ID3v2 & FLAC tag
This commit is contained in:
parent
85132da563
commit
a18c04acd4
|
@ -89,6 +89,7 @@ const DEFAULTS = {
|
|||
composer: false,
|
||||
involvedPeople: false,
|
||||
source: false,
|
||||
rating: false,
|
||||
savePlaylistAsCompilation: false,
|
||||
useNullSeparator: false,
|
||||
saveID3v1: true,
|
||||
|
|
|
@ -112,6 +112,14 @@ function tagID3(path, track, save){
|
|||
})
|
||||
}
|
||||
|
||||
if (save.rating) {
|
||||
let rank = (track.rank / 10000) * 2.55;
|
||||
rank = rank > 255 ? 255 : Math.round(rank);
|
||||
tag.setFrame('POPM', {
|
||||
rating: rank
|
||||
})
|
||||
}
|
||||
|
||||
if (save.cover && track.album.embeddedCoverPath){
|
||||
const coverArrayBuffer = fs.readFileSync(track.album.embeddedCoverPath)
|
||||
if (coverArrayBuffer.length != 0){
|
||||
|
@ -218,6 +226,11 @@ function tagFLAC(path, track, save){
|
|||
flac.setTag(`SOURCEID=${track.id}`)
|
||||
}
|
||||
|
||||
if (save.rating) {
|
||||
let rank = Math.round(track.rank / 10000);
|
||||
flac.setTag(`RATING=${rank}`)
|
||||
}
|
||||
|
||||
if (save.cover && track.album.embeddedCoverPath){
|
||||
let picture = fs.readFileSync(track.album.embeddedCoverPath)
|
||||
if (picture.length != 0) flac.importPicture(picture)
|
||||
|
|
|
@ -223,6 +223,7 @@ class Track {
|
|||
this.ISRC = trackAPI_gw.ISRC
|
||||
this.trackNumber = trackAPI_gw.TRACK_NUMBER
|
||||
this.contributors = trackAPI_gw.SNG_CONTRIBUTORS
|
||||
this.rank = trackAPI_gw.RANK_SNG
|
||||
|
||||
this.lyrics = new Lyrics(trackAPI_gw.LYRICS_ID || "0")
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue