rename french accent because of linux

Download and get help for different MediaMonkey Addons.

Moderators: Peke, Gurus

kiko26
Posts: 4
Joined: Sat Aug 19, 2006 2:36 pm

rename french accent because of linux

Post by kiko26 »

I'm french and i have some problem. I hope someone could help me.
I just move all my files (mp3) to a NAS server on linux. i would like to rename all the files to remove all accent characters and spaces in the name of the mp3 file.

example, rename :
"S:\mp3\Cinéma\11 - Le 5ème élément.MP3"
in
"S:\mp3\cinema\11-le_5eme_element.mp3"

I would like to transform "11 - " by "11-" and all the "spaces" character by "_".


The letters with accent in french are :
- à â ä translate to a
- é è ê ë translate to e
- î ï translate to i
- ô ö translate to o
- ù û ü translate to u
- ÿ translate to y
- ç translate to c

i can do that (rename file) easily in my server (NAS on linux), but i can't do that in the mdb file of MediaMonkey. I think it is possible in vbs script in MediaMonkey, but i don't know this language.

i searched in many scripts available in this forum but i didnt find one to make what i desire.
if someone can help me, if would be coul.
thanks for all
and long life for mediamonkey

did mediamonkey exist for linux ?
Steegy
Posts: 3452
Joined: Sat Nov 05, 2005 7:17 pm

Post by Steegy »

You can try the script "PersonalTagEnhancer" with the modified code below:
PersonalTagEnhancer - http://www.mediamonkey.com/forum/viewto ... 2092#42092 & More info on customisation
-- Fixes tags using your personal preferences (e.g. "Featuring --> ft.", "RMX --> Remix", ...) that can easily be added/changed

The advantage of this script is that it gives a preview of the changes, and that it makes some other improvements too.

E.g. the ChangeCharacters part would then become:

Code: Select all

Function ChangeCharacters(Tag) 
   Tag = Replace(Tag, "´", "'", 1, -1, 1) 
   Tag = Replace(Tag, "`", "'", 1, -1, 1)

   Tag = Replace(Tag, " ", "_", 1, -1, 1) 
   Tag = Replace(Tag, " - ", "-", 1, -1, 1) 

   Tag = Replace(Tag, "à", "a", 1, -1, 1)
   Tag = Replace(Tag, "â", "a", 1, -1, 1)
   Tag = Replace(Tag, "ä", "a", 1, -1, 1)
   Tag = Replace(Tag, "á", "a", 1, -1, 1)

   Tag = Replace(Tag, "è", "e", 1, -1, 1)
   Tag = Replace(Tag, "ê", "e", 1, -1, 1)
   Tag = Replace(Tag, "ë", "e", 1, -1, 1)
   Tag = Replace(Tag, "é", "e", 1, -1, 1)

   Tag = Replace(Tag, "î", "i", 1, -1, 1)
   Tag = Replace(Tag, "ï", "i", 1, -1, 1)

   Tag = Replace(Tag, "ô", "o", 1, -1, 1)
   Tag = Replace(Tag, "ö", "o", 1, -1, 1)

   Tag = Replace(Tag, "ù", "u", 1, -1, 1)
   Tag = Replace(Tag, "û", "u", 1, -1, 1)
   Tag = Replace(Tag, "ü", "u", 1, -1, 1)
   Tag = Replace(Tag, "ú", "u", 1, -1, 1)

   Tag = Replace(Tag, "ÿ", "y", 1, -1, 1)

   Tag = Replace(Tag, "ç", "c", 1, -1, 1)

   ChangeCharacters = Tag 
End Function 
did mediamonkey exist for linux ?
There is no MediaMonkey version available (or planned) for Linux.

Cheers
Steegy
Extensions: ExternalTools, ExtractFields, SongPreviewer, LinkedTracks, CleanImport, and some other scripts (Need Help with Addons > List of All Scripts).
Steegy
Posts: 3452
Joined: Sat Nov 05, 2005 7:17 pm

Post by Steegy »

Or even better (much general, but therefore a bit slower):

Code: Select all

Function ChangeCharacters(Tag) 
   Tag = Replace(Tag, "´", "'", 1, -1, 1) 
   Tag = Replace(Tag, "`", "'", 1, -1, 1) 

   Tag = Replace(Tag, " ", "_", 1, -1, 1) 
   Tag = Replace(Tag, " - ", "-", 1, -1, 1)

   Tag = RemoveAccents(Tag)
End Function

Function RemoveAccents(InputString)
    Const AccentString = "ÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÏÑÒÓÔÕÖÙÚÛÜÝàáâãäåçèéêëìíîïðñòóóôõöùúûüýÿ"
    Const NonAccentStr = "AAAAAACEEEEIIIIINOOOOOUUUUYaaaaaaceeeeIIIIonoooooouuuuyy"

    RemoveAccents = InputString

    Dim i
    For i = 1 To Len(AccentString)
        RemoveAccents = Replace(RemoveAccents, Mid(AccentString, i, 1), Mid(NonAccentStr, i, 1))
    Next
End Function
Cheers
Steegy
Extensions: ExternalTools, ExtractFields, SongPreviewer, LinkedTracks, CleanImport, and some other scripts (Need Help with Addons > List of All Scripts).
Bex
Posts: 6316
Joined: Fri May 21, 2004 5:44 am
Location: Sweden

Post by Bex »

Note that Steegys great script changes the tags and not the file names!
You'll need to use the Auto-Organise feature afterwards todo that.

If you don't want to alter your tags you could try this:
1. Change the Character mapping in Mediamonkey.ini file
MediaMonkey Readme wrote: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.
I don't know if this will work but I think so. You'll need to add one line per character mapping.
- à â ä translate to a
- é è ê ë translate to e
- î ï translate to i
- ô ö translate to o
- ù û ü translate to u
- ÿ translate to y
- ç translate to c
Makes 16 lines plus one for 'space ' to '_'

Then you of course need to use the Auto-organise feature to rename all your files.
The advantage with this solution is that you can keep the tags with
accent characters.


2. If you have MM Gold you can filemonitor your whole collection and do the filename changes within Access. The changes you then make will actually rename the files if MM is running while you do them!
Use the Search and Replace feature on the field SongPath in the Songs table. Eeh, that means 17 times... Perhaps you could make an advanced formula, using the replace function, to do the job with an update query?

Edit!
Perhaps the easiest way is to alter Steegy's script to only rename the files instead...
Advanced Duplicate Find & Fix Find More From Same - Custom Search. | Transfer PlayStat & Copy-Paste Tags/AlbumArt between any tracks.
Tagging Inconsistencies Do you think you have your tags in order? Think again...
Play History & Stats Node Like having your Last-FM account stored locally, but more advanced.
Case & Leading Zero Fixer Works on filenames too!

All My Scripts
kiko26
Posts: 4
Joined: Sat Aug 19, 2006 2:36 pm

Post by kiko26 »

ok, thank a lot for your quick answer !

I only want to rename the files names (because of linux), i don't want to rename the id3 tag.

I will begin to do like Bex says.
i have MM Gold and i will do the point 2 of Bex before, and if it is ok, i xill do my all thousands files.
if this doesn't work, i will do the point 1 of Bex.

and this doesn't work like i want, i will test the Steegy's method.
thanks for all
I will tell you here what i do.
many thanks
Steegy
Posts: 3452
Joined: Sat Nov 05, 2005 7:17 pm

Post by Steegy »

Oops... sorry about that. I clearly didn't read the whole question well enough. Let's call it "profession deformity"... (that's translated from Dutch).
Change the Character mapping in Mediamonkey.ini file
Yeah, that should work perfectly.
Extensions: ExternalTools, ExtractFields, SongPreviewer, LinkedTracks, CleanImport, and some other scripts (Need Help with Addons > List of All Scripts).
Bex
Posts: 6316
Joined: Fri May 21, 2004 5:44 am
Location: Sweden

Post by Bex »

Steegy wrote:
Change the Character mapping in Mediamonkey.ini file
Yeah, that should work perfectly.
I recommend that too since it makes it easier to fix new tracks when they are added. You can also set up an auto-playlist to find the files that needs to be changed:
Path/Filename contians

Code: Select all

À;Á;Â;Ã;Ä;Å;Ç;È;É;Ê;Ë;Ì;Í;Î;Ï;Ï;Ñ;Ò;Ó;Ô;Õ;Ö;Ù;Ú;Û;Ü;Ý;à;á;â;ã;ä;å;ç;è;é;ê;ë;ì;í;î;ï;ð;ñ;ò;ó;ó;ô;õ;ö;ù;ú;û;ü;ý;ÿ
Advanced Duplicate Find & Fix Find More From Same - Custom Search. | Transfer PlayStat & Copy-Paste Tags/AlbumArt between any tracks.
Tagging Inconsistencies Do you think you have your tags in order? Think again...
Play History & Stats Node Like having your Last-FM account stored locally, but more advanced.
Case & Leading Zero Fixer Works on filenames too!

All My Scripts
kiko26
Posts: 4
Joined: Sat Aug 19, 2006 2:36 pm

Post by kiko26 »

well,

I used the method 2 of Bex, MM Gold was opened.

I opened the table Songs, and i changed one character é by e in this record, in the filename :
:\_a classer\BOF\Léon\BO Léon - Ballad for Mathilda.mp3

The result is :
:\_a classer\BOF\Léon\BO Leon - Ballad for Mathilda.mp3

MMGold take the change, all is ok.

After, i decide to change one character é by e in the name of subfolder, like this :
:\_a classer\BOF\Léon\BO Leon - Ballad for Mathilda.mp3

The result is :
:\_a classer\BOF\Leon\BO Leon - Ballad for Mathilda.mp3

Here, MMGold don't take the change and don't rename the subfolder in my hard disk.

Then , it's no good.

I think there's no soultion, for my problem.
I think i'm going to destroy my database in MMGold, rename all my folders, subfolders, and filenames, and rebuild my database in MMGold.

If someone has a different solution, i will take it.

thanks a lot for your spent time.
kiko26
Bex
Posts: 6316
Joined: Fri May 21, 2004 5:44 am
Location: Sweden

Post by Bex »

Ok, to bad it didn't work on folders, wonder why?

But, try alternativ one then!

You say that you will destroy your database and build up everything again! :o
There's no need for that (you will forever loose your playhistory, playcount, dateadded perhaps more...).
Simply do the editing within MM and everything will be fine!
Or if you use another application todo the editing just keep MM running and the file-monitor will update MM correctly!
Advanced Duplicate Find & Fix Find More From Same - Custom Search. | Transfer PlayStat & Copy-Paste Tags/AlbumArt between any tracks.
Tagging Inconsistencies Do you think you have your tags in order? Think again...
Play History & Stats Node Like having your Last-FM account stored locally, but more advanced.
Case & Leading Zero Fixer Works on filenames too!

All My Scripts
Steegy
Posts: 3452
Joined: Sat Nov 05, 2005 7:17 pm

Post by Steegy »

readme.txt wrote: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.

Code: Select all

[FilenameMappings]
3A=2D
2A=2D
3F=
3E=2D
3C=2D
22=27
7C=2D
2F=2D

E0=61
E2=61
E4=61

E9=65
E8=65
EA=65
EB=65

EE=69
EF=69

F4=6F
F6=6F

F9=75
FB=75
FC=75

FF=79

E7=63

A0=5F
First, make sure that MediaMonkey is closed.

Then, please open the MediaMonkey.ini file in your My Music/MediaMonkey folder (as indicated in the above "readme text") and replace your section [FilenameMappings] with the one above.

After that, you can (re)start MediaMonkey and use the "auto-organize" function on the tracks that you want to be renamed (accents etc. removed). You will now notice that the "conversions" you proposed are automaticly done by MediaMonkey.


Cheers
Steegy
Extensions: ExternalTools, ExtractFields, SongPreviewer, LinkedTracks, CleanImport, and some other scripts (Need Help with Addons > List of All Scripts).
Bex
Posts: 6316
Joined: Fri May 21, 2004 5:44 am
Location: Sweden

Post by Bex »

Yes, do what Steegy says!

If not, I actually found a script which adds underscore to the path:
http://www.mediamonkey.com/forum/viewtopic.php?t=10172
Perhaps you can alter it so it fit your needs...
Advanced Duplicate Find & Fix Find More From Same - Custom Search. | Transfer PlayStat & Copy-Paste Tags/AlbumArt between any tracks.
Tagging Inconsistencies Do you think you have your tags in order? Think again...
Play History & Stats Node Like having your Last-FM account stored locally, but more advanced.
Case & Leading Zero Fixer Works on filenames too!

All My Scripts
Steegy
Posts: 3452
Joined: Sat Nov 05, 2005 7:17 pm

Post by Steegy »

Code: Select all

Sub NormalizeFilename
  Dim list, itm, i, tmp, res, qty, message 

  Set list = SDB.CurrentSongList 

  res = SDB.MessageBox( "About to (possibly) modify " + CStr(list.count) + " files. Continue?", mtConfirmation, Array(mbOk, mbCancel)) 

  if res = mrOK then 
    For i=0 To list.count-1 
      Set itm = list.Item(i) 
      tmp = itm.Path

      tmp = Replace(tmp, " ", "_") 
      tmp = Replace(tmp, "´", "'") 
      tmp = Replace(tmp, "`", "'") 

      tmp = Replace(tmp, " ", "_") 
      tmp = Replace(tmp, " - ", "-") 

      tmp = RemoveAccents(tmp)

      itm.Path = tmp 
      itm.UpdateDB 
    Next 
  End If 
End Sub 


Function RemoveAccents(InputString) 
    Const AccentString = "ÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÏÑÒÓÔÕÖÙÚÛÜÝàáâãäåçèéêëìíîïðñòóóôõöùúûüýÿ" 
    Const NonAccentStr = "AAAAAACEEEEIIIIINOOOOOUUUUYaaaaaaceeeeIIIIonoooooouuuuyy" 

    RemoveAccents = InputString 

    Dim i 
    For i = 1 To Len(AccentString) 
        RemoveAccents = Replace(RemoveAccents, Mid(AccentString, i, 1), Mid(NonAccentStr, i, 1)) 
    Next 
End Function
Just a quick mod of the script that Bex linked. I emphasize "quick" because I don't have much time and didn't test it.

Cheers
Steegy
Extensions: ExternalTools, ExtractFields, SongPreviewer, LinkedTracks, CleanImport, and some other scripts (Need Help with Addons > List of All Scripts).
kiko26
Posts: 4
Joined: Sat Aug 19, 2006 2:36 pm

Post by kiko26 »

Hello, i just finished the rename of my collection using the last script given by Steegy.

i have had few problem but now it's ok.
i want to thank you all for your job and your time.

now all my mp3 filename don't have french accent and space, for my linux server it's very fine.

many thanks.
bye
kaste
Posts: 3
Joined: Thu Oct 27, 2005 2:50 am

Re: rename french accent because of linux

Post by kaste »

very old thread ... I just thought I post my [FilenameMappings] here. That way I keep all tags as they are, but the file names themselves are clean 7 bit ascii, I think.
Cheers, Kai.
21=
22=27
2A=2D
2F=2D
3A=2D
3E=2D
3C=2D
3F=
81=2D
82=2C
83=66
84=2C
85=5F
86=2D
87=2D
88=5E
89=5F
8A=5F
8B=5F
8C=5F
8D=5F
8E=5A
8F=5F
90=5F
91=27
92=27
93=27
94=27
95=2D
96=2D
97=2D
98=7E
99=2D
9A=2D
9B=2D
9C=2D
9D=2D
9E=7A
9F=59
A0=20
A1=5F
A2=5F
A3=5F
A4=5F
A5=5F
A6=5F
A7=5F
A8=5F
A9=5F
AA=5F
AB=5F
AC=5F
AD=2D
AE=5F
AF=2D
B0=5F
B1=5F
B2=32
B3=33
B4=27
B5=5F
B6=5F
B7=5F
B8=5F
B9=5F
BA=5F
BB=5F
BC=5F
BD=5F
BE=5F
BF=
C0=41
C1=41
C2=41
C3=41
C4=41
C5=41
C6=41
C7=43
C8=45
C9=45
CA=45
CB=45
CC=49
CD=49
CE=49
CF=49
D0=44
D1=4E
D2=4F
D3=4F
D4=4F
D5=4F
D6=4F
D7=2D
D8=2D
D9=55
DA=55
DB=55
DC=55
DD=59
DE=2D
DF=73
E0=61
E1=61
E2=61
E3=61
E4=61
E5=61
E6=61
E7=63
E8=65
E9=65
EA=65
EB=65
EC=69
ED=69
EE=69
EF=69
F0=2D
F1=6E
F2=6F
F3=6F
F4=6F
F5=6F
F6=6F
F7=2D
F8=2D
F9=75
FA=75
FB=75
FC=75
FD=79
FE=2D
FF=79
beans

Re: rename french accent because of linux

Post by beans »

Hi, I've tried this and edited the MediaMonkey.ini file in the C:\Documents and Settings\USER\Local Settings\Application Data\MediaMonkey folder. And after reopening MediaMonkey nothing happens. When I check the .ini file again, it has reverted back to the way it was originally--deleting everything I've added. Any help would be appreciated.
Post Reply