mirror of
https://github.com/beetbox/beets.git
synced 2025-12-06 16:42:42 +01:00
dedup query-joining code
This commit is contained in:
parent
2281bcd4e5
commit
60e945a516
1 changed files with 7 additions and 5 deletions
12
bts
12
bts
|
|
@ -109,6 +109,11 @@ def tag_album(items, lib, copy=True, write=True):
|
||||||
if write:
|
if write:
|
||||||
item.write()
|
item.write()
|
||||||
|
|
||||||
|
def make_query(criteria):
|
||||||
|
"""Make query string for the list of criteria."""
|
||||||
|
return ' '.join(criteria).strip() or None
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class BeetsApp(cmdln.Cmdln):
|
class BeetsApp(cmdln.Cmdln):
|
||||||
name = "bts"
|
name = "bts"
|
||||||
|
|
@ -188,10 +193,7 @@ class BeetsApp(cmdln.Cmdln):
|
||||||
${cmd_usage}
|
${cmd_usage}
|
||||||
${cmd_option_list}
|
${cmd_option_list}
|
||||||
"""
|
"""
|
||||||
q = ' '.join(criteria)
|
q = make_query(criteria)
|
||||||
if not q.strip():
|
|
||||||
q = None # no criteria => match anything
|
|
||||||
|
|
||||||
if opts.album:
|
if opts.album:
|
||||||
for artist, album in self.lib.albums(query=q):
|
for artist, album in self.lib.albums(query=q):
|
||||||
_print(artist + ' - ' + album)
|
_print(artist + ' - ' + album)
|
||||||
|
|
@ -210,7 +212,7 @@ class BeetsApp(cmdln.Cmdln):
|
||||||
${cmd_usage}
|
${cmd_usage}
|
||||||
${cmd_option_list}
|
${cmd_option_list}
|
||||||
"""
|
"""
|
||||||
q = ' '.join(criteria).strip() or None
|
q = make_query(criteria)
|
||||||
|
|
||||||
# Get the matching items.
|
# Get the matching items.
|
||||||
if opts.album:
|
if opts.album:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue