trigger fs scan after changing path, move folder if new path does not exist, fixes #214

This commit is contained in:
j 2016-01-27 11:58:11 +05:30
commit e27e429fd6
3 changed files with 25 additions and 4 deletions

View file

@ -66,6 +66,11 @@ def setPreferences(data):
data['contact'] != settings.preferences['contact']
change_username = 'username' in data and \
data['username'] != settings.preferences['username']
if 'libraryPath' in data and \
data['libraryPath'] != settings.preferences['libraryPath']:
change_path = [settings.preferences['libraryPath'], data['libraryPath']]
else:
change_path = False
update_dict(settings.preferences, data)
if 'username' in data:
u = state.user()
@ -75,8 +80,10 @@ def setPreferences(data):
Changelog.record(u, 'editusername', data['username'])
if change_contact:
Changelog.record(state.user(), 'editcontact', data['contact'])
if change_path:
state.tasks.queue('changelibrarypath', change_path)
return settings.preferences
actions.register(setPreferences)
actions.register(setPreferences, cache=False)
def resetUI(data):
'''
@ -88,7 +95,7 @@ def resetUI(data):
os.unlink(ui_json)
settings.ui = settings.pdict(ui_json, settings.config['user']['ui'])
return settings.ui
actions.register(resetUI)
actions.register(resetUI, cache=False)
def setUI(data):
'''
@ -99,7 +106,7 @@ def setUI(data):
'''
update_dict(settings.ui, data)
return settings.ui
actions.register(setUI)
actions.register(setUI, cache=False)
def getUsers(data):