Skip to content

Commit

Permalink
Add support of AZW, it's usually the MOBI format
Browse files Browse the repository at this point in the history
  • Loading branch information
xxyzz committed Jan 15, 2022
1 parent 39448cd commit c3a73ef
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 15 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# WordDumb

A calibre plugin that generates Word Wise and X-Ray files then sends them to Kindle. Supports KFX, AZW3 and MOBI eBooks.
A calibre plugin that generates Word Wise and X-Ray files then sends them to Kindle. Supports KFX, AZW3, AZW and MOBI eBooks.

Languages X-Ray supports: Català, Dansk, Deutsch, English, Español, Français, Italiano, Lietuvių, Nederlands, Norsk bokmål, Polski, Português, Română, Ελληνικά, Македонски, Русский, 中文, 日本語.
Languages supported by X-Ray: Català, Dansk, Deutsch, English, Español, Français, Italiano, Lietuvių, Nederlands, Norsk bokmål, Polski, Português, Română, Ελληνικά, Македонски, Русский, 中文, 日本語.

![screenshot](https://user-images.githubusercontent.com/21101839/130245435-b874f19a-7785-4093-9975-81596efc42bb.png)

Expand Down
20 changes: 7 additions & 13 deletions metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,24 @@


def check_metadata(db, book_id, languages):
# Get the current metadata for this book from the db
mi = db.get_metadata(book_id, get_cover=True)
fmts = db.formats(book_id)
book_fmt = None

book_language = mi.get("languages")
if book_language is None or len(book_language) == 0:
if not book_language:
return None

book_language = book_language[0]
if book_language not in languages:
return None

# check book format
if 'KFX' in fmts:
book_fmt = 'KFX'
elif 'AZW3' in fmts:
book_fmt = 'AZW3'
elif 'MOBI' in fmts:
book_fmt = 'MOBI'
book_fmts = db.formats(book_id)
chosen_fmt = None
supported_fmts = ['KFX', 'AZW3', 'AZW', 'MOBI']
if (fmts := [f for f in supported_fmts if f in book_fmts]):
chosen_fmt = fmts[0]
else:
return None

return (book_id, book_fmt, db.format_abspath(book_id, book_fmt),
return (book_id, chosen_fmt, db.format_abspath(book_id, chosen_fmt),
mi, languages[book_language])


Expand Down

0 comments on commit c3a73ef

Please sign in to comment.