Repository for neat file name string patterns and tagger script snippets

EDIT: I found a serious misplaced parenthesis error in my script. It was causing soundtracks to become completely messed up. I’ve replaced it below with my corrected version.

I rewrote my script to make it a little more compact. I used to have a lot of repeated code, but now I pulled the common code out of the $if statements and consolidated it.

I also added a feature I just discovered to clean up my folder names. I added some scripts to set control variables and then my naming script adds some disambiguating elements to file names only where necessary.

I have a couple versions of the same release, and I was using release comments to keep them in separate folders. The unfortunate side effect of this was presence of release comments on releases where I didn’t need them. Now I can designate only certain releases to add the release comment to the folder name, while all the rest are unaffected. Since variables are written to the files as tags, I only have to designate the release once, and it will always use the alternate naming script.

In this test, you can see the AKB48 single has it’s release comments (Type-A, Type-B) in the folder name, while the Rush album doesn’t. Kate Bush’s Cloudbusting single now has it’s media type in the folder name, but none of the other albums do.

In the Scripting tag, I added the following lines, each in it’s own script:

$set(usereleasecomment,1)
$set(usemediatype,1)
$delete(usereleasecomment)
$delete(usemediatype)

I also have a common script that’s set to run automatically.

$if($gt(%_totalalbumtracks%,99),$set(tracknumber,$num(%tracknumber%,3)),$set(tracknumber,$num(%tracknumber%,2)))

My full naming script is:

$replace(
$replace(
$replace(
$replace(
$replace(
$replace(
$if($in(%releasetype%,soundtrack),
	$noop(Soundtracks)
	Soundtrack/~
	$left($swapprefix(%album%,A,An,The),1)~/$swapprefix(%album%,A,An,The),
		$if(%compilation%,
		$noop(Various artist albums)
		Various Artists/~
		$left($swapprefix(%album%,A,An,The),1)~/$swapprefix(%album%,A,An,The),
		$noop(Normal albums)
		~$left($if2(%albumartistsort%,%artistsort%,%albumartist%,%artist%),1)~/
		$if2(%albumartistsort%,%artistsort%,%albumartist%,%artist%)/%album%))
	$noop(Common path)
	$if(%usereleasecomment%,$if(%_releasecomment%, \(%_releasecomment%\)))
	$if(%usemediatype%,$if(%media%, \(%media%\)))
	$if($in(%releasetype%,single), \(Single\))
	$if($in(%releasetype%,ep), \(EP\))/
	$if($gt(%totaldiscs%,1),%discnumber%)
	$if($gt(%_totalalbumtracks%,99),$num(%tracknumber%,3),$num(%tracknumber%,2)) - %artist% - %title%
,*,[x])
,?,)
,:,-)
,",')
,<,{)
,>,})
4 Likes