Explicit Lyrics Tag

I am trying to create an action that will search %unsyncedlyrics% for explicit cuss words and if found will then add the label "Explicit" to a new tag field %contentadvisory%. Any suggestions?

create an action of the type format tag-field
as tag enter %contentadvisory% (it is not in the list of tags but don't worry)
as format string enter

$if($strchr(%unsyncedlyrics%,swear word),Explicit,)
Which means if there is a in the lyrics write "Explicit" to the field %contentadvisory%, otherwise write nothing.

you would have to create an action for every word that you think is an explicit word.
If the same lyrics contain several words from the banned word list, the tag will be written several times.
I wonder how you will make use of this user-defined field as a player would have to be able to deal with user-defined fields. Otherwise it would be a mere academic hobby, wouldn't it?
A friend of mine has appended the string [explicit] to %title% so that he can use automated playlists that do not show tracks with [explicit] in the title...

Thanks for the detailed reply! Unfortunately that will always output as "Explicit". But your explanation pointed me in the right direction and this is what I came up with:

$ifgreater($strstr(%unsyncedlyrics%,fuck),0,Explicit,Clean)

This will work for one cuss word but not any additional words. If I try duplicating the action the output will always be the last action.

For example if lyrics had: "fuck" and "piss"
then the Action:
$ifgreater($strstr(%unsyncedlyrics%,fuck),0,Explicit,Clean)
$ifgreater($strstr(%unsyncedlyrics%,piss),0,Explicit,Clean)
would return "Explicit"

but if the lyrics had only "fuck" and NOT "piss"
then the Action:
$ifgreater($strstr(%unsyncedlyrics%,fuck),0,Explicit,Clean)
$ifgreater($strstr(%unsyncedlyrics%,piss),0,Explicit,Clean)
would return "Clean" since the last action overwrites the first..

the ideal situation would be to have some kind of OR operator instead of duplicating the actions but I don't know if mp3tag supports one.

any thoughts?

Read something about using Regular Expresssion in Mp3tag ...

DD.20100216.2233.CET

Here comes a proposal how it could be done.

Begin Actionsgroup Test#20100216.ilokoi

Action #1
Actiontype 5: Format tag field
Field: UNSYNCEDLYRICS
Formatstring:

'Leon Well racley wou wounny expris Rever lood him then ithen on wed,

her thim ante ne a now ing ve he gook ong of Parat and bug he sayed
bartand or that milet; a days awastracket; buld seed bet monsuddeadmin,
and he liketch a fies awas inder was ley for saver yound winged onev.
Ang much a mays, Smiled, throg; and Dandeamor And to down to he com the
minute her ma, it of pelled, all hey thaded ferculd lamet dowinly was
forkinink of yer as ticher keplence suld yout.
He witted, out hern holt.
Proublon if to ste days lemilere core out hin got.
Smil smining of and buted comee be cou he dozint himehorteraddley, as,
a given too, foll the winideres the as ve yould see siablays.
And was a fard.'

Action #2
Actiontype 5: Format tag field
Field: BADWORDS
Formatstring: 'gook|buld|yound|ferculd'

Action #3
Actiontype 5: Format tag field
Field: CONTENTADVISORY
Formatstring: $ifgreater($len(%UNSYNCEDLYRICS%),$len($regexp(%UNSYNCEDLYRICS%,'(?i)\b('%BADWORDS%')\b',)),'bad','good')

Action #4
Actiontype 9: Remove fields
Fields to remove (semicolon separated): BADWORDS

End Actionsgroup Test#20100216.ilokoi (4 Actions)

DD.20100216.2307.CET
Edit.DD.20120717.1602.CEST

Thank you! This works well. I had not considered using the $len to setup a comparison. I have implemented your solution as:

Action #1
Actiontype 5: Format tag field
Field: CONTENTADVISORY
Formatstring: $ifgreater($len(%UNSYNCEDLYRICS%),$len($regexp(%UNSYNCEDLYRICS%,'(?i)\b('fuck|piss|cunt|sex|cock|dick|pussy|shit|ass|bitch|fucking')\b',)),Dirty,Clean)

This appears to work well without the need of the extra actions you described earlier.

I would appreciate if you explained what (?i)\b does?

Thanks for all the help!

I am glad that you have understand the proposal and have managed to implement the essential part so quickly.

The anchor "\b" means "word boundary". The RE looks only for whole words but not for string fragments.

The modifier "?i" means to use ignore case, e. g. the RE (?i)te(?-i)st should match test and TEst, but not teST or TEST.

DD.20100217.1744.CET

I'm grateful for the explanation, I had searched the forums and didn't find a reference to those operators. Now I can rest assured knowing the music I play at work is "safe" for everyone.

Best regards!

Hello there, I realise that this is an old thread but it looks like you have come up with a working solution to a problem I have encountered.

I modified the word list and tag field created, but otherwise it is the same.

Action #1
Actiontype 5: Format tag field
Field: EXPLICITLYRICS
Formatstring: $ifgreater($len(%UNSYNCEDLYRICS%),$len($regexp(%UNSYNCEDLYRICS%,'(?i)\b('anal|anus|arse|ass|ballsack|balls|bastard|bitch|biatch|blowjob|bollocks|boner|boobs|bugger|butt|buttplug|clitoris|cock|coon|crap|cunt|dick|dildo|dyke|fellate|fellatio|felching|fuck|fucker|fuckers|flange|Goddamn|homo|jerk|jizz|knobend|labia|muff|nigger|nigga|penis|piss|prick|pube|pussy|queer|scrotum|sex|shit|slut|smegma|spunk|tit|tosser|turd|twat|vagina|wank|whore')\b',)),Dirty,Clean)

I'm wondering if there is a way to not touch the file if it is clean? Rather than adding 'clean' to the tags in those instances.

If you don't touch your song, you have to check it again and again.
Writing "Clean" to the tag EXPLICITLYRICS give you the control to filter all files without "Clean" or "Dirty" and therefore check only this (hopefully smaller) amount of files.

Thanks for your explanation, that makes sense and is a good enough reason to leave it alone.