I want to insert %originalyear% into album title tag

Tags: #<Tag:0x00007fd2a64b8428>

I thought it would be as easy as this:

%originalyear% $if($gt(%totaldiscs%,1),$if(%discnumber%,$set(album,%album% (Disc %discnumber%))))

I am missing something. I am new at this be gentle.
For sorting purpose it needs to be in front.

Almost. You need to escape the parentheses around “Disc %discnumber%”. See the note under Syntax in the manual for more information.

Also, if it were me, I would replace your %originalyear% with $if2(%originalyear%,0000) which will insert “0000” if the %originalyear% tag is blank (which can and does happen if there is no release event with a date in the release group).

2 Likes

Is this for file naming script or for actually changing the tag? To change the tag you’ll need e.g.

$if(%originalyear%,$set(album,%originalyear% %album%))

Or to go with Rd swift’s suggestion to set it to 0000 if empty:

$set(album,$if2(%originalyear% ,0000 )%album%)
2 Likes

Good question. I was too focused on the code snippet and completely missed the context.

1 Like

This is a tagger script, my idea for naming did work, easy. The field will not be blank because I will look it up and make it happen. I don’t want to do anything to the rest of the script, it works.
I will try these suggestions.
thank you

This is a tagging script.

TY outsidecontext the entire script works.

$if(%originalyear%,$set(album,%originalyear%%album%))$if($gt(%totaldiscs%,1),$if(%discnumber%,$set(album,%album% (Disc %discnumber%))))

The purpose for this is that media player will not sort by artist then year it is one or the other. I may someday want to see everything done in one year but not today.
Having the year in the album title just works.
I wish I had thought about this a long time ago, I have a lot of work to do.
Thank You

NOTE to anyone that might copy and past that code the back slashes are not showing up at the end enter backslash here(Disc %discnumber%here))))

1 Like

NOTE to anyone that might copy and past that code the back slashes are not showing up at the end enter backslash here(Disc %discnumber%here))))

To get the backslashes to appear, you either have to escape them (double backslash) or include the line in a code block (preformatted text).