Adrian Sampson committed 3749dd1

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

Comments (0)

Files changed (5)


     default_action: apply
     languages: []
     detail: no
+    flat: no
 clutter: ["Thumbs.DB", ".DS_Store"]
 ignore: [".*", "*~", "System Volume Information"]


             yield ImportTask.item_task(item)
+        # 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)


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


   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:


   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