Guess values from catalog # to give result %album% [%catalog #]


#1

I need help in creating an action or script which will add to the album field with the contents of the catalog # field.

eg
album: Froggy EP
Catalog #: DEFDIG1110

result
album: Froggy EP [DEFDIG1110]
Catalog #: DEFDIG1110

I have tried using a similar action as below but the album field keeps adding to itself every time I run the action eg
album 1st time: Froggy EP [DEFDIG1110]
album 2nd time: Froggy EP [DEFDIG1110] [DEFDIG1110]

I already have the action to fill the catalog # from the album:

[#0]
T=7
F=%album%
1=%dummy% [%catalog #%]

Here it is in normal format:
Guess values
Source format: %album%
Guessing pattern: %dummy% [%catalog #%]

This fills in the catalog # from the album
eg
album: Froggy EP [DEFDIG1110]
Catalog #: BLANK FIELD

result
album: Froggy EP [DEFDIG1110]
Catalog #: DEFDIG1110

So I would greatly appreciate help with this, Thanks in advance.


#2

You can use an action "Format value" and do not run it twice!
Actiontype 5: Format value
Field: ALBUM
Formatstring: %ALBUM%'÷['%CATALOG÷#%']'
Note: Replace each special ÷ character with one space character.

DD.20110310.2043.CET


#3

thank you for that. But is it possible to do this as a reg exp to allow the action to run multiple times without adding to the album over and over again.

mainly beacuse I want to run this through my entire 10k library and some fields have the catalog # and some album fields have the format %album% [%catalog #] only.

Thanks DetlevD


#4

You describe a case of misuse.
You can apply the Mp3tag Filter to prevent those accidents.
Keep in mind, that files, which are not in view, will not be touched, so the run time will be faster.

DD.20110312.1606.CET


#5

okay. Thanks again. I will use ur action but ill try to see if I could place this action inside the same one if the action is run twice that it deletes the 2nd closed brackets.
eg.
%album% [%catalog #%] [%catalog #%]
result
%album% [%catalog #%]

it would be a dirty fix but could just do the trick :slight_smile:
any suggestions. Thanks


#6

Actiontype 5: Format value
Field: ALBUM
Formatstring: $if($eql($right(%ALBUM%,$len('÷['%CATALOG÷#%']')),'÷['%CATALOG÷#%']'),%ALBUM%,%ALBUM%'÷['%CATALOG÷#%']')
Note: Replace each special ÷ character with one space character.

DD.20110312.1645.CET


#7

Thanks, but it doesn't work. It keeps adding to the ablum field.
Is it possible to instead delete everything after the 2nd last ]
eg.
[catalog #] [catalog #]


#8

Well, I have checked the given action before publishing and did it again just now.
The action works as designed.
The action appends the catalog number to the ALBUM field only in the case, when there is no catalog number appended, otherwise it leaves the field content as is.

Maybe there is a spelling error in your transcript.

DD.20110312.2300.CET


#9
The action works as designed.

Thanks for your time and patience, I've added a few other things to make it work how I want. See below

THIS WORKS highlighted are the values that move

[#0] Upper case for %catalog #%
[#1] Transfer %album% [%catalog #%] to %catalog #% credit goes to DetlevD
[#2] Append %catalog #% to %album% [%catalog #%] credit goes to DetlevD
[#3] Removes ÷[] (÷ represents a white space) ÷[] happens when there is no %album% [%catalog #%] or %catalog #%
[#4] Removes [] added as I have trim leading space action above this action therefore deleting []

[#0]
T=1
F=CATALOG #
1=2
2=

[#1]
T=7
F=%album%
1=%dummy% [%catalog #%]

[#2]
T=5
F=ALBUM
1=$if($eql($right(%ALBUM%,$len(' ['%CATALOG #%']')),' ['%CATALOG #%']'),%ALBUM%,%ALBUM%' ['%CATALOG #%']')

[#3]
T=2
F=ALBUM
1= []
2=
3=0|0

[#4]
T=2
F=ALBUM
1=[]
2=
3=0|0

#10

You did not say that the fields ALBUM and/or CATALOG # could be possibly not exist in your files, which you want to manipulate with the action script.

You can handle such erroneous case by using an appropriate Mp3tag Filter to not show such files, in order not to embed complex error handling into the scripting expressions.
Sure, it is always a point of view and how someone organizes the work process.

If there is enough time and machine capacity, then someone can do the same error checking on each file, that means, repeatedly doing the same on 10k or more files, when maybe only a few files have really the need to be checked.
It would be better to do a sort of pre processing in a first step, to divide the good ones from the bad ones, in order to prevent the good ones to be treated always as if they were bad ones.
That is the job of the Mp3tag Filter.

The good message which I read from your action script is, that you know how to use the Mp3tag toolbox and how you can help yourself, to reach a self defined goal.

The following scripting expression has embedded the needed error checking.
You can write the expression into one action "Format value" and run it for the field ALBUM.

$if($and(%ALBUM%,%CATALOG #%),$if($eql($right(%ALBUM%,$len(' ['%CATALOG #%']')),' ['%CATALOG #%']'),%ALBUM%,%ALBUM%' ['%CATALOG #%']'),%ALBUM%)

Only if the fields ALBUM and CATALOG # exist, then the content from the field CATALOG # will be concatenated, using a space character, at the right edge of the content of the field ALBUM.
If there exist already such a concatenation, then the field ALBUM will be left as is.
If the content of the field CATALOG # has been changed in the meantime, then a new catalog number string will be appended to the existing content of the field ALBUM. This results to repeated concatenations.

Therefore it is recommended, before applying the scripting expression, to copy the original content of the field ALBUM to a backup field, for example ORIG_ALBUM, and keep this backup field while the whole life time of the file.
A backup field makes it possible to always restore the original condition. Possibly changes of the catalog number can take place without further problems.
Using the value from field ORIG_ALBUM together with the new catalog number will give the combined new value to put into the field ALBUM.

DD.20110313.1035.CET


#11

Thank you, my may not have been the best way though but I wish I was as good as you though at this stuff.
And sorry for not saying that some info was missing in the fields in the first place

I do use the filter but this is one of many actions I keep [x] ticked all the time as I am slowly but surely going through my libray :slight_smile: my machine is an i7 CPU @ 3.2Ghz and 12GB RAM so it flys through them.

WORKS
The following scripting expression has embedded the needed error checking.
You can write the expression into one action "Format value" and run it for the field ALBUM.

$if($and(%ALBUM%,%CATALOG #%),$if($eql($right(%ALBUM%,$len(' ['%CATALOG #%']')),' ['%CATALOG #%']'),%ALBUM%,%ALBUM%' ['%CATALOG #%']'),%ALBUM%)

Thank YOU so much

Much action file now looks like this (highlighted are the values that move)
[#0] Transfer %album% [%catalog #%] to %catalog #% credit goes to DetlevD
[#1] Append %catalog #% to %album% [%catalog #%] (ONLY IF NOT THERE) credit goes to DetlevD

[#0]
T=7
F=%album%
1=%dummy% [%catalog #%]

[#1]
T=5
F=ALBUM
1=$if($and(%ALBUM%,%CATALOG #%),$if($eql($right(%ALBUM%,$len(' ['%CATALOG #%']')),' ['%CATALOG #%']'),%ALBUM%,%ALBUM%' ['%CATALOG #%']'),%ALBUM%)