Let holdit take many books.
This commit is contained in:
parent
4d224e7d6a
commit
f93309a37c
1 changed files with 13 additions and 7 deletions
20
epubfile.py
20
epubfile.py
|
@ -1051,13 +1051,19 @@ def covercomesfirst_argparse(args):
|
||||||
covercomesfirst(book)
|
covercomesfirst(book)
|
||||||
|
|
||||||
def holdit_argparse(args):
|
def holdit_argparse(args):
|
||||||
book = Epub.open(args.epub)
|
epubs = [epub for pattern in args.epubs for epub in glob.glob(pattern)]
|
||||||
print(book.root_directory.absolute_path)
|
books = []
|
||||||
|
for epub in epubs:
|
||||||
|
book = Epub.open(epub)
|
||||||
|
print(f'{epub} = {book.root_directory.absolute_path}')
|
||||||
|
books.append((epub, book))
|
||||||
|
|
||||||
input('Press Enter when ready.')
|
input('Press Enter when ready.')
|
||||||
# Saving re-writes the opf from memory, which might undo any manual changes.
|
for (epub, book) in books:
|
||||||
# So let's re-read it first.
|
# Saving re-writes the opf from memory, which might undo any manual changes.
|
||||||
book.read_opf(book.opf_filepath)
|
# So let's re-read it first.
|
||||||
book.save(args.epub)
|
book.read_opf(book.opf_filepath)
|
||||||
|
book.save(epub)
|
||||||
|
|
||||||
def merge(input_filepaths, output_filename, do_headerfile=False):
|
def merge(input_filepaths, output_filename, do_headerfile=False):
|
||||||
book = Epub.new()
|
book = Epub.new()
|
||||||
|
@ -1148,7 +1154,7 @@ def main(argv):
|
||||||
p_covercomesfirst.set_defaults(func=covercomesfirst_argparse)
|
p_covercomesfirst.set_defaults(func=covercomesfirst_argparse)
|
||||||
|
|
||||||
p_holdit = subparsers.add_parser('holdit')
|
p_holdit = subparsers.add_parser('holdit')
|
||||||
p_holdit.add_argument('epub')
|
p_holdit.add_argument('epubs', nargs='+', default=[])
|
||||||
p_holdit.set_defaults(func=holdit_argparse)
|
p_holdit.set_defaults(func=holdit_argparse)
|
||||||
|
|
||||||
p_merge = subparsers.add_parser('merge')
|
p_merge = subparsers.add_parser('merge')
|
||||||
|
|
Loading…
Reference in a new issue