Convert ebooks with few clicks on Telegram!

Overview

E-Book Converter Bot

Telegram Badge

Open Source Love made-with-python

PayPal Patreon Liberapay

A bot that converts e-books to various formats, powered by calibre! It currently supports 34 input formats and 19 output formats.

You can start using it or adding it to your group here on Telegram.

About the code:

This project is a modular bot, made using Python 3 and the following:

Bot features:

This bot aims to provide an easy way for telegram users to convert e-books from and to different formats.

It supports converting from the following formats:

['azw', 'azw3', 'azw4', 'azw8', 'cb7', 'cbc', 'cbr', 'cbz', 'chm', 'djvu', 'docx',
 'doc', 'epub', 'fb2', 'fbz', 'html', 'htmlz', 'kfx', 'kfx-zip', 'kpf', 'lit',
 'lrf', 'mobi', 'odt', 'opf', 'pdb', 'pml', 'prc', 'rb', 'rtf', 'snb', 'tcr',
 'txt', 'txtz']

To the following formats:

['azw3', 'docx', 'epub', 'fb2', 'htmlz', 'kfx', 'lit', 'lrf', 'mobi', 'oeb',
 'pdb', 'pmlz', 'rb', 'rtf', 'snb', 'tcr', 'txt', 'txtz', 'zip']

Some more features of the bot:

  • Force book direction to be RTL
  • Multilingual support, you can contribute and add your own languages if you want :).

Usage

  • Forward any supported file to the bot and choose the required format to convert to, and in few seconds the bot will reply you with the converted file.
  • The bot works in groups too. Reply with /convert to any file then do the same steps as in private.
  • You can change the preferences of the bot such as language using /settings or /preferences commands.

Before setting up the bot

  • Copy config.json.example file to config.json and fill the required information:
    {
      "tg_bot_token": "11111111:xxxxxxxxxxxxxxxxxx",
      "tg_bot_id": 111111111,
      "api_key": 1121221,
      "api_hash": "xxxxxxxxxxxxxxxxxxxx",
      "tg_bot_admins": [
        2222222
      ]
    }
  • Compile the translation files using the following command:
    make i18n-compile 

Setting up the bot

Before all, clone this repository.

Using Docker

  • Simply, run the following command:
docker-compose up --build -d

Without Docker [NOT RECOMMENDED]

Python dependencies

It requires Python 3.7 with pip v19+ installed or poetry if you use it.

Clone the repository and run any of the following commands:

Using poetry
poetry install
Using Pip
pip install .

Database

The bot depends on sqlite database. Make sure that your system has it installed.

Other requirements

You can go through the Dockerfile to see how the bot requirements are being installed.

  • The conversion process is done by utilizing Calibre and its ebook-convert, so make sure you have it installed.
  • To convert from and to KFX, you need to install KFX Input and KFX Output plugins in calibre, this can be done from the command line by using the following commands:
    # KFX Input
    wget https://plugins.calibre-ebook.com/291290.zip 
    calibre-customize -a 291290.zip
    # KFX Output
    wget https://plugins.calibre-ebook.com/272407.zip
    calibre-customize -a 272407.zip
  • Also, KFX Output plugin requires Kindle Previewer 3, which can run on linux under Wine.

Running the bot

If you finally managed to get all pieces in its place without using docker, run the bot using:

python3 -m ebook_converter_bot

Internationalization (i18n)

The bot uses gettext for internationalization and makefile for running i18n tasks easily.

  • First, generate .pot template using make i18n-generate-messages.
  • Update the current translation files using make i18n-merge, then edit the translation strings.
  • Compile the translation files using make i18n-compile.

To add a new language to the bot, run the following command (change 'ar' to your language code) then edit the new language file with translation and compile.

LANG=ar make i18n-init-lang
Owner
Youssif Shaaban Alsager
Python Developer, @XiaomiFirmwareUpdater Lead Developer, Open Source Enthusiast, and Technical Writer / Translator.
Youssif Shaaban Alsager
Map Reduce Wordcount in Python using gRPC

This project is implemented in Python using gRPC. The input files are given in .txt format and the word count operation is performed.

Divija 4 Dec 05, 2022
Athens: a great tool for taking notes and organising knowldge

AthensSyncer Athens is a great tool for taking notes and organising knowldge. But it is a bummer that you cannot use it accross multiple devices. Well

6 Dec 14, 2022
Repository containing the code for An-Gocair text normaliser

Scottish Gaelic Text Normaliser The following project contains the code and resources for the Scottish Gaelic text normalisation project. The repo can

3 Jun 28, 2022
This is REST-API for Indonesian Text Summarization using Non-Negative Matrix Factorization for the algorithm to summarize documents and FastAPI for the framework.

Indonesian Text Summarization Using FastAPI This is REST-API for Indonesian Text Summarization using Non-Negative Matrix Factorization for the algorit

Viqi Nurhaqiqi 2 Nov 03, 2022
Returns unicode slugs

Python Slugify A Python slugify application that handles unicode. Overview Best attempt to create slugs from unicode strings while keeping it DRY. Not

Val Neekman 1.3k Jan 04, 2023
"Complexity" of Flags of the countries of the world

"Complexity" of Flags of the countries of the world Flags (png) from: https://flagcdn.com/w2560.zip https://flagpedia.net/download/images run: chmod +

Alexander Lelchuk 1 Feb 10, 2022
Um simulador de caixa registradora com database usando arquivos .txt

🛒 Caixa Registradora V2 ❓ - Como usar? Execute o caixa-registradora.py, nele vai ter um menu interativo, você pode cadastrar diversos produtos em um

Gabriel 0 Sep 25, 2022
Correcting typos in a word based on the frequency dictionary

Auto-correct text Correcting typos in a word based on the frequency dictionary. This algorithm is based on the distance between words according to the

Anton Yakovlev 2 Feb 05, 2022
A Python3 script that simulates the user typing a text on their keyboard.

A Python3 script that simulates the user typing a text on their keyboard. (control the speed, randomness, rate of typos and more!)

Jose Gracia Berenguer 3 Feb 22, 2022
Translate .sbv subtitle files

deepl4subtitle Deeplを使って字幕ファイル(.sbv)を翻訳します。タイムスタンプも含めて出力しますが、翻訳時はタイムスタンプは文の一部とは切り離されるので、.sbvファイルをそのまま翻訳機に突っ込むよりも高精度な翻訳ができるはずです。 つかいかた 入力する.sbvファイルの前処理

Yasunori Toshimitsu 1 Oct 20, 2021
A minimal python script for generating multiple onetime use bip39 seed phrases

seed_signer_ontimes WARNING This project has mainly been used for local development, and creation should be ran on a air-gapped machine. A minimal pyt

CypherToad 4 Sep 12, 2022
从flomo导出的笔记中生成词云

flomo-word-cloud 从flomo导出的笔记中生成词云 如何使用? 将本项目克隆到你的电脑上,使用如下的命令,安装所需python库 pip install -r requirements.txt 在项目里新建一个file文件夹,把所有从flomo导出的html文件放入其中 运行main

Hannnk 9 Dec 30, 2022
This script has been created in order to find what are the most common demanded technologies in Data Engineering field.

This is a Python script that given a whole corpus of job descriptions and a file with keywords it extracts the number of number of ocurrences of these keywords and write it to a file. This script it

Antonio Bri Pérez 0 Jul 17, 2022
This project aims to test check if your RegExp are being matched by grep.

Bash RegExp This project aims to test check if your RegExp are being matched by grep. It's a local server that starts on the port 8080. It runs the se

Quatrecentquatre 1 Feb 28, 2022
This repository contains scripts to control a RGB text fan attached to a Raspberry Pi.

RGB Text Fan Controller This repository contains scripts to control a RGB text fan attached to a Raspberry Pi. Setup The Raspberry Pi and RGB text fan

Luke Prior 1 Oct 01, 2021
A python tool one can extract the "hash" from a WINDOWS HELLO PIN

WINHELLO2hashcat About With this tool one can extract the "hash" from a WINDOWS HELLO PIN. This hash can be cracked with Hashcat, more precisely with

33 Dec 05, 2022
The bot creates hashtags for user's texts in Russian and English.

telegram_bot_hashtags The bot creates hashtags for user's texts in Russian and English. It is a simple bot for creating hashtags. NOTE file config.py

Yana Davydovich 2 Feb 12, 2022
The project is investigating methods to extract human-marked data from document forms such as surveys and tests.

The project is investigating methods to extract human-marked data from document forms such as surveys and tests. They can read questions, multiple-choice exam papers, and grade.

Harry 5 Mar 27, 2022
box is a text-based visual programming language inspired by Unreal Engine Blueprint function graphs.

Box is a text-based visual programming language inspired by Unreal Engine blueprint function graphs. $ cat factorial.box ┌─ƒ(Factorial)───┐

Pranav 104 Dec 24, 2022
PyMultiDictionary is a Dictionary Module for Python 3+ to get meanings, translations, synonyms and antonyms of words in 20 different languages

PyMultiDictionary PyMultiDictionary is a Dictionary Module for Python 3+ to get meanings, translations, synonyms and antonyms of words in 20 different

Pablo Pizarro R. 19 Dec 26, 2022