mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-20 05:13:16 -07:00
Update beets to 1.4.7
Also updates: - colorama-0.4.1 - jellyfish-0.6.1 - munkres-1.0.12 - musicbrainzngs-0.6 - mutagen-1.41.1 - pyyaml-3.13 - six-1.12.0 - unidecode-1.0.23
This commit is contained in:
parent
05b0fb498f
commit
e854005ae1
193 changed files with 15896 additions and 6384 deletions
|
@ -117,38 +117,48 @@ class MBSyncPlugin(BeetsPlugin):
|
|||
album_formatted)
|
||||
continue
|
||||
|
||||
# Map recording MBIDs to their information. Recordings can appear
|
||||
# multiple times on a release, so each MBID maps to a list of
|
||||
# TrackInfo objects.
|
||||
# Map release track and recording MBIDs to their information.
|
||||
# Recordings can appear multiple times on a release, so each MBID
|
||||
# maps to a list of TrackInfo objects.
|
||||
releasetrack_index = dict()
|
||||
track_index = defaultdict(list)
|
||||
for track_info in album_info.tracks:
|
||||
releasetrack_index[track_info.release_track_id] = track_info
|
||||
track_index[track_info.track_id].append(track_info)
|
||||
|
||||
# Construct a track mapping according to MBIDs. This should work
|
||||
# for albums that have missing or extra tracks. If there are
|
||||
# multiple copies of a recording, they are disambiguated using
|
||||
# their disc and track number.
|
||||
# Construct a track mapping according to MBIDs (release track MBIDs
|
||||
# first, if available, and recording MBIDs otherwise). This should
|
||||
# work for albums that have missing or extra tracks.
|
||||
mapping = {}
|
||||
for item in items:
|
||||
candidates = track_index[item.mb_trackid]
|
||||
if len(candidates) == 1:
|
||||
mapping[item] = candidates[0]
|
||||
if item.mb_releasetrackid and \
|
||||
item.mb_releasetrackid in releasetrack_index:
|
||||
mapping[item] = releasetrack_index[item.mb_releasetrackid]
|
||||
else:
|
||||
for c in candidates:
|
||||
if (c.medium_index == item.track and
|
||||
c.medium == item.disc):
|
||||
mapping[item] = c
|
||||
break
|
||||
candidates = track_index[item.mb_trackid]
|
||||
if len(candidates) == 1:
|
||||
mapping[item] = candidates[0]
|
||||
else:
|
||||
# If there are multiple copies of a recording, they are
|
||||
# disambiguated using their disc and track number.
|
||||
for c in candidates:
|
||||
if (c.medium_index == item.track and
|
||||
c.medium == item.disc):
|
||||
mapping[item] = c
|
||||
break
|
||||
|
||||
# Apply.
|
||||
self._log.debug(u'applying changes to {}', album_formatted)
|
||||
with lib.transaction():
|
||||
autotag.apply_metadata(album_info, mapping)
|
||||
changed = False
|
||||
# Find any changed item to apply MusicBrainz changes to album.
|
||||
any_changed_item = items[0]
|
||||
for item in items:
|
||||
item_changed = ui.show_model_changes(item)
|
||||
changed |= item_changed
|
||||
if item_changed:
|
||||
any_changed_item = item
|
||||
apply_item_changes(lib, item, move, pretend, write)
|
||||
|
||||
if not changed:
|
||||
|
@ -158,7 +168,7 @@ class MBSyncPlugin(BeetsPlugin):
|
|||
if not pretend:
|
||||
# Update album structure to reflect an item in it.
|
||||
for key in library.Album.item_keys:
|
||||
a[key] = items[0][key]
|
||||
a[key] = any_changed_item[key]
|
||||
a.store()
|
||||
|
||||
# Move album art (and any inconsistent items).
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue