-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix audio track number not displayed and adds audio disk (media) number #1454
Conversation
Borewit
commented
Aug 15, 2018
- Fixes audio track number not displayed of the total number of is not defined
- Adds the disk (media) number to audio track properties
- Changes the order of audio track properties
… defined (common.track.of === null).
…track, disk, album, format
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a nice enhancement! Thanks!
src/renderer/pages/player-page.js
Outdated
if (common[key].of) { | ||
str += ` of ${common[key].of}` | ||
} | ||
return React.createElement('div', { key, className: 'audio-' + key }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd suggest returning a JSX block, like the one we had before.
src/renderer/pages/player-page.js
Outdated
// Audio metadata: disk & track-number | ||
const count = ['track', 'disk'] | ||
count.forEach(key => { | ||
const nrElem = renderTrack(common, key, key[0].toUpperCase() + key.substring(1)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can use CSS to capitalize the label.
If we do that we would only pass key
and avoid operating directly on the string.
On renderTrack
we would be able to do:
const style = { textTransform: 'capitalize' }
return (
<div className={`audio-${key}`}>
<label style={style}>{key}</label> {str}
</div>
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no experience with React, I blindly followed your suggestion.
But seems to do the job, so well done.
src/renderer/pages/player-page.js
Outdated
// Audio metadata: disk & track-number | ||
const count = ['track', 'disk'] | ||
count.forEach(key => { | ||
const nrElem = renderTrack(common, key, key[0].toUpperCase() + key.substring(1)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we can remove the third param, which is not needed anymore.
:)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, yeah sure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just did some quick testing and added a fix to handle undefined values on renderTrack
.
I think we're ready to merge :)
Good catch, but strange, common.track: & common.disk should always exist... public readonly common: ICommonTagsResult = {
track: {no: null, of: null},
disk: {no: null, of: null}
}; |
On player-page:232 we default |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, lets get this merged 👍