cleanup
This commit is contained in:
parent
753724a23c
commit
ec50a04097
1 changed files with 11 additions and 1 deletions
|
@ -18,7 +18,7 @@ from changelog import Changelog
|
||||||
from db import MutableDict
|
from db import MutableDict
|
||||||
import json_pickler
|
import json_pickler
|
||||||
from .icons import icons
|
from .icons import icons
|
||||||
from .person import get_sort_name
|
from .person import get_sort_name, Person
|
||||||
from queryparser import Parser
|
from queryparser import Parser
|
||||||
from settings import config
|
from settings import config
|
||||||
from utils import remove_empty_folders
|
from utils import remove_empty_folders
|
||||||
|
@ -762,3 +762,13 @@ class Metadata(db.Model):
|
||||||
del m.data['id']
|
del m.data['id']
|
||||||
return m.data
|
return m.data
|
||||||
return {}
|
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()
|
||||||
|
|
Loading…
Reference in a new issue