add --flat option to import command (GC-202)

This commit is contained in:
Adrian Sampson 2013-02-26 20:59:52 -08:00
parent 706c4fb7f6
commit f268aae17f
5 changed files with 21 additions and 0 deletions

View file

@ -18,6 +18,7 @@ import:
default_action: apply
languages: []
detail: no
flat: no
clutter: ["Thumbs.DB", ".DS_Store"]
ignore: [".*", "*~", "System Volume Information"]

View file

@ -564,6 +564,15 @@ def read_tasks(session):
yield ImportTask.item_task(item)
continue
# A flat album import merges all items into one album.
if config['import']['flat'] and not config['import']['singletons']:
all_items = []
for _, items in autotag.albums_in_dir(toppath):
all_items += items
yield ImportTask(toppath, toppath, all_items)
yield ImportTask.done_sentinel(toppath)
continue
# Produce paths under this directory.
if _resume():
resume_dir = resume_dirs.get(toppath)

View file

@ -713,6 +713,8 @@ import_cmd.parser.add_option('-i', '--incremental', dest='incremental',
action='store_true', help='skip already-imported directories')
import_cmd.parser.add_option('-I', '--noincremental', dest='incremental',
action='store_false', help='do not skip already-imported directories')
import_cmd.parser.add_option('--flat', dest='flat',
action='store_true', help='import an entire tree as a single album')
def import_func(lib, opts, args):
config['import'].set_args(opts)

View file

@ -12,6 +12,9 @@ New configuration options:
Sam Doshi.
* :ref:`detail` enables a mode where all tracks are listed in the importer UI,
as opposed to only changed tracks.
* The ``--flat`` option to the ``beet import`` command treats an entire
directory tree of music files as a single album. This can help in situations
where a multi-disc album is split across multiple directories.
Other stuff:

View file

@ -93,6 +93,12 @@ right now; this is something we need to work on. Read the
instead want to import individual, non-album tracks, use the *singleton*
mode by supplying the ``-s`` option.
* If you have an album that's split across several directories under a common
top directory, use the ``--flat`` option. This takes all the music files
under the directory (recursively) and treats them as a single large album
instead of as one album per directory. This can help with your more stubborn
multi-disc albums.
.. only:: html
Reimporting