fix(meta): use correct total disc number count (#634)

This commit is contained in:
Miraculous Owonubi 2024-01-14 06:11:31 +03:00 committed by GitHub
parent cd414abddf
commit 437c505e54
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 17 deletions

View File

@ -50,22 +50,22 @@ Depending on the URLs you provide freyr, it will;
Here's a list of the metadata that freyr can extract from each streaming service:
| Meta | Spotify | Apple Music | Deezer |
| :------------: | :-----: | :---------: | :----: |
| `Title` | ✔ | ✔ | ✔ |
| `Artist` | ✔ | ✔ | ✔ |
| `Composer` | ✗ | ✔ | ✔ |
| `Album` | ✔ | ✔ | ✔ |
| `Genre` | ✗ | ✔ | ✔ |
| `Track Number` | ✔ | ✔ | ✔ |
| `Disk Number` | ✔ | ✔ | ✔ |
| `Release Date` | ✔ | ✔ | ✔ |
| `Rating` | ✔ | ✔ | ✔ |
| `Album Artist` | ✔ | ✔ | ✔ |
| `ISRC` | ✔ | ✔ | ✔ |
| `Label` | ✔ | ✔ | ✔ |
| `Copyright` | ✔ | ✔ | ✗ |
| `Cover Art` | ✔ | ✔ | ✔ |
| Meta | Spotify | Apple Music | Deezer |
| :------------: | :-----: | :---------: | :---------------: |
| `Title` | ✔ | ✔ | |
| `Artist` | ✔ | ✔ | |
| `Composer` | ✗ | ✔ | |
| `Album` | ✔ | ✔ | |
| `Genre` | ✗ | ✔ | |
| `Track Number` | ✔ | ✔ | |
| `Disk Number` | ✔ | ✔ | ✔ (no total) |
| `Release Date` | ✔ | ✔ | |
| `Rating` | ✔ | ✔ | |
| `Album Artist` | ✔ | ✔ | |
| `ISRC` | ✔ | ✔ | |
| `Label` | ✔ | ✔ | |
| `Copyright` | ✔ | ✔ | |
| `Cover Art` | ✔ | ✔ | |
## Support the project

2
cli.js
View File

@ -1108,7 +1108,7 @@ async function init(packageJson, queries, options) {
album: track.album, // ©alb
genre: (genre => (genre ? genre.concat(' ') : ''))((track.genres || [])[0]), // ©gen | gnre
tracknum: `${track.track_number}/${track.total_tracks}`, // trkn
disk: `${track.disc_number}/${track.disc_number}`, // disk
disk: `${track.disc_number}${track.total_discs ? `/${track.total_discs}` : ''}`, // disk
year: new Date(track.release_date).toISOString().split('T')[0], // ©day
compilation: track.compilation, // ©cpil
gapless: options.gapless ?? false, // pgap

View File

@ -167,6 +167,7 @@ export default class AppleMusic {
total_tracks: albumInfo.ntracks,
release_date: albumInfo.release_date,
disc_number: trackInfo.attributes.discNumber,
total_discs: albumInfo.tracks.reduce((acc, track) => Math.max(acc, track.attributes.discNumber), 1),
contentRating: trackInfo.attributes.contentRating,
isrc: trackInfo.attributes.isrc,
genres: trackInfo.attributes.genreNames,

View File

@ -153,6 +153,7 @@ export default class Spotify {
total_tracks: albumInfo.ntracks,
release_date: albumInfo.release_date,
disc_number: trackInfo.disc_number,
total_discs: albumInfo.tracks.reduce((acc, track) => Math.max(acc, track.disc_number), 1),
contentRating: trackInfo.explicit === true ? 'explicit' : 'inoffensive',
isrc: (trackInfo.external_ids || {}).isrc,
genres: albumInfo.genres,