forked from 0x2620/pandora
use get_sort_name/get_sort_title
This commit is contained in:
parent
bb17fef613
commit
0b8b04234a
3 changed files with 3 additions and 4 deletions
|
@ -14,7 +14,6 @@ from django.db.models.signals import pre_delete
|
||||||
|
|
||||||
from ox.django import fields
|
from ox.django import fields
|
||||||
import ox
|
import ox
|
||||||
from ox.normalize import canonicalTitle
|
|
||||||
import chardet
|
import chardet
|
||||||
|
|
||||||
from item import utils
|
from item import utils
|
||||||
|
@ -79,7 +78,7 @@ class File(models.Model):
|
||||||
def set_state(self):
|
def set_state(self):
|
||||||
self.name = self.get_name()
|
self.name = self.get_name()
|
||||||
self.folder = self.get_folder()
|
self.folder = self.get_folder()
|
||||||
self.sort_name = utils.sort_string(canonicalTitle(self.name))
|
self.sort_name = utils.sort_string(ox.get_sort_title(self.name))
|
||||||
|
|
||||||
if not os.path.splitext(self.name)[-1] in (
|
if not os.path.splitext(self.name)[-1] in (
|
||||||
'.srt', '.rar', '.sub', '.idx', '.txt', '.jpg', '.png', '.nfo') \
|
'.srt', '.rar', '.sub', '.idx', '.txt', '.jpg', '.png', '.nfo') \
|
||||||
|
|
|
@ -34,7 +34,7 @@ class Person(models.Model):
|
||||||
|
|
||||||
def save(self, *args, **kwargs):
|
def save(self, *args, **kwargs):
|
||||||
if not self.name_sort:
|
if not self.name_sort:
|
||||||
self.name_sort = ox.normalize.canonicalName(self.name)
|
self.name_sort = ox.get_sort_name(self.name)
|
||||||
self.name_sort = unicodedata.normalize('NFKD', self.name_sort)
|
self.name_sort = unicodedata.normalize('NFKD', self.name_sort)
|
||||||
self.numberofnames = len(self.name.split(' '))
|
self.numberofnames = len(self.name.split(' '))
|
||||||
super(Person, self).save(*args, **kwargs)
|
super(Person, self).save(*args, **kwargs)
|
||||||
|
|
|
@ -28,7 +28,7 @@ class Title(models.Model):
|
||||||
|
|
||||||
def save(self, *args, **kwargs):
|
def save(self, *args, **kwargs):
|
||||||
if not self.title_sort:
|
if not self.title_sort:
|
||||||
self.title_sort = ox.normalize.canonicalTitle(self.title)
|
self.title_sort = ox.get_sort_title(self.title)
|
||||||
self.title_sort = unicodedata.normalize('NFKD', self.title_sort)
|
self.title_sort = unicodedata.normalize('NFKD', self.title_sort)
|
||||||
super(Title, self).save(*args, **kwargs)
|
super(Title, self).save(*args, **kwargs)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue