diff --git a/beets/importer.py b/beets/importer.py index ff8e6284b..0fc11f660 100644 --- a/beets/importer.py +++ b/beets/importer.py @@ -487,24 +487,14 @@ class ImportTask(object): elif self.choice_flag == action.APPLY: # Applying autotagged metadata. Just get AA from the first # item. - # FIXME this is overly complicated. Can we assume that - # `self.items` contains only elements that are not none and - # at least one of them? - for item in self.items: - if item is not None: - first_item = item - break - else: - assert False, "all items are None" - if not first_item.albumartist: - changes['albumartist'] = first_item.artist - if not first_item.mb_albumartistid: - changes['mb_albumartistid'] = first_item.mb_artistid + if not self.items[0].albumartist: + changes['albumartist'] = self.items[0].artist + if not self.items[0].mb_albumartistid: + changes['mb_albumartistid'] = self.items[0].mb_artistid # Apply new metadata. for item in self.items: - if item is not None: - item.update(changes) + item.update(changes) def manipulate_files(self, move=False, copy=False, write=False, session=None): diff --git a/test/test_importer.py b/test/test_importer.py index bf37b21b4..371e9ab1c 100644 --- a/test/test_importer.py +++ b/test/test_importer.py @@ -947,13 +947,6 @@ class InferAlbumDataTest(_common.TestCase): self.task.infer_album_fields() self.assertFalse(self.items[0].comp) - def test_first_item_null_apply(self): - self.items[0] = None - self.task.set_choice(AlbumMatch(0, None, {}, set(), set())) # APPLY - self.task.infer_album_fields() - self.assertFalse(self.items[1].comp) - self.assertEqual(self.items[1].albumartist, self.items[2].artist) - class ImportDuplicateAlbumTest(unittest.TestCase, TestHelper):