mirror of
https://github.com/beetbox/beets.git
synced 2025-12-06 00:24:25 +01:00
Do not assign args to query
This commit is contained in:
parent
4260162d44
commit
afe97cf31e
8 changed files with 14 additions and 26 deletions
|
|
@ -1293,14 +1293,9 @@ class CommonOptionsParser(optparse.OptionParser):
|
|||
setattr(parser.values, option.dest, True)
|
||||
|
||||
# Use the explicitly specified format, or the string from the option.
|
||||
if fmt:
|
||||
value = fmt
|
||||
elif value:
|
||||
(value,) = [value]
|
||||
else:
|
||||
value = ""
|
||||
|
||||
value = fmt or value or ""
|
||||
parser.values.format = value
|
||||
|
||||
if target:
|
||||
config[target._format_config_key].set(value)
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -83,14 +83,13 @@ class BareascPlugin(BeetsPlugin):
|
|||
|
||||
def unidecode_list(self, lib, opts, args):
|
||||
"""Emulate normal 'list' command but with unidecode output."""
|
||||
query = args
|
||||
album = opts.album
|
||||
# Copied from commands.py - list_items
|
||||
if album:
|
||||
for album in lib.albums(query):
|
||||
for album in lib.albums(args):
|
||||
bare = unidecode(str(album))
|
||||
print_(bare)
|
||||
else:
|
||||
for item in lib.items(query):
|
||||
for item in lib.items(args):
|
||||
bare = unidecode(str(item))
|
||||
print_(bare)
|
||||
|
|
|
|||
|
|
@ -65,10 +65,9 @@ class BPSyncPlugin(BeetsPlugin):
|
|||
move = ui.should_move(opts.move)
|
||||
pretend = opts.pretend
|
||||
write = ui.should_write(opts.write)
|
||||
query = args
|
||||
|
||||
self.singletons(lib, query, move, pretend, write)
|
||||
self.albums(lib, query, move, pretend, write)
|
||||
self.singletons(lib, args, move, pretend, write)
|
||||
self.albums(lib, args, move, pretend, write)
|
||||
|
||||
def singletons(self, lib, query, move, pretend, write):
|
||||
"""Retrieve and apply info from the autotagger for items matched by
|
||||
|
|
|
|||
|
|
@ -180,8 +180,7 @@ class EditPlugin(plugins.BeetsPlugin):
|
|||
def _edit_command(self, lib, opts, args):
|
||||
"""The CLI command function for the `beet edit` command."""
|
||||
# Get the objects to edit.
|
||||
query = args
|
||||
items, albums = _do_query(lib, query, opts.album, False)
|
||||
items, albums = _do_query(lib, args, opts.album, False)
|
||||
objs = albums if opts.album else items
|
||||
if not objs:
|
||||
ui.print_("Nothing to edit.")
|
||||
|
|
|
|||
|
|
@ -36,11 +36,10 @@ def lslimit(lib, opts, args):
|
|||
if (opts.head or opts.tail or 0) < 0:
|
||||
raise ValueError("Limit value must be non-negative")
|
||||
|
||||
query = args
|
||||
if opts.album:
|
||||
objs = lib.albums(query)
|
||||
objs = lib.albums(args)
|
||||
else:
|
||||
objs = lib.items(query)
|
||||
objs = lib.items(args)
|
||||
|
||||
if opts.head is not None:
|
||||
objs = islice(objs, opts.head)
|
||||
|
|
|
|||
|
|
@ -63,10 +63,9 @@ class MBSyncPlugin(BeetsPlugin):
|
|||
move = ui.should_move(opts.move)
|
||||
pretend = opts.pretend
|
||||
write = ui.should_write(opts.write)
|
||||
query = args
|
||||
|
||||
self.singletons(lib, query, move, pretend, write)
|
||||
self.albums(lib, query, move, pretend, write)
|
||||
self.singletons(lib, args, move, pretend, write)
|
||||
self.albums(lib, args, move, pretend, write)
|
||||
|
||||
def singletons(self, lib, query, move, pretend, write):
|
||||
"""Retrieve and apply info from the autotagger for items matched by
|
||||
|
|
|
|||
|
|
@ -97,7 +97,6 @@ class MetaSyncPlugin(BeetsPlugin):
|
|||
def func(self, lib, opts, args):
|
||||
"""Command handler for the metasync function."""
|
||||
pretend = opts.pretend
|
||||
query = args
|
||||
|
||||
sources = []
|
||||
for source in opts.sources:
|
||||
|
|
@ -106,7 +105,7 @@ class MetaSyncPlugin(BeetsPlugin):
|
|||
sources = sources or self.config["source"].as_str_seq()
|
||||
|
||||
meta_source_instances = {}
|
||||
items = lib.items(query)
|
||||
items = lib.items(args)
|
||||
|
||||
# Avoid needlessly instantiating meta sources (can be expensive)
|
||||
if not items:
|
||||
|
|
|
|||
|
|
@ -22,11 +22,10 @@ from beets.ui import Subcommand, print_
|
|||
def random_func(lib, opts, args):
|
||||
"""Select some random items or albums and print the results."""
|
||||
# Fetch all the objects matching the query into a list.
|
||||
query = args
|
||||
if opts.album:
|
||||
objs = list(lib.albums(query))
|
||||
objs = list(lib.albums(args))
|
||||
else:
|
||||
objs = list(lib.items(query))
|
||||
objs = list(lib.items(args))
|
||||
|
||||
# Print a random subset.
|
||||
objs = random_objs(
|
||||
|
|
|
|||
Loading…
Reference in a new issue