Giter Club home page Giter Club logo

fb2mobi's Introduction

This program is based on fb2conv program published by dnkorpushov on the-ebook.org site.

Important:

This project has been "stable" for a while - no changes or additional fixes were requested for a long time. Builds for Linux and Windows build environments have been fully defined in the docker files and build process fully automated in scripts. At the same time maintaining Python build environment for several platforms (as well as attemptng to fix various problems with Unicode support in Python for Windows) has been noticeable burden for me - requiring time and resources (which I do not have). As the result I am reducing my attention to this project - there would not be conversion to latest Python or any further program binary distributions for Windows and Linux coming from me. I may be able to provide source level fixes, but this would be it.

Instead I am opening new project - fb2converter, a complete rewrite of this program in go language which requires much less support time (or so I think). At the moment it has everything command line of fb2mobi does and then some and eventually it may even get its own UI, we'll see. Any new features or significant fixes would be provided by new project or would have to come from somebody else.

Original program (being Python 2) did not work well under Windows when non-russian system codepage was selected for non-Unicode programs. In order to improve the situation I had to port it to Python 3. Later author of original converter re-joined the project and ported GUI UI here. He also added binary releases for MAC.

Here is brief list of changes to the original project (in addition to bug fixes):

  • All messages and profile descriptions got translated to English
  • Fixed all problems I was aware of at the moment (see git log)
  • Added ability to apply xslt transformation from external file to fb2 before further processing (--xslt key or <xslt> config tag)
  • Added xslt extension "katz_tr" to speedup and simplify transformation of direct speech in dialogs
  • Added smart dropcaps processing (--dropcaps=Smart key or <dropcaps>Smart</dropcaps> config tag)
  • Added some rudimentary epub processing (like title rewriting based on calibre metadata and hyphenation)
  • Switched hyphenator to hyphen which uses properly maintained dictionaries from LibreOffice, so now many languages are supported and you could add more
  • Added support for "floating" footnotes (--notes-mode=float key or <notesMode>float</notesMode> config tag)
  • Added support for MOBI post-processing and optimization
  • Added cover and thumbnail image optimization
  • Made cover size user configurable (--screen-width, --screen-height or <screenWidth>, <screenHeight>)
  • Added support for latest Kidle firmware (>= 5.7.2)
  • Added simple tool to generate thumbnails on Kindle devices
  • Added synchronous logging to file and console (console logging level is set independently by --console-level key or <consoleLevel> config tag)
  • Added an option to make PNG images non-transparent to prevent "ghostly images" on Kindle (--remove-png-transparency key or <removePngTransparency> config tag)
  • Added support for auto-generation of PageMaps - now it is possible to have APNX files (--apnx=eInk|PC key or <generateAPNX> profile tag). Number of uncompessed text characters per page is (approximately) controlled by charactersPerPage profile tag and by default is equal to 2300 (Calibre default setting)
  • Removed <flatTOC> support. New config tag <tocType> and command line parameter --toc-type could be used instead with values Flat|Kindle|Normal. This introduces special support for eInk Kindle devices with 2-level TOC views. Additional tag <tocKindleLevel> and parameter --toc-kindle-level allow for precise tuning of generated NCX for eInk devices.
  • Expanded book title generation: added #padnumber to generate number in series padded with zeros (use <seriesPositions> or --series-positions to specify how many digits overall will be generated) and #date to add proper date from <title-info> if availabe.
  • Added new <chapterLevel> configuration tag and ---chapter-level parameter along with new style .titleblock_nobreak. When parsing sections this style will be generated if nesting level is greater or equal to specified value. This allows better control of page breaks on sections boundaries.
  • Supported <openBookFromCover> configuration tag and ---open-book-from-cover parameter for compatibility with fb2conv. Works for epub output only.
  • Changed how book title and book author are formatted - added processing of conditional blocks, for example: <bookTitleFormat>{(#abbrseries{ #padnumber}) }#title</bookTitleFormat>. To output curly braces escape them with backslash.
  • Added new css style .linkanchor - this is style for all href links which are NOT pointing to the note bodies. This allows for flexible formatting of hyperlinks in the text.
  • Added "default" cover for fb2 which do not have it (APG 2018.1) - <coverDefault> in profile configuration.
  • Added image re-sampling - <scaleImages> in profile configuration or --scale-images on command line (Should be positive non-zero float number, cover image is exempt from this). DPI is preserved.
  • Added --config parameter and changed the way program looks for configuration file. Now, unless --config is provided files in user HOME directory have precedence over distribution files.
  • For FB2 input files output name could be derived from book metadata using tag <outputPattern> and the same rules as for book title.
  • Added support for multiple authors

More info can be found on russian forum.

Program uses source code (modified) from following projects released under GPL:

In order to build releases we are using Python 3.6.5 with following modules.

If you are not using "frozen" distribution you would need to download Amazon's KindleGen.

Enjoy!

fb2mobi's People

Contributors

dependabot[bot] avatar dnkorpushov avatar gmk57 avatar rupor-github avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fb2mobi's Issues

А можно файл requirements.txt в сорцы?

У меня вот с этим
(fb2mobi_env)wad@wad-think2:/PycharmProjects/fb2mobi (master)$ pip freeze
Pillow==3.3.0
PyHyphen==2.0.5
cssutils==1.0.1
lxml==3.6.0
собралось и сконвертировалось под
(fb2mobi_env)wad@wad-think2:
/PycharmProjects/fb2mobi (master)$ uname -a
Linux wad-think2 3.13.0-37-generic #64-Ubuntu SMP Mon Sep 22 21:28:38 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

Неточности и огрехи

В документации указано, что нужно использовать в программе с графическим интерфейссом (страница ведь "Работа с программой (версия с графическим интерфейсом)") утилиту synccovers для синхронизации обложек. Вместе с тем вот тут указано

Для версии с графическим интерфейсом это не требуется - программа автоматически создает миниатюры обложек при отправке книг на устройство Kindle.

Как бы там ни было, а обложки упорно не хотят приходить на мой PW3 с последними обновлениями (при отправке через отправке сконвертированных mobi книг почтой как вручную, так и почтой через программу; версия программы самая последняя - 3.6.65)

Также указано , что kindleRemovePersonalLabel = true позволит добавлять книгу не в Docs, а в Books. На самом устройстве книги эти тоже не распознаются как книги, а распознаются как документы.

Устройства Kindle различают книги, купленные в магазине Amazon и книги, созданные с помощью утилиты kindlegen. На старых версиях ПО прошивки Kindle книги, созданные с помощью kindlegen имели визуальную метку "Personal". Включение данной опции позволяет создать файл, который будет восприниматься устройством Kindle также, как и книга, купленная в Amazon, что позволяет удалить метку "Personal".

В остальном вроде бы всё отлично. Переносы в книге расставляются. Страницы синхронизируюся. Можно выделять отрывки и делиться ими в соцсетях. Всё очень удобно, быстро и практично. Коллекции уже можно быстро и удобно создать через браузер. Если бы ещё обложки нормально работали и книги распознавались как книги - был бы просто космос!

macos: pointer being freed was not allocated

Не уверен что проблема в самом fb2mobi, возможно у меня просто какая-то библиотека старая или кривая. Вот что примерно происходит:

$ python3 fb2mobi.py ../books/fb2/112552.fb2 test.mobi
INFO: Converting "112552.fb2"...
INFO: Using profile "default".
INFO: Converting fb2 to html...
INFO: Applying XSLT transformations "/Users/muRn/PycharmProjects/bot/fb2mobi/spaces.xsl"
Python(3684,0x7fff75710000) malloc: *** error for object 0x10383c870: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Abort trap: 6

--console-level DEBUG --log somefile.log не дают никакой дополнительной информации

Python 3.6.0

Есть идеи из-за чего это может происходить?

AttributeError: 'EpubProc' object has no attribute 'header'

Please, help. Having this problem. Different books, ebup -> mobi conversion. Win10/64, v3.3.4.

M:\Books>for /R "M:\Books\mathesay\" %a in ("*.epub") do "G:\Soft\Kindle\fb2mobi\fb2mobi.exe" "%~a"

M:\Books>"G:\Soft\Kindle\fb2mobi\fb2mobi.exe" "M:\Books\mathesay\mathe-2016.epub"
INFO: Converting "mathe-2016.epub"...
INFO: Using profile "default".
INFO: Unpacking epub...
INFO: Processing epub...
Traceback (most recent call last):
  File "d:\python\python35\lib\site-packages\cx_freeze-5.0-py3.5-win-amd64.egg\cx_Freeze\initscripts\Console.py", line 21, in <module>
  File "fb2mobi.py", line 611, in <module>
  File "fb2mobi.py", line 514, in process
  File "fb2mobi.py", line 215, in process_file
  File "E:\builds_lib\fb2mobi\modules\epub.py", line 109, in process
  File "E:\builds_lib\fb2mobi\modules\epub.py", line 48, in insert_hyphenation
AttributeError: 'EpubProc' object has no attribute 'header'

Проблема с типом документа в Kindle

Здравствуйте,
столкнулся с такой проблемой. Конвертирую книгу в mobi, заливаю в читалку.
В списке эта книга отображается как doc, а не book.
Возможно ли добавить возможность менять/удалять Personal Doc Tag [PDOC] при конвертации.
Спасибо.

Не понимает длинные пути Linux

Неправильная работа при указании путей в стиле Linux (деление директорий правым косой слэш '/', экранирование пробелов левым слэшем ''). Пути пытается понимать как параметры.
Например:
fb2mobi /tmp/К/Клавелл\ Джеймс/Сегун.fb2 /run/media/username/Kindle/Сегун.mobi
fb2mobi.py: error: unrecognized arguments: /run/media/username/Kindle/Сегун.mobi

С короткими именами путей (/tmp/file.fb2), работает нормально

Error while converting file (MacOS 10.11.4 with python3.3 from ports)

Every time when I'm trying to convert some fb2 book I get this error:

bash-3.2$: python3.3 fb2mobi.py /Users/user/Downloads/some_book.fb2 
INFO: Converting "some_book.fb2"...
INFO: Using profile "default".
INFO: Converting fb2 to html...
INFO: Applying XSLT transformations "/Users/user/Downloads/fb2mobi-master/spaces.xsl"
CRITICAL: Error while converting file "/Users/user/Downloads/some_book.fb2"

Where can I find more detailed log? (MacOS 10.11.4 with python3.3 from ports)
Also, when I'm using fb2conv-gui-1.8 tool from http://www.the-ebook.org/forum/viewtopic.php?t=28447&postdays=0&postorder=asc&start=0 on the same file - everything works as well.

Hangs in UI when using Google Drive

К слову, если в gui нажать на значок "Добавить файлы из Google Drive", то откроется в браузере страница, где потребуется войти в гугл или выбрать свой аккаунт. Так вот, если эту вкладку закрыть (ну передумал я, например или что-то ещё), то gui зависает от слова совсем.
Windows 10-64 latest (@n-osennij)

sendToKindle isn't working

Books that are sent via sendToKindle are not added to the Kindle Library. That must be some special issue, because the sending itself works (I used sendToKindle to send to my own mail address without any problem) and there are no issues with my mail provider in connection with Amazon (sending the same book from web UI to Kindle Library works, too). But only the direct sending isn't working.

Maybe someone has an idea where to look at?

max-width and max-height are not supported by Kindle readers

default.css contains the following:

.image img {
    max-width:100%; 
    max-height:100%;
}

When converting a book, kindlegen reports the following:

Warning(htmlprocessor):W28001: CSS style specified in content is not supported by Kindle readers. Removing the CSS property: 'max-width' in file: C:\Users\serge\AppData\Local\Temp\tmpizlduo59\OEBPS\stylesheet.css


Warning(htmlprocessor):W28001: CSS style specified in content is not supported by Kindle readers. Removing the CSS property: 'max-height' in file: C:\Users\serge\AppData\Local\Temp\tmpizlduo59\OEBPS\stylesheet.css

Probably this section can be removed from CSS.

Установка на Linux

А есть ли более простая и доступная установка для Linux? С windows всё понятно - клац-клац, и готово. А установка на linux - целая эпопея. Искать в каком-то файле список зависимостей. Искать, как их установить и т.д. Можно ли как-то собрать это в инструкции сразу (хотя бы для debian), потому что такие танцы - местный адок.

fb2mobi on Windows 10 fails

Запуская exe получаю следующую ошибку:

C:\Program Files (x86)\MyHomeLib\converters\fb2mobi>fb2mobi.exe
Traceback (most recent call last):
  File "d:\python\python35_32\lib\site-packages\cx_freeze-5.0-py3.5-win32.egg\cx_Freeze\initscripts\Console.py", line 21, in <module>
  File "fb2mobi.py", line 588, in <module>
  File "fb2mobi.py", line 422, in process
  File "d:\python\python35_32\lib\logging\__init__.py", line 1008, in __init__
  File "d:\python\python35_32\lib\logging\__init__.py", line 1037, in _open
PermissionError: [Errno 13] Permission denied: 'C:\\Program Files (x86)\\MyHomeLib\\converters\\fb2mobi\\debug.log'

Если запускать как Administrator, все работает как надо

Footnote links in superscript without CSS rules

I have noticed that every hyper-link, including footnote links, belongs to class anchor and each anchor is aligned via CSS like this:

.anchor {
    vertical-align: super;
    font-size: 70%;
}

However, not every hyper-link is a footnote link. Many non-fiction books contain usual hyper-links as well as footnote links. Usual “inline” hyper-links therefore should not be superscripted.

Amazon recommends (even requires) footnote links to be superscripted with the <sup> HTML tag, see here.

Is it possible to add an option for that or just make it the default behaviour?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.