use unicodedata.normalize for sort_title

This commit is contained in:
j 2010-11-14 19:58:33 +01:00
parent dcd8731b75
commit 67a31d1f58

View file

@ -7,6 +7,7 @@ import os
import sys import sys
import re import re
import hashlib import hashlib
import unicodedata
import ox import ox
import ox.iso import ox.iso
@ -164,7 +165,10 @@ def parse_path(path):
def sort_title(title): def sort_title(title):
#title #title
title = re.sub(u'[\'!¿¡,\.;\-"\:\*\[\]]', '', title) title = re.sub(u'[\'!¿¡,\.;\-"\:\*\[\]]', '', title)
title = title.replace(u'Æ', 'Ae')
#title = title.replace(u'Æ', 'Ae')
title = unicodedata.normalize('NFKD',title)
#pad numbered titles #pad numbered titles
title = re.sub('(\d+)', lambda x: '%010d' % int(x.group(0)), title) title = re.sub('(\d+)', lambda x: '%010d' % int(x.group(0)), title)
return title.strip() return title.strip()