mirror of
https://github.com/beetbox/beets.git
synced 2025-12-24 17:43:52 +01:00
This utilises regex substitution in the substitute plugin. The previous approach only used regex to match the pattern, then replaced it with a static string. This change allows more complex substitutions, where the output depends on the input. ### Example use case Say we want to keep only the first artist of a multi-artist credit, as in the following list: ``` Neil Young & Crazy Horse -> Neil Young Michael Hurley, The Holy Modal Rounders, Jeffrey Frederick & The Clamtones -> Michael Hurley James Yorkston and the Athletes -> James Yorkston ```` This would previously have required three separate rules, one for each resulting artist. By using a regex substitution, we can get the desired behaviour in a single rule: ```yaml substitute: ^(.*?)(,| &| and).*: \1 ``` (Capture the text until the first `,` ` &` or ` and`, then use that capture group as the output) ### Notes I've kept the previous behaviour of only applying the first matching rule, but I'm not 100% sure it's the ideal approach. I can imagine both cases where you want to apply several rules in sequence and cases where you want to stop after the first match. |
||
|---|---|---|
| .. | ||
| __init__.py | ||
| lyrics_download_samples.py | ||
| test_acousticbrainz.py | ||
| test_advancedrewrite.py | ||
| test_albumtypes.py | ||
| test_art.py | ||
| test_aura.py | ||
| test_autobpm.py | ||
| test_bareasc.py | ||
| test_beatport.py | ||
| test_bucket.py | ||
| test_convert.py | ||
| test_discogs.py | ||
| test_edit.py | ||
| test_embedart.py | ||
| test_embyupdate.py | ||
| test_export.py | ||
| test_fetchart.py | ||
| test_filefilter.py | ||
| test_ftintitle.py | ||
| test_hook.py | ||
| test_ihate.py | ||
| test_importadded.py | ||
| test_importfeeds.py | ||
| test_info.py | ||
| test_ipfs.py | ||
| test_keyfinder.py | ||
| test_lastgenre.py | ||
| test_limit.py | ||
| test_lyrics.py | ||
| test_mbsubmit.py | ||
| test_mbsync.py | ||
| test_mpdstats.py | ||
| test_parentwork.py | ||
| test_permissions.py | ||
| test_play.py | ||
| test_player.py | ||
| test_playlist.py | ||
| test_plexupdate.py | ||
| test_plugin_mediafield.py | ||
| test_random.py | ||
| test_replaygain.py | ||
| test_smartplaylist.py | ||
| test_spotify.py | ||
| test_subsonicupdate.py | ||
| test_substitute.py | ||
| test_the.py | ||
| test_thumbnails.py | ||
| test_types_plugin.py | ||
| test_web.py | ||
| test_zero.py | ||