fix VA inference for small (1-track) albums

This commit is contained in:
Adrian Sampson 2011-07-07 09:19:33 -07:00
parent 45383eced2
commit 951e4eec86
2 changed files with 8 additions and 1 deletions

View file

@ -135,7 +135,8 @@ def _infer_album_fields(task):
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

View file

@ -360,6 +360,12 @@ class InferAlbumDataTest(unittest.TestCase):
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):