move all non ascii first letters into _

This commit is contained in:
j 2017-06-12 17:00:32 +02:00
parent 643e2e587e
commit 9a6b212ec4
1 changed files with 3 additions and 0 deletions

View File

@ -9,6 +9,7 @@ import shutil
import stat
import unicodedata
import time
import string
import ox
from sqlalchemy.orm import load_only
@ -772,6 +773,8 @@ class File(db.Model):
title = '%s (%s)' % (title, extra.strip())
filename = '%s.%s' % (title, extension)
first = unicodedata.normalize('NFD', author[0].upper())[0].upper()
if first not in string.ascii_uppercase:
first = '_'
new_path = os.path.join(first, author, filename)
new_path = new_path.replace('\x00', '')
new_path = new_path.replace('\n', ' ').replace(' ', ' ')