Tuesday, March 06, 2007

Updating MP3 filenames

I already have tag editing in Goggles Music Manager, but that feature is not really complete unless you also have the ability to update the corresponding filename. Imagine that you change the title of a track, the filename would probably need to reflect the new title as well. Often you might have filenames that are not correct, stored in the wrong location, or stored in a flat directory instead of hierarchy type directory structure. So there is definitely a need to change the filename.

What's not easy is to determine what the new filename should be. There are several factors we should take care of:
  1. Character encoding of the file system. This may be specified by the current locale, but also you should be able to override it. For example, your current locale is UTF8 but you only want to write 7-bit ASCII to support transferring files to devices with no UTF8 support.
    Then there is this issue of converting unicode to 8 bit character encodings. Some combined characters in unicode may not have a equivelant character in the target encoding, but in decomposed form they may (for example the character "ë").
  2. Characters that have a special meaning in shells should be removed.
  3. Simplify white space usage.
  4. Optionally substitute any spaces for underscores.
  5. Optionally only use lower case characters.
  6. Optionally only use lower case characters for the file extension.

No comments: