mirror of
https://github.com/beetbox/beets.git
synced 2026-02-22 15:22:42 +01:00
rename -i flag to -s ("singletons") and fix behavior
This commit is contained in:
parent
12854ad2ff
commit
45eef6e876
4 changed files with 11 additions and 11 deletions
|
|
@ -125,7 +125,7 @@ class ImportConfig(object):
|
|||
_fields = ['lib', 'paths', 'resume', 'logfile', 'color', 'quiet',
|
||||
'quiet_fallback', 'copy', 'write', 'art', 'delete',
|
||||
'choose_match_func', 'should_resume_func', 'threaded',
|
||||
'autot', 'items']
|
||||
'autot', 'singletons']
|
||||
def __init__(self, **kwargs):
|
||||
for slot in self._fields:
|
||||
setattr(self, slot, kwargs[slot])
|
||||
|
|
@ -457,7 +457,7 @@ def apply_choices(config):
|
|||
task.save_progress()
|
||||
|
||||
|
||||
# Individual-item pipeline stages.
|
||||
# Singleton pipeline stages.
|
||||
|
||||
def read_items(config):
|
||||
"""Reads individual items by recursively descending into a set of
|
||||
|
|
@ -497,8 +497,8 @@ def run_import(**kwargs):
|
|||
config = ImportConfig(**kwargs)
|
||||
|
||||
# Set up the pipeline.
|
||||
if config.items:
|
||||
# Individual item importer.
|
||||
if config.singletons:
|
||||
# Singleton importer.
|
||||
stages = [read_items(config), item_lookup(config), item_query(config)]
|
||||
#TODO non-autotagged
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -283,7 +283,7 @@ def choose_match(task, config):
|
|||
# The import command.
|
||||
|
||||
def import_files(lib, paths, copy, write, autot, logpath, art, threaded,
|
||||
color, delete, quiet, resume, quiet_fallback, items):
|
||||
color, delete, quiet, resume, quiet_fallback, singletons):
|
||||
"""Import the files in the given list of paths, tagging each leaf
|
||||
directory as an album. If copy, then the files are copied into
|
||||
the library folder. If write, then new metadata is written to the
|
||||
|
|
@ -332,7 +332,7 @@ def import_files(lib, paths, copy, write, autot, logpath, art, threaded,
|
|||
autot = autot,
|
||||
choose_match_func = choose_match,
|
||||
should_resume_func = should_resume,
|
||||
items = items,
|
||||
singletons = singletons,
|
||||
)
|
||||
|
||||
# If we were logging, close the file.
|
||||
|
|
@ -369,7 +369,7 @@ import_cmd.parser.add_option('-q', '--quiet', action='store_true',
|
|||
dest='quiet', help="never prompt for input: skip albums instead")
|
||||
import_cmd.parser.add_option('-l', '--log', dest='logpath',
|
||||
help='file to log untaggable albums for later review')
|
||||
import_cmd.parser.add_option('-i', '--items', dest='items',
|
||||
import_cmd.parser.add_option('-s', '--singletons', action='store_true',
|
||||
help='import individual tracks instead of full albums')
|
||||
def import_func(lib, config, opts, args):
|
||||
copy = opts.copy if opts.copy is not None else \
|
||||
|
|
@ -390,7 +390,7 @@ def import_func(lib, config, opts, args):
|
|||
quiet = opts.quiet if opts.quiet is not None else DEFAULT_IMPORT_QUIET
|
||||
quiet_fallback_str = ui.config_val(config, 'beets', 'import_quiet_fallback',
|
||||
DEFAULT_IMPORT_QUIET_FALLBACK)
|
||||
items = opts.items
|
||||
singletons = opts.singletons
|
||||
|
||||
# Resume has three options: yes, no, and "ask" (None).
|
||||
resume = opts.resume if opts.resume is not None else \
|
||||
|
|
@ -408,7 +408,7 @@ def import_func(lib, config, opts, args):
|
|||
else:
|
||||
quiet_fallback = importer.action.SKIP
|
||||
import_files(lib, args, copy, write, autot, opts.logpath, art, threaded,
|
||||
color, delete, quiet, resume, quiet_fallback, items)
|
||||
color, delete, quiet, resume, quiet_fallback, singletons)
|
||||
import_cmd.func = import_func
|
||||
default_commands.append(import_cmd)
|
||||
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ def iconfig(lib, **kwargs):
|
|||
should_resume_func = lambda _: False,
|
||||
threaded = False,
|
||||
autot = True,
|
||||
items = False,
|
||||
singletons = False,
|
||||
)
|
||||
for k, v in kwargs.items():
|
||||
setattr(config, k, v)
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ class NonAutotaggedImportTest(unittest.TestCase):
|
|||
quiet_fallback='skip',
|
||||
choose_match_func = None,
|
||||
should_resume_func = None,
|
||||
items=False,
|
||||
singletons=False,
|
||||
)
|
||||
|
||||
return paths
|
||||
|
|
|
|||
Loading…
Reference in a new issue