Adding comments conditional on genre

I’ve been struggling to work out how to get a more complex script to work. Essentially I’d like to use the comment tag to add a number of values based on genre (and later add the energy level - but I can do that in a second script if needed).

Here’s the pseudo code of what I’m trying to achieve:

if ( genre = House ) set comment [DNC] [HSE]
if ( genre = Deep House ) set comment [DNC] [HSE] [DEEP]
if ( genre = Trance ) set comment [DNC] [TRNC]
if ( genre = Tech House ) set comment [DNC] [HSE] [TCH]
if ( genre = Techno ) set comment [DNC] [TCHN]

So far I’ve only really ended up with everything having the same value - not great :slight_smile:

Is there a way to do this in a single script so I don’t have to have one for every possible genre and have it easy enough to maintain that I can just add a new line to it when a new genre needs to be accounted for?

Secondary - I’ve already got a script that conditionally adds the value “[ELn]” to the comment if the track has an energy level (where “n” is the Energy Level value) but accomplishing the above AND this in one hit would be a huge convenience.

It might help if you could post your current script that isn’t doing what you want, so we can get a better idea of what you’re trying to do. Thanks.

Here’s a snippet of what I had that doens’t work:


$eq(Genre, Dance),$set(comment:,[DNC] [HSE] $if(EnergyLevel,[EL%EnergyLevel%]))),
$eq(Genre, Dance),
$set(comment:,[DNC] [HSE] $if(EnergyLevel,[EL%EnergyLevel%]))),$if(
$eq(Genre, Funk),
$set(comment:,[FNK] $if(EnergyLevel,[EL%EnergyLevel%]))),
$eq(Genre, Techno),
$set(comment:,[DNC] [TCHN] $if(EnergyLevel,[EL%EnergyLevel%]))),
$if(… etc

I was hoping this would result in a kind of cascading if then else that ran through the list until it got to the end but it doesn’t seem to work that way.

First try getting rid of the spaces between the commas and your genre types, and enclose the genre variable in percent signs. For example, change $eq(Genre, Dance) to $eq(%genre%,Dance). Same thing with the ‘EnergyLevel’ in your ‘$if’ statements.

If you want to append the information, then change all your $set(comment,[whatever]) statements to something like $set(comment,%comment% [whatever]).


Nice one - that’s really helped me get moving on this!