Analogous to fromfilename but adding the option to configure regex patterns to filter results more precisely.
Directly inject from this repository:
pipx inject beets git+https://github.com/whatphilipcodes/fromregs
Then add the plugin to your config:
plugins: fromregs [...]
The following config replicates the default settings:
fromregs:
custom_matchlist:
[
'^(?P<artist>.+)[\-_](?P<title>.+)[\-_](?P<tag>.*)$',
'^(?P<track>\d+)[\s.\-_]+(?P<artist>.+)[\-_](?P<title>.+)[\-_](?P<tag>.*)$',
'^(?P<artist>.+)[\-_](?P<title>.+)$',
'^(?P<track>\d+)[\s.\-_]+(?P<artist>.+)[\-_](?P<title>.+)$',
'^(?P<track>\d+)[\s.\-_]+(?P<title>.+)$',
'^(?P<track>\d+)\s+(?P<title>.+)$',
"^(?P<title>.+) by (?P<artist>.+)$",
'^(?P<track>\d+).*$',
"^(?P<title>.+)$",
]
bad_title_matchlist: ["^$"]
artist_post_sub: ['\s{2,}']
title_post_sub: ['\[.*?\]', '\s{2,}']
final_strip: yes
fill_album_from_title: no,
limit_tracknumber: 25,
If you are trying to come up with your own regex patterns this plugin delivers more detailed logs when running verbose at level 2:
beet -vv import path/to/track(s)
custom matchlist
Works via the capture groups <artist>
(album or track artist), <track>
(track number) and <title>
(album or track title). The <tag>
capture group is only used when importing more than one track as an album. This field cannot be an emtpy list!
bad_title_matchlist
Used to determine if a track is processed (matches the list) or is skipped entirely. This field cannot be an emtpy list!
artist_post_sub
Removes parts of the artist result that match with this list as a post-processing step.
title_post_sub
Removes parts of the title result that match with this list as a post-processing step.
final_strip
If true, removes excess white space on all results individually as the last step before applying the results.
fill_album_from_title
Uses the title as album, if that matches your search strategy.
limit_tracknumber
Threshold to decide wether a number should be treated as a track or only used for album, artist and title names.