Beets: Beet import ignores directories with tilde character

Created on 4 Oct 2020  ·  3Comments  ·  Source: beetbox/beets

On my Ubuntu system, beet import does not recurse into subdirectories containing a tilde ~ character.

Steps to reproduce

$ mkdir 'bar~'
$ touch 'bar~/song.mp3'
$ tree
.
└── bar~
    └── song.mp3

1 directory, 1 file
$ beet import .
No files imported from /home/curtis/test
$ mv 'bar~' bar
$ beet import .
unreadable file: /home/curtis/test/bar/song.mp3
No files imported from /home/curtis/test

Setup

  • OS: Ubuntu 20.04.1 LTS
  • Python version: Python 3.7.8
  • beets version: 1.4.9
  • Turning off plugins made problem go away (yes/no): no

My configuration (output of beet config) is:

{}

Most helpful comment

@sampsyo Ah, thanks! Then in that case, it would have helped me to see that when I ran beet -vv import. Turning on that extra-verbose logging still didn't give any hints as to why such directories were being skipped. What would you think about a patch like:

diff --git a/beets/util/__init__.py b/beets/util/__init__.py
index bb84aedc..7b78cf26 100644
--- a/beets/util/__init__.py
+++ b/beets/util/__init__.py
@@ -197,6 +197,9 @@ def sorted_walk(path, ignore=(), ignore_hidden=False, logger=None):
         skip = False
         for pat in ignore:
             if fnmatch.fnmatch(base, pat):
+                logger.debug(u'ignoring {0} due to ignore rule {1}'.format(
+                    base, pat
+                ))
                 skip = True
                 break
         if skip:

?

All 3 comments

Indeed; *~ is in the default ignore configuration:
https://beets.readthedocs.io/en/stable/reference/config.html#ignore

@sampsyo Ah, thanks! Then in that case, it would have helped me to see that when I ran beet -vv import. Turning on that extra-verbose logging still didn't give any hints as to why such directories were being skipped. What would you think about a patch like:

diff --git a/beets/util/__init__.py b/beets/util/__init__.py
index bb84aedc..7b78cf26 100644
--- a/beets/util/__init__.py
+++ b/beets/util/__init__.py
@@ -197,6 +197,9 @@ def sorted_walk(path, ignore=(), ignore_hidden=False, logger=None):
         skip = False
         for pat in ignore:
             if fnmatch.fnmatch(base, pat):
+                logger.debug(u'ignoring {0} due to ignore rule {1}'.format(
+                    base, pat
+                ))
                 skip = True
                 break
         if skip:

?

Yeah, sounds good!

Was this page helpful?
0 / 5 - 0 ratings