flac.flac / mp3.mp3

I would like to know, if Mp3tag supports manipulation of the file extension?

Very rarely I somehow end up with files that have filename like
Abc flac.flac
instead of
Abc.flac
or
X Y Z mp3.mp3
instead of
X Y Z.mp3

So I tried to create an action to take care of this: some kind of format value for the "_FILENAME" with the "trim". But it seems that "_FILENAME" in Mp3tag means literally filename and not filename + extension. And so such an action would be impossible to work as I would like it to work [and I need to take some other approach]

See the pseudo-variable %_filename_ext% which includes the extension and see if you do something with it.

As your example show, there is only the need to remove trailing text from the filename, where the trailing text contains the name of the file extension, e .g. ' flac' or ' mp3'.
Apply functions like $regexp, $cutRight, $left, $replace, $if, $eql, $ifgreater, and variables like %_filename% and %_extension%.

Examples ...

_FILENAME <== $replace(%_filename%'$',' '%_extension%'$',) _FILENAME <== $trimRight($replace(%_filename%'$',%_extension%'$',)) _FILENAME <== $regexp(%_filename%,'\s+'%_extension%'$',) _FILENAME <== $regexp(%_filename%,'(\s*'%_extension%')*$',)

But it would be better you check the other code, which have introduced the failure.

DD.20160417.1804.CEST, DD.20160505.1656.CEST

I replaced the _FILENAME with _FILENAME_EXT in four of variation of my action. And now they do nothing [in opposition to doing it wrong]

So this simple trick does not work in this case

I simply don't know what trailing text is. [I lack some in my English]

But I'm deducting that you mean that I have to take care only of the filename and not filename + extension

But the problem with that is that there could be some song title which goes
Something, Something, WAW.vw Some More Gibberish Blablaflacflac
And so I would not end up later on with a correct filename
Something, Something, WAV.vw Some More Gibberish Blablaflacflac.flac
but with a
Something, Something, WAV Some More Gibberish Blabla.flac
or even [if I were to add more file extension to the equation] with
Something, Something, Some More Gibberish Blabla.flac

I know that this is unlikely and I should present some more possible [not so gibberish] example. But I always try to think how a change / code can go wrong, and not about those 99.9% easy cases, where it will work perfectly. And I just know that once I put something to my actions, I simply forget what [how much do] the do; ans so after a while I would make more and more of unneeded changes

So if the direction to take was to "look at the end of only the filename and even only there make the change", there still would be room for unwanted change of the actual end of a title. Or am I wrong on that?

As language is not logical you will always have ambiguities.
Why don't you simply rewrite the filename of those files?

The meaning is: "trailing" or "appended" as the opposite of "leading" or "prepended".

  • Буксируемый текст, Добавлен текст
  • Ведущий текст, Предваряет текст

Yes.

Well, this looks like as there is some serious error in the other actions, which create the filename.

DD.20160417.1922.CEST

Because I would need to spot them first

Of course I can put "flac.flac" in the filter; and then make manually the change. But that's what actions are for: they take care of repetitive tasks

But I don't understand that duplicity: extensions by _FILENAME and _FILENAME_EXT are not "seen" by actions; but the filter takes notice of extensions of files

THis is not quite correct:
for "Replace with regular expression" it is specified:

"Note: At this action _FILENAME applies to the whole file name including its extension. "
http://help.mp3tag.de/options_format.html#regexp

I came up with
Regular expression "_FILENAME" $Right(.flac{n,}) - > flacbut it doesn't work

is that a ...

?
I think that you have to use something like (*.\d),$1

This is botch.

You are about to run into the wild.
If you remove the filetype extension, then the files probably become invalid.
See post #3 in this thread, where I told you to modify the filename, but not the extension.

DD.20160419.0657.CEST

The code itself my be botch, the approach is proper

As I do not want to risk of changing a strange [but correct] title, I need to process end of filename with extension at the same time

Today I'm using WAV, FLAC, MP3, WV; but tomorrow I may be using dome two other formats, that from their repeated extension will create even more possibilities for such valid titles. And thus I should process end + extension and not just the end

What I was trying to achieve with this code was:
1] look at the end of file and extension
2] see if any number of ".flac" there is
3] delete every ".flac" and place just one ".flac" at the end of filename + extension
This would not change the extension. In 99.99% cases it would just replace ".flac" with ".flac" in the extension and do nothing in the filename

Note: The dot in your regular expression denotes any character.

DD.20160422.1209.CEST

A now, for a simple solution

Here is what works for "Field" "_FILENAME" in "Replace with regular expression"
[when "Replace matches" is set to ".flac"]

flac.flacThis turns "flac.flac" into a single ".flac"

And here is what doesn't work

$Right(flac.flac)
$cutRight(flac.flac)
$trimRight(flac.flac)

So how do I tell it to make the replacement just at the end?

Try out the examples from there ... post #3 in this thread ...
flac.flac / mp3.mp3

DD.20160427.0712.CEST

This does the trick

But only if there is a pause

So it works for
xxx flac.flac
but does not for
xxxflac.flac
because it just adds a dollar sign

This does the trick even where this is not pause

But not when there is more than one repetition

So it works for
xxx flac.flac
xxxflac.flac
but does not for
xxxflacflac.flac
xxxflac.flac.flac

because it just adds a dollar sign

So as long as I combine these both with a foolow up of cutting of
flac$
mp3$
wav$
wv$
wav$

I should be able to do that [rare] work on formats that I work with, without [very rarely] accidentally messing up strange both valid [original] titles

Thank you for all the info

As I said already, you should concentrate your effort to check your code routines from before, because there is the coding quirk, which creates multiple strings of the file extension at the end of the filename.

See once again ... flac.flac / mp3.mp3
... I have added a fourth example formatstring.

DD.20160505.1004.CEST, DD.20160505.1659.CEST

Thank you for all the info