HydrogenAudio

Hosted Forums => foobar2000 => General - (fb2k) => Topic started by: stevehero on 2020-09-01 01:48:07

Title: beta v1.6 beta 17 - File ops - ? character is getting replaced with _ and others
Post by: stevehero on 2020-09-01 01:48:07
Before the illegal filename ? character would get replaced with nothing.

Now it's getting replaced with an underscore.

Is this permanent or a bug that's just slipped in?

It appears the something has changed with illegal characters. I haven't changed my file op formatting is ages (2 years) but it's now picking up on things it wasn't before.
Title: Re: beta v1.6 beta 17 - File ops - ? character is getting replaced with _ and others
Post by: Peter on 2020-09-01 11:30:21
It's meant to be replaced with an underscore if in mid-text and removed if trailing. But point noted, it will be changed to work like old versions did for the sake of consistency.
Title: Re: beta v1.6 beta 17 - File ops - ? character is getting replaced with _ and others
Post by: stevehero on 2020-09-01 11:34:52
Thanks. I think the pipe character has changed to an underscore. It was changed before to a hyphen I believe. 
Title: Re: beta v1.6 beta 17 - File ops - ? character is getting replaced with _ and others
Post by: deus-ex on 2020-09-01 12:56:13
It's meant to be replaced with an underscore if in mid-text and removed if trailing. But point noted, it will be changed to work like old versions did for the sake of consistency.
In the recent builds you would also get an underscore for trailing illegal characters, i.e. the cases I witnessed affected the "?" character. How about making it togglable, perhaps with an option to define the replacing character?
Title: Re: beta v1.6 beta 17 - File ops - ? character is getting replaced with _ and others
Post by: felldownawell on 2020-09-07 02:25:50
Thanks. I think the pipe character has changed to an underscore. It was changed before to a hyphen I believe.

Can confirm.  Change still present in v1.6 final.
Title: Re: beta v1.6 beta 17 - File ops - ? character is getting replaced with _ and others
Post by: deus-ex on 2020-09-07 09:33:53
Make sure that the advanced setting is disabled accordingly (screenshot).
Title: Re: beta v1.6 beta 17 - File ops - ? character is getting replaced with _ and others
Post by: stevehero on 2020-09-07 11:57:30
Make sure that the advanced setting is disabled accordingly (screenshot).
 
 This is for the converter. The issue is with file ops.
Title: Re: beta v1.6 beta 17 - File ops - ? character is getting replaced with _ and others
Post by: Sohl on 2020-09-07 13:28:50
Make sure that the advanced setting is disabled accordingly (screenshot).

 This is for the converter. The issue is with file ops.

There is also an identical option under 'Advanced/Tools/File Operations'
Title: Re: beta v1.6 beta 17 - File ops - ? character is getting replaced with _ and others
Post by: stevehero on 2020-09-07 14:27:20
Thanks, silly me. Updated to v1.6.

Although when it's unchecked the pipe character is getting replaced with an underscore whereas before it was getting replaced with a hyphen AFAIK.
Title: Re: beta v1.6 beta 17 - File ops - ? character is getting replaced with _ and others
Post by: scrambles on 2020-09-11 16:31:09
Although when it's unchecked the pipe character is getting replaced with an underscore whereas before it was getting replaced with a hyphen AFAIK.

The change in pipe character replacement threw me for a loop because I thought new files weren't synching to my devices correctly, as many of my genre tags use a pipe. I tried to get around it by changing my pattern to explicitly replace | with - but it looks like the automatic replacement is done before the pattern matching. Is all of this intended and if so is there any way for a user to replace | with -?
Title: Re: beta v1.6 beta 17 - File ops - ? character is getting replaced with _ and others
Post by: stevehero on 2020-09-11 21:30:19
.. is there any way for a user to replace | with -?
You're going to have to wrap your existing format and use something like so:

Code: [Select]
$replace(yourexistingformathere,|,-)
Title: Re: beta v1.6 beta 17 - File ops - ? character is getting replaced with _ and others
Post by: scrambles on 2020-09-17 18:14:42
You're going to have to wrap your existing format and use something like so:

Code: [Select]
$replace(yourexistingformathere,|,-)

Unfortunately, this doesn't work - the replacement of | to _ seems to be impossible to override currently. I wonder if this is intended or not, as it seems inconsistent.
Title: Re: beta v1.6 beta 17 - File ops - ? character is getting replaced with _ and others
Post by: stevehero on 2020-09-17 19:46:56
It works for me in the latest beta.
Title: Re: beta v1.6 beta 17 - File ops - ? character is getting replaced with _ and others
Post by: scrambles on 2020-09-17 21:10:56
Ran a simplified test case in 1.6.1 beta 6, screenshot in attachment.
Title: Re: beta v1.6 beta 17 - File ops - ? character is getting replaced with _ and others
Post by: stevehero on 2020-09-17 23:37:28
Ran a simplified test case in 1.6.1 beta 6, screenshot in attachment.
 
 

You're right. What I actually did was: (Not ideal I know but this mimics the behaviour I had before)

Code: [Select]
$replace('a_string',_,-)
Title: Re: beta v1.6 beta 17 - File ops - ? character is getting replaced with _ and others
Post by: scrambles on 2020-09-18 20:21:30
That's a damn good workaround, thank you for the suggestion. Files with artist or album tags that include a pipe are still going to be updated but that's a handful vs tens of thousands, so calling it a good solution.
Title: Re: beta v1.6 beta 17 - File ops - ? character is getting replaced with _ and others
Post by: stevehero on 2020-09-18 20:36:03
That's a damn good workaround, thank you for the suggestion. Files with artist or album tags that include a pipe are still going to be updated but that's a handful vs tens of thousands, so calling it a good solution.
 
 You also could do this:

Code: [Select]
$replace($replace($replace('a_string',_,mytempunderscorefix),_,-),mytempunderscorefix,_)

This way you retain any underscores.
Title: Re: beta v1.6 beta 17 - File ops - ? character is getting replaced with _ and others
Post by: felldownawell on 2020-09-18 21:30:11
You're right. What I actually did was: (Not ideal I know but this mimics the behaviour I had before)

Code: [Select]
$replace('a_string',_,-)


Thanks for this.  Simple, but it never occurred to me this would work on illegal character replacements.

Scrambles, I just wrapped the $replace around the whole file name pattern and it addressed artist and album tags just fine.
Title: Re: beta v1.6 beta 17 - File ops - ? character is getting replaced with _ and others
Post by: scrambles on 2020-09-19 00:20:24
You also could do this:

Code: [Select]
$replace($replace($replace('a_string',_,mytempunderscorefix),_,-),mytempunderscorefix,_)

This way you retain any underscores.

I thought this was brilliant but it actually doesn't work, as the pipes are replaced with underscores before the pattern is even matched.
Title: Re: beta v1.6 beta 17 - File ops - ? character is getting replaced with _ and others
Post by: stevehero on 2020-09-19 00:48:57
Not much that can be done then, I didn't test that but thought it may work.

Pity there's no character set that the user could use for the replacement of each illegal character.
Title: Re: beta v1.6 beta 17 - File ops - ? character is getting replaced with _ and others
Post by: marc2k3 on 2020-12-23 21:32:52
Regarding ? replacements, the SDK function pfc::io::path::charReplaceDefault could do with updating as it currently falls through to using an underscore which doesn't match the behaviour of file operations/converter.