diff --git a/oml/downloads.py b/oml/downloads.py index 8bd6cc4..70333e0 100644 --- a/oml/downloads.py +++ b/oml/downloads.py @@ -28,7 +28,7 @@ class Downloads(Thread): if now > settings.server.get('last_update_check', 0) + 24*60*60: settings.server['last_update_check'] = now update.download() - state.user().library.export_json() + state.user().export_library() def download_next(self): import item.models diff --git a/oml/user/models.py b/oml/user/models.py index af88441..5c7d771 100644 --- a/oml/user/models.py +++ b/oml/user/models.py @@ -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)