sigrun
September 17, 2014, 8:14pm
1
I am trying to format my classical music. So in the title field I want to move the Op. number to the beginning.
So for example the track title might be:
Piano Sonata No. 2 in B-flat minor Op. 35 "Funeral March" - 2. Scherzo
I want it to be:
Op. 35 - Piano Sonata No. 2 in B-flat minor "Funeral March" - 2. Scherzo
Of course the Op. number isn't always going to be the same.
I tried to create an action myself for this, but it's too difficult.
Any help would be appreciated, Thanks!
sigrun:
... example the track title might be:
Piano Sonata No. 2 in B-flat minor Op. 35 "Funeral March" - 2. Scherzo
I want it to be:
Op. 35 - Piano Sonata No. 2 in B-flat minor "Funeral March" - 2. Scherzo
..
If the "Op." is the separator and always followed by a number, you can try an action of the type
"Replace with regular expression" for TITLE
Search: (.) Op. (\d+) (. )
Replace: Op. $2 $1 $3
DetlevD
September 18, 2014, 5:19am
3
Action: Format value
Field: TITLE
Formatstring: $regexp ( %TITLE% , ' ^(.+?)\b(?:op.?|opus)\s?(\d+),?\s?(.+?)$ ' , ' Op. $2 - $1$3 ' , 1 )
From:
aaa op123 bbb
aaa op 123 bbb
aaa op.123 bbb
aaa op. 123 bbb
aaa opus123 bbb
aaa opus 123 bbb
To:
Op. 123 - aaa bbb
DD.20140918.0919.CEST
sigrun
September 18, 2014, 6:27pm
4
DetlevD:
Action: Format value
Field: TITLE
Formatstring: $regexp ( %TITLE% , ' ^(.+?)\b(? p.?|opus)\s?(\d+),?\s?(.+?)$ ' , ' Op. $2 - $1$3 ' , 1 )
From:
aaa op123 bbb
aaa op 123 bbb
aaa op.123 bbb
aaa op. 123 bbb
aaa opus123 bbb
aaa opus 123 bbb
To:
Op. 123 - aaa bbb
DD.20140918.0919.CEST
Brilliant! Thanks!
I have noticed one flaw: if the Op. number is at the end of the title it will only take the first digit.
So "Op. 23" is moved as "Op. 2" and "3" stays at the end.
I added an action to the group that adds text to the title before running your action & then removes it after running, which solves it.
DetlevD
September 19, 2014, 4:30am
5
That's another starting point, but you can build quickly the new regular expression, which works also without the last part " bbb".
Action: Format value
Field: TITLE
Formatstring: $regexp ( %TITLE% , ' ^(.+?)?\s?(?:op.?|opus)\s?(\d+),?\s?(.+?)?$ ' , ' Op. $2 - $1$3 ' , 1 )
DD.20140919.0940.CEST