diff --git a/src/calibre/db/cli/cmd_catalog.py b/src/calibre/db/cli/cmd_catalog.py index 62d2b8606c..7a2157686c 100644 --- a/src/calibre/db/cli/cmd_catalog.py +++ b/src/calibre/db/cli/cmd_catalog.py @@ -12,6 +12,7 @@ from calibre.db.cli import integers_from_string readonly = True version = 0 # change this if you change signature of implementation() needs_srv_ctx = True +no_remote = True def implementation(db, notify_changes, ctx): @@ -103,8 +104,6 @@ Options control how entries are displayed in the generated catalog output. def main(opts, args, dbctx): if len(args) < 1: raise SystemExit(_('You must specify a catalog output file')) - if dbctx.is_remote: - raise SystemExit(_('Generating catalogs from server libraries is not supported')) if opts.ids: opts.ids = list(integers_from_string(opts.ids)) fmt = args[0].rpartition('.')[-1] diff --git a/src/calibre/db/cli/main.py b/src/calibre/db/cli/main.py index 2efa0fbccb..ee98b6e944 100644 --- a/src/calibre/db/cli/main.py +++ b/src/calibre/db/cli/main.py @@ -48,6 +48,8 @@ def send_message(msg=''): def run_cmd(cmd, opts, args, dbctx): m = module_for_cmd(cmd) + if dbctx.is_remote and getattr(m, 'no_remote', False): + raise SystemExit(_('The {} command is not supported with remote (server based) libraries').format(cmd)) ret = m.main(opts, args, dbctx) if not dbctx.is_remote and not opts.dont_notify_gui and not getattr(m, 'readonly', False): send_message() @@ -167,7 +169,7 @@ class DBCtx(object): @property def db(self): if self._db is None: - self._db = LibraryDatabase(self.library_path).new_api + self._db = LibraryDatabase(self.library_path) return self._db def path(self, path): @@ -180,7 +182,7 @@ class DBCtx(object): m = module_for_cmd(name) if self.is_remote: return self.remote_run(name, m, *args) - return m.implementation(self.db, None, *args) + return m.implementation(self.db.new_api, None, *args) def interpret_http_error(self, err): if err.code == httplib.UNAUTHORIZED: