Commits

Adrian Sampson  committed a256ec5

fix VA inference for small (1-track) albums

  • Participants
  • Parent commits fc8e0a3
  • Tags 1.0b9

Comments (0)

Files changed (2)

File beets/importer.py

     if task.choice_flag == action.ASIS:
         # Taking metadata "as-is". Guess whether this album is VA.
         plur_artist, freq = plurality([i.artist for i in task.items])
-        if freq > 1 and float(freq) / len(task.items) >= SINGLE_ARTIST_THRESH:
+        if freq == len(task.items) or (freq > 1 and
+                float(freq) / len(task.items) >= SINGLE_ARTIST_THRESH):
             # Single-artist album.
             changes['albumartist'] = plur_artist
             changes['comp'] = False

File test/test_importer.py

         self.assertEqual(self.items[0].mb_albumartistid,
                          'some album artist id')
 
+    def test_small_single_artist_album(self):
+        self.items = [self.items[0]]
+        self.task.items = self.items
+        self.task.set_choice(importer.action.ASIS)
+        self._infer()
+        self.assertFalse(self.items[0].comp)
 
 class DuplicateCheckTest(unittest.TestCase):
     def setUp(self):