compare NFD normalized paths

This commit is contained in:
j 2019-01-14 17:10:40 +05:30
parent 3cd63695c4
commit 74586d7164
2 changed files with 5 additions and 0 deletions

View file

@ -168,6 +168,7 @@ def remove(data):
'''
if 'ids' in data and data['ids']:
for i in models.Item.query.filter(models.Item.id.in_(data['ids'])):
logger.info('remove item %s', i)
i.remove_file()
state.cache.clear('group:')
return {

View file

@ -7,6 +7,7 @@ import os
import shutil
import stat
import time
import unicodedata
import ox
@ -31,6 +32,7 @@ def remove_missing(books=None):
prefix = get_prefix()
if books is None:
books = collect_books(prefix)
books = [unicodedata.normalize('NFD', path) for path in books]
with db.session():
if os.path.exists(prefix):
logger.debug('scan for removed files')
@ -40,6 +42,8 @@ def remove_missing(books=None):
if state.shutdown:
return
path = f.fullpath()
path = unicode
path = unicodedata.normalize('NFD', path)
db_paths.append(path)
if f.item:
items[path] = f.sha1