Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Album art - illegal characters in filename issue (Read 4892 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Album art - illegal characters in filename issue

Hello!

I store all my album art images in one folder and set foobar to read it from there. They're named as "%artist% - %album%". It works most of the time. But sometimes the album name has an illegal character, usually ":".  In which case I can't name the files as such.
So far I couldn't figure out a solution for this. Neither on the file naming side, nor within foobar(handling illegal characters somehow).

Any ideas?

Album art - illegal characters in filename issue

Reply #1
these are the rules you have to follow for the display preference to work...

Code: [Select]
\/:| need to be replaced with -
* needs to be replaced with x
" needs to be replaced with ''
<> need to be replaced with _
? needs to be stripped completely

Album art - illegal characters in filename issue

Reply #2
these are the rules you have to follow for the display preference to work...

Code: [Select]
\/:| need to be replaced with -
* needs to be replaced with x
" needs to be replaced with ''
<> need to be replaced with _
? needs to be stripped completely

Thanks.
Where do you get this from by the way?

Album art - illegal characters in filename issue

Reply #3
this is from the file operations wiki page...

Quote
Beginning in 0.9.6.4, symbols which are invalid in folder and file names such as / \ |: get replaced by a -, * gets replaced by x, " gets replaced with '', and ? < > get replaced by an _.


i didn't quote it before because the part about replacing ? with _ is out of date. i'm too lazy to make a wiki account and change it. presumably it changed with v1 of foobar but i don't actually know.

also, there is nothing that says file operations is related to how the album art preferences work.

if you want to test a really extreme example, you could tag a track with this as the album...

Code: [Select]
\/:|*"<>?


now name an image

Code: [Select]
----x''__.jpg


and %album%.jpg should display it just fine.

Album art - illegal characters in filename issue

Reply #4
Thanks for the info.

Album art - illegal characters in filename issue

Reply #5
these are the rules you have to follow for the display preference to work...

Code: [Select]
\/:| need to be replaced with -
* needs to be replaced with x
" needs to be replaced with ''
<> need to be replaced with _
? needs to be stripped completely


I'm not quite sure I understand. Need to be replaced where?

I'm trying to batch embed album covers into MP3 files, and this is failing for the mentioned characters. According to the post 2 before mine, : should automatically be replaced by - , but this doesn't work. Or do you mean actually renaming the album name? That's definitely not an option, why would I want to change the correct name?

edit: how would this work:
You may want to consider using $ascii() or $ansi() to sanitize the names when applying file operations.

Album art - illegal characters in filename issue

Reply #6
well of course you don't want to modify your artist/album tags. those rules apply to the image names if you want the foobar artreader to display them using %artist%, %album% etc.

as foobar cannot manipulate images, you have to do it manually or configure another application to do it when fetching/saving them.

personally, i think using metadata as part of image filenames is a waste of time. what's wrong with the good old fashioned cover.jpg* inside each folder along side the audio files?


*i avoid folder.jpg due to mishaps in the past with windows media player wiping out good images with crap.

Album art - illegal characters in filename issue

Reply #7
personally, i think using metadata as part of image filenames is a waste of time. what's wrong with the good old fashioned cover.jpg* inside each folder along side the audio files?


*i avoid folder.jpg due to mishaps in the past with windows media player wiping out good images with crap.

Because it's only available from that folder. This way you get album art for single files and every variant/conversion for the same album without needing to copy image files all the time like crazy.
Also what if you have files from several albums in one folder? You could only add one album art for all. This is a common occurrence when I encode a lump of files for my ipod.
I just found having the cover art in the audio file's folder to be problematic and messy.

Album art - illegal characters in filename issue

Reply #8
well i did prefix my previous statement with the word personally...

if i do any lossless>lossy conversions, foobar's converter will copy the image automatically. i never keep lossy copies on the pc. they go straight on my portable and are considered disposable.
if i had different variants of the same album, i might expect them to have different art. if not, i'd be happy with duplicating the image.
as for multiple albums in a single folder.... not going to happen. i can understand why folder structure shouldn't matter when your files are properly tagged but it's not a system i could live with.

Album art - illegal characters in filename issue

Reply #9
I'm not quite sure I understand. Need to be replaced where?

In the filename of the image file that matches up with a given album.

Album art - illegal characters in filename issue

Reply #10
I'm not quite sure I understand. Need to be replaced where?

In the filename of the image file that matches up with a given album.


Ehm, no. As those characters are not allowed for filenames the image file names obviously don't have them included.

My problem is this. I'm using foobar to batch convert albums stored as one .WAV file with track information included in the .CUE file to MP3s. The problem here is that the convert function unfortunately can't also embed the images, which would be the easiest solution as the images are named exactly the same as the .cue files themselves. So the only solution is to embed the images after the conversion, with tagging - batch attach pictures - %artist% - %album% or whatever. That's where I run into the problem with the special characters, as the %artist% etc. tags inside the MP3s obviously have the 'correct' name with special characters.

Any way around this?

Just having the image in the same folder isn't an option, even if all software that I use could deal with this solution which I doubt I would still have to manually copy thousands of images to the correct folder.

Album art - illegal characters in filename issue

Reply #11
Ehm, no. As those characters are not allowed for filenames the image file names obviously don't have them included.

I meant to include the following quote after the fact, but the board's flood protection kicked in and I forgot to come back to it after the timer expired:
if you want to test a really extreme example, you could tag a track with this as the album...

Code: [Select]
\/:|*"<>?


now name an image

Code: [Select]
----x''__.jpg


and %album%.jpg should display it just fine.

What he is saying is that an image file named ----x''__.jpg will be mapped to an album tagged \/:|*"<>?. When using %album%, foobar2000 will be looking for the replacement characters when attempting to find a match.

Therefore, a file named Example- 5x Rating.jpg will be mapped to an album tagged Example: 5* Rating?.

The same logic (should) apply to %artist%, etc.

Album art - illegal characters in filename issue

Reply #12
Any way around this?

An example, pls. What are the values of: 1)artist tag, 2)album tag, 3)image filename.
(i assume that you use %artist% - %album%.jpg as a pattern)

Album art - illegal characters in filename issue

Reply #13
Any way around this?

An example, pls. What are the values of: 1)artist tag, 2)album tag, 3)image filename.
(i assume that you use %artist% - %album%.jpg as a pattern)


That's right.

Artist tag: 24-Carat Black
Album tag: Ghetto: Misfortune's Wealth (Remastered 1994)
Image filename: 24-Carat Black - Ghetto  Misfortune's Wealth (Remastered 1994)
[2 spaces between Ghetto & Misfortune's]

Which means you probably helped me find the cause of the problem myself ;-) EAC replaces : and other not allowed characters with space in the filenames. So I guess there would have to be a possibility to map those characters to space in foobar when trying to batch attach album cover image files.

Edit: There are 2 spaces between Ghetto and Misfortune's, not really visible in the forum.

Album art - illegal characters in filename issue

Reply #14
Artist tag: 24-Carat Black
Album tag: Ghetto: Misfortune's Wealth (Remastered 1994)
Image filename: 24-Carat Black - Ghetto  Misfortune's Wealth (Remastered 1994)
[2 spaces between Ghetto & Misfortune's]

Which means you probably helped me find the cause of the problem myself ;-) EAC replaces : and other not allowed characters with space in the filenames. So I guess there would have to be a possibility to map those characters to space in foobar when trying to batch attach album cover image files.

Yes, there's $replace() function. For example:
Code: [Select]
$replace(%artist% - %album%,:, )

or
Code: [Select]
$replace(%artist% - %album%,\, ,/, ,:, ,|, ,*, ,", ,<, ,>, ,?, )


Album art - illegal characters in filename issue

Reply #15
Artist tag: 24-Carat Black
Album tag: Ghetto: Misfortune's Wealth (Remastered 1994)
Image filename: 24-Carat Black - Ghetto  Misfortune's Wealth (Remastered 1994)
[2 spaces between Ghetto & Misfortune's]

Which means you probably helped me find the cause of the problem myself ;-) EAC replaces : and other not allowed characters with space in the filenames. So I guess there would have to be a possibility to map those characters to space in foobar when trying to batch attach album cover image files.

Yes, there's $replace() function. For example:
Code: [Select]
$replace(%artist% - %album%,:, )

or
Code: [Select]
$replace(%artist% - %album%,\, ,/, ,:, ,|, ,*, ,", ,<, ,>, ,?, )



Thank you so much!!!

Album art - illegal characters in filename issue

Reply #16
Yes, there's $replace() function. For example:


this won't work. foobar already replaces the bad characters internally so they don't even exist by time any title formatting functions kick in.

example album name

Code: [Select]
Overloaded: The Singles Collection




using your thinking, this image should not display because i've told it to look for a space instead of :

but as you can see from my filename and artwork panel with tooltip, it loads the file with a dash in place of the :

you cannot override the pattern it looks for.

Album art - illegal characters in filename issue

Reply #17
Additional question, would it be possible to do this replace AND replace é by e at the same time for example?

Album art - illegal characters in filename issue

Reply #18
It's simpler to use $ansi($replace(.....))

Album art - illegal characters in filename issue

Reply #19
Unfortunately, I also found a case where the replace function isn't able to replace : with space. It seems to work in many cases but not in all.

In any case, I'm giving up on this now, because the whole deal was already way too time consuming as is.

However, what I really would like to pass along to anyone actually involved in the project: If your software already includes batch converting music from a single-file-album with cue sheet, which is a great function, I would highly recommend you implement the functionality of embedding album art at the same time. This would save everyone using the conversion the second step and the whole messy deal with searching and replacing characters, which only geeks will try to do in the first place IMHO. Thanks to everyone who helped me with this.

Album art - illegal characters in filename issue

Reply #20
Unfortunately, I also found a case where the replace function isn't able to replace : with space. It seems to work in many cases but not in all.


given my explanation with screenshot above, it should not work in any cases. also, computers generally don't do random. it either works or it doesn't.

edit: thinking about it, i haven't actually tested the batch attach pictures feature with title formatting functions like $replace but i'd be amazed if it behaved differently to the artwork preferences given the message on the dialog.

Re: Album art - illegal characters in filename issue

Reply #21

i didn't quote it before because the part about replacing ? with _ is out of date. i'm too lazy to make a wiki account and change it. presumably it changed with v1 of foobar but i don't actually know.
The wiki still shows "_". So, what's replaced with what nowadays?

If I want to recreate the character replacement do I need to use some monstrous combination of embedded $replace functions? Still there isn't a function to invoke foobar's replacement process?