Skip to main content
Topic: Is there no way to change the illegal characters "\" &q (Read 4432 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Is there no way to change the illegal characters "\" &q

I've encountered a problem that's been discussed here before, but the solution they came to is not sufficient for me. What they managed in the end, was to change all the illegal characters to hyphens (-). But I actually want to transform "\" and "/" into " -- " (to hyphens, space before and after) and ":" into " -" (a space before the hyphen).

Is there any way to do this? Has the renamer perhaps been updated since that last thread? I don't really see why the renamer shouldn't work with those characters... Or is it the $replace() function?

Is there no way to change the illegal characters "\" &q

Reply #1
ah, that is a problem.  yes it is the replace function.  you might look at this program, i've used it before.  it's quick, and very lightweight.

http://cerebralsynergy.com/download.php?view.55

here is a crude "tutorial".  please excuse the crudeness, i did it quickly.  hopefully this helps.

http://img161.imagevenue.com/img.php?image...e_122_504lo.JPG

Is there no way to change the illegal characters "\" &q

Reply #2
Thanks , but if it's not incorporated in foobar, I'll rather stick to underscores until this is fixed. Renaming files without foobar knowing will surely only lead to further problems/more work, and the meaning of my script was to rename my entire library by the press of a button.

But thanks anyway, greatly appreciated.

Edit: I see that the renamer you linked to renames the files based on tags, and noe just replaces the underscores (of course, since I stated that I want underscores replaced differently depending on the original). This won't do at all, since I've build up a fairly "advanced" script in foobar (it's getting more advanced by the day), and that program surely doesn't support such scripts. I'm not renaming my entire library in one single way; the renaming depends upon many factors.

Oh, and another thing about the renamer - why does foobar hang so long after renaming/moving a bunch of files? (It hangs maybe 10-15 seconds when moving a single album of 10-20 tracks.)

Is there no way to change the illegal characters "\" &q

Reply #3
this might work...

try using $strchr(s,c) to find out whether the underscore was a slash or a colon.  then use the replace function in an if statement based on that info.  for example:

Code: [Select]
$ifgreater($strchr(%tag%,'/'),1,$replace(%tag%,'_',' -- '),)
$ifgreater($strchr(%tag%,':'),1,$replace(%tag%,'_',' -'),)


of course, this wouldn't work if there are both slashes and colons in the same tag.  but i have a feeling that that wouldn't be the case.

Is there no way to change the illegal characters "\" &q

Reply #4
Thanks, but I'd rather prefer a foolproof method that works no matter what's the case. Until that happens, I'll just live with underscores. After all, it's what it looks like inside foobar that matters the most.

Is there no way to change the illegal characters "\" &q

Reply #5
this would be SO easy to do if there would be proper loops in foobar script.  unfortunately, it's a bit of a disaster without them.  i think it can be done though.

basically the idea is to use $strchr() (in conjunction with $right() and a bunch of variables) to find where the colons and slashes are, then using $insert() to, umm, insert the dashes in the correct place(s), then, finally use $replace() to remove the colons and slashes.

but, like i said, it would be a HUGE disaster.

Is there no way to change the illegal characters "\" &q

Reply #6
Have you tried something along the lines of:
Code: [Select]
$replace(%tag%,
$char(34),_,$char(42),_,$char(47), -- ,
$char(58), -,$char(60),_,$char(62),_,
$char(63),_,$char(92), -- ,$char(124),_)

* replace the underscores with whatever you like

Is there no way to change the illegal characters "\" &q

Reply #7
Is there a list of all $char characters?

Is there no way to change the illegal characters "\" &q

Reply #8
the $char() command uses standard ascii values, type "ascii table" into google and take your pick from the many lists.

Is there no way to change the illegal characters "\" &q

Reply #9
Thanks, I found the list at Wikipedia. I'll try as soon as I get the chance.

Is there no way to change the illegal characters "\" &q

Reply #10
Nope, didn't work.  This is starting to annoy me.

Is there no way to change the illegal characters "\" &q

Reply #11
sorry you had to go through that. i could have told you it wasn't going to work, because i tried the same thing.  in fact i believe i posted something to that effect in the thread mentioned above.

Is there no way to change the illegal characters "\" &q

Reply #12
So is the renamer filtering tags for illegal characters BEFORE it applies the titleformatting?


Is there no way to change the illegal characters "\" &q

Reply #14
yes, so unfortunately that goes for any function, so that my previous disastrous solution will not work.

so.... you and i and everyone else will just have to deal. 

Is there no way to change the illegal characters "\" &q

Reply #15
What I've always done (for the past 3 years or so), is wrap my whole string with a $replace() string so it looks kind of like this:

$replace(X:\covers\%artist% - %album%,\,,/,,",,*,,:,,<,,>,,?,,|,)

so it just replaces all the illegals with nothing. Underscores are ugly. I do this because when you copy+paste a string with illegal characters into a filename in windows, it does the same thing; replaces the illegals with nothing.

I wish there was an option in the foobar core that handles the way all illegal characters are handled when renamed. having huge $replace() functions everywhere kind of sucks :\

 
SimplePortal 1.0.0 RC1 © 2008-2020