move all non ascii first letters into _
This commit is contained in:
parent
643e2e587e
commit
9a6b212ec4
1 changed files with 3 additions and 0 deletions
|
@ -9,6 +9,7 @@ import shutil
|
||||||
import stat
|
import stat
|
||||||
import unicodedata
|
import unicodedata
|
||||||
import time
|
import time
|
||||||
|
import string
|
||||||
|
|
||||||
import ox
|
import ox
|
||||||
from sqlalchemy.orm import load_only
|
from sqlalchemy.orm import load_only
|
||||||
|
@ -772,6 +773,8 @@ class File(db.Model):
|
||||||
title = '%s (%s)' % (title, extra.strip())
|
title = '%s (%s)' % (title, extra.strip())
|
||||||
filename = '%s.%s' % (title, extension)
|
filename = '%s.%s' % (title, extension)
|
||||||
first = unicodedata.normalize('NFD', author[0].upper())[0].upper()
|
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 = os.path.join(first, author, filename)
|
||||||
new_path = new_path.replace('\x00', '')
|
new_path = new_path.replace('\x00', '')
|
||||||
new_path = new_path.replace('\n', ' ').replace(' ', ' ')
|
new_path = new_path.replace('\n', ' ').replace(' ', ' ')
|
||||||
|
|
Loading…
Reference in a new issue