diff --git a/beets/ui/commands.py b/beets/ui/commands.py index 610ae551e..46ae1d936 100644 --- a/beets/ui/commands.py +++ b/beets/ui/commands.py @@ -237,7 +237,7 @@ def show_change(cur_artist, cur_album, match): medium = track_info.disc mediums = track_info.disctotal if config['per_disc_numbering']: - if mediums > 1: + if mediums and mediums > 1: return u'{0}-{1}'.format(medium, medium_index) else: return six.text_type(medium_index or index) diff --git a/beetsplug/keyfinder.py b/beetsplug/keyfinder.py index 34a4abca4..a3fbc8211 100644 --- a/beetsplug/keyfinder.py +++ b/beetsplug/keyfinder.py @@ -48,7 +48,7 @@ class KeyFinderPlugin(BeetsPlugin): self.find_key(lib.items(ui.decargs(args)), write=ui.should_write()) def imported(self, session, task): - self.find_key(task.items) + self.find_key(task.imported_items()) def find_key(self, items, write=False): overwrite = self.config['overwrite'].get(bool) diff --git a/docs/changelog.rst b/docs/changelog.rst index ec6c1b3a7..8b49b97a1 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -106,6 +106,8 @@ Fixes: * 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. Thanks to :user:`jdetrey`. :bug:`1638` +* :doc:`/plugins/keyfinder`: Avoid a crash when trying to process unmatched + tracks. :bug:`2537` For developers: