mirror of
https://github.com/beetbox/beets.git
synced 2025-12-06 08:39:17 +01:00
bugfix: ignore subdirectories of ignored
directories in unimported plugin
This commit is contained in:
parent
b09806e0df
commit
c88953805b
1 changed files with 11 additions and 9 deletions
|
|
@ -41,15 +41,17 @@ class Unimported(BeetsPlugin):
|
|||
os.path.join(lib.directory, x.encode())
|
||||
for x in self.config["ignore_subdirectories"].as_str_seq()
|
||||
]
|
||||
in_folder = {
|
||||
os.path.join(r, file)
|
||||
for r, d, f in os.walk(lib.directory)
|
||||
for file in f
|
||||
if not any(
|
||||
[file.endswith(ext) for ext in ignore_exts]
|
||||
+ [r in ignore_dirs]
|
||||
)
|
||||
}
|
||||
in_folder = set()
|
||||
for root, _, files in os.walk(lib.directory):
|
||||
# do not traverse if root is a child of an ignored directory
|
||||
if any(root.startswith(ignored) for ignored in ignore_dirs):
|
||||
continue
|
||||
for file in files:
|
||||
# ignore files with ignored extensions
|
||||
if any(file.endswith(ext) for ext in ignore_exts):
|
||||
continue
|
||||
in_folder.add(os.path.join(root, file))
|
||||
|
||||
in_library = {x.path for x in lib.items()}
|
||||
art_files = {x.artpath for x in lib.albums()}
|
||||
for f in in_folder - in_library - art_files:
|
||||
|
|
|
|||
Loading…
Reference in a new issue