Extract COMMENT field in separate fields

The COMMENT field of my FLAC-tags looks like:
COMMENT: 1950s (Songs-DB_Custom1)
COMMENT: Cool; Male Vocalists; Female Vocalists; Genius (Songs-DB_Custom2)
COMMENT: American (Songs-DB_Custom3)
COMMENT: Romantic; Chillout (Songs-DB_Occasion)

Or COMMENT: 1950s (Songs-DB_Custom1)\\Cool; Male Vocalists; Female Vocalists; Genius (Songs-DB_Custom2)\\American (Songs-DB_Custom3)\\Romantic; Chillout (Songs-DB_Occasion)

I want those information not in 1 field but in separate fields, like
COMMENT SONGS-DB_CUSTOM1: 1950s
COMMENT SONGS-DB_CUSTOM2: Cool; Male Vocalists; Female Vocalists; Genius
COMMENT SONGS-DB_CUSTOM3: American
COMMENT SONGS-DB_OCCASION: Romantic; Chillout

I have tried to make an format value action for this, but without succes.
Can someone help me?

If the COMMENT fields are always in the same order, you can use

Action type: Guess values
Source format: $regexp($meta_sep(comment,€),'\s+(Songs-DB.+?)',)
Guessing pattern: %COMMENT SONGS-DB_CUSTOM1%€%COMMENT SONGS-DB_CUSTOM2%€%COMMENT SONGS-DB_CUSTOM3%€%COMMENT SONGS-DB_OCCASION%

It works.
Thank you very much! :slight_smile:
I never could have make such an complicated action.

Thanks for the solution but the tagger does not always put them in the same order! This happens at times:

Comment field: Italian (Songs-DB_Custom3); 2000s (Songs-DB_Custom1); Beautiful; Remix; Male (Songs-DB_Custom2); Love; Party (Songs-DB_Occasion)

What would you do in that case? Can you make an universal solution, or can you make another action for such cases? I have tried switching around the numbers in the action you provided but with no luck.

Thanks a lot!

Infuscu

I can't think of a universal solution. The best thing is probably to just take dano's Guess values action as an example and adjust it to the changed order of the fields.

In my case, the order of the custom comment fields is always

COMMENT SONGS-DB_CUSTOM3
COMMENT SONGS-DB_CUSTOM1
COMMENT SONGS-DB_CUSTOM2
COMMENT SONGS-DB_OCCASION

But sometimes one or more fields are missing, so for example it looks like this:

COMMENT SONGS-DB_CUSTOM3
COMMENT SONGS-DB_CUSTOM2

In this case, when not all 4 fields are available, the action command is not working.

How should I adjust the Source format/Guessing pattern so I can extract the comment field in separate custom comment fields no matter how many are available?

Thanks in advance!

Here comes a proposal, which may work for you.
Note that there are two slightly different proposals for MP3 and FLAC.
Due to a possible bug in Mp3tag, when working with the FLAC / Vorbis comment tag, there is an additional workaround in the action group for the FLAC tag.

The attached archive file contains ...

  • 2 media files of type MP3 with proper tag fields,
  • 2 media files of type FLAC with proper tag fields,
  • 1 Mp3tag action group for MP3 tagged files,
  • 1 Mp3tag action group for FLAC / Vorbis Comment tagged files.

Run the fitting action group against the test files and use the dialog "Extended tags..." to check the results.

20131227.MP3.FLAC.meta.split.sort.rar (179 KB)
DD.20131227.2134.CET

I have changed the Mp3tag action group code in order to get a better view to the program flow.

TEMP1 <== '~~~'$meta_sep(COMMENT,'~~~') TEMP1 <== $regexp(%TEMP1%,'\s*\(Songs-DB_Custom1\)\s*','~~~1') TEMP1 <== $regexp(%TEMP1%,'\s*\(Songs-DB_Custom2\)\s*','~~~2') TEMP1 <== $regexp(%TEMP1%,'\s*\(Songs-DB_Custom3\)\s*','~~~3') TEMP1 <== $regexp(%TEMP1%,'\s*\(Songs-DB_Occasion\)\s*','~~~4') TEMP2 <== $regexp(%TEMP1%,'^.*(?:~~~(.+?)~~~1).*$','$1') TEMP3 <== %TEMP3%'~~~'$if($eql(%TEMP1%,%TEMP2%),,%TEMP2%) TEMP2 <== $regexp(%TEMP1%,'^.*(?:~~~(.+?)~~~2).*$','$1') TEMP3 <== %TEMP3%'~~~'$if($eql(%TEMP1%,%TEMP2%),,%TEMP2%) TEMP2 <== $regexp(%TEMP1%,'^.*(?:~~~(.+?)~~~3).*$','$1') TEMP3 <== %TEMP3%'~~~'$if($eql(%TEMP1%,%TEMP2%),,%TEMP2%) TEMP2 <== $regexp(%TEMP1%,'^.*(?:~~~(.+?)~~~4).*$','$1') TEMP3 <== %TEMP3%'~~~'$if($eql(%TEMP1%,%TEMP2%),,%TEMP2%) %TEMP3% ==> ~~~%COMMENT SONGS-DB_CUSTOM1%~~~%COMMENT SONGS-DB_CUSTOM2%~~~%COMMENT SONGS-DB_CUSTOM3%~~~%COMMENT SONGS-DB_OCCASION%

20131227.COMMENT.meta.split.sort.v1.MP3.mta (1.16 KB)
DD.20131229.1630.CET

20131227.MP3.FLAC.meta.split.sort.rar (179 KB)

20131227.COMMENT.meta.split.sort.v1.MP3.mta (1.16 KB)

Thank you very much, DetlevD, it's working now :slight_smile:
That looks so complicated, I could have never figured this out by myself.

One more question: is it possible to write an action that opens another action? So I could write an if-statement, that opens either one or the other action group depending on if it's a mp3 or a flac file.

This is not possible yet.

Here in this case you may use the FLAC file oriented action group, which has the embedded workaround code, for MP3 files too.

DD.20131228.1645.CET