mirror of
https://github.com/beetbox/beets.git
synced 2026-01-05 07:23:33 +01:00
list albums with "ls -a"
This commit is contained in:
parent
a348e19112
commit
7a0b76e448
1 changed files with 9 additions and 2 deletions
11
bts
11
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):
|
||||
|
|
|
|||
Loading…
Reference in a new issue