feat: write genre metadata from iTunes primaryGenreName
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
e462b54adf
commit
5f8141d6ba
1 file changed
+4
-2
@@ -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, artworkUrl, outputDir }) {
|
||||
async function downloadTrack({ jobId, artist, albumArtist, title, album, year, trackNum, totalTracks, genre, artworkUrl, outputDir }) {
|
||||
const mainArtist = albumArtist || artist;
|
||||
const safeArtist = sanitize(mainArtist);
|
||||
const safeAlbum = sanitize(album || 'Singles');
|
||||
@@ -196,6 +196,7 @@ async function downloadTrack({ jobId, artist, albumArtist, title, album, year, t
|
||||
if (year) ffArgs.push('-metadata', `date=${String(year)}`);
|
||||
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 (hasCover) {
|
||||
ffArgs.push(
|
||||
'-metadata:s:v', 'title=Album cover',
|
||||
@@ -239,8 +240,9 @@ async function downloadAlbumTracks({ jobId, artist, albumTitle, tracks, artworkU
|
||||
title: track.trackName || track.title,
|
||||
album: albumTitle,
|
||||
year: track.releaseDate ? new Date(track.releaseDate).getFullYear() : undefined,
|
||||
trackNum: track.trackNumber || undefined,
|
||||
trackNum: track.trackNumber || undefined,
|
||||
totalTracks: total,
|
||||
genre: track.primaryGenreName || undefined,
|
||||
artworkUrl: artworkUrl || track.artworkUrl100,
|
||||
outputDir: CONFIG.musicPath,
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user