mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Add an "all" keyword to export all known libraries
This commit is contained in:
parent
525f74d8c0
commit
7c53c1b029
@ -97,7 +97,8 @@ Everything after the -- is passed to the script.
|
||||
help=_('Export all calibre data (books/settings/plugins). Normally, you will'
|
||||
' be asked for the export dir and the libraries to export. You can also specify them'
|
||||
' as command line arguments to skip the questions.'
|
||||
' Use absolute paths for the export directory and libraries.'))
|
||||
' Use absolute paths for the export directory and libraries.'
|
||||
' The special keyword "all" can be used to export all libraries.'))
|
||||
parser.add_option('--import-calibre-data', default=False, action='store_true',
|
||||
help=_('Import previously exported calibre data'))
|
||||
parser.add_option('-s', '--shutdown-running-calibre', default=False,
|
||||
|
@ -391,7 +391,10 @@ def run_exporter(export_dir=None, args=None):
|
||||
raise SystemExit('You must specify the export dir and libraries to export')
|
||||
export_dir = args[0]
|
||||
all_libraries = {os.path.normcase(os.path.abspath(path)):lus for path, lus in all_known_libraries().iteritems()}
|
||||
libraries = {os.path.normcase(os.path.abspath(os.path.expanduser(path))) for path in args[1:]}
|
||||
if 'all' in args[1:]:
|
||||
libraries = set(all_libraries)
|
||||
else:
|
||||
libraries = {os.path.normcase(os.path.abspath(os.path.expanduser(path))) for path in args[1:]}
|
||||
if libraries - set(all_libraries):
|
||||
raise SystemExit('Unknown library: ' + tuple(libraries - all_libraries)[0])
|
||||
libraries = {p: all_libraries[p] for p in libraries}
|
||||
|
Loading…
x
Reference in New Issue
Block a user