export library.json into data, fixes #82

This commit is contained in:
j 2016-01-20 13:22:00 +05:30
commit bae70fd829
2 changed files with 8 additions and 1 deletions

View file

@ -92,6 +92,13 @@ class User(db.Model):
j['name'] = self.name
return j
def export_library(self):
old_path = os.path.join(os.path.expanduser(settings.preferences['libraryPath']), 'Books', 'library.json')
if os.path.exists(old_path):
os.unlink(old_path)
path = os.path.join(settings.data_path, 'library.json')
self.library.export_json(path)
def is_online(self):
return state.nodes and state.nodes.is_online(self.id)