Skip to content

Commit

Permalink
Merge pull request #5160 from Dr-Blank/bug-unimported-failing-to-igno…
Browse files Browse the repository at this point in the history
…re-subdirectories
  • Loading branch information
Serene-Arc authored Apr 14, 2024
2 parents cc941df + 640c961 commit 125f26f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
20 changes: 11 additions & 9 deletions beetsplug/unimported.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,17 @@ def print_unimported(lib, opts, args):
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:
Expand Down
3 changes: 3 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,9 @@ Bug fixes:
* Fix bug where all media types are reported as the first media type when
importing with MusicBrainz as the data source
:bug:`4947`
* Fix bug where unimported plugin would not ignore children directories of
ignored directories.
:bug:`5130`

For plugin developers:

Expand Down

0 comments on commit 125f26f

Please sign in to comment.