How to bypass/skip directories?

Is there a way to direct beets to ignore certain directories on the drive where I keep the music files where I am running it? For right now, the version of my config file (below) is specifying only one of tens of directories (one level up, relatively) just for testing and learning purposes.

But even in the path mentioned below, I have a mixture of FLAC files and Audacity projects. So you know, I’m going to have gazillions of *.au files for beets to waste its time on.

Or do I need to reorganize the drive for beets’ sake?
TIA

directory: /media/mark/LP_MUSIC/Music
library: ~/data/musiclibrary.db

import:
copy: no
write: no

Beets only operates on audio files, so it should leave your *.au files alone. You can test it out.

How about if I hadn’t mentioned them at all? They’re only one kind of non-audio file that beets seems to waste time having to even process.
For further example, I also have (on this removable drive) an entire Backup folder of other assorted files from my Macbook. LOTS of assorted file types, extensions. First time I tried to run beets, I could see how much time it was spending reviewing completely avoidable folders.

How to tell beets to disregard them? Or, do I just reorganize the whole file structure of the drive?
Is there a way to tell beets to avoid directories ending in *data/ ?
Or hidden directories? Or $RECYCLE.BIN?

OR…
If I just change the config.yaml file for each specific root level directory, does the musiclibrary.db file get overwritten each time, or is there a way to append to the database file each time?

Is the answer here?: https://beets.readthedocs.io/en/v1.4.5/reference/config.html#ignore

Not real clear on the syntax of using it, though, as beets is my first exposure to yaml.

Yes this is the answer :slight_smile:

For the syntax I suggest you copy over the defaults from beets/config_default.yaml at master · beetbox/beets · GitHub and adapt/extend for your needs.

A better human readable syntax for lists in yaml is the one with leading dashes:

ignore:
  - first entry
  - second entry

You can even leave out the quotes around it, yaml should be smart enough to know that it’s strings with whitespace.

HTH

Ah and yeah, to spit out your current config just issue: beet config --defaults, even better than looking up config_default.yaml in the repo :wink:

I still can’t figure out what I’m doing wrong. The relevant part of my current config.yaml file looks like this:


directory: /media/mark/LP_MUSIC/
ignore: [“2013*, “$RECYCLE.BIN”,“Backup”]
#ignore: [”/media/mark/LP_MUSIC/$RECYCLE.BIN//*"]
#ignore "/media/mark/LP_Music/Backup/
/*"
#ignore “/media/mark/LP_MUSIC//*data/

library: ~/data/musiclibrary.db

The error messages say:
configuration error: /home/mark/.config/beets/config.yaml could not be read: while parsing a flow sequence
in “/home/mark/.config/beets/config.yaml”, line 2, column 9
expected ‘,’ or ‘]’, but got ‘’
in “/home/mark/.config/beets/config.yaml”, line 2, column 19"

The directories I’m trying to get bypassed are 2013Macbook.backup, $RECYCLE.BIN, Backup, and a couple of others, but I’ve been aborting before the others even became an issue.
I figure if I can get a clue about the proper syntax, I should be able to figure out the rest.
Anybody?

@baudoinia Hi can you put your config and code output into code boxes? I’m unable to read it properly (some characters are interpreted as markdown, it looks messy…). At the moment, there is no chance of analysing it for me, sorry.

Other than that: We’ll figure your actual problem out, I’m sure :slight_smile:

I’m sorry, I don’t know how to use code boxes. Can I upload cropped screenshots instead?
Screenshot_gvim_beets-config

and the output is thus:
Screenshot_2023-03-18_15-52-13

1 Like

I’ve decided to just go ahead and hide the directories I want ignored, then I can use the ‘ignore’ statement right out the example you gave.

I’ll still have directories which have mixed actual flac and ogg files, along with some Audacity projects. So I’ll still want to know how to tell beets to ignore directories ending in *_data, and *.aup files.

I can see your error now: After 2013 you have * instead of " (doublequote)

If * should be part of the pattern, just close with doublequote afterwards.

And yes using yaml dash syntax is easier. do it that way

just state it using the dash syntax you already learned :slight_smile:

ignore:
    - *.aup
    - ...
1 Like

Code boxes are called “preformatted text” in the toolbar while editing

find the buttom most right hidden under the gear symbol

basically discourse understands markdown syntax which you could even type in manually (triple backticks for codebox)

1 Like

Well I’ve got it functioning again, at least, but it’s still giving me output about files that are located under a directory that I marked as hidden, and told beets to ignore. But it doesn’t want to ignore! I would think if you marked a directory with an initial period, that all subdirectories of it should be likewise ignored, right?

library: ~/data/musiclibrary.db
directory: /media/mark/LP_MUSIC/
ignore_hidden: yes
ignore:
   - ".*"
   - "*~"
   - "*.aup"
   - "*_data/**"

But I keep seeing for example: "`could not get filesize: [Errno 2] No such file or directory: b'/media/mark/LP_MUSIC/2013Macbook.backup/Library/Mobile Documents/com~apple~CloudDocs/ \xd0\xb2\xd0\xbe\xd0\xb7\xd0\xb2\xd1\x80\xd0\xb0\xd1\x89\xd0\xb0\xd0\xb9\xd1\x81\xd1\x8f.ogg'
could not get filesize: [Errno 2] No such file or directory: b'/media/mark/LP_MUSIC/2013Macbook.backup/Library/Mobile Documents/com~apple~CloudDocs/ \xd0\xbf\xd1\x80\xd0\xb5\xd0\xb4\xd0\xbe\xd1\x81\xd1\x82\xd0\xb5\xd1\x80\xd0\xb5\xd0\xb6\xd0\xb5\xd0\xbd\xd0\xb0.ogg'

etc. etc.
ALL of these files are in subdirectories of .2013Macbook.backup.
(and what does the b’ mean before the path?

And to prove that .2013Macbook.backup is a hidden directory, here’s a screenshot of the file mgr. Thunar:

Interesting. Please also post your error message in a “preformatted textbox” I’d like to make sure what I see is correct:

The error message does not seem to have a leading dot for the directory 2013Macbook.backup, thus is not hidden. Let’s clarify that as a next step.

Also I will check what this hidden feature acutally does, I’d need to check the code, I’ve no idea what this is supposed to do except what is documented. I do suppose that it works as designed and documented though :slight_smile:

Another idea: Is it correctly being ignored when you actually state the full path of that directory?

ignore:
   - ".2013Macbook.backup"

Stating the full path of the directory seems to do the trick.

I too noted that the error message did not reflect the leading dot.
I confirmed that bash treated the directory as hidden (compare the output of the 2 ‘ls’ commands at the top of the window)

Oops, spoke too soon.

<pre>could not get filesize: [Errno 2] No such file or directory: b&apos;/media/mark/LP_MUSIC/2013Macbook.backup/Downloads/Tales_From_Zaikina_mp3/073.mp3&apos;
could not get filesize: [Errno 2] No such file or directory: b&apos;/media/mark/LP_MUSIC/2013Macbook.backup/Downloads/Tales_From_Zaikina_mp3/074.mp3&apos;
could not get filesize: [Errno 2] No such file or directory: b&apos;/media/mark/LP_MUSIC/2013Macbook.backup/Downloads/Tales_From_Zaikina_mp3/075.mp3&apos;
could not get filesize: [Errno 2] No such file or directory: b&apos;/media/mark/LP_MUSIC/2013Macbook.backup/Downloads/Tales_From_Zaikina_mp3/076.mp3&apos;
could not get filesize: [Errno 2] No such file or directory: b&apos;/media/mark/LP_MUSIC/2013Macbook.backup/Downloads/Tales_From_Zaikina_mp3/077.mp3&apos;
could not get filesize: [Errno 2] No such file or directory: b&apos;/media/mark/LP_MUSIC/2013Macbook.backup/Downloads/Tales_From_Zaikina_mp3/078.mp3&apos;
could not get filesize: [Errno 2] No such file or directory: b&apos;/media/mark/LP_MUSIC/2013Macbook.backup/Downloads/Tales_From_Zaikina_mp3/079.mp3&apos;
could not get filesize: [Errno 2] No such file or directory: b&apos;/media/mark/LP_MUSIC/2013Macbook.backup/Downloads/Tales_From_Zaikina_mp3/080.mp3&apos;
could not get filesize: [Errno 2] No such file or directory: b&apos;/media/mark/LP_MUSIC/2013Macbook.backup/Downloads/Tales_From_Zaikina_mp3/081.mp3&apos;
could not get filesize: [Errno 2] No such file or directory: b&apos;/media/mark/LP_MUSIC/2013Macbook.backup/Downloads/Tales_From_Zaikina_mp3/082.mp3&apos;
could not get filesize: [Errno 2] No such file or directory: b&apos;/media/mark/LP_MUSIC/2013Macbook.backup/Downloads/Tales_From_Zaikina_mp3/083.mp3&apos;
could not get filesize: [Errno 2] No such file or directory: b&apos;/media/mark/LP_MUSIC/2013Macbook.backup/Downloads/Tales_From_Zaikina_mp3/084.mp3&apos;
could not get filesize: [Errno 2] No such file or directory: b&apos;/media/mark/LP_MUSIC/2013Macbook.backup/Downloads/Tales_From_Zaikina_mp3/085.mp3&apos;
could not get filesize: [Errno 2] No such file or directory: b&apos;/media/mark/LP_MUSIC/2013Macbook.backup/Downloads/Tales_From_Zaikina_mp3/086.mp3&apos;
could not get filesize: [Errno 2] No such file or directory: b&apos;/media/mark/LP_MUSIC/2013Macbook.backup/Downloads/Tales_From_Zaikina_mp3/087.mp3&apos;
could not get filesize: [Errno 2] No such file or directory: b&apos;/media/mark/LP_MUSIC/2013Macbook.backup/Downloads/Tales_From_Zaikina_mp3/088.mp3&apos;
could not get filesize: [Errno 2] No such file or directory: b&apos;/media/mark/LP_MUSIC/2013Macbook.backup/Downloads/Tales_From_Zaikina_mp3/089.mp3&apos;
could not get filesize: [Errno 2] No such file or directory: b&apos;/media/mark/LP_MUSIC/2013Macbook.backup/Downloads/Tales_From_Zaikina_mp3/090.mp3&apos;
</pre>

You have some weird html code int this log. can’t read. :slight_smile:

Another trial and error idea: Try using single quotes instead of the doublequotes.

All of that was just the beets output which indicated that I predicted too soon that the directory ‘.2013Macbook.backup’ was being successfully ignored.
It was just iterations of the statement that the file sizes of X many mp3 files in that directory could not be determined because ‘No such file or directory.’

(I appreciate that you’ve stuck with me this long! :smile: )

1 Like