From 45eef6e876d55b0d3004b91a5cab72d1365ed6f9 Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Tue, 12 Apr 2011 23:31:44 -0700 Subject: [PATCH] rename -i flag to -s ("singletons") and fix behavior --- beets/importer.py | 8 ++++---- beets/ui/commands.py | 10 +++++----- test/_common.py | 2 +- test/test_importer.py | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/beets/importer.py b/beets/importer.py index ef8c45f85..6ddcb183e 100644 --- a/beets/importer.py +++ b/beets/importer.py @@ -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: diff --git a/beets/ui/commands.py b/beets/ui/commands.py index 47c96abf7..eabbf5fde 100755 --- a/beets/ui/commands.py +++ b/beets/ui/commands.py @@ -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) diff --git a/test/_common.py b/test/_common.py index 8d0ed6cba..3033b3300 100644 --- a/test/_common.py +++ b/test/_common.py @@ -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) diff --git a/test/test_importer.py b/test/test_importer.py index 5be15e5bc..a0b226581 100644 --- a/test/test_importer.py +++ b/test/test_importer.py @@ -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