diff --git a/beets/library.py b/beets/library.py index ff1b46249..5f59e4938 100644 --- a/beets/library.py +++ b/beets/library.py @@ -218,7 +218,7 @@ class Item(object): self.library = library if not self.library: raise LibraryError('no library to add to') - self.library.add_item(self, copy) + self.library.add(self, copy) return self.id def remove(self): @@ -532,7 +532,7 @@ class BaseLibrary(object): ### basic operations ### - def add_item(self, item, copy=False): #FIXME rename to "add", copy default to true + def add(self, item, copy=False): #FIXME copy should default to true """Add the item as a new object to the library database. The id field will be updated; the new id is returned. If copy, then each item is copied to the destination location before it is added. @@ -616,14 +616,14 @@ class BaseLibrary(object): ### convenience methods ### - def add(self, path, copy=False): #FIXME change name to add_path() + def add_path(self, path, copy=False): items = [] for f in _walk_files(path): try: item = Item.from_path(_normpath(f), self) except FileTypeError: log.warn(f + ' of unknown type, skipping') - self.add_item(item, copy) + self.add(item, copy) class Library(BaseLibrary): @@ -692,7 +692,7 @@ class Library(BaseLibrary): #### main interface #### - def add_item(self, item, copy=False): + def add(self, item, copy=False): #FIXME make a deep copy of the item? item.library = self if copy: diff --git a/test/test_db.py b/test/test_db.py index 3e7c9998d..bb2d0c51e 100755 --- a/test/test_db.py +++ b/test/test_db.py @@ -106,8 +106,8 @@ class AddTest(unittest.TestCase): 'where composer="the composer"').fetchone()['grouping'] self.assertEqual(new_grouping, self.i.grouping) - def test_library_add_inserts_row(self): - self.lib.add(os.path.join('rsrc', 'full.mp3')) + def test_library_add_path_inserts_row(self): + self.lib.add_path(os.path.join('rsrc', 'full.mp3')) new_grouping = self.lib.conn.execute('select grouping from items ' 'where composer="the composer"').fetchone()['grouping'] self.assertEqual(new_grouping, self.i.grouping) diff --git a/test/test_files.py b/test/test_files.py index 92ace3d05..19df33b04 100755 --- a/test/test_files.py +++ b/test/test_files.py @@ -146,8 +146,8 @@ class AddTest(unittest.TestCase): if os.path.exists(self.dir): shutil.rmtree(self.dir) - def test_library_add_copies(self): - self.lib.add(os.path.join('rsrc', 'full.mp3'), copy=True) + def test_library_add_path_copies(self): + self.lib.add_path(os.path.join('rsrc', 'full.mp3'), copy=True) self.assertTrue(os.path.isfile(os.path.join(self.dir, 'item.mp3'))) class HelperTest(unittest.TestCase):