SongKong Jaikoz

SongKong and Jaikoz Music Tagger Community Forum

Sanitize a name with "/"

Hi Paul,

I don’t think this is really a bug, yet I don’t know if there is a standard way to fix this.

Having a release with a slash in album’s name, when renaming the files, it creates an unwanted subfolder.
See screenshot:

My filename mask is using ifnotempty(album,'/').
Cheers

What platform is this on?

Windows 11 (that’s why “/” creates a subfolder).

Ah maybe that’s the issue I’m not aware of this / as well as \ on Windows 11?

Yes, it seems that W11 doesn’t accept anymore / in pathname.
Maybe it’s because I enabled WSL?

image
Me, trying to add a “/” for renaming the folder “81/89”

Actually Im not sure why this is happening, we already fixed this to solve the AC/DC issue.

If you go to Preferences:FileName Masks, select your mask and Edit, then modify data in Example 1 so it looks a bit like your album do you see the issue or only when run it? Because for my mask it converts any / in fieldname to - and this is done automatically by SongKong I havent coded it in the rename mask itself.

And I tried it for real on an ACDC folder so although the Album Artist is set to AC/DC the folder name is AC-DC

image

This is on Windows 10, but the conversion is made in the code so I dont think this is actually a Windows 11 issue.

Hi Paul,
I set album to “Revolver / Volver” in example 1 and, indeed, it was correctly transformed in the sample:
image
… at least visually.

I’m going to do some additional testing here to try to pinpoint the conditions under which the error could recur.

Hi Paul,

I found the issue!
It’s when using discogs_album instead of album.
Even if the sample is correctly displayed, it is not sanitized when actually renaming the file (so, from my perspective, it’s a double issue because the results from samples should exactly reproduce the renaming sequence).

This being said, have you considered replacing / by (Big solidus) instead of hyphen-minus?
It would be much more “visual” for AC⧸DC or 1⧸4 and it looks great in file explorer:
image

Good work, okay I have replicated issue and it could occur whenever using a MusicBrainz or Discogs script field rather than a regular script field - https://jthink.atlassian.net/browse/SONGKONG-2781

Solved a difficult to find bug a while ago whereby user was using FRACTIONSLASH character instead of regular slash character so was not converted to - by SongKong, however the underlying operating system did treat like a slash and removed from filename. This was very confusing and I think use of the BigSolidus character could also be confusing for the average user so I don’t want to do this.

I thought you could write a function to use BigSolidus but that would be tricky because the conversion from / to - has to be done on per field before we apply the Filename Rename mask so you cannot do it directly within Filename Rename mask as the Slash has already be converted to Hyphen before the rename mask is applied.

You could do it by use Scripter to change the value before using Filename mask because the Slash to Hyphen conversion is not done in Scripter as not necessary. For example if want to use discogs_album since it is not a regular field you could copy this value to custom1 field and apply conversion of Hyphen to Big Solidus as you do it, then use custom1 field instead of discogs_album in your rename mask.

But this is all a bit complicated so I have created an improvement issue to Replaces Slashes with option

https://jthink.atlassian.net/browse/SONGKONG-2782