It's used to quickly assign several genres (out of a list of 15 predefined genres) to a song.
-> 15 buttons assigned to 15 scripts.
(yes, it's a woraround for this (non-existing) plugin)
heres the code:
1. Format GENRE using: $puts(var,'rock')$if($strstr(%genre%,$get(var)),$replace(%genre%,$get(var),),[%genre%]','$get(var))
2. Split GENRE field by "," seperator
So here's what it does:
- It takes all genres as one string ( "rock, latin, ska" )
- it test if the string saved in the variable var (here: "rock") occurs somewhere in the genre-string
-> if YES, it replaces this string by nothing ("rock" -> "")
-> if NO, it adds a comma + the string to the genres
- finally the genre-string is split again by comma as seperator
well, it works. But it's not really good:
- if theres a genre-tag "rockabily" it will make "abily" out of it
- it always adds the genre at the end. (I would like to have a standard-order...)
What i would like to have is:
- Test each genre-tag seperately if it equals the desired one
-> if yes, delete that tag (and leave the other genre-tags)
-> if no, add the desired genre-tag
- sort the tags (maybe alphabetically - otherwise this would get too complicated)
i know that you can pick out the individual tags by $meta(genre,[number]) - but how to delete a specific genre-tag?
edit:
okay, I stayed with the solution above (1 genre-string), but improved it by...
- padding the genre-string with ", " at the beginning and at the end.
- testing for ", rock, " instead of only for "rock"
New Code:
$puts(var,', rock, ')$puts(gen,[', '%genre%', '])
$if($strstr($get(gen),$get(var)),$replace($get(gen),$get(var),),$get(gen)$get(var))
this rules out the problem of "rockabily"
... but how to sort multiple genres (alphabetically)?