add lost items
This commit is contained in:
parent
0169f5bf57
commit
07300f83f3
1 changed files with 10 additions and 0 deletions
|
@ -134,7 +134,9 @@ def run_scan():
|
||||||
remove_missing(books)
|
remove_missing(books)
|
||||||
|
|
||||||
added = 0
|
added = 0
|
||||||
|
|
||||||
with db.session():
|
with db.session():
|
||||||
|
user = state.user()
|
||||||
for f in ox.sorted_strings(books):
|
for f in ox.sorted_strings(books):
|
||||||
if state.shutdown:
|
if state.shutdown:
|
||||||
break
|
break
|
||||||
|
@ -144,6 +146,14 @@ def run_scan():
|
||||||
if not file:
|
if not file:
|
||||||
file = add_file(id, f, prefix, f)
|
file = add_file(id, f, prefix, f)
|
||||||
added += 1
|
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:
|
if added:
|
||||||
trigger_event('change', {})
|
trigger_event('change', {})
|
||||||
logger.debug('imported %s unknown books', added)
|
logger.debug('imported %s unknown books', added)
|
||||||
|
|
Loading…
Reference in a new issue