Exporting coverart as filename is not saving exactly as it should

Hi there,

I wrote an action that will export coverart as filename and works great until i noticed a small issue.

If i have a filename like: "Rihanna - Work .mp3" <-- Notice the space after "k" in work.
If i run my export cover action i get "Rihanna - Work.jpg" <-- No space? This is incorrect as i need it to be exactly the same as the filename itself with the ending space if it exists.

My action setup:
Export cover to file "%filename%"

Now! If i use: Export cover to file "%_filename_ext%",
i receive: "Rihanna - Work .mp3.jpg" <-- The space gets included in this but obiously i dont need the .mp3 (file extension). Perhaps theres something i can do with this?

P.s, i even tried: $replace(%_filename_ext%,.mp3,) as this will allow me to replace .mp3 and be left with "k .jp" but it still replaces and removes my space!

Any help is appreciated.

Thanks!

I can't do anything about the vanishing space character.
But, perhaps if you use the $trim() function when you import the jpgs again, you succeed:
Import cover from file: $trim(%artist% - %album%).jpg

Just as a footnote: there are far more threads in this forum that deal with the topic of getting rid of leading or trailing blanks than there are that want to preserve them.

Sadly i need it to work off the filename as the system i use uses the mp3 filename and replaces .mp3 with .jpg etc. Very complicated to explain here but sadly i need it to work with filename. Your idea wont work with me. I need to make an image named EXACTLY whats on the mp3 filename even if it has ending spaces! To be honest, the content im parsing is old and the new content never has ending space but sadly removing the space is not an option here as it will mess up our references etc in our DB. On a side note, why the hell did the devs design it so it removes ending spaces? If i want the spaces removed i would do it myself.. Simple task, name it from filename. Leave whats in the filename alone and dont replace or remove anything inside!! Was just testing the replace function and same thing? What if i want to replace the last letter with a space?? It wont work! (Your space vanishes anyway xD) Cant stress how angry i am with this.. Stupidily designed. ._.

there is a thread from 2010:

Talking about design questions:

I wonder if the DB is really designed in such a way that one cannot adapt the references so that the files without trailing space will be found again ...

@irishwill2008
I can offer your 2 workarounds:

  1. If the amount of files with space isn't too large you could filter them with %_filename% HAS " .mp3" and do the extraction manually file for file with a right mouse click on the cover in the tagpanel and "extract cover". This way the space remains at its place. The filename can be predefined to
    %_filename%
    in
    Tools -> Options -> Tag Sources -> Default file name for cover art.

  2. You could use %_filename_ext% and later rename the file (getting rid the the .mp3) externally i.e. with a tool like bulk-rename or even someway internally with using the tools options of Mp3Tag.