rename -i flag to -s ("singletons") and fix behavior

This commit is contained in:
Adrian Sampson 2011-04-12 23:31:44 -07:00
parent 12854ad2ff
commit 45eef6e876
4 changed files with 11 additions and 11 deletions

View file

@ -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:

View file

@ -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)

View file

@ -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)

View file

@ -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