mirror of
https://github.com/beetbox/beets.git
synced 2026-01-04 15:03:22 +01:00
Merge pull request #2494 from antlarr/fix-importer-multicd
Fix import of multidisc releases with subdirectories
This commit is contained in:
commit
f62c9a6cc5
2 changed files with 11 additions and 1 deletions
|
|
@ -1469,6 +1469,14 @@ MULTIDISC_MARKERS = (br'dis[ck]', br'cd')
|
|||
MULTIDISC_PAT_FMT = br'^(.*%s[\W_]*)\d'
|
||||
|
||||
|
||||
def is_subdir_of_any_in_list(path, dirs):
|
||||
"""Returns True if path os a subdirectory of any directory in dirs
|
||||
(a list). In other case, returns False.
|
||||
"""
|
||||
ancestors = ancestry(path)
|
||||
return any(d in ancestors for d in dirs)
|
||||
|
||||
|
||||
def albums_in_dir(path):
|
||||
"""Recursively searches the given directory and returns an iterable
|
||||
of (paths, items) where paths is a list of directories and items is
|
||||
|
|
@ -1488,7 +1496,7 @@ def albums_in_dir(path):
|
|||
# and add the current directory. If so, just add the directory
|
||||
# and move on to the next directory. If not, stop collapsing.
|
||||
if collapse_paths:
|
||||
if (not collapse_pat and collapse_paths[0] in ancestry(root)) or \
|
||||
if (is_subdir_of_any_in_list(root, collapse_paths)) or \
|
||||
(collapse_pat and
|
||||
collapse_pat.match(os.path.basename(root))):
|
||||
# Still collapsing.
|
||||
|
|
|
|||
|
|
@ -79,6 +79,8 @@ Fixes:
|
|||
limited encoding.
|
||||
* :doc:`/plugins/convert`: The default configuration uses FFmpeg's built-in
|
||||
AAC codec instead of faac. Thanks to :user:`jansol`. :bug:`2484`
|
||||
* Fix import of multidisc releases with subdirectories, which previously
|
||||
made each disc be imported separately in different releases. :bug:`2493`
|
||||
|
||||
|
||||
1.4.3 (January 9, 2017)
|
||||
|
|
|
|||
Loading…
Reference in a new issue