How to remove illegal chars in file name while mass renaming

Post a reply

Smilies
:D :) :( :o :-? 8) :lol: :x :P :oops: :cry: :evil: :roll: :wink:

BBCode is ON
[img] is ON
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: How to remove illegal chars in file name while mass renaming

Re: How to remove illegal chars in file name while mass renaming

by Peke » Sun Mar 24, 2019 8:23 pm

Feature: Options in Auto-Organise to remove or replace problem characters in filenames

by colin_e » Sat Mar 23, 2019 10:10 am

This issue has been kicking around for years, and it's still causing problems.

I recently had my music server (Logitech Media Server) choke on some new files I had added, because the tags (and thence filenames in auto-organise) contained Unicode characters including-
  • Left/right single and double quotes
  • Ellipsis (...)
  • Left/right single quotes
And i'm a native English speaker! Imagine what it's like for anyone with a lot of albums/tracks by artists from non-English speaking countries.

For the moment I have hacked something up using nested $Replace() functions, but it's verbose, ugly, and not general. It will fail each time it hits a new character it doesn't have a rule for.

I know there's a feature to map characters in the MM.ini file, but that's pretty well hidden, and apparently it doesn't handle Unicode. Both of those things need to be fixed with a general-purpose set of functions for "fixing up" characters in both tags and pathnames to suit the needs and limitations of the systems (e.g. media server, streamer) being used.

Re: Auto-organise- unsupported/dangerous characters in filenames

by colin_e » Sat Mar 23, 2019 9:55 am

Well, this deals with the specific cases I've found so far (except MM won't create a filename with 3 trailing dots it seems, (i.e filename...). but it's not pretty, and it won't deal with Unicode chars I haven't seen before.

Auto-Organise rule that deals with-

Folder/Directory
  • Unicode "Smart" left/right double quote characters (“”)
  • Unicode ellipsis … (tries to replace it with 3 trailing full stops but that doesn't happen)
Track filename
  • Unicode left single quotation mark (‘)

Code: Select all

<path to music library>\$Replace($Replace($Replace($Replace(<Album Artist>\<Album>,“,),”,),…,...)\$Replace(<Track#:2> - <Title>,’,')
This would be much easier if MM had a $SafeChars or $Translate (something like the tr command in Unix) to map one set of characters to another (or nothing) in a single function.

Auto-organise- unsupported/dangerous characters in filenames

by colin_e » Sat Mar 23, 2019 9:00 am

Client: Windows 7 Pro 64bit
File Server: Debian Buster/Sid with Logitech Media Server (LMS)

I know this is a question that's been answered before, but I am am looking for some more detail on the answer.

I recently had a problem with my music server (LMS) not scanning all my music files, and after some digging it turned out that non-ASCII characters (i.e. Latin1 or Unicode) in pathnames for files like -

Code: Select all

I'm Mandy Fly Me.flac
(that's a "smart apostrophe" in Unicode) were the cause.

The answer given in the above thread says-

From the MediaMonkey Readme.txt
b) .ini file customization
MediaMonkey saves configuration information on a per-user basis to an .ini file stored in:
C:\Documents and Settings\USERX\My Documents\My Music\MediaMonkey\MediaMonkey.ini

Advanced users can edit the MediaMonkey.ini file to change several settings. If you
plan on making such changes, it's prudent to back up your .ini file beforehand. Also
make certain to close MediaMonkey before making such changes so that it doesn't
overwrite any of the changes you've made.

ii) To eliminate illegal characters when auto creating file names from tags, there is a section
[FilenameMappings] in the .ini file, where hexadecimal values define mappings between characters.
For example E1=61 means that "/" is mapped to "a". You can modify these settings if you're
adventurous. You can find hexadecimal values of characters in the "Character map" application
included with Windows. Note that unicode is not supported in this feature.
Question- What does "unicode is not supported" actually mean? What happens if a Unicode character is encountered in a tag, and you want to use this feature?

Case in point-

You wouldn't think of Joe Walsh as a source of "international character" problems, but his album

Code: Select all

“But Seriously, Folks…”
causes problems at two levels-
  • If you leave the Unicode chars in the filename (two smart quotes and the single "..." ellipsis character) it will choke LMS
  • If you set MM to use only ASCII values in tags (a) You are losing information from the tag; and (b) A Linux server won't allow you to write a filename containing plain ASCII quotes.
So. somehow I want to configure around this without losing the ability to use auto-organise, which is a crucial feature for me.

I have also seen the $Replace() function referred to in auto-organise masks. I wonder if this is an option...

by pierrotlefou » Sat Aug 21, 2004 4:18 am

It works, Thanks
:lol:

avoiding illegal characters for auto-rename

by rusty » Fri Aug 20, 2004 7:42 am

From the readme:

iii)To eliminate illegal characters when auto creating file names from tags, there is a section
[FilenameMappings] in the .ini file, where hexadecimal values define mappings between characters.
For example E1=61 means that "/" is mapped to "a". You can modify these settings if you're
adventurous. You can find hexadecimal values of characters in the "Character map" application
included with Windows. Note that unicode is not supported in this feature.

Let me know if you have any questions...

-Rusty

How to remove illegal chars in file name while mass renaming

by Pierrotlefou » Thu Aug 19, 2004 7:46 am

Some ID Tag may contain chars such as ":", "?", "\".

Is there a way to automaticaly remove/replace those chars when renaming files with the "auto-organize file" tool? and not modifying the IDtag?

Thanks
Pierrot

Top