diff --git a/src/renderer/pages/player-page.js b/src/renderer/pages/player-page.js index 7fb8114420..23713b0df1 100644 --- a/src/renderer/pages/player-page.js +++ b/src/renderer/pages/player-page.js @@ -204,6 +204,28 @@ function renderOverlay (state) { ) } +/** + * Render track or disk number string + * @param common metadata.common part + * @param key should be either 'track' or 'disk' + * @return track or disk number metadata as JSX block + */ +function renderTrack (common, key) { + // Audio metadata: track-number + if (common[key] && common[key].no) { + let str = `${common[key].no}` + if (common[key].of) { + str += ` of ${common[key].of}` + } + const style = { textTransform: 'capitalize' } + return ( +
+ {str} +
+ ) + } +} + function renderAudioMetadata (state) { const fileSummary = state.getPlayingFileSummary() if (!fileSummary.audioInfo) return @@ -227,6 +249,15 @@ function renderAudioMetadata (state) { )) } + // Audio metadata: disk & track-number + const count = ['track', 'disk'] + count.forEach(key => { + const nrElem = renderTrack(common, key) + if (nrElem) { + elems.push(nrElem) + } + }) + // Audio metadata: album if (common.album) { elems.push(( @@ -269,16 +300,6 @@ function renderAudioMetadata (state) { )) } - // Audio metadata: track-number - if (common.track && common.track.no && common.track.of) { - const track = common.track.no + ' of ' + common.track.of - elems.push(( -
- {track} -
- )) - } - // Audio metadata: format const format = [] fileSummary.audioInfo.format = fileSummary.audioInfo.format || ''