From a26d92ad5055fa057647158eb79511e7b1841162 Mon Sep 17 00:00:00 2001 From: Joris Date: Sat, 23 Sep 2023 18:50:14 +0200 Subject: Fix adding a new book without a file `book_path` was not defined, use `book_source` instead in condition. --- cli/new/command.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cli/new/command.py b/cli/new/command.py index dae0be7..17b686c 100644 --- a/cli/new/command.py +++ b/cli/new/command.py @@ -32,7 +32,7 @@ def run(books_library, book_source=None): metadata_path = f'{output_dir}/metadata.toml' cover_path = f'{output_dir}/cover.webp' - if not book_source is None: + if book_source is not None: ext = format.extension(book_source) book_path = f'{output_dir}/book{ext}' book_source_dir = os.path.dirname(os.path.realpath(book_source)) @@ -55,7 +55,7 @@ def run(books_library, book_source=None): # Ask for confirmation print(f'About to create:\n\n- {metadata_path}\n- {cover_path}') - if not book_source is None: + if book_source is not None: print(f'- {book_path}') print(f'\nAnd moving:\n\n {book_source},\n -> {book_source_new}.') print() @@ -68,7 +68,7 @@ def run(books_library, book_source=None): download_cover(cover_url, cover_path) with open(metadata_path, 'w') as f: f.write(metadata) - if not book_path is None: + if book_source is not None: shutil.copyfile(book_source, book_path) if format.extension(book_source) in ['mobi', 'azw3']: os.rename(book_source, book_source_new) -- cgit v1.2.3