From 7a0b76e448d1b5a4aeaec5bfba2a73760c05276d Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Fri, 27 Nov 2009 22:29:44 -0800 Subject: [PATCH] list albums with "ls -a" --- bts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/bts b/bts index c7de36666..ffbdf47c1 100755 --- a/bts +++ b/bts @@ -143,6 +143,8 @@ class BeetsApp(cmdln.Cmdln): self.lib.save() @cmdln.alias("ls") + @cmdln.option('-a', '--album', action='store_true', + help='show matching albums instead of tracks') def do_list(self, subcmd, opts, *criteria): """${cmd_name}: query the library @@ -152,8 +154,13 @@ class BeetsApp(cmdln.Cmdln): q = ' '.join(criteria) if not q.strip(): q = None # no criteria => match anything - for item in self.lib.get(q): - _print(item.artist + ' - ' + item.album + ' - ' + item.title) + + if opts.album: + for artist, album in self.lib.albums(query=q): + _print(artist + ' - ' + album) + else: + for item in self.lib.items(query=q): + _print(item.artist + ' - ' + item.album + ' - ' + item.title) def do_bpd(self, subcmd, opts, host=None, port=None):