Skip to main content

Welut is a ebook converter

Project description

Welut is a ebook converter

Requirements

  • ebook-convert: $ sudo apt install calibre - convert epub & mobi to pdf.

  • pdftocairo: $ sudo apt install -y poppler-utils - convert pdf to images

Installation

Welut is available directly from PyPI:

  1. Installing the package.

$ pip install welut
  1. Don’t forget to add 'welut' to your 'INSTALLED_APPS'.

# settings.py
INSTALLED_APPS = [
    ....
    'welut',
]
  1. Doing makemigrations & migrate

./manage.py makemigrations welut
./manage.py migrate welut

Configuration (settings.py)

WELUT_EXTENSIONS = ['.pdf', '.epub', '.mobi']         # support file extensions
WELUT_REMOVED_EXTENSIONS = ['.pdf', '.epub', '.mobi'] # file to remove after uploaded
WELUT_IMAGES_EXTENSION = '.png'                       # format images extension

Usage

You can using ForeignKey or OneToOneField.

from django.db import models
from welut.models import EbookConverter


class EBook(models.Model):
    title = models.CharField(max_length=200)
    ebook_file = models.ForeignKey(EbookConverter, related_name='ebook_file')
    created = models.DateTimeField(auto_now_add=True)
    modified = models.DateTimeField(auto_now=True)

    def __str__(self):
        return self.title

    def get_files(self):
        """ return list images of ebook per-page """
        return self.ebook_file.get_files()

Templates

{% for img_url in object.get_files %}
  <img src="{{ MEDIA_URL }}{{ img_url }}">
{% endfor %}

Usage Preview

https://raw.githubusercontent.com/agusmakmun/welut/master/welut_demo/media/welut-demo.png

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

welut-1.0.4.tar.gz (6.4 kB view details)

Uploaded Source

File details

Details for the file welut-1.0.4.tar.gz.

File metadata

  • Download URL: welut-1.0.4.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for welut-1.0.4.tar.gz
Algorithm Hash digest
SHA256 d898b4f5fb6add287ec7e6218e5b5db9808bae7c445423186543315e34603b07
MD5 de736caf6a784ef3104b25651f75a117
BLAKE2b-256 a7a953acc3b6afff989ff1b129552433de59ddd2c7286f02133200a21a3735c8

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page