Skip to content
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

Take the audio tracks in a data track into account. #1638

Merged
merged 8 commits into from
Apr 29, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion beets/autotag/mb.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,10 @@ def album_info(release):
format = medium.get('format')

all_tracks = medium['track-list']
if 'data-track-list' in medium:
all_tracks += medium['data-track-list']
total = len(all_tracks)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO, total is not a very good name (total… what?). I would probably just remove that line and…

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had elected to name this variable total because the track index in the same function is named index. Likewise, the corresponding parameter of track_info is medium_total. Sounded kind of consistent to me. But I don't mind changing its name to anything else which you'd think is more explicit :)

Cheers,
Jérémie.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps something like track_count would be more descriptive?


if 'pregap' in medium:
all_tracks.insert(0, medium['pregap'])

Expand All @@ -228,7 +232,7 @@ def album_info(release):
index,
int(medium['position']),
int(track['position']),
len(medium['track-list']),
total,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

… use len(all_tracks) here instead. all_tracks is a good variable name (it contains all the tracks), and len() is a known function (or should be, anyway).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alas, that would inadvertently count the pregap track.

)
ti.disctitle = disctitle
ti.media = format
Expand Down
5 changes: 5 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ The new features:
* :doc:`/plugins/plexupdate`: A new ``library_name`` option allows you to select
which Plex library to update. :bug:`1572` :bug:`1595`
* Add new `include` config option to allow including external config files.
* The importer now supports audio files contained in data tracks when they are
listed in MusicBrainz: the corresponding audio tracks are now merged into the
main track list. (This feature depends on a new version of the
``musicbrainzngs`` library which is not yet released, but will start working
when it is available.) Thanks to :user:`jdetrey`. :bug:`1638`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds great! ✨


Fixes:

Expand Down