Skip to content

Commit

Permalink
fix(meta): use correct total disc number count (#634)
Browse files Browse the repository at this point in the history
  • Loading branch information
miraclx authored Jan 14, 2024
1 parent cd414ab commit 437c505
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 17 deletions.
32 changes: 16 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/services/apple_music.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions src/services/spotify.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 437c505

Please sign in to comment.