diff options
| author | Joris | 2023-09-23 18:50:14 +0200 | 
|---|---|---|
| committer | Joris | 2023-09-23 18:50:14 +0200 | 
| commit | a26d92ad5055fa057647158eb79511e7b1841162 (patch) | |
| tree | dd58e827fee82ecfa78540dbbe610b0f95cfb593 | |
| parent | f1eee98bb5144efc1aa242bad0e5676e12d882a5 (diff) | |
Fix adding a new book without a filemain
`book_path` was not defined, use `book_source` instead in condition.
| -rw-r--r-- | cli/new/command.py | 6 | 
1 files 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)  | 
