Replace Data in Embedded Cuesheet


#1

First of all, let me say how much I love mp3tag. I've been using it for over a year and it's one of the most robust pieces of software I've ever used. Florian, you have a wonderful product.

I would like to know if this is possible. I have .flac files with embedded cuesheets (created by EAC/REACT2). Could I use an action in mp3tag to replace some specific data within the cuesheet (the metadata CUESHEET tag) with some other data?

Specifically, I would like to add the year of the album to the beginning of the filename (the FILE field). For example, I would want to change this (the first part of CUESHEET):

REM DISCNUMBER 1
REM TOTALDISCS 1
REM GENRE Rock/Pop
REM DATE 1994
REM DISCID A70C310B
REM COMMENT "ExactAudioCopy v0.99pb5"
PERFORMER "Oasis"
TITLE "Definitely Maybe"
FILE "Oasis - Definitely Maybe.flac" WAVE
TRACK 01 AUDIO
[...]

to this:

REM DISCNUMBER 1
REM TOTALDISCS 1
REM GENRE Rock/Pop
REM DATE 1994
REM DISCID A70C310B
REM COMMENT "ExactAudioCopy v0.99pb5"
PERFORMER "Oasis"
TITLE "Definitely Maybe"
FILE "Oasis - [1994] Definitely Maybe.flac" WAVE
TRACK 01 AUDIO

[...]

Leaving everything the same except the FILE field.

Thanks much!


#2

Supposing the cuesheet text data is available in a tag-field named CUESHEET, and the year value can be derived from the statement REM DATE, then this action can help:

Begin Action Group Test 2010#20101224.Flasshe

Action #1
Actiontype 5: Format value
Field: TMP_CUESHEET
Formatstring: $replace($regexp(%CUESHEET%,'^(.?)(FILE÷".+?÷-)(.+?"÷WAVE)(.?)$','$1$2÷[YYYY]$3$4'),'[YYYY]',$regexp(%CUESHEET%,'^.?REM÷DATE÷(\d\d\d\d).$','[$1]'))

Note: Replace each special ÷ character with one space character.
End Action Group Test 2010#20101224.Flasshe (1 Action)

This will create a temporary tag-field TMP_CUESHEET just for the test purpose.
If it works fine, then the original CUESHEET tag-field can be overwritten by the TMP_CUESHEET content, and the tag-field TMP_CUESHEET can be removed.

Or the other way is to overwrite the original content of the tag-field CUESHEET with the previous action in one go, using the tag-field CUESHEET as target.




DD.20101224.1238.CET




#3

That is exactly what I wanted. Works great!! Thanks so much!


#4

The Formatstring can be done shorter.

Begin Action Group Test 2010#20101224.Flasshe.2

Action #1
Actiontype 5: Format value
Field: TMP_CUESHEET
Formatstring: $regexp(%CUESHEET%,'^(.?REM÷DATE÷)(\d\d\d\d)(.?FILE÷".+?÷-)(.+?"÷WAVE)(.*?)$','$1$2$3÷[$2]$4')

Note: Replace each special ÷ character with one space character.
End Action Group Test 2010#20101224.Flasshe.2 (1 Action)

DD.20101225.0717.CET


#5

Thanks, that worked as well. My renaming is complete and I'm very happy today!