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
Add support for pregap tracks #1493
Conversation
item.track = track_info.medium_index or track_info.index | ||
item.track = track_info.medium_index | ||
if item.track is None: | ||
item.track = track_info.index |
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.
Since this is a little tricky, an inline condition, like this:
item.track = track_info.medium_index if track_info.medium_index is not None else track_info.index
or a comment to the effect of "we want to let the track number be zero, but if the medium index is not provided we need to fall back to the overall index" would be helpful here.
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 did not inline the conditional because of its size; I'll add that comment there instead.
This looks great, and I agree with your reasoning about the Other than that (and pending a changelog entry), this looks great! Let me know when you're happy and we'll merge it. |
No problem, I'll describe the numbering behavior in the documentation and add a changelog entry if you want. Where in the documentation do you suggest I add that? |
Good question. Certainly on the config page under |
Sorry, I messed up with the local branches here. I added some text to the |
Awesome; looks great! Thank you for addressing this feature, even though it spans two projects. ✨ I expanded the docs a little; let me know if I messed anything up. |
Ignore my rambling, misunderstood. |
This pull request adds support for pregap tracks in imports from Musicbrainz. This will only work after Musicbrainzngs releases a new version and beets starts using it, but everything should work as normal until then.
Two things to note:
track_info.index
starting at 1 even in the presence of pregap tracks, which means that users withper_disc_numbering
deactivated will see the pregap track as track 1 and every other track as its "original" album track number plus one. In albums with a single disc that felt strange to me, but then I thought about albums with multiple discs and multiple pregap tracks - I could set the index of the pregap in the first disc as 0, but then I would have to go sequential from there, including other pregap tracks in the same release. As I thought that would be rather inconsistent I implemented as seen in this pull request, but suggestions would be welcome;Fixes #1104.