$noop(Remove Unicode lookalikes)

$setmulti(_unicode_src,０; １; ２; ３; ４; ５; ６; ７; ８; ９; ◌; ‘; ’; ‚; ‛; “; ”; „; ‟; ‐; ‑; –; —; ‒; ―; ․; ‥; …; ‼; ⁇; ⁄; ∕; ／; 〜; ～; （; ［; ＜; ）; ］; ＞; ？; ！; ：)
$setmulti(_unicode_dst,0; 1; 2; 3; 4; 5; 6; 7; 8; 9;  ; '; '; \,; '; "; "; "; "; -; -; -; -; -; -; .; ..; ...; !!; ??; /; /;  / ; ~; ~;  \(;  [; <; \) ; ] ; >; ? ; ! ; :)

$foreach(artist; albumartist; title; album; composer; discsubtitle,
	$set(_tag,%_loop_value%)
	$foreach(%_unicode_src%,
		$set(_search,%_loop_value%)
		$set(_replace,$getmulti(%_unicode_dst%,$add(%_loop_count%,-1)))
		$set(%_tag%,$replace($get(%_tag%),%_search%,%_replace%))
		$set(%_tag%,$trim($rreplace($get(%_tag%), +, )))
	)
)

$noop(Consistent spacing for CV credits)

$foreach(artist; albumartist,
	$set(%_loop_value%,$rreplace($get(%_loop_value%),\(?i\) *\\\( *CV[.:：]? *, \(CV: ))
)

$noop(Format MusicBrainz enums for display)

$setmulti(releasetype,$title($replace(%releasetype%,ep,EP)))

$noop(Remove unwanted MusicBrainz tags)

$delete(musicbrainz_originalartistid)
$delete(musicbrainz_originalalbumid)
$delete(musicbrainz_discid)
$delete(musicbrainz_workid)

$noop(Prefer BARCODE tag over UPC tag)

$if(%upc%,$set(barcode,%upc%))
$delete(upc)

$noop(Ignore [none] barcode)

$replacemulti(%barcode%,[none],)
$cleanmulti(barcode)

$noop(Ignore [none] catalog number)

$replacemulti(%catalognumber%,[none],)
$cleanmulti(catalognumber)

$noop(Ignore catalog number for Digital Media)

$if($eq_any(%media%,Digital Media),$delete(catalognumber))

$noop(Ignore soundtrack type on non-album releases)

$if($in(%releasetype%,Album),,
	$replacemulti(%releasetype%,Soundtrack,)
	$cleanmulti(releasetype)
)

$noop(Keep only essential tags)

$keep(encoder,artist,title,album,albumartist,composer,releasetype,date,tracknumber,discnumber,discsubtitle,totaldiscs,totaltracks,isrc,barcode,catalognumber,media,source,url)
