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]
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%.
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?
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
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.
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
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
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.