@culinko
Have you considered using $findfile with PSS?
From PSS wiki
$findfile(path,[path2,path3,...])
Determinates whether the specified file(s) exist(s) and returns the first file. If you do not have the file does not return anything. (Strictly speaking, "false" returns). Path can be specified. The path allows wildcards.
The below should check both the original path & the path with the foobar2000/JScript Biography replacement of illegal characters. An advantage of this is that covers saved are compatible with both foobar2000 album art reader, if ever you want to use that, as well as your PSS configuration.
$set_ps_global(artist.name,$replace(%artist%,'?','_',':','_','/','_','*','_','"','_','\','_','|','_','<','_','>','_'))
$set_ps_global(album.name,$replace(%album%,'?','_',':','_','/','_','*','_','"','_','\','_','|','_','<','_','>','_'))
$set_ps_global(album.artist.name,$replace(%album artist%,'?','_',':','_','/','_','*','_','"','_','\','_','|','_','<','_','>','_'))
$set_ps_global(album2.name,$replace(%album%,/,-,\,-,|,-,:,-,*,x,"",'',<,_,>,_,?,))
$set_ps_global(album2.artist.name,$replace(%album artist%,/,-,\,-,|,-,:,-,*,x,"",'',<,_,>,_,?,))
$set_ps_global(cover.path,
$findfile(
$replace(%path%,%filename_ext%,)Cover\$get_ps_global(album.artist.name) - $get_ps_global(album.name) '['%date%']'.*,
$replace(%path%,%filename_ext%,)Cover\$get_ps_global(album2.artist.name) - $get_ps_global(album2.name) '['%date%']'.*
)
)
I removed ' quotes from the code I wrote as I don't think they're necessary & used wild card for extension. I confirmed that $findfile works as stated although haven't tested the actual code, so it might need tweaking.
There is another way if my memory of PSS is correct where you test if your original path exists using $findfile, & if it doesn't exist try & load the image provided by foobar2000 album art reader; i.e. conditionally set whether to use something like %path%,artreader or $get_ps_global(cover.path) in the $drawimage or $imageabs functions.
If those aren't to your liking, then I can tell you how to edit the code so all illegal characters are replaced with an underscore. It should be a simple one line change. I am reluctant to offer it as an option as someone's sure to set it inadvertently & break things + you can solve the issue, I think, by yourself by a small change to the PSS code as indicated.
HTH