Add audio metadata standalone entries for: year & release information
This commit is contained in:
@@ -210,34 +210,69 @@ function renderAudioMetadata (state) {
|
|||||||
const common = fileSummary.audioInfo.common
|
const common = fileSummary.audioInfo.common
|
||||||
|
|
||||||
// Get audio track info
|
// Get audio track info
|
||||||
let title = common.title
|
const title = common.title ? common.title : fileSummary.name
|
||||||
if (!title) {
|
|
||||||
title = fileSummary.name
|
// Show a small info box in the middle of the screen with title/album/etc
|
||||||
}
|
const elems = []
|
||||||
let artist = common.albumartist || common.artist ||
|
|
||||||
|
// Audio metadata: artist(s)
|
||||||
|
const artist = common.albumartist || common.artist ||
|
||||||
(common.artists && common.artists.filter(function (a) { return a }).join(', ')) ||
|
(common.artists && common.artists.filter(function (a) { return a }).join(', ')) ||
|
||||||
'(Unknown Artist)'
|
'(Unknown Artist)'
|
||||||
let album = common.album
|
if (artist) {
|
||||||
if (album && common.year && !album.includes(common.year)) {
|
elems.push((
|
||||||
album += ' (' + common.year + ')'
|
<div key='artist' className='audio-artist'>
|
||||||
if (common.label || common.catalognumber) {
|
<label>Artist</label>{artist}
|
||||||
album += ', '
|
</div>
|
||||||
let releaseInfo = []
|
))
|
||||||
if (common.label) {
|
|
||||||
releaseInfo.push(common.label)
|
|
||||||
}
|
|
||||||
if (common.catalognumber) {
|
|
||||||
releaseInfo.push(common.catalognumber)
|
|
||||||
}
|
|
||||||
album += releaseInfo.join(' / ')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let track
|
|
||||||
if (common.track && common.track.no && common.track.of) {
|
|
||||||
track = common.track.no + ' of ' + common.track.of
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let format = []
|
// Audio metadata: album
|
||||||
|
if (common.album) {
|
||||||
|
elems.push((
|
||||||
|
<div key='album' className='audio-album'>
|
||||||
|
<label>Album</label>{common.album}
|
||||||
|
</div>
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|
||||||
|
// Audio metadata: year
|
||||||
|
if (common.year) {
|
||||||
|
elems.push((
|
||||||
|
<div key='year' className='audio-year'>
|
||||||
|
<label>Year</label>{common.year}
|
||||||
|
</div>
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|
||||||
|
// Audio metadata: release information (label & catalog-number)
|
||||||
|
if (common.label || common.catalognumber) {
|
||||||
|
const releaseInfo = []
|
||||||
|
if (common.label) {
|
||||||
|
releaseInfo.push(common.label)
|
||||||
|
}
|
||||||
|
if (common.catalognumber) {
|
||||||
|
releaseInfo.push(common.catalognumber)
|
||||||
|
}
|
||||||
|
elems.push((
|
||||||
|
<div key='release' className='audio-release'>
|
||||||
|
<label>Release</label>{ releaseInfo.join(' / ') }
|
||||||
|
</div>
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|
||||||
|
// Audio metadata: track-number
|
||||||
|
if (common.track && common.track.no && common.track.of) {
|
||||||
|
const track = common.track.no + ' of ' + common.track.of
|
||||||
|
elems.push((
|
||||||
|
<div key='track' className='audio-track'>
|
||||||
|
<label>Track</label>{track}
|
||||||
|
</div>
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|
||||||
|
// Audio metadata: format
|
||||||
|
const format = []
|
||||||
if (fileSummary.audioInfo.format.dataformat) {
|
if (fileSummary.audioInfo.format.dataformat) {
|
||||||
format.push(fileSummary.audioInfo.format.dataformat)
|
format.push(fileSummary.audioInfo.format.dataformat)
|
||||||
}
|
}
|
||||||
@@ -250,38 +285,7 @@ function renderAudioMetadata (state) {
|
|||||||
if (fileSummary.audioInfo.format.bitsPerSample) {
|
if (fileSummary.audioInfo.format.bitsPerSample) {
|
||||||
format.push(fileSummary.audioInfo.format.bitsPerSample + ' bit')
|
format.push(fileSummary.audioInfo.format.bitsPerSample + ' bit')
|
||||||
}
|
}
|
||||||
format = format.join(', ')
|
if (format.size > 0) {
|
||||||
|
|
||||||
let comments
|
|
||||||
if (common.comment) {
|
|
||||||
comments = common.comment.join(' / ')
|
|
||||||
}
|
|
||||||
|
|
||||||
// Show a small info box in the middle of the screen with title/album/etc
|
|
||||||
const elems = []
|
|
||||||
if (artist) {
|
|
||||||
elems.push((
|
|
||||||
<div key='artist' className='audio-artist'>
|
|
||||||
<label>Artist</label>{artist}
|
|
||||||
</div>
|
|
||||||
))
|
|
||||||
}
|
|
||||||
if (album) {
|
|
||||||
elems.push((
|
|
||||||
<div key='album' className='audio-album'>
|
|
||||||
<label>Album</label>{album}
|
|
||||||
</div>
|
|
||||||
))
|
|
||||||
}
|
|
||||||
if (track) {
|
|
||||||
elems.push((
|
|
||||||
<div key='track' className='audio-track'>
|
|
||||||
<label>Track</label>{track}
|
|
||||||
</div>
|
|
||||||
))
|
|
||||||
}
|
|
||||||
|
|
||||||
if (format) {
|
|
||||||
elems.push((
|
elems.push((
|
||||||
<div key='format' className='audio-format'>
|
<div key='format' className='audio-format'>
|
||||||
<label>Format</label>{format}
|
<label>Format</label>{format}
|
||||||
@@ -289,10 +293,11 @@ function renderAudioMetadata (state) {
|
|||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (comments) {
|
// Audio metadata: comments
|
||||||
|
if (common.comment) {
|
||||||
elems.push((
|
elems.push((
|
||||||
<div key='comments' className='audio-comments'>
|
<div key='comments' className='audio-comments'>
|
||||||
<label>Comments</label>{comments}
|
<label>Comments</label>{common.comment.join(' / ')}
|
||||||
</div>
|
</div>
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user