feat: add disc number and compilation metadata tags
- disc tag written as discNum/discTotal (e.g. 2/2) for multi-disc albums - compilation=1 set when iTunes collectionType is Compilation Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
5f8141d6ba
commit
4e19178e24
1 file changed
+6
-1
@@ -108,7 +108,7 @@ async function downloadArtwork(url, dir) {
|
||||
}
|
||||
|
||||
// Download a single track: yt-dlp audio + ffmpeg clean metadata + iTunes cover embedded
|
||||
async function downloadTrack({ jobId, artist, albumArtist, title, album, year, trackNum, totalTracks, genre, artworkUrl, outputDir }) {
|
||||
async function downloadTrack({ jobId, artist, albumArtist, title, album, year, trackNum, totalTracks, discNum, discTotal, compilation, genre, artworkUrl, outputDir }) {
|
||||
const mainArtist = albumArtist || artist;
|
||||
const safeArtist = sanitize(mainArtist);
|
||||
const safeAlbum = sanitize(album || 'Singles');
|
||||
@@ -197,6 +197,8 @@ async function downloadTrack({ jobId, artist, albumArtist, title, album, year, t
|
||||
if (trackNum) ffArgs.push('-metadata', `track=${totalTracks ? `${trackNum}/${totalTracks}` : String(trackNum)}`);
|
||||
if (totalTracks) ffArgs.push('-metadata', `totaltracks=${String(totalTracks)}`);
|
||||
if (genre) ffArgs.push('-metadata', `genre=${genre}`);
|
||||
if (discNum) ffArgs.push('-metadata', `disc=${discTotal ? `${discNum}/${discTotal}` : String(discNum)}`);
|
||||
if (compilation) ffArgs.push('-metadata', `compilation=1`);
|
||||
if (hasCover) {
|
||||
ffArgs.push(
|
||||
'-metadata:s:v', 'title=Album cover',
|
||||
@@ -242,6 +244,9 @@ async function downloadAlbumTracks({ jobId, artist, albumTitle, tracks, artworkU
|
||||
year: track.releaseDate ? new Date(track.releaseDate).getFullYear() : undefined,
|
||||
trackNum: track.trackNumber || undefined,
|
||||
totalTracks: total,
|
||||
discNum: track.discNumber || undefined,
|
||||
discTotal: track.discCount || undefined,
|
||||
compilation: track.collectionType === 'Compilation' || undefined,
|
||||
genre: track.primaryGenreName || undefined,
|
||||
artworkUrl: artworkUrl || track.artworkUrl100,
|
||||
outputDir: CONFIG.musicPath,
|
||||
|
||||
Reference in new issue
Block a user