use path to populate unknown sort names, #958
This commit is contained in:
parent
fdb358ea89
commit
7b22bba4e7
2 changed files with 7 additions and 2 deletions
|
@ -9,7 +9,7 @@ from django.conf import settings
|
|||
|
||||
from item.models import get_item, Item
|
||||
import item.tasks
|
||||
|
||||
from person.models import get_name_sort
|
||||
import models
|
||||
import extract
|
||||
|
||||
|
@ -17,6 +17,9 @@ _INSTANCE_KEYS = ('mtime', 'path')
|
|||
|
||||
def get_or_create_item(volume, info, user):
|
||||
item_info = ox.parse_movie_path(info['path'])
|
||||
if item_info.get('director') and item_info.get('directorSort'):
|
||||
for name, sortname in zip(item_info['director'], item_info['directorSort']):
|
||||
get_name_sort(name, sortname)
|
||||
return get_item(item_info, user)
|
||||
|
||||
def get_or_create_file(volume, f, user, item=None):
|
||||
|
|
|
@ -15,11 +15,13 @@ import item.models
|
|||
import managers
|
||||
import tasks
|
||||
|
||||
def get_name_sort(name):
|
||||
def get_name_sort(name, sortname=None):
|
||||
name = unicodedata.normalize('NFKD', name).strip()
|
||||
if name:
|
||||
person, created = Person.objects.get_or_create(name=name)
|
||||
if created:
|
||||
if sortname:
|
||||
person.sortname = sortname
|
||||
person.save()
|
||||
sortname = unicodedata.normalize('NFKD', person.sortname)
|
||||
else:
|
||||
|
|
Loading…
Reference in a new issue