cleanup broken file db entries
This commit is contained in:
parent
dcdf864dd7
commit
47647a7b86
1 changed files with 8 additions and 1 deletions
|
@ -41,7 +41,14 @@ def remove_missing(books=None):
|
||||||
return
|
return
|
||||||
path = f.fullpath()
|
path = f.fullpath()
|
||||||
db_paths.append(path)
|
db_paths.append(path)
|
||||||
|
if f.item:
|
||||||
items[path] = f.sha1
|
items[path] = f.sha1
|
||||||
|
else:
|
||||||
|
state.db.session.delete(f)
|
||||||
|
dirty = True
|
||||||
|
if dirty:
|
||||||
|
state.db.session.commit()
|
||||||
|
dirty = False
|
||||||
removed = set(db_paths) - set(books)
|
removed = set(db_paths) - set(books)
|
||||||
if removed:
|
if removed:
|
||||||
logger.debug('%s files removed', len(removed))
|
logger.debug('%s files removed', len(removed))
|
||||||
|
|
Loading…
Reference in a new issue