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