From 951e4eec86b75efabc0b7916f523355cfc223a81 Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Thu, 7 Jul 2011 09:19:33 -0700 Subject: [PATCH] fix VA inference for small (1-track) albums --- beets/importer.py | 3 ++- test/test_importer.py | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/beets/importer.py b/beets/importer.py index 42ac05e6c..3ecda5dbd 100644 --- a/beets/importer.py +++ b/beets/importer.py @@ -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 diff --git a/test/test_importer.py b/test/test_importer.py index ae829acf9..8d9786fd6 100644 --- a/test/test_importer.py +++ b/test/test_importer.py @@ -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):