From fb7773ba463dba9f3c204d3ac53d96f4713be5c3 Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Thu, 29 Jul 2010 11:10:59 -0700 Subject: [PATCH] fixed deleting of albums (rm -a): now deletes album entry --- beets/ui/commands.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/beets/ui/commands.py b/beets/ui/commands.py index 89010e953..1a6b8937a 100644 --- a/beets/ui/commands.py +++ b/beets/ui/commands.py @@ -373,9 +373,10 @@ def remove_items(lib, query, album, delete=False): """ # Get the matching items. if album: + albums = list(lib.albums(query=query)) items = [] - for album in lib.albums(query=query): - items += album.items() + for al in albums: + items += al.items() else: items = list(lib.items(query=query)) @@ -397,11 +398,14 @@ def remove_items(lib, query, album, delete=False): if not ui.input_yn(prompt, True): return - # Remove and delete. - for item in items: - lib.remove(item) - if delete: - os.unlink(item.path) + # Remove (and possibly delete) items. + if album: + for al in albums: + al.remove(delete) + else: + for item in items: + lib.remove(item, delete) + lib.save() remove_cmd = ui.Subcommand('remove',