add lost items

This commit is contained in:
j 2019-01-12 22:34:15 +05:30
parent 0169f5bf57
commit 07300f83f3
1 changed files with 10 additions and 0 deletions

View File

@ -134,7 +134,9 @@ def run_scan():
remove_missing(books)
added = 0
with db.session():
user = state.user()
for f in ox.sorted_strings(books):
if state.shutdown:
break
@ -144,6 +146,14 @@ def run_scan():
if not file:
file = add_file(id, f, prefix, f)
added += 1
elif user not in file.item.users:
item = file.item
item.add_user(user)
logger.debug('add %s to local user', id)
add_record('additem', item.id, file.info)
add_record('edititem', item.id, item.meta)
item.update()
added += 1
if added:
trigger_event('change', {})
logger.debug('imported %s unknown books', added)