diff --git a/beets/autotag/__init__.py b/beets/autotag/__init__.py index 73c228d8c..7bf2fa88d 100644 --- a/beets/autotag/__init__.py +++ b/beets/autotag/__init__.py @@ -38,17 +38,17 @@ MULTIDISC_PAT_FMT = r'%s\s*\d' # Additional utilities for the main interface. -def albums_in_dir(path, ignore=()): +def albums_in_dir(path): """Recursively searches the given directory and returns an iterable of (path, items) where path is a containing directory and items is a list of Items that is probably an album. Specifically, any folder - containing any media files is an album. Directories and file names - that match the glob patterns in ``ignore`` are skipped. + containing any media files is an album. """ collapse_root = None collapse_items = None - for root, dirs, files in sorted_walk(path, ignore): + for root, dirs, files in sorted_walk(path, + ignore=config['ignore'].get(list)): # Get a list of items in the directory. items = [] for filename in files: diff --git a/beets/importer.py b/beets/importer.py index 2d8a9e838..248f05c89 100644 --- a/beets/importer.py +++ b/beets/importer.py @@ -261,6 +261,8 @@ class ImportSession(object): """ self.lib = lib self.logfile = logfile + self.paths = paths + self.query = query def tag_log(self, status, path): """Log a message about a given album to logfile. The status should @@ -307,7 +309,7 @@ class ImportSession(object): """Run the import task. """ # Set up the pipeline. - if config.query is None: + if self.query is None: stages = [read_tasks(self)] else: stages = [query_tasks(self)] @@ -561,7 +563,7 @@ def read_tasks(session): # Produce paths under this directory. if progress: resume_dir = resume_dirs.get(toppath) - for path, items in autotag.albums_in_dir(toppath, config.ignore): + for path, items in autotag.albums_in_dir(toppath): # Skip according to progress. if progress and resume_dir: # We're fast-forwarding to resume a previous tagging. diff --git a/beets/ui/commands.py b/beets/ui/commands.py index 069c4b7e1..d72dcb900 100644 --- a/beets/ui/commands.py +++ b/beets/ui/commands.py @@ -599,8 +599,9 @@ class TerminalImportSession(importer.ImportSession): assert False def should_resume(path): - return ui.input_yn("Import of the directory:\n%s" - "\nwas interrupted. Resume (Y/n)?" % path) + return ui.input_yn(u"Import of the directory:\n{0}\n" + "was interrupted. Resume (Y/n)?" + .format(displayable_path(path))) # The import command. @@ -697,6 +698,8 @@ def import_func(lib, opts, args): else: query = None paths = args + if not paths: + raise ui.UserError('no path specified') import_files(lib, paths, query) import_cmd.func = import_func