Syntax error on removal of certain characters and text

Ah, I ran the program from the original directory after moving my actions to actions - copy folder and when I closed the program there were no errors. I'll have to try and figure out which file is causing the problem.

Trouble-shooting intent was to have an absolutely clean, virgin installation directly from the mp3tag.de web site. If that worked, then any changes you have made from that baseline would be the issue.

Not sure how you are using the A: drive - that's not very common since it has been reserved for (now obsolete) floppy drives.

Anyway, from your next message, I see you have found you have a problem in actions. Standard trouble-shooting is to re-introduce them one by one until the problem returns.

I'm just an old guy doing battle with computers since the early 80s. Glad you can see a light at the end of the tunnel.

Thanks for your help Jimmy. I understood the intent and I downloaded and installed mp3tag to the directory I mentioned.

Since the A drive is redundant, I use it as the partition for my documents.

I have figured out that it's not the MTA files themselves that are the problem, it was because I had given them names that were too long. As soon as I shortened the names of the two longest, I was able to move them all back and get mp3tag working without error upon exit again.

If anyone else reports a similar problem, it will be good to know it's the filename length that's likely the cause.

Right, so the program is running fine again and I'm not getting a syntax error any more. However, I still can't get my action to work properly and it must be fairly straightforward to correct.

Running convert tag to filename to test one of the lines:

$num(%track%,2) $replace(%title%, '('acoustic')',, '('album')',, '('digital album')',, '('ep')',, '('lp')',, '('single')',)
Result: 01 Surround (Acoustic).mp3

The file "A:\Music\American Hi-Fi\American Hi-Fi Acoustic\01 Surround (Acoustic).mp3" already exists.
File "A:\Music\American Hi-Fi\American Hi-Fi Acoustic\01 Surround (Acoustic).mp3" has not been renamed.

I see that the problem is that the brackets and text are all part of the title. So I need to run something else first before breaking it up?

And "Acoustic" is not "acoustic"

1 Like

Good to know that there is a limit on the length.

I'm happy that you've moved to the next part of the puzzle.

Apologies, it does work perfectly with the correct case. I'm going to work on a solution that either involves changing the case and then running the action or including all variants within this script. The latter seems most simple.

Not sure the latter is going to work?

$num(%track%,2) $replace(%title%, '('ACOUSTIC')',, '('Acoustic')',, '('acoustic')',, ('ALBUM')',, '('Album')',, '('album')',, '('DIGITAL ALBUM')',, '('Digital Album')',, '('digital album')',, '('EP')',, '('Ep')',, '('ep')',, '('LP')',, '('Lp')',, '('lp')',, '('SINGLE')',, '('Single')',, '('single')',)

"A:\Music\American Hi-Fi\American Hi-Fi Acoustic\01 Surround (Acoustic).mp3" ->
"A:\Music\American Hi-Fi\American Hi-Fi Acoustic[ SYNTAX ERROR IN FORMATTING STRING ].mp3"

$num(%track%,2) $replace(%title%, '('Acoustic')',, '('album')',, '('digital album')',, '('ep')',, '('lp')',, '('single')',)

"A:\Music\American Hi-Fi\American Hi-Fi Acoustic\01 Surround (Acoustic).mp3" ->
"A:\Music\American Hi-Fi\American Hi-Fi Acoustic\01 Surround.mp3"

Do you understand why this happens? If it looks for an exact match, surely it can't be a problem checking for the same words in different cases?

Missing '
So you are right:

1 Like

Thank you, I really appreciate your help with this.

The complete code is below in case anyone else wants to do something similar.

[#0]
T=5
! Remove Text (Album, Album Version, Album Version Explicit, Compile, Digital Album, Digital Version, EP, LP, Lullaby Rendition, Lullaby Version and Single) DIRECTORY=
F=_DIRECTORY
1=$replace(%_directory%, '('ALBUM')',, '('Album')',, '('album')',, '('ALBUM VERSION')',, '('Album Version')',, '('album version')',, '('ALBUM VERSION EXPLICIT')',, '('Album Version Explicit')',, '('album version explicit')',, '('COMPILE')',, '('Compile')',, '('compile')',, '('DIGITAL ALBUM')',, '('Digital Album')',, '('digital album')',, '('DIGITAL VERSION')',, '('Digital Version')',, '('digital version')',, '('EP')',, '('Ep')',, '('ep')',, '('LP')',, '('Lp')',, '('lp')',, '('LULLABY RENDITION')',, '('Lullaby Rendition')',, '('lullaby rendition')',, '('LULLABY VERSION')',, '('Lullaby Version')',, '('lullaby version')',, '('SINGLE')',, '('Single')',, '('single')',)

[#1]
T=5
! Remove Text (Acoustic, Album, Album Version, Album Version Explicit, Compile, Digital Album, Digital Version, EP, LP, Lullaby Rendition, Lullaby Version and Single) from FILENAME=
F=_FILENAME
1=$replace(%_filename%, '('ACOUSTIC')',, '('Acoustic')',, '('acoustic')',, '('ALBUM')',, '('Album')',, '('album')',, '('ALBUM VERSION')',, '('Album Version')',, '('album version')',, '('ALBUM VERSION EXPLICIT')',, '('Album Version Explicit')',, '('album version explicit')',, '('COMPILE')',, '('Compile')',, '('compile')',, '('DIGITAL ALBUM')',, '('Digital Album')',, '('digital album')',, '('DIGITAL VERSION')',, '('Digital Version')',, '('digital version')',, '('EP')',, '('Ep')',, '('ep')',, '('LP')',, '('Lp')',, '('lp')',, '('LULLABY RENDITION')',, '('Lullaby Rendition')',, '('lullaby rendition')',, '('LULLABY VERSION')',, '('Lullaby Version')',, '('lullaby version')',, '('SINGLE')',, '('Single')',, '('single')',)

[#2]
T=5
! Remove Text (Album, Album Version, ALlum Version Explicit, Compile, Digital Album, Digital Version, EP, LP, Lullaby Rendition, Lullaby Version and Single) from ALBUM=
F=_ALBUM
1=$replace(%_album%, '('ALBUM')',, '('Album')',, '('album')',, '('ALBUM VERSION')',, '('Album Version')',, '('album version')',, '('ALBUM VERSION EXPLICIT')',, '('Album Version Explicit')',, '('album version explicit')',, '('COMPILE')',, '('Compile')',, '('compile')',, '('DIGITAL ALBUM')',, '('Digital Album')',, '('digital album')',, '('DIGITAL VERSION')',, '('Digital Version')',, '('digital version')',, '('EP')',, '('Ep')',, '('ep')',, '('LP')',, '('Lp')',, '('lp')',, '('LULLABY RENDITION')',, '('Lullaby Rendition')',, '('lullaby rendition')',, '('LULLABY VERSION')',, '('Lullaby Version')',, '('lullaby version')',, '('SINGLE')',, '('Single')',, '('single')',)

[#3]
T=5
! Remove Text (Acoustic, Album, Album Version, ALlum Version Explicit, Compile, Digital Album, Digital Version, EP, LP, Lullaby Rendition, Lullaby Version and Single) from TITLE=
f=TITLE
1=$replace(%title%, '('ACOUSTIC')',, '('Acoustic')',, '('acoustic')',, '('ALBUM')',, '('Album')',, '('album')',, '('ALBUM VERSION')',, '('Album Version')',, '('album version')',, '('ALBUM VERSION EXPLICIT')',, '('Album Version Explicit')',, '('album version explicit')',, '('COMPILE')',, '('Compile')',, '('compile')',, '('DIGITAL ALBUM')',, '('Digital Album')',, '('digital album')',, '('DIGITAL VERSION')',, '('Digital Version')',, '('digital version')',, '('EP')',, '('Ep')',, '('ep')',, '('LP')',, '('Lp')',, '('lp')',, '('LULLABY RENDITION')',, '('Lullaby Rendition')',, '('lullaby rendition')',, '('LULLABY VERSION')',, '('Lullaby Version')',, '('lullaby version')',, '('SINGLE')',, '('Single')',, '('single')',)

How does this work in comparison and is this case sensitive?

[#0]
T=7
F=$REPLACE(%ALBUM% \u003d\u003d\u003d %_FILENAME%,' (Album)',)
1=%ALBUM% \u003d\u003d\u003d %_FILENAME%

[#1]
T=7
F=$REPLACE(%ALBUM% \u003d\u003d\u003d %_FILENAME%,' (Digital Album)',)
1=%ALBUM% \u003d\u003d\u003d %_FILENAME%

[#2]
T=7
F=$REPLACE(%ALBUM% \u003d\u003d\u003d %_FILENAME%,' (EP)',)
1=%ALBUM% \u003d\u003d\u003d %_FILENAME%

[#3]
T=7
F=$REPLACE(%ALBUM% \u003d\u003d\u003d %_FILENAME%,' (LP)',)
1=%ALBUM% \u003d\u003d\u003d %_FILENAME%

[#4]
T=7
F=$REPLACE(%ALBUM% \u003d\u003d\u003d %_FILENAME%,' (Single)',)
1=%ALBUM% \u003d\u003d\u003d %_FILENAME%

The function $replace() is and stays case sensitive - it should have been easy to find that out without the need to consult the forum.
The guess value action takes a string and splits it into fields. How that string comes about has nothing to do with the action itself. You can see it more or less as a more universal application of the converter Filename-Tag.
If you want to save that work, I would still recommend to first modify the tag fields and then write that new text to _DIRECTORY and _FILENAME.
Also, it may be worthwhile to consider actions of the type "Replace" instead of "Format value" as you can set the action "Replace" to ignore the case.

Thanks for confirming, I'll give that some thought.

Here's another variation I found in my files. I'll leave this here as an example.

[#0]
T=5
F=REMOVE_LIST
1= (Album)| (Digital Album)| (EP)| (LP)| (Single)

[#1]
T=5
F=REMOVE_LIST
1=$replace(%remove_list%,'(',\'(',')',\')')

[#2]
T=5
F=ALBUM
1=$regexp(%album%,(%remove_list%),)

[#3]
T=5
F=_FILENAME
1=$regexp(%_filename%,(%remove_list%),)

[#4]
T=5
F=_DIRECTORY
1=$regexp(%_directory%,(%remove_list%),)

[#5]
T=9
F=REMOVE_LIST

And another

[#0]
T=4
F=_FILENAME
1=(example)
2=
3=0

[#1]
T=4
F=TITLE
1=(example)
2=
3=0

[#2]
T=4
F=_ALL
1=(example)
2=
3=0

[#3]
T=4
F=_ALL
1=()
2=
3=0

This example with "example" features some rather questionable ideas:

If you replace the text "(example)" with nothing, it is a text constant, so it is not really a pattern that has to be defined in a regular expression. So an action of the type "Replace with regular expression" is probably not the optimum.
This is combined with rather sloppy code because the brackets, which serve a special purpose in regular expressions, are not escaped.
Only this circumstance makes it necessary to have a 4th action which again replaces a text constant in a regular expression ... discussion see above.
I would see this example as a bad example.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.