From 2711420cdeda0cade69466429736feffba32d04f Mon Sep 17 00:00:00 2001 From: xxyzz Date: Fri, 21 May 2021 11:18:13 +0800 Subject: [PATCH] return None in get_asin() if the book doesn't have any ASIN record --- __init__.py | 2 +- metadata.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/__init__.py b/__init__.py index 413b753..bd0d093 100644 --- a/__init__.py +++ b/__init__.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 from calibre.customize import InterfaceActionBase -VERSION = (3, 7, 1) +VERSION = (3, 7, 2) class WordDumbDumb(InterfaceActionBase): diff --git a/metadata.py b/metadata.py index ba3bd92..5a391e6 100644 --- a/metadata.py +++ b/metadata.py @@ -62,9 +62,9 @@ def get_asin(book_path, book_fmt): else: with open(book_path, 'rb') as f: mu = MetadataUpdater(f) - if (asin := mu.original_exth_records.get(113, None)) is None: - asin = mu.original_exth_records.get(504, None) - return asin.decode('utf-8') + if (asin := mu.original_exth_records.get(113)) is None: + asin = mu.original_exth_records.get(504) + return asin.decode('utf-8') if asin else None return None