How to remove illegal chars in file name while mass renaming

Any ideas about how to improve MediaMonkey for Windows 4? Let us know!

Moderator: Gurus

Pierrotlefou

How to remove illegal chars in file name while mass renaming

Post by Pierrotlefou »

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
rusty
Posts: 8396
Joined: Tue Apr 29, 2003 3:39 am
Location: Montreal, Canada

avoiding illegal characters for auto-rename

Post by rusty »

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
pierrotlefou

Post by pierrotlefou »

It works, Thanks
:lol:
colin_e
Posts: 80
Joined: Thu Dec 28, 2006 6:39 pm

Auto-organise- unsupported/dangerous characters in filenames

Post by colin_e »

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...
Regards: Colin
colin_e
Posts: 80
Joined: Thu Dec 28, 2006 6:39 pm

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

Post by colin_e »

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.
Regards: Colin
colin_e
Posts: 80
Joined: Thu Dec 28, 2006 6:39 pm

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

Post by colin_e »

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.
Regards: Colin
Peke
Posts: 17457
Joined: Tue Jun 10, 2003 7:21 pm
Location: Earth
Contact:

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

Post by Peke »

Best regards,
Peke
MediaMonkey Team lead QA/Tech Support guru
Admin of Free MediaMonkey addon Site HappyMonkeying
Image
Image
Image
How to attach PICTURE/SCREENSHOTS to forum posts
Post Reply