Bookmarklet for bulk-editing track titles

Just in case it’s useful to other editors, I’ve been using this bookmarklet to bulk-edit track titles from the tracklist tab in the release editor, usually when I need to fix a bunch of ETI:

javascript:(()=>{const t=document.querySelectorAll("input.track-name");if(!t.length){alert("No track inputs found");return}const n=prompt("Track title regexp");if(n===null)return;const r=prompt("Replacement");if(r===null)return;const c=new RegExp(n);for(const e of[...t]){const o=e.value.replace(c,r);o!==e.value&&(e.value=o,e.dispatchEvent(new Event("change")))}})();

(Non-minified version is at https://codeberg.org/derat/mb-bookmarklets/src/branch/main/rename_tracks.js.)

It prompts for a regular expression to search for in each track title and then for a replacement pattern.

It can be handy for correcting non-parenthesized ETI. For this edit, I entered - ([^-]+)$ in the first prompt (to match space-dash-space-ETI at the ends of titles, capturing the ETI part) and ($1) in the second prompt (to replace with a space and then the original ETI in parentheses).

I’ve also used it to quickly remove repetitive ETI from the ends of track titles in live releases. For this edit, I entered - Live 1995$ in the first prompt (to match that string at the ends of titles) and then left the second prompt blank (to replace with nothing).

4 Likes

Hah, I’ve been doing something similar, but using the track parser and Notepad++ to mass fix titles with bad ETI (particularly from spotify)
Lately though the track parser isn’t splitting artists correctly, and I don’t know if it’s something i’m doing or if it’s a MB bug. I’ll be checking out your script and try and learn how to write my own version as well :smiley: