Set a Tag Value based on Tag Value in another Tag

Hi Forum,

I want to populate the tag %mediatype% based on the values written to %releasetype%. If the value CD and Single are fond in %releasetype% the value CDS should be written to %mediatype%. Here are the values used:

%releasetype% -> %mediatype%
7" -> 7''
12" -> 12''
LP -> LP
CD + Album -> CD
CD + Single -> CDS
Maxi-Single -> CDM

%releasetype% (taken from DiscOgs using dano's script) contains multiple values separated by comma (,) or slash (/). %mediatype% will always be written as just one value.

Do you RegEx Wizards have any suggestions on how to do this?



Action: Format Value

Make sure you use a quotationmark and not two accents for 7" and 12". That's how discogs is using it.

Note that all things you didn't list will be copied unchanged into the new field.

As far as I know dano uses the field MEDIATYPE for his discogscript, not RELEASETYPE as you stated. If I am right and you mixed it up, use RELEASETYPE as field and replace %releasetype% with %mediatype% inside the formatstring.

You could built this also direct into the web script if you edit it with a text editor.
Put these lines direct after the Mediatype/Releasetype part of dano's script.

outputto "mediatype"
gotochar 1
regexpreplace ".*7\".*" "7\""
regexpreplace ".*12\".*" "12\""
regexpreplace ".*LP.*" "LP"
regexpreplace ".*CD.*Album.*" "CD"
regexpreplace ".*CD.*Single.*" "CDS"
regexpreplace ".*Maxi-Single.*" "CDM"

Again, change mediatype into releasetype in the code above if dano is already using mediatype as I think.

The code above adds a new field to the script. If you would like to change the original field instead, use only the regexpreplace-lines and place them right befor the sayrest-line of the Mediatype/Releasetype part of dano's script-