import single files and one-track albums

An alternate proposal for what's being discussed in #640.
This commit is contained in:
Adrian Sampson 2014-04-02 17:14:48 -07:00
parent 100b3d4d65
commit c9141a6adf
3 changed files with 9 additions and 9 deletions

View file

@ -563,8 +563,7 @@ def read_tasks(session):
for toppath in session.paths:
# Check whether the path is to a file.
if config['import']['singletons'] and \
not os.path.isdir(syspath(toppath)):
if not os.path.isdir(syspath(toppath)):
try:
item = library.Item.from_path(toppath)
except mediafile.UnreadableFileError:
@ -572,7 +571,10 @@ def read_tasks(session):
util.displayable_path(toppath)
))
continue
yield ImportTask.item_task(item)
if config['import']['singletons']:
yield ImportTask.item_task(item)
else:
yield ImportTask(toppath, [toppath], [item])
continue
# A flat album import merges all items into one album.

View file

@ -746,12 +746,8 @@ def import_files(lib, paths, query):
"""
# Check the user-specified directories.
for path in paths:
fullpath = syspath(normpath(path))
if not config['import']['singletons'] and not os.path.isdir(fullpath):
raise ui.UserError(u'not a directory: {0}'.format(
displayable_path(path)))
elif config['import']['singletons'] and not os.path.exists(fullpath):
raise ui.UserError(u'no such file: {0}'.format(
if not os.path.exists(syspath(normpath(path))):
raise ui.UserError(u'no such file or directory: {0}'.format(
displayable_path(path)))
# Check parameter consistency.

View file

@ -36,6 +36,8 @@ New stuff:
example: ``beet modify artist:beatles oldies!`` deletes the ``oldies``
flexible attribute from the database, for the matching items. Thanks to
brilnius.
* The :ref:`import-cmd` command can now accept individual files as arguments
even in non-singleton mode. Files are imported as one-track albums.
Fixes: