Remove media tags (like [sound:rec123.mp3]) automatically when media is deleted in Finder

Related to my other post Recordings are not stored after quitting Anki + how to play recordings outside Anki (solved)

I want to delete media inside collection.media folder using Finder etc. I then want to remove [sound:rec123.mp3] tags from notes that contained the deleted media. This can be heavy operation so it cannot be triggered automatically when opening Anki etc.

I propose that Check media dialog could offer button to perform tags removal in cards if desired.

Audio is always automatically played when studying a card. That way the user can know if the media was deleted (if system audio isn’t muted). It’s also possible to hide audio play buttons in the settings. The problem is that when system audio is muted or not very loud and play buttons are disabled, the user cannot know if cards contain audio or not (only by viewing the card).

Anki expects you to do it in the reverse order - removing the sounds from certain cards (or deleting the cards), and then using Check Media to automatically clean up the unused files.