trigger fs scan after changing path, move folder if new path does not exist, fixes #214
This commit is contained in:
parent
2e04379838
commit
e27e429fd6
3 changed files with 25 additions and 4 deletions
|
|
@ -43,6 +43,7 @@ def remove_missing():
|
|||
dirty = True
|
||||
if dirty:
|
||||
state.db.session.commit()
|
||||
state.cache.clear('group:')
|
||||
for f in File.query:
|
||||
if not state.tasks.connected:
|
||||
return
|
||||
|
|
@ -107,6 +108,17 @@ def run_scan():
|
|||
added += 1
|
||||
trigger_event('change', {})
|
||||
|
||||
def change_path(old, new):
|
||||
new_books = os.path.join(new, 'Books')
|
||||
if not os.path.exists(new_books):
|
||||
ox.makedirs(new)
|
||||
shutil.move(os.path.join(old, 'Books'), new_books)
|
||||
remove_empty_folders(old)
|
||||
else:
|
||||
ox.makedirs(new_books)
|
||||
run_scan()
|
||||
trigger_event('change', {})
|
||||
|
||||
def run_import(options=None):
|
||||
options = options or {}
|
||||
logger.debug('run_import')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue