And another attempt to normalize

This commit is contained in:
Ade
2014-10-01 22:13:02 +13:00
parent 63a32e473f
commit 63e106a12d
2 changed files with 9 additions and 5 deletions

View File

@@ -177,10 +177,13 @@ def replace_all(text, dic, normalize=False):
for i, j in dic.iteritems():
if normalize:
if sys.platform == 'darwin':
j = unicodedata.normalize('NFD', j)
else:
j = unicodedata.normalize('NFC', j)
try:
if sys.platform == 'darwin':
j = unicodedata.normalize('NFD', j)
else:
j = unicodedata.normalize('NFC', j)
except TypeError:
j = unicodedata.normalize('NFC', j.decode(headphones.SYS_ENCODING, 'replace'))
text = text.replace(i, j)
return text

View File

@@ -629,10 +629,11 @@ def renameNFO(albumpath):
logger.error(u'Could not rename file: %s. Error: %s' % (os.path.join(r, file).decode(headphones.SYS_ENCODING, 'replace'), e))
def moveFiles(albumpath, release, tracks):
logger.info("Moving files: %s" % albumpath)
try:
year = release['ReleaseDate'][:4]
except TypeError:
year = ''
year = u''
artist = release['ArtistName'].replace('/', '_')
album = release['AlbumTitle'].replace('/', '_')