Commits

Adrian Sampson committed 3749dd1

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

Comments (0)

Files changed (5)

beets/config_default.yaml

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

beets/importer.py

             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)

beets/ui/commands.py

     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)
 

docs/changelog.rst

   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:
 

docs/reference/cli.rst

   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