This commit is contained in:
j 2016-01-14 18:39:56 +05:30
parent 753724a23c
commit ec50a04097

View file

@ -18,7 +18,7 @@ from changelog import Changelog
from db import MutableDict
import json_pickler
from .icons import icons
from .person import get_sort_name
from .person import get_sort_name, Person
from queryparser import Parser
from settings import config
from utils import remove_empty_folders
@ -762,3 +762,13 @@ class Metadata(db.Model):
del m.data['id']
return m.data
return {}
def remove_unused_names():
used = list(set(
get_sort_name(a)
for i in Item.query
for a in i.meta.get('author', [])
))
for p in Person.query.filter(Person.sortname.notin_(used)):
state.db.session.delete(p)
state.db.session.commit()