fix a few old config references in importer

This commit is contained in:
Adrian Sampson 2012-10-26 20:54:37 -07:00
parent 56a2d41183
commit a50397f2a4
3 changed files with 13 additions and 8 deletions

View file

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

View file

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

View file

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